lib/paraduct/runner.rb in paraduct-0.0.3 vs lib/paraduct/runner.rb in paraduct-1.0.0.beta1
- old
+ new
@@ -23,11 +23,11 @@
# run script with params
# @return [String] stdout
# @raise [Paraduct::Errors::ProcessError] command exited error status
def perform
- export_variables = key_capitalized_params.merge("PARADUCT_JOB_ID" => @job_id, "PARADUCT_JOB_NAME" => job_name)
+ export_variables = @params.reverse_merge("PARADUCT_JOB_ID" => @job_id, "PARADUCT_JOB_NAME" => job_name)
variable_string = export_variables.map{ |key, value| %(export #{key}="#{value}";) }.join(" ")
Array.wrap(@script).inject("") do |stdout, command|
stdout << run_command("#{variable_string} #{command}")
stdout
@@ -37,17 +37,13 @@
def job_dir
Pathname(@base_job_dir).join(job_name)
end
def job_name
- key_capitalized_params.map { |key, value| "#{key}_#{value}" }.join("_").gsub(%r([/ ]), "_")
+ @params.map { |key, value| "#{key}_#{value}" }.join("_").gsub(%r([/ ]), "_")
end
- def key_capitalized_params
- self.class.capitalize_keys(@params)
- end
-
def formatted_params
@params.map{ |key, value| "#{key}=#{value}" }.join(", ")
end
def logger
@@ -56,16 +52,9 @@
file_logger = Logger.new(Pathname(@base_job_dir).join("#{job_name}.log"))
@logger = stdout_logger.extend(ActiveSupport::Logger.broadcast(file_logger))
end
@logger
- end
-
- def self.capitalize_keys(params)
- params.inject({}) do |res, (key, value)|
- res[key.upcase] = value
- res
- end
end
private
def run_command(command)