ruby Bundle install
bundle install的作用:Make sure all dependencies in yourGemfileare available to your application.
尤其是你切换环境(切换不同的系统),这个时候在新的环境中可能各个Gem组件的版本不匹配,就需要运行bundle Install来保证当前环境的GEM FILES版本匹配。
[ruby]view plaincopy
$ 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