Could Not Find Rake-10.1.0 in Any of the Sources

Bundler::GemNotFound: Could not find rake-10.3.2 in any of the sources

bundle config set --local path 'vendor/cache'

generally fixes it as that is the more common problem. Basically, your bundler path configuration is messed up. See their documentation (first paragraph) for where to find those configurations and change them manually if needed.

Could not find rake-10.0.4 in any of the sources (Bundler::GemNotFound)

Sometimes we didn't get the response from http://rubygems.org/. So it will show the given error.

You can use following ways for fixing this issue

  • Try again for gem install using gem install rack command and run bundle update rake for updating your Gemfile.lock file.
  • Delete the Gemfile.lock and again bundle install it.

An error occurred while installing rake (10.1.0), and Bundler cannot continue

You should first update Rubygems:

gem update --system

And then update Bundler:

gem install bundler

source: NoMethodError: private method `open' called for Gem::Package:Class An error occurred while installing rake (10.0.3), and Bundler cannot continue

Rails not finding rake-10.5.0

I believe the issue was to do with my Ruby install.
I ran the below commands and this seems to have solved the issue

rvm install ruby-2.0.0-p643
rvm --default use 2.0.0
ruby -v
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-darwin14.1.0]

Rails: You have already activated rake 10.3.1, but your Gemfile requires rake 10.2.2 (Gem::LoadError)

EDIT 2:
You should look at bundle update and change your workflow a little. Refer to this question for further assistance.


Original answer

This is a simple issue which happens when your gemset has a rake version that is newer than the version number your Gemfile.lock mentions.

As is mentioned in the error message, you can use bundle exec to get things working.

My solution in such cases is to just remove Gemfile.lock if I am not too worried other gem versions and their endless dependencies. Otherwise, you can try just removing the one line in Gemfile.lock which talks about the version of rake. run bundle install and the world should be a happy place again. (edit 2: Run bundle update --source instead of this. Don't do this.)

PS: Try using gemsets and organising your gems with rvm for different projects.

Edit

I prefer using rbenv now for managing installations and all gems for a project reside in vendor/bundle using bundle install --path option. Later scope every gem command with bundle exec.

Hence, rails s becomes bundle exec rails s. A little more typing is, in my opinion, better if it means that things will remain clean and conflicts such as this one don't happen.

How to populate devise user

Populator doesn't load the ActiveRecord instance; so any validations, callbacks, embedded methods wouldn't work. Instead it loads its own Record object, using columns attributes and pure SQL to boost performance.

On the other hand, Devise doesn't create :password column, it creates encrypted_password column and does all the logic behind the scene, check this link if you want to have insight about devise code.

Solution: We need to call password_digest to encrypt the given password, and then set the encrypted_password directly, but this method is protected and can't be called inside the rake. Instead we would use the 'new' method to trigger password_digest, so your code would be something like this:

password = "password"

User.populate 20 do |user|
user.name = Faker::Name.name
user.email = Faker::Internet.email
user.encrypted_password = User.new(:password => password).encrypted_password
# rest of your code here
end


Related Topics



Leave a reply



Submit