Errors in Gemfile - ruby-on-rails

I've cloned my app from Github but I've got errors on Gemfile. So I think, this app. is still running on heroku and it said that all up to date when I've used following commands:
git status
//On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
git push heroku
//Everything up-to-date
Also I could see output in heroku.
How to fix the error in Gemfile?
thanks.
//error as below:
There was an error parsing `Gemfile`: The `branch` option for `gem 'recaptcha'` is not allowed. Only gems with a git source can specify a branch. Bundler cannot continue.
# from /home/ubuntu/workspace/typo-1/Gemfile:46
# -------------------------------------------
# gem 'acts_as_tree_rails3'
> gem 'recaptcha', :require => 'recaptcha/rails', :branch => 'rails3'
#
//Gemfile
env = ENV["RAILS_ENV"] || 'development'
dbfile = File.expand_path("../config/database.yml", __FILE__)
#unless File.exists?(dbfile)
# raise "You need to configure config/database.yml first"
#else
# conf = YAML.load(File.read(dbfile))
# adapter = conf[env]['adapter']
# raise "You need define an adapter in your database.yml" if adapter == '' || adapter.nil?
# case adapter
# when 'sqlite3'
# gem 'sqlite3'
# when 'postgresql'
# gem 'pg'
# when 'mysql'
# gem 'sam-mysql-ruby'
# else
# raise "Don't know what gem to use for adapter #{adapter}"
# end
#end
group :production do
gem 'pg'
end
source 'https://rubygems.org'
ruby "1.9.3"
gem 'thin'
gem 'rails', '~> 3.0.10'
gem 'require_relative'
gem 'htmlentities'
gem 'json'
gem 'bluecloth', '~> 2.1'
gem 'coderay', '~> 0.9'
gem 'kaminari'
gem 'RedCloth', '~> 4.2.8'
gem 'addressable', '~> 2.1', :require => 'addressable/uri'
gem 'mini_magick', '~> 1.3.3', :require => 'mini_magick'
gem 'uuidtools', '~> 2.1.1'
gem 'flickraw-cached'
gem 'rubypants', '~> 0.2.0'
gem 'rake', '~> 0.9.2'
gem 'acts_as_list'
gem 'acts_as_tree_rails3'
gem 'recaptcha', :require => 'recaptcha/rails', :branch => 'rails3'
group :development, :test do
gem 'ruby-debug19'
gem 'factory_girl', '~> 2.2'
gem 'webrat'
gem 'rspec-rails', '~> 2.0'
gem 'simplecov', :require => false
gem 'sqlite3'
gem 'cucumber'
gem 'cucumber-rails', :require => false
gem 'cucumber-rails-training-wheels'
gem 'database_cleaner'
gem 'capybara'
end
//edited
I took off branch but got error as below when run bundle install:
bundle install
"Your Ruby version is 2.3.0, but your Gemfile specified 1.9.3"
Version 2.4 create the same error. So,I've changed to 2.3.0 - it went through until another error as below:
Results logged to
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/json-1.7.5/gem_make.out
An error occurred while installing json (1.7.5), and Bundler cannot continue.
Make sure that gem install json -v '1.7.5' succeeds before bundling.
//editing
I've follow the answer suggested to use the old version 1.9.2 and I be able to use command bundle install but after pushing to heroku, I've got empty page on heroku and errors as below:
//errors
2017-07-23T18:09:50.995656+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
2017-07-23T18:09:50.995657+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/controllers/controller.rb:71:in `start'
2017-07-23T18:09:50.995657+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/runner.rb:187:in `run_command'
2017-07-23T18:09:50.995658+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/runner.rb:152:in `run!'
2017-07-23T18:09:50.995659+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/bin/thin:6:in `<top (required)>'
2017-07-23T18:09:50.995659+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `load'
2017-07-23T18:09:50.995660+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/bin/thin:23:in `<top (required)>'
2017-07-23T18:09:51.185918+00:00 heroku[web.1]: Process exited with status 1
2017-07-23T18:09:51.200309+00:00 heroku[web.1]: State changed from starting to crashed
2017-07-23T18:09:51.845236+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=typoa.herokuapp.com request_id=7c8caa3e-8bad-4431-9da6-8ddf2f52a4d1 fwd="108.211.182.6" dyno= connect= service= status=503 bytes= protocol=https
2017-07-23T18:19:04.542770+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=typoa.herokuapp.com request_id=798e1c83-078a-4da6-b2cd-dfbf47b80687 fwd="108.211.182.6" dyno= connect= service= status=503 bytes= protocol=https
//edited
When I took off suggested line( with recaptcha), I could not see app. locally.
With this line I could see app. locally.
Errors without this line as below:
rails server -b $IP -p $PORT
=> Booting WEBrick
=> Rails 3.0.17 application starting in development on http://0.0.0.0:8080
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
home/ubuntu/workspace/typo-1/config/initializers/recaptcha.rb:1:in `<top (required)>': uninitialized constant Recaptcha (NameError)
from /usr/local/rvm/gems/ruby-1.9.3-p551/gems/railties-3.0.17/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
In any cases, I could not push to heroku:
Errors as below(it recommends to use the latest version of Ruby):
Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: !
remote: ! An error occurred while installing ruby-1.9.3
remote: !
remote: ! Heroku recommends you use the latest supported Ruby version listed here:
//edit
I could not find a working app to see the solution of this problem...Error message as below:
http://typosphere.org/stable.tar.gz#

1- In reCAPTCHA project on Github there is not a branch rails3, so, remove that piece of your Gemfile.
gem 'recaptcha', :require => 'recaptcha/rails'
2- Since you are using ruby 2.2.x, and in Gemfile is 1.9.3 I suggest that you should install 1.9.3 (via rvm or via rvm or whatever you use to manage your ruby versions) in your machine and work with that in order to avoid other conflicts you may find, because you are using a legacy code.
rvm install 1.9.3
rvm use 1.9.3
now install gem bundler and after that blundle install your Gemfile

I did not get this error using Ruby 2.4.1. I did get the same error when I changed versions to 1.9.3, as specified in the Gemfile. I also don't see a branch called rails3 at the source on Github. I would try removing the branch option first.
gem 'recaptcha', require: 'recaptcha/rails'

Related

missing required flag heroku tail

I am working to deploy my rails app. Everything in running in local environment but I am having some issues making my first push to heroku. I am getting the standard app error, see pic:
when i run the command heroku logs --tail, i get the following error:
my gemfile is as so:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
gem 'sqlite3'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
group :production do
gem 'pg'
end
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
below are my heroku logs:
2
018-02-09T00:48:11.108425+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
2018-02-09T00:48:11.108427+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
2018-02-09T00:48:11.108435+00:00 app[web.1]: from bin/rails:3:in `load'
2018-02-09T00:48:11.108437+00:00 app[web.1]: from bin/rails:3:in `<main>'
2018-02-09T00:48:11.120606+00:00 app[web.1]: => Booting WEBrick
2018-02-09T00:48:11.120615+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://0.0.0.0:52651
2018-02-09T00:48:11.120619+00:00 app[web.1]: => Ctrl-C to shutdown server
2018-02-09T00:48:11.120618+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-09T00:48:11.120621+00:00 app[web.1]: Exiting
2018-02-09T00:49:30.407211+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=postcable.herokuapp.com request_id=ec520950-df52-44ee-95aa-890d9ad76949 fwd="67.20.250.6" dyno= connect= service= status=503 bytes= protocol=https
2018-02-09T00:49:32.372812+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=postcable.herokuapp.com request_id=ffdb944b-9293-4d96-8986-b0af2974704c fwd="67.20.250.6" dyno= connect= service= status=503 bytes= protocol=https
First of all, to get the log error to work correctly also pass a flag for your app name as well:
heroku logs --tail --app my_heroku_app_name
Also, it seems you have nested gem groups. I am assuming you are using postgresql as your database for production so I would recommend to move pg out of development>production group like so:
gem 'pg'
group :development do
gem 'sqlite3'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
Then run
bundle install
Lastly, try pushing to heroku again with
git push heroku master
I solved, needed to define the PG version in my gemfile:
gem 'pg', '~> 0.18.4'

Heroku Failed to Install gems via bundler error with Publify

I am trying to host a RoR app with Publify gem via heroku. However I keep getting the following error. I have followed the instructions on Publify's github page concerning heroku, https://github.com/publify/publify. Another interesting thing is that it runs perfectly on my own server (rails s), signalling that something is wrong with the environment in the gemfile.
Thanks in advance for your help.
Here are the errors I am receiving (heroku push) :
Your version of git is 1.9.3. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
Checking for app files to sync... done, 590 files needed
Uploading: 100.0% (ETA: 0s)
Launching build process... done
Preparing app for compilation... done
Fetching buildpack... done
Detecting buildpack... done, Buildkit+Ruby
Fetching cache... empty
Compiling app...
Compiling for Ruby
Compiling Ruby/Rails
sh: Syntax error: Unterminated quoted string
!
ERROR: There was an error parsing your Gemfile, we cannot continue
ERROR: Unfortunately, a fatal error has occurred. Please see the Bundler
ERROR: troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
ERROR: /tmp/compile_unHgf/Gemfile:19:in `eval_gemfile': You need to configure config/database.yml first (RuntimeError)
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/dsl.rb:36:in `instance_eval'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/dsl.rb:36:in `eval_gemfile'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/dsl.rb:10:in `evaluate'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/definition.rb:26:in `build'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler.rb:153:in `definition'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/cli/platform.rb:10:in `block in run'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/ui/shell.rb:69:in `silence'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/cli/platform.rb:9:in `run'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/cli.rb:358:in `platform'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/vendor/thor/command.rb:27:in `run'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/vendor/thor/base.rb:440:in `start'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/cli.rb:9:in `start'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/bin/bundle:20:in `block in <top (required)>'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/gems/bundler-1.6.3/bin/bundle:20:in `<top (required)>'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/bin/bundle:19:in `load'
ERROR: from /tmp/d20150118-87-1khnax5/bundler-1.6.3/bin/bundle:19:in `<main>'
!
ERROR: Build failed, exited 1
Since the problem has been caused by the gemfile here is mine,
source 'https://rubygems.org'
if ENV["HEROKU"]
ruby '2.1.3'
gem "pg"
gem "thin" # Change this to another web server if you want (ie. unicorn, passenger, puma...)
gem "rails_12factor"
else
require 'yaml'
env = ENV["RAILS_ENV"] || 'development'
dbfile = File.expand_path("../config/database.yml", __FILE__)
unless File.exists?(dbfile)
if ENV['DB']
FileUtils.cp "config/database.yml.#{ENV['DB'] || 'postgres'}", 'config/database.yml'
else
raise "You need to configure config/database.yml first"
end
end
conf = YAML.load(File.read(dbfile))
environment = conf[env]
adapter = environment['adapter'] if environment
raise "You need define an adapter in your database.yml or set your RAILS_ENV variable" if adapter == '' || adapter.nil?
case adapter
when 'sqlite3'
gem 'sqlite3'
when 'postgresql'
gem 'pg'
when 'mysql2'
gem 'mysql2'
else
raise "Don't know what gem to use for adapter #{adapter}"
end
end
gem 'rails', '~> 4.1.7'
gem 'htmlentities'
gem 'bluecloth', '~> 2.1'
gem 'coderay', '~> 1.1.0'
gem 'kaminari'
gem 'RedCloth', '~> 4.2.8'
gem 'addressable', '~> 2.1', :require => 'addressable/uri'
gem 'mini_magick', '~> 3.8.1', :require => 'mini_magick'
gem 'uuidtools', '~> 2.1.1'
gem 'flickraw-cached'
gem 'rubypants', '~> 0.2.0'
gem 'rake', '~> 10.3.2'
#gem 'acts_as_list'
#gem 'acts_as_tree_rails3'
gem 'fog'
gem 'recaptcha', :require => 'recaptcha/rails', :branch => 'rails3'
gem 'carrierwave', '~> 0.10.0'
gem 'akismet', '~> 1.0'
gem 'twitter', '~> 5.6.0'
gem "jquery-rails", "~> 3.1.0"
gem "jquery-ui-rails", "~> 5.0.2"
gem 'rails-timeago', '~> 2.0'
gem 'rails_autolink', '~> 1.1.0'
gem 'dynamic_form', '~> 1.1.4'
gem 'non-stupid-digest-assets'
# removed from Rails-core as Rails 4.0
gem 'actionpack-page_caching', '~> 1.0.2'
gem 'rails-observers', '~> 0.1.2'
group :assets do
gem 'sass-rails', " ~> 4.0.3"
gem 'coffee-rails', " ~> 4.0.1"
gem 'uglifier'
end
group :development, :test do
gem 'thin'
gem 'factory_girl', '~> 4.5.0'
gem 'capybara'
gem 'rspec-rails', '~> 3.1.0'
gem 'simplecov', :require => false
gem 'pry-rails'
gem 'better_errors', '~> 2.0.0'
gem 'binding_of_caller'
gem 'guard-rspec'
end
# Install gems from each theme
Dir.glob(File.join(File.dirname(__FILE__), 'themes', '**', "Gemfile")) do |gemfile|
eval(IO.read(gemfile), binding)
end
it looks like the part of the Gemfile that you want to use aka the if ENV["HEROKU"] block is not being executed. instead, the else block is invoked which raises the error in the snippet of the log you posted.
there are several possible causes of this that i'm going to write down in order of probablity
you did not set heroku config:set HEROKU=true as explained in the publify documentation
heroku ignores the environment variable
the custom build-pack you are using interferes with what you are trying to achieve
something else is broken

Can't run new application

I've installed RoR in my MacOS X using this guide
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
Here my versions:
$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
$ rails --version
Rails 3.2.3
$ gem --version
1.8.23
I was unable to run my app so I've googled and modified Gemfile using this tutorial: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
Now this is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platform => :ruby
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.0'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
When I run the app using
rails server
I got this:
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load': /Users/giacomo/websrc/rubyrails-app/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_rubyrails-app_session'
^
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:245:in `load'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/engine.rb:588
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/engine.rb:587:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/engine.rb:587
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/giacomo/websrc/rubyrails-app/config/environment.rb:5
from /Users/giacomo/websrc/rubyrails-app/config.ru:4:in `require'
from /Users/giacomo/websrc/rubyrails-app/config.ru:4
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/giacomo/websrc/rubyrails-app/config.ru:1:in `new'
from /Users/giacomo/websrc/rubyrails-app/config.ru:1
How can I solve the problem?
By using Ruby 1.9.x instead of 1.8.7.
Or by opening /Users/giacomo/websrc/rubyrails-app/config/initializers/session_store.rb and replacing:
key: '_rubyrails-app_session'
With:
:key => '_rubyrails-app_session'
And opening /Users/giacomo/websrc/rubyrails-app/config/initializers/wrap_parameters.rb and replacing:
wrap_parameters format: [:json]
With:
wrap_parameters :format => [:json]
The error occurs because the new ruby has another syntax for hash. Tutorial that you used is outdated, I would suggest to try this: http://railsapps.github.com/installing-rails.html
This is the best I could find. And also it is constantly updated.
In your case you need just to install new version of ruby and then reinstall rails.

