开发者

In Ruby on Rails, why is "bundle install" so slow to create Gemfile.lock and "rails g foo name:string" creates it so quickly?

开发者 https://www.devze.com 2023-02-25 08:27 出处:网络
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

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.

0

精彩评论

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