In Ruby on Rails, why is "bundle install" so slow to create Gemfile.lock and "rails g foo name:string" creates it so quickly?
I already have all the gems, and each time I do
rails trytry02
cd trytry02
bundle install
to create the Gemfile.lock, i开发者_Go百科t takes a long time to fetch data from rubygems.org. But I noticed that if I do a
rails g scaffold foo name:string
before doing the bundle install, then the Gemfile.lock is created very fast. Is there a way to create it fast but not using rails g scaffold
?
Douglas is correct, this is because bundle install
is doing a round trip to rubygems.org
to look for newer versions. If you want to just use the local versions...
bundle install --local
But - why are you generating your Gemfile.lock
so often that this is an issue? Your Gemfile.lock
should be under version control, ie. part of your project, and so should only change occasionally.
Try to change https to http in the Gemfile and see if this increases its speed.
精彩评论