Autotest and Title test failing in chapter 3 of Ruby on Rails 3 Tutorial by Michael Hartl - Perhaps Gem version miss match

I'm going through the Ruby on Rails 3 Tutorial by Michael Hartl. I have a hard time getting past the testing error. I can test the existence of pages fine but as soon as I want to test the title it fails. I'm sure I followed the text to the T
My auto test also fails because of some gem version miss-match I tried everything I could find online but nothing helped.
Can someone also pint me to the right place for rspec function documentation?
I appreciate any help. Thanks
This is the link to my public repository https://justfarnaz#github.com/justfarnaz/Sample_app_new.git
I'm running Rails 3.1.1 and the Gemfile bellow.
Both error messages and the Gemfile are bellow.
// Failing message after I run bundle exec rspec spec/
.F...
Failures:
1) PagesController GET 'home' should have the right title
Failure/Error: response.should have_selector("title", :content => "Ruby on Rails Tutorial Sample App | Home ")
expected following output to contain a Ruby on Rails Tutorial Sample App | Home tag:
# ./spec/controllers/pages_controller_spec.rb:12
Finished in 0.05239 seconds
5 examples, 1 failure
Failed examples:
rspec ./spec/controllers/pages_controller_spec.rb:10 # PagesController GET 'home' should have the right title
Autotest error
autotest
loading autotest/rails_rspec2
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -rrubygems -S /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/bin/rspec --tty '/Users/justfarnaz/Documents/Ruby/sites/sample_app/spec/controllers/pages_controller_spec.rb'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in setup': You have already activated rspec-core 2.7.1, but your Gemfile requires rspec-core 2.6.4. Using bundle exec may solve this. (Gem::LoadError)
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:17:insetup'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:110:in setup'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/setup.rb:17
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:ingem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in require'
from /Users/justfarnaz/Documents/Ruby/sites/sample_app/config/boot.rb:6
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:ingem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:in require'
from /Users/justfarnaz/Documents/Ruby/sites/sample_app/config/application.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:ingem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:in require'
from /Users/justfarnaz/Documents/Ruby/sites/sample_app/config/environment.rb:2
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:ingem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:in require'
from /Users/justfarnaz/Documents/Ruby/sites/sample_app/spec/spec_helper.rb:50
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:ingem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:55:in require'
from /Users/justfarnaz/Documents/Ruby/sites/sample_app/spec/controllers/pages_controller_spec.rb:1
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:inload'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in load_spec_files'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:inmap'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/configuration.rb:459:in load_spec_files'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/command_line.rb:18:inrun'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:80:in run_in_process'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:69:inrun'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.7.1/lib/rspec/core/runner.rb:10:in `autorun'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/bin/rspec:4
Gemfile
source 'http://rubygems.org'
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'json'
group :development do
gem 'rspec-rails', '2.6.1'
end
group :test do
gem 'rspec-rails', '2.6.1'
gem 'webrat' , '0.7.1'
gem 'spork', '0.9.0.rc8'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
Same problem. Try to edit Gemfile and change version of
gem 'rspec-rails', '2.6.1'
in test and development groups to 2.7.0

