bundle install

bundle install的作用:Make sure all dependencies in your Gemfile are available to your application.

尤其是你切换环境(切换不同的系统),这个时候在新的环境中可能各个Gem组件的版本不匹配,就需要运行bundle Install来保证当前环境的GEM FILES版本匹配。

$ bundle install [--binstubs=PATH] [--clean] [--deployment] [--frozen]
                 [--full-index] [--gemfile=FILE] [--local] [--no-cache]
                 [--no-prune] [--path=PATH] [--quiet] [--shebang=STRING]
                 [--standalone=ARRAY] [--system] [--without=GROUP GROUP]

Options:

--binstubs: Generate bin stubs for bundled gems to ./bin

--clean: Run bundle clean automatically after install

--deployment: Install using defaults tuned for deployment environments

--frozen: Do not allow the Gemfile.lock to be updated after this install

--full-index: Use the rubygems modern index instead of the API endpoint

--gemfile: Use the specified gemfile instead of Gemfile

--local: Do not attempt to fetch gems remotely and use the gem cache instead

--no-cache: Don't update the existing gem cache.

--no-prune: Don't remove stale gems from the cache.

--path: Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine

--quiet: Only output warnings and errors.

--shebang: Specify a different shebang executable name than the default (usually 'ruby')

--standalone: Make a bundle that can work without the Bundler runtime

--system: Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application

--without: Exclude gems that are part of the specified named group.


rails new时bundle install有的时候非常慢

rails new xxx创建一个新项目,常常会卡在“run  bundle install”,有的时候快点,有的时候非常慢

C:\Work>rails new ptian1
      create
      create  README.rdoc
      create  Rakefile
      ...

      ...
      create  vendor/plugins/.gitkeep
         run  bundle install


这是因为rails new时自动会运行bundle install,而bundle install会自动去rubygems.org查找是否有更新。但需要的gems我早安装好了,且不用更新,所以上面步骤就可省了。强烈建议rails党委取消rails new时自动查找gems更新功能!

解法很简单

rails new my_app --skip-bundle
cd my_app
bundle install --local

另外,最新版bundler速度提高不少,建议使用,也能提速

gem install bundler --pre



参考:

http://gembundler.com/v1.3/bundle_install.html

http://rubyer.me/blog/941/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值