I upgraded my rails 2.3.8 app to rails 3. when I run the rake db:reset command, it returns the following error
rake aborted! test-unit is not part of the bundle. Add it to Gemfile. /Users/Shenario/Desktop/stack24/Rakefile:7:in `' (See full trace by running task with --trace)
i'm new to rails, and wud be glad if you guys out ther coud help me! thanks!
the trace --
rake aborted!
test-unit is not part of the bun开发者_如何学JAVAdle. Add it to Gemfile.
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/bundler-1.0.7/lib/bundler/shared_helpers.rb:102:in block in cripple_rubygems'
/Users/Shenario/Desktop/stack24/lib/tasks/rspec.rake:1:in
'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:131:in load'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:131:in
block in load_tasks'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:131:in each'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:131:in
load_tasks'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:141:in load_tasks'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:77:in
method_missing'
/Users/Shenario/Desktop/stack24/Rakefile:7:in <top (required)>'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2383:in
load'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2383:in raw_load_rakefile'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2017:in
block in load_rakefile'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2016:in
load_rakefile'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2000:in block in run'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:2068:in
standard_exception_handling'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/lib/rake.rb:1998:in run'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/gems/rake-0.8.7/bin/rake:31:in
'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in load'
/Users/Shenario/.rvm/gems/ruby-1.9.2-p136/bin/rake:19:in
'
After searching for "test-unit", found this:
gem 'test-unit', '2.0.7' if RUBY_VERSION.to_f >= 1.9
in lib/tasks/rspec.rake
I suspected it was caused by me copying the whole lib folder from older rails version to this new one.
Solution: removed that file, then things seem to work fine after.
Basically I suggest you look at lib/tasks and see if there are rake tasks that are incompatible with rails 3.
you must have at least
gem "rails", "~> 3.0.3"
in your Gemfile, then remove Gemfile.lock (if any) and run:
bundle check
if you need some missing gems, run:
bundle install
bundler will install all required gems at least for rails 3.0.3, including test-unit gem. btw remember that a migration from rails 2.3.x to 3.0.x in most cases requires some code changes.
Add this to your Gemfile (replacing VERSION with your required version number).
gem 'test-unit', 'VERSION', :platform => :ruby_19
For Rails 2.3.11, I needed version 1.2.3 of the test-unit gem.
精彩评论