What is Bundler?

It tracks an application's code and the rubygems it needs to run, 

  • track : たどる、監視・追跡する

so that an application will always have the exact gems (and versions) that it needs to run.

  • so that : 〜できるように
  • always have : 常備
  • exact : 的確な

Getting Started

Getting started with bundler is easy! Open a terminal window and run this command: 
bundler を始めるのは簡単だよ! ターミナルを開いて、以下のコマンドを入力してね

$ gem install bundler

Specify your dependencies in a Gemfile in your project's root:

  • Specify : 〜を含める
  • dependencies : 依存関係
source 'https://rubygems.org'
gem 'nokogiri'
gem 'rack', '~>1.1'
gem 'rspec', :require => 'spec'

Install all of the required gems from your specified sources: 

  • required : 望んだ
$ bundle install
$ git add Gemfile Gemfile.lock

The second command adds the Gemfile and Gemfile.lock to your repository. 

This ensures that other developers on your app, as well as your deployment environment, will all use the same third-party code that you are using now. 

  • ensures : 確実にする、守る、保険を掛ける
  • as well as : 〜の前後。AだけでなくBも

Inside your app, load up the bundled environment

require 'rubygems'
require 'bundler/setup'

# require your gems as usual
require 'nokogiri'

訳注 : railsだとこの部分はよきにはからってくれる

Run an executable that comes with a gem in your bundle: 
あなたの bundle にある gem の実行ファイルを起動させる

$ bundle exec rspec spec/models
  • executable : 実行ファイル

In some cases, running executables without bundle exec may work, 
往々にして、bundle exec なしでも、コマンドが実行できるよ

  • In some cases : 往々にして

if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.
あなたのシステムに入っている gem と、bundle に入っている gem がコンフリクトしていないのが理由だよ

However, this is unreliable and is the source of considerable pain. 

  • source of : 原因
  • considerable : かなりの
  • pain : 痛み、苦労、深い
  • However : けれども、しかしながら
  • unreliable : 信頼ならない、頼りにならない

Even if it looks like it works, it may not work in the future or on another machine. 

  • Even : たとえ〜でも

Finally, if you want a way to get a shortcut to gems in your bundle:

$ bundle install --binstubs
$ bin/rspec spec/models

The executables installed into bin are scoped to the bundle, and will always work.