本文根据 Devhints / Bundler 翻译。代码示例及版本范围沿用原文。
命令
bundle # same as bundle install
bundle install # installs gems
bundle install -j3 # faster (3 jobs)
bundle update # update all gems
bundle update --source gemname # update specified gem
bundle outdated # show outdated gems
cd `bundle show rails` # inspect a gem's dir
bundle gem # new gem skeleton
Gem(Ruby 库)
gem 'hello'
gem 'hello', group: 'development'
GitHub 支持
gem 'hello', github: 'rstacruz/hello'
gem 'hello', github: 'rstacruz/hello', 'branch: master'
分组
group :development do
gem 'hello'
end
部署
$ bundle install --without=test,development --deployment
本地 Gem 开发
在您的 Gemfile 中,定义一个 Git 源及分支:
gem 'hello', github: 'rstacruz/hello', branch: 'master'
然后:
$ bundle config --global local.xxx ~/projects/xxx
Rake Gem 任务
# Rakefile
require 'bundler/gem_tasks'
终端:
$ rake release
$ rake build