ruby on rails - Run a command in the context of a different app -
i have 2 rails apps on same server, let's call them , b.
i trying have app restart app b via app b's own capistrano task. unfortunately, after cd-ing app b's directory, trying run app a's capistrano instead. missing something?
example code
system("cd /apps/appb/current && pwd && bundle exec cap:restart")
pwd correctly returns path of appb (/apps/appb/current), however, in there traceback cap:restart. because still trying run cap command in context of appa, e.g.
/apps/appa/shared/bundle/ruby/1.9.1/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:152:in 'require': cannot load such file -- airbrake/capistrano (loaderror) /apps/appa/shared/bundle/ruby/1.9.1/gems/capistrano-2.15.4/lib/capistrano/configuration/loading.rb:152:in 'require'.
i tried without 'bundle exec', , have tried other ways of making system calls. created bash script in directory , tried run way.
all methods described exhibit same behaviour.
your appreciated =)
you need use bundler.with_clean_env
ensure subprocess doesn't pick current bundler environment:
bundler.with_clean_env system("cd /apps/appb/current && pwd && bundle exec cap:restart") end
this same problem install bundle of gem within other rails application
Comments
Post a Comment