开发者

upgraded rails 3 app rake db:reset error

开发者 https://www.devze.com 2023-02-03 08:58 出处:网络
I upgraded my rails 2.3.8 app to rails 3. when I run the rake db:reset command, it returns the following error

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:inblock 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:inload_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:inmethod_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:inload' /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:inblock 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:inload_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:instandard_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.

0

精彩评论

暂无评论...
验证码 换一张
取 消