ruby on rails - How to raise error if cap deploy was not invoked using bundle exec -
i encountered subtle issue capistrano deployment gem dependencies , enforce how capistrano invoked.
how can detect capistrano invoked using 'bundle exec' this:
bundle exec cap app deploy
and not this:
cap app deploy
i raise error in latter case detecting method of invocation @ top of deploy.rb file.
it appears bundler sets $bundle_bin_path , $bundle_gemfile environment variables when running executables. example, this:
env >/tmp/1 bundler exec env >/tmp/2 diff -u /tmp/[12]
you'll see differences in environment.
so in deployment script, can this:
abort "you must run using 'bundle exec ...'" unless env['bundle_bin_path'] || env['bundle_gemfile']
hope helps.
Comments
Post a Comment