bin/soloist in soloist-0.0.2 vs bin/soloist in soloist-0.0.3
- old
+ new
@@ -4,11 +4,11 @@
require 'fileutils'
require 'yaml'
require 'tempfile'
def fileify(contents)
- file = Tempfile.new("sololist")
+ file = Tempfile.new("soloist")
file << contents
file.flush
file
end
@@ -26,12 +26,12 @@
[file_contents, path_to_file]
end
log_level = ENV['LOG_LEVEL'] || "info"
-solistrc_contents, soloistrc_path = walk_up_and_find_file(["soloistrc"])
-soloistrc = YAML.load(solistrc_contents)
+soloistrc_contents, soloistrc_path = walk_up_and_find_file(["soloistrc"])
+soloistrc = YAML.load(soloistrc_contents)
json_contents = {
:recipes => soloistrc["Recipes"]
}
@@ -51,9 +51,14 @@
# end
solo_rb = fileify(solo_rb_contents)
metadata_json = fileify(json_contents.to_json)
-command = "sudo bash -c 'RAILS_ENV=$RAILS_ENV chef-solo -j #{metadata_json.path} -c #{solo_rb.path} -l #{log_level}'"
+env_vars = ["PATH=#{ENV['PATH']}"]
+%w{BUNDLE_PATH GEM_HOME GEM_PATH RAILS_ENV}.each do |v|
+ env_vars << "#{v}=#{ENV[v]}" unless ENV[v].nil?
+end
+
+command = "sudo bash -c '#{env_vars.join(' ')} chef-solo -j #{metadata_json.path} -c #{solo_rb.path} -l #{log_level}'"
puts "running chef: " + command
system(command) || exit(1)
\ No newline at end of file