LoginSignup
4
2

More than 5 years have passed since last update.

bundle exec が面倒だから direnv 使って省略する。

Posted at

実行ファイルを置いてもらう

bundle install のオプションをこうする。

bundle install --path vendor/bundle --binstubs vendor/bundle/bin -j4

これで vendor/bundle/bin に実行ファイルが置かれる。

PATH を通す

direnv を使う。

1 インストール

brew install direnv
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc

2 設定ファイルを作る

cd project_directory
direnv edit .

3 書き込む

PATH_add vendor/bundle/bin
PATH_add bin

これで rubocop とか rspec とか自由に叩ける。

副作用

素敵な副作用として、プロジェクトディレクトリで vim を立ち上げると vendor/bundle/bin/rubocop を使ってくれる。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2