Use good old bash for preparing execution environment for bin/ commands
authorMarcin Kulik <m@ku1ik.com>
Fri, 7 Mar 2014 16:25:08 +0000 (17:25 +0100)
committerMarcin Kulik <m@ku1ik.com>
Fri, 7 Mar 2014 16:57:38 +0000 (17:57 +0100)
commit5a77142c5fa219ce03431586780ea8cf5d4802d2
treedb316f00bf562abbac6c8a63f032433181e926d3
parent74617cfcb0abaae7e34d5a10abac609d9e98d5f1
Use good old bash for preparing execution environment for bin/ commands

Gitorious::CLI.new.run_with_gitorious_environment in addition to
changing current working directory, setting RAILS_ENV and switching user
also initializes the Gitorious configuration loader (in order to get the
"user" setting from gitorious.yml).

bin/rake, bin/unicorn and other "gem binary" scripts used it and were
loading the requested gem binary in the same process. This approach
worked in most cases but in some cases it resulted in ambiguous app
booting paths - configuration loader was loading Gitorious classes
(before Rails was loaded) which depended on some Rails functionality
(like ActiveSupport logger) and thus required additional conditions, or
even resulted in broken functionality.

This change is a first step for moving the responsibility of preparing
proper execution environment from ruby scripts themselves to the wrapper
bash script which executes (using "exec") proper ruby/rails command after
preparing the environment.
.gitignore
bin/bundle
bin/console
bin/exec [new file with mode: 0755]
bin/rake
bin/restart
bin/restore
bin/snapshot
bin/unicorn