server/files/usr/local/ec2onrails/bin/rails_env in pauldowman-ec2onrails-0.9.10 vs server/files/usr/local/ec2onrails/bin/rails_env in pauldowman-ec2onrails-0.9.10.0

- old
+ new

@@ -17,19 +17,17 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# This script runs a command with RAILS_ENV set to the value that's specified -# in the the mongrel_cluster config file. If a command isn't given as an -# argument it simply prints the value of RAILS_ENV +# This script runs a command with RAILS_ENV set to current value for +# this instance. If a command isn't given as an argument it simply +# prints the value of RAILS_ENV require "yaml" +require "#{File.dirname(__FILE__)}/../lib/utils" -@rails_env = YAML::load_file("/etc/mongrel_cluster/app.yml")["environment"] - if ARGV.any? - result = system "env RAILS_ENV=#{@rails_env} #{ARGV.join(' ')}" - raise("error: #{$?}") unless result + exec "env RAILS_ENV=#{Ec2onrails::Utils.rails_env} #{ARGV.join(' ')}" else - puts @rails_env + puts Ec2onrails::Utils.rails_env end