How to allow sass file path in Rails Chrome browser? - ruby-on-rails

I start create new Rails app and can't understand why there is no path to sass files. How to allow sass file path in Rails Chrome browser?
like that
Here is my Gemfile
gem 'bourbon'
gem 'neat'
group :assets do
gem 'coffee-rails'
gem 'sass-rails'
gem 'uglifier'
end
group :development do
gem 'foreman'
gem 'better_errors'
gem 'binding_of_caller'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails', '>= 2.14'
end

Related

Bundle install cause strange error

I'm getting a strange error message when running bundle install or even just rails -v within a rails project root directory:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 16 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/local/bin/rails:22:in `<main>'
However this doesn't happen in my home directory /Users/myname
I messed up something and don't know what, any help?
EDIT
Gemfile
source 'https://rubygems.org'
ruby '2.2.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
gem 'checkr-official'
gem 'chronic'
gem 'devise', '~> 3.4.0'
gem 'exception_notification'
gem 'friendly_id'
gem 'geocoder'
gem 'kaminari'
gem "mini_magick"
gem 'mysql2'
gem 'linkedin'
gem 'omniauth'
gem 'omniauth-facebook'
gem "omniauth-google-oauth2"
gem 'RedCloth'
gem "refile", require: "refile/rails"
gem "refile-mini_magick"
gem 'StreetAddress'
gem "stripe"
gem 'truevault', github: "marks/truevault.rb", ref: "e3bda1af6bfb355"
gem 'whenever', '~> 0.9.4'
gem 'impressionist'
gem "koala"
gem 'twilio-ruby', '~> 4.11.1'
# CSS and javascript
gem 'coffee-rails', '~> 4.1.0'
gem 'compass-rails'
gem 'ejs'
gem 'faker'
gem 'font-awesome-sass', '~> 4.3.0'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'momentjs-rails', '>= 2.8.1'
gem 'sass-rails'
gem 'uglifier', '>= 1.3.0'
# Generic admin requirements not specified elsewhere
gem 'bootstrap-sass', '>= 3.3' # 3.3 adds better support for media css object
gem 'simple_form', ">= 3.1.0.rc2"
# google api client used for dashboard authorization for google analytics
gem 'google-api-client'
gem 'capistrano', '~> 3.4'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem "capistrano-db-tasks", require: false
group :development do
gem 'awesome_print', :require => 'ap'
end
group :development, :test do
gem "factory_girl_rails", "~> 4.0"
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'pry'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', '1.4.0'
end
This error is probably caused by a corruption of the Rails installation.
Try running gem list. If you don't see railties in the list, run gem install rails.
If that doesn't work, I think you should try starting afresh. Create a new gemset, install bundler and run bundle install. That should fix things.

Bundle Install on dev giving an error that a production gem is missing

Why is my gemfile not skipping over "production" gems?
I just installed Rails on Mac OS X Mavericks (possibly an irrelevant detail). When I do bundle install, it gives me an error about missing pg gem. However this is only listed in my production environment, so shouldn't it be skipped? Commenting out my gem pg makes bundle install successful.
Extra context:
I just installed Rails on Mac OS X Mavericks. When I try to open my project, it seems to think I'm in "production" and tries to use my "pg" gem for Postgres. If I try to use rails s or rails console, I get the error that I haven't installed "pg" which should only be used in production for my DB.
I followed this tutorial: http://railsapps.github.io/installrubyonrails-mac.html
My gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.0'
gem 'bootstrap-sass', '~> 3.0.1.0.rc'
gem 'bcrypt-ruby', '3.0.1'
# generates names, email addresses, and other placeholders for factories.
gem 'faker'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'aws-sdk', '1.11.1'
gem 'd3-rails', '~>3.3.7'
# used for file ajax uploads
gem 'remotipart', '~> 1.2'
# used for making server side variables accessible in JS
gem 'gon', '4.1.1'
gem "introjs-rails"
# High voltage for static pages
gem 'high_voltage', '~> 2.0.0'
gem "koala", "~> 1.8.0rc1"
gem 'acts_as_list'
group :development, :test do
gem 'sqlite3', '1.3.8'
# rspec-rails includes RSpec itself in a wrapper to make it play nicely with Rails.
gem 'rspec-rails'
# replaces Rails' default fixtures for feeding test data to the test suite with much more preferable factories
gem 'factory_girl_rails'
# watches your application and tests and runs specs for you automatically when it detects changes.
gem 'guard-rspec'
gem 'spork-rails', '4.0.0'
gem 'guard-spork', '1.5.0'
gem 'childprocess', '0.3.6'
end
group :test do
gem 'selenium-webdriver'
# makes it easy to programatically simulate your users' interactions with your application
gem 'capybara'
gem 'factory_girl_rails'
gem 'guard-rspec' # tims tutorial
# opens your default web browser upon failed integration specs to show you what your application is rendering.
gem 'launchy' # tims tutorial
# helps clear out db after using selenium in tests
gem 'database_cleaner' # tims tutorial
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
# added for resizing panes on d3fiddle pages
gem 'jquery-ui-rails'
# added for code highlighting on d3fiddle pages
gem 'codemirror-rails'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'omniauth-facebook', '1.4.0'
By default, Bundler includes all groups. You have to explicitly exclude any groups you don't want like so:
bundle install --without production
After the first time, Bundler will remember your previous setting, so the production group will be excluded next time you run bundle install.

