I just encountered a subtle issue with capistrano deployment gem dependencies and I would like to enforce how capistrano is invoked.
How can I detect that capistrano was invoked using ‘bundle exec’ like this:
bundle exec cap app deploy
And not like this:
cap app deploy
I would like to raise an error in the latter case by detecting the method of invocation at the top of my deploy.rb file.
It appears that Bundler sets the $BUNDLE_BIN_PATH and $BUNDLE_GEMFILE environment variables when running executables. For example, do this:
You’ll see the differences in the environment.
So then in your deployment script, you can do something like this:
Hope this helps.