Rails. Gem bundle failed

after I run:
bundle install
I got:
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:14:in <top
(required)>': undefined methodremove' for Gem::QuickLoader:Module
(NoMethodError) from :158:in require' from
<internal:gem_prelude>:158:inload_full_rubygems_library' from
:280:in method_missing' from
/usr/local/bin/bundle:19:in'
mat#Macbook-Pro~/Documents/workspace/RoR/rails_projects/sample_app$
Edited:
>bundle -v
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:14:in `<top (required)>': undefined method `remove' for Gem::QuickLoader:Module (NoMethodError)
from <internal:gem_prelude>:158:in `require'
from <internal:gem_prelude>:158:in `load_full_rubygems_library'
from <internal:gem_prelude>:280:in `method_missing'
from /usr/local/bin/bundle:19:in `<main>'
mat#Macbook-Pro~$ gem -v
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:86:in `<top (required)>': undefined method `load_plugins' for Gem:Module (NoMethodError)
from /usr/local/bin/gem:9:in `require'
from /usr/local/bin/gem:9:in `<main>'
My Gemfile is :
>
source 'http://rubygems.org'
gem 'rails', '3.0.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3', '1.3.3'
group :development do
gem 'rspec-rails', '2.6.1'
end
group :test do
gem 'rspec-rails', '2.6.1'
gem 'webrat', '0.7.1'
end
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
Could anybody help me?THanks!
I faced with a similar error:
$ bundle -v
/Users/Reza/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/site_ruby/1.9.1/rubygems.rb:14:in `<top (required)>': undefined method `remove' for Gem::QuickLoader:Module (NoMethodError)
It seems that all [..]/rubygems.rb Undefined method[..] issues is related to a conflict between installed rubygems (e.g. via rvm rubygems) and built in rubygems methods in ruby 1.9.x
just rename the installed rubygems files and issue is resolved.
$ which ruby
/Users/Reza/.rvm/rubies/ruby-1.9.2-rc2/bin/ruby
$ echo $MY_RUBY_HOME
/Users/Reza/.rvm/rubies/ruby-1.9.2-rc2
$ cd "$MY_RUBY_HOME/lib/ruby/site_ruby/1.9.1/"
$ mv rubygems.rb rubygems.rb-rename
$ mv rubygems rubygems-rename
$ bundle -v
Bundler version 1.0.18
Try to manually update to the latest RubyGems version from here:
http://rubygems.org/pages/download
1. Download the latest rubygems
http://production.cf.rubygems.org/rubygems/rubygems-1.8.7.tgz
2. Extract it
tar zxvf rubygems-1.8.7.tgz
3. Install it
cd rubygems-1.8.7
sudo ruby setup.rb
If that does not help you can try and download an older version of rubygems from here:
http://rubyforge.org/frs/?group_id=126
For example 1.8.5, 1.8.0, 1.7.0, 1.6.0.

Resources