LoginSignup
147
147

More than 5 years have passed since last update.

bundle execを使わずに済む方法(rbenv編)

Posted at
$ cd
$ mkdir .rbenv/plugins
$ cd .rbenv/plugins
$ git clone git://github.com/ianheggie/rbenv-binstubs.git
  • rbenvにはpluginsという仕組みがあってrbenvに機能を追加できる。ruby-buildもその一つ。「ひとつのことをうまくやる」思想っぽい。
  • そのpluginのひとつにbundlerとの連携をうまくやってくれるrbenv-bundlerというのがあるんだけど、rbenvはこれを非推奨といってる。パフォーマンスが悪くなったり、バグが多いみたい。
  • 同じようなpluginを探したところ、rbenv-binstubsというものを見つけた。thoughtbotのブログで紹介されていた。

Rails 3

$ cd path/to/project
$ bundle install --binstubs
$ rbenv rehash
$ rails s
  • --path=vendor/bundleを指定するとうまくいかなかった。

Rails 4

$ cd path/to/project
$ bundle install --binstubs=bundle_bin
$ rbenv rehash
$ rails s
  • Rails 4からはbinディレクトリの扱いが若干変わるので要注意。詳しくはこちら
  • binstubsが実行ファイルを生成するディレクトリを指定する。指定してもちゃんと動く。
147
147
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
147
147