ruby Bundle install

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

尤其是你切換環境(切換不同的系統),這個時候在新的環境中可能各個Gem組件的版本不匹配,就需要運行bundle Install來保證當前環境的GEM FILES版本匹配。

[ruby]view plaincopy

print?

$?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

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容