Why aren't things from /vendor being copied during bundle install?

I'm trying to install bootstrap-sass-rails. I copied this line: gem 'bootstrap-sass-rails' into the assets group. I ran bundle install. I followed the directions on the README exactly, but Sass complained that it couldn't find 'twitter/bootstrap' - I fiddled around a bit with locating the file and then...
Here comes the confusing part -- the gem was installed fine (or so Bundler said). But now there's nothing in my /vendor/assets/stylesheets directory! I checked git status and no new Sass files (or anything else really) was changed except app/assets/stylesheets/application.css.scss and app/assets/javascripts/application.js! I thought maybe that gem was broken, but the same thing happened with bootstrap-sass.
Why aren't my gems being installed correctly?
Full Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'bson_ext'
gem 'nokogiri'
gem 'execjs'
gem 'therubyracer'
gem 'rb-readline', '~> 0.4.2'
gem 'jquery-rails'
gem 'simple_form'
gem 'mysql2'
gem 'chronic'
gem 'prawn-labels'
gem 'draper'
gem 'ruby-aaws'
gem 'bcrypt-ruby'
gem 'sass-rails', '~> 3.2'
group :assets do
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'bootstrap-sass-rails'
end
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'quiet_assets'
gem 'thin'
end
group :development, :test do
gem 'bourne'
gem 'rspec-rails'
gem 'pry'
gem 'pry-doc'
gem 'pry-debugger'
gem 'pry-rails'
gem 'faker'
gem 'pdf-inspector'
gem 'guard-rspec'
gem 'guard-zeus'
gem 'guard-livereload'
gem 'debugger'
gem 'rb-fsevent' if RUBY_PLATFORM =~ /darwin/i
if RUBY_PLATFORM =~ /linux/i then
gem 'rb-inotify' # Filesystem changes
gem 'libnotify' # Desktop notifications
end
end
group :test do
gem 'factory_girl_rails'
end
For "bootstrap-sass-rails" gem, the actual js and css files are located in gem's directory. They won't be copied to /vendor. And other gems do the same unless they provide a special generate task.
These directories will be included in assets' path. So when you mention #import bootstrap, Rails know where to search the files.

Updated Rails test suite set up?

Anyone know of a more up-to-date version of a Rails Rspec/Guard/Spork/Growl test suite set up?
These used to be great, but have become outdated as Ruby, Rails and the gems upgraded.
http://ygamretuta.me/2011/08/10/rails-3-setting-up-guard-with-rspec-and-spork-with-growl-notifications-in-osx/
https://eq8scrapbook.heroku.com/equivalents_scrap/on_rspec_spork_guard_configuration
Even the M. Hartl Ruby on Rails Tutorial instructions results in Guard tossing up a ChildProcess error and doesn't load the DRb server.
Here's what I've found to fix my problem above:
rails new app_name --skip-test-framework
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'bootstrap-sass', '2.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'jquery-rails', '2.0.2'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
gem 'rspec', '2.11.0'
gem 'guard', '1.6.2'
gem 'guard-rspec', '1.2.1'
gem 'guard-spork', '1.4.2'
gem 'spork-rails', '3.2.1'
gem 'spork', '1.0.0rc3'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '4.1.0'
gem 'database_cleaner', '0.7.0'
gem 'launchy', '2.1.0'
gem 'rb-fsevent', :require => false
gem 'growl', '1.0.3'
end
group :production do
gem 'pg', '0.12.2'
end
Then run this:
bundle update; bundle install; rails g rspec:install; guard init rspec; guard init spork; spork --bootstrap
Guardfile
Put the boostrapped spork block before the rspec block
spec_helper.rb
Put the block starting with "ENV["RAILS_ENV"] ||= 'test'" inside the Spork.prefork block
.rspec
add --drb
Run 'guard' and you should be all set.

A file called -e in my Rails app root directory

Right in my root path (where the Gemfile is) I have a file called -e which is empty. I wonder if this is something created by Rails or plugin? Or just a file I created by accident?
Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
end
gem 'annotate', '2.5.0', group: :development
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '4.1.0'
end
group :production do
gem 'pg', '0.12.2'
end
(I hope is not the later, or I will feel very stupid).

Resources