pablomarti
pablomarti

Reputation: 2107

Could not find rake 10.0.3 in any of the sources, when working with Whenever and Capistrano

I'm trying to use the gem Whenever with Capistrano over my Rails app on 3.2.8, working with RVM and a gemset for that Rails version.

I'm getting the following error: Could not find rake-10.0.3 in any of the sources (Bundler::GemNotFound)

This is the output of the error (which I logged over a file):

/home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find rake-10.0.3 in any of the sources (Bundler::GemNotFound)
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `map!'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/spec_set.rb:83:in `materialize'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/definition.rb:113:in `specs'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/definition.rb:158:in `specs_for'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/definition.rb:147:in `requested_specs'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/environment.rb:23:in `requested_specs'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:11:in `setup'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler.rb:116:in `setup'
    from /home/some_user/.rvm/gems/ruby-1.9.3-p286@global/gems/bundler-1.2.1/lib/bundler/setup.rb:17:in `<top (required)>'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from /home/some_user/some_user/config/boot.rb:6:in `<top (required)>'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/some_user/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from script/rails:5:in `<main>'

I did also get the error when I was using Rake 10.0.2 (I made bundle update and get Rake 10.0.3, and I leave it for testing). Also, I noticed that the bundler is searching over @global when I think it should search over the gemset (called @r328, and is located on /home/some_user/.rvm/gems).

.rvmrc (located inside of the project)

source ~/.profile
rvm use 1.9.3@r328
rvm_trust_rvmrcs_flag=1

.profile

if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function

schedule.rb (for testing)

set :output, "#{path}/log/cron.log"

every 1.minute do
  runner "MenuOrder.send_resume(2)"
end

deploy.rb

set :whenever_command, "bundle exec whenever"
require "whenever/capistrano"

The output of gem list

actionmailer (3.2.8)
actionpack (3.2.8)
active_utils (1.0.5)
activeadmin (0.5.0)
activemerchant (1.29.3, 1.28.0)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
arbre (1.0.1)
arel (3.0.2)
authorize-net (1.5.2)
bcrypt-ruby (3.0.1)
bourbon (3.0.1, 2.1.2, 2.1.1)
builder (3.0.4)
bundler (1.2.1)
capistrano (2.13.5)
carrierwave (0.8.0, 0.7.1, 0.7.0)
chronic (0.9.0)
cocaine (0.4.2)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
daemon_controller (1.1.0)
daemons (1.1.9)
delayed_job (3.0.4)
delayed_job_active_record (0.3.3)
devise (2.2.0, 2.1.2)
erubis (2.7.0)
execjs (1.4.0)
fastercsv (1.5.5)
fastthread (1.0.7)
formtastic (2.2.1)
has_scope (0.5.1)
highline (1.6.15)
hike (1.2.1)
i18n (0.6.1)
inherited_resources (1.3.1)
journey (1.0.4)
jquery-rails (2.1.4, 2.1.3)
json (1.7.6, 1.7.5)
kaminari (0.14.1)
mail (2.4.4)
meta_search (1.1.3)
mime-types (1.19)
money (5.1.0)
multi_json (1.5.0, 1.3.7, 1.3.6)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.6.2)
net-ssh-gateway (1.1.0)
nokogiri (1.5.6, 1.5.5)
orm_adapter (0.4.0)
paperclip (3.4.0, 3.3.1)
passenger (3.9.1.beta, 3.0.19, 3.0.18)
polyamorous (0.5.0)
polyglot (0.3.3)
rack (1.4.3, 1.4.1)
rack-cache (1.2)
rack-raw-upload (1.1.1, 1.1.0)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.8)
railties (3.2.8)
rake (10.0.3, 10.0.2, 0.9.2.2)
rdoc (3.12)
recaptcha (0.3.4)
responders (0.9.3)
rich (1.4.1, 1.3.1)
rmagick (2.13.1)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
sass (3.2.5, 3.2.3, 3.2.1)
sass-rails (3.2.5)
sprockets (2.1.3)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35, 0.3.34)
uglifier (1.3.0)
warden (1.2.1)
whenever (0.8.1)

I tried with bundle update, removing Gemfile.lock and making bundle install, uninstalling all the rake gems (10.0.3 and 10.0.2) and installing the gem with bundle install but nothing worked.

Upvotes: 4

Views: 15326

Answers (5)

ethicalhack3r
ethicalhack3r

Reputation: 1132

Just a bundle install worked for me. I think it was because I had updated Ruby but then forgot to run bundler afterwards.

Upvotes: 1

Marc
Marc

Reputation: 4586

This problem is actually due to BUNDLE_PATH overriding the rvm gemset settings and storing the downloaded files elsewhere whenever you run bundle install. To solve this, you can either delete your .bundle folder or remove the BUNDLE_PATH line from .bundle/config. Just rerun bundle install once that's done and you should be good to go!

Upvotes: 0

pablomarti
pablomarti

Reputation: 2107

What I did to solve the problem was a little tricky:

  1. Remove all the versions of Rake
  2. Remove Gemfile.lock
  3. Run bundle install
  4. Install Rake manually with: gem install rake --version=10.0.2

Now it is working, but for some reason it doesn't write the log file. I will fix it and post the update.

Upvotes: 3

harsh4u
harsh4u

Reputation: 2600

You can use

bundle install --path vendor/cache

Hope this help you.

Upvotes: 10

Allen
Allen

Reputation: 834

So that's the error you get when you're running a rake task or when you're setting up a rake task to when with cron? If you think it's the whatever gem, I KNOW there has been a lot of discussion about whenever not working because Capistrano actually changed around some internals and they've been slowly fixing them, but they haven't released an update to the gem.

Run a search through their issues and see if you can find what is related to you:

https://github.com/javan/whenever/issues

Upvotes: 0

Related Questions