<leif_>
hi everyone, I have a question about vendoring, which is causing me an issue with guard-rspec and foreman - is this an appropriate place ?
<leif_>
ok I'll just go ahead and start.
<leif_>
When I do the following bundle install --path vendor/bundle --binstubs vendor/bundle/bin --jobs=4 everything installs as expected, and I see gem files where required etc. After that I do the following bundle exec foreman start which fires up guard and unicorn for me. Then I hit an issue. Guard is trying to setup guard-rspec, which in turn tries to run bundler. And I get this error. 13:31:49 guard.1 | /usr/local/var/rbenv/versio
<leif_>
wow that did not format well, trying again
<leif_>
everything installs as expected, and I see gem files where required etc.
<leif_>
After that I do the following
<leif_>
bundle exec foreman start
<leif_>
which fires up guard and unicorn for me. Then I hit an issue.
<leif_>
Guard is trying to setup guard-rspec, which in turn tries to run bundler. And I get this error.
<leif_>
13:31:49 guard.1 | /usr/local/var/rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 143 total gem(s) (Gem::LoadError)
<indirect>
IRC only allows one line of text at a time
<leif_>
And if I search my vendored gems, bundler is indeed not there.
<indirect>
you’ll likely need to put the full error into a paste service
<leif_>
I can do that - in a minute
<indirect>
foreman doesn’t usually expect to be run by bundler
<leif_>
A workaround this is to set my GEM_PATH as follows
<leif_>
This allows Guard to now find the installed bundler, and the error goes away and everything is sweet.
<indirect>
I would expect that you need to change your Procfile to run `bundle exec guard` and `bundle exec unicorn`
<leif_>
So my first thought is that bundler should vendor itself when we pass --path and --binstubs, and we just set the GEM_PATH to the vendored gems. Or that bundler, when it checks for vendored gems, sees that itself is vendored and makes sure guard-spec (and any other utility) will find itself there.
<leif_>
Thoughts ?
<indirect>
not a good idea
<leif_>
foreman doesnt expect that ? is that documented as a best practice ?
<indirect>
yes
<indirect>
every example of how to use forman I have ever seen says to put `bundle exec` in your Procfile and to run `foreman start`, not `bundle exec foreman start`
<indirect>
if you really want to install bundler into the bundled gems
<indirect>
you can just run `bundle exec gem install bundler`
<leif_>
ok - and the reason why vendoring bundler is a bad idea ?
<leif_>
is it just in this scenario ?
<indirect>
yeah
<indirect>
just this scenario
<indirect>
guard is written with the expectation that it will be run at a high enough level that it can load bundler
<indirect>
as you saw with that exception
<indirect>
guard could be written in such a way that it would work
<indirect>
but they decided not to do that
<indirect>
the fix is not to force bundler into the gems needed by your application (beacuse bundler is already installed at the system level)
<indirect>
it’s to just run guard at the level that guard expects
<leif_>
ok - the only thing that makes me uncomfortable is that foreman has a dependency on thor - as does guard - so its possbile/probably foreman will use one version of thor and guard (under foreman) another. Shoul I worry ?
<indirect>
no
<indirect>
they’re completely separate ruby processes
<indirect>
foreman loads the system version of thor
<indirect>
and then it creates a completely new ruby interpreter to run `bundle exec guard`
<leif_>
ok I'll need to go away and think about that for a while.
<indirect>
that ruby process loads bundler, which only allows the version of thor requested in the gemfile, and then guard loads that version of thor
<leif_>
ok so thanx for helping. I appreciate it. I am concerned if I am setting my self up for a problem when I deploy to Heroku.
<leif_>
but Heroku wont run foreman the way I am either I guess
leif_ has quit [Quit: Page closed]
relix has joined #bundler
jhass has quit [Read error: Connection reset by peer]