将 Rails 3.2 升级到 4.2 -> 无法加载此类文件 -- resque_scheduler/tasks

Upgrade Rails 3.2 to 4.2 -> cannot load such file -- resque_scheduler/tasks

我正在尝试将我的 Rails 3.2 项目升级到 Rails 4.2,包括我 Gemfile 中的所有依赖项。我已经从我的 Gemfile 中删除了旧版本号限制,删除了我的 Gemfile.lockbundle install。它升级了我希望的一切(据我所知),但是当我做 rake db:setup 我得到以下错误:

p@jarvis ~/g/s/g/n/j/x> rake db:setup --trace
rake aborted!
LoadError: cannot load such file -- resque_scheduler/tasks
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/home/p/gop/src/github.com/x/x/x/lib/tasks/resque.rake:2:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `block in run_tasks_blocks'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `each'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `run_tasks_blocks'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:452:in `run_tasks_blocks'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:453:in `load_tasks'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `public_send'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `method_missing'
/home/p/gop/src/github.com/x/x/x/Rakefile:7:in `<top (required)>'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:686:in `raw_load_rakefile'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:96:in `block in load_rakefile'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:95:in `load_rakefile'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:79:in `block in run'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
/var/lib/gems/2.3.0/gems/rake-11.2.2/lib/rake/application.rb:77:in `run'
/var/lib/gems/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'

我试过使用 gem 'resque-scheduler', '~> 2.5.5',但没有成功(在 Google 的某个地方看到了推荐)。还尝试提供 Github 路径,但没有成功。不确定它是否相关,但我的 Gemfile 有一个连字符,错误有一个下划线。这有什么关系吗?

这是我的 Gemfile 的样子:

source 'https://rubygems.org'

gem 'rails'
gem 'postgresql'
gem 'haml'

# Base-62 conversion library
gem 'radix62'

# Generated views will default to haml
gem 'haml-rails'

gem 'resque'
gem 'resque-scheduler' 
gem 'activeadmin', github: 'activeadmin'
gem 'activeresource'

group :development do
  gem 'pry-rails'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails'
  gem 'coffee-rails'
  gem 'therubyracer', :platforms => :ruby
  gem 'uglifier'
end

gem 'jquery-rails'

这是我的 Gemfile.lock:

GIT
  remote: git://github.com/activeadmin/activeadmin.git
  revision: f0243d495067a8e5b03bd017fe04c5b7de422870
  specs:
    activeadmin (1.0.0.pre2)
      arbre (~> 1.0, >= 1.0.2)
      bourbon
      coffee-rails
      formtastic (~> 3.1)
      formtastic_i18n
      inherited_resources (~> 1.6)
      jquery-rails
      jquery-ui-rails
      kaminari (~> 0.15)
      rails (>= 3.2, < 5.0)
      ransack (~> 1.3)
      sass-rails
      sprockets (< 4)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.6)
      actionpack (= 4.2.6)
      actionview (= 4.2.6)
      activejob (= 4.2.6)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.6)
      actionview (= 4.2.6)
      activesupport (= 4.2.6)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.6)
      activesupport (= 4.2.6)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.6)
      activesupport (= 4.2.6)
      globalid (>= 0.3.0)
    activemodel (4.2.6)
      activesupport (= 4.2.6)
      builder (~> 3.1)
    activerecord (4.2.6)
      activemodel (= 4.2.6)
      activesupport (= 4.2.6)
      arel (~> 6.0)
    activeresource (4.1.0)
      activemodel (~> 4.0)
      activesupport (~> 4.0)
      rails-observers (~> 0.1.2)
    activesupport (4.2.6)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arbre (1.0.3)
      activesupport (>= 3.0.0)
    arel (6.0.3)
    bourbon (4.2.7)
      sass (~> 3.4)
      thor (~> 0.19)
    builder (3.2.2)
    coderay (1.1.1)
    coffee-rails (4.1.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.1.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    concurrent-ruby (1.0.2)
    erubis (2.7.0)
    execjs (2.7.0)
    formtastic (3.1.4)
      actionpack (>= 3.2.13)
    formtastic_i18n (0.6.0)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    haml (4.0.7)
      tilt
    haml-rails (0.9.0)
      actionpack (>= 4.0.1)
      activesupport (>= 4.0.1)
      haml (>= 4.0.6, < 5.0)
      html2haml (>= 1.0.1)
      railties (>= 4.0.1)
    has_scope (0.6.0)
      actionpack (>= 3.2, < 5)
      activesupport (>= 3.2, < 5)
    html2haml (2.0.0)
      erubis (~> 2.7.0)
      haml (~> 4.0.0)
      nokogiri (~> 1.6.0)
      ruby_parser (~> 3.5)
    i18n (0.7.0)
    inherited_resources (1.6.0)
      actionpack (>= 3.2, < 5)
      has_scope (~> 0.6.0.rc)
      railties (>= 3.2, < 5)
      responders
    jquery-rails (4.1.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (5.0.5)
      railties (>= 3.2.16)
    json (1.8.3)
    kaminari (0.17.0)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    libv8 (3.16.14.15)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.9.0)
    mono_logger (1.1.0)
    multi_json (1.12.1)
    nokogiri (1.6.8)
      mini_portile2 (~> 2.1.0)
      pkg-config (~> 1.1.7)
    pg (0.18.4)
    pkg-config (1.1.7)
    polyamorous (1.3.0)
      activerecord (>= 3.0)
    postgresql (1.0.0)
      pg
    pry (0.10.3)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    pry-rails (0.3.4)
      pry (>= 0.9.10)
    rack (1.6.4)
    rack-protection (1.5.3)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    radix62 (1.0.1)
    rails (4.2.6)
      actionmailer (= 4.2.6)
      actionpack (= 4.2.6)
      actionview (= 4.2.6)
      activejob (= 4.2.6)
      activemodel (= 4.2.6)
      activerecord (= 4.2.6)
      activesupport (= 4.2.6)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.6)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails-observers (0.1.2)
      activemodel (~> 4.0)
    railties (4.2.6)
      actionpack (= 4.2.6)
      activesupport (= 4.2.6)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (11.2.2)
    ransack (1.7.0)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      activesupport (>= 3.0)
      i18n
      polyamorous (~> 1.2)
    redis (3.3.0)
    redis-namespace (1.5.2)
      redis (~> 3.0, >= 3.0.4)
    ref (2.0.0)
    responders (2.2.0)
      railties (>= 4.2.0, < 5.1)
    resque (1.26.0)
      mono_logger (~> 1.0)
      multi_json (~> 1.0)
      redis-namespace (~> 1.3)
      sinatra (>= 0.9.2)
      vegas (~> 0.1.2)
    resque-scheduler (4.3.0)
      mono_logger (~> 1.0)
      redis (~> 3.3)
      resque (~> 1.26)
      rufus-scheduler (~> 3.2)
    ruby_parser (3.8.2)
      sexp_processor (~> 4.1)
    rufus-scheduler (3.2.1)
    sass (3.4.22)
    sass-rails (5.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sexp_processor (4.7.0)
    sinatra (1.4.7)
      rack (~> 1.5)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    slop (3.6.0)
    sprockets (3.6.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.1.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    therubyracer (0.12.2)
      libv8 (~> 3.16.14.0)
      ref
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.5)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (3.0.0)
      execjs (>= 0.3.0, < 3)
    vegas (0.1.11)
      rack (>= 1.0.0)

PLATFORMS
  ruby

DEPENDENCIES
  activeadmin!
  activeresource
  coffee-rails
  haml
  haml-rails
  jquery-rails
  postgresql
  pry-rails
  radix62
  rails
  resque
  resque-scheduler
  sass-rails
  therubyracer
  uglifier

BUNDLED WITH
   1.12.5

Resque-Scheduler documentation 声明要执行任务,您需要执行以下操作:

require 'resque/scheduler/tasks'

我认为你应该从 resque-scheduler/tasks 改为那个!