Sha256: c0f37ea45499e2dc72bb803199f601ab50896186f59ed7096f169de1c36fafd8
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'albacore/support/attrmethods' module RunCommand extend AttrMethods attr_accessor :command, :working_directory attr_array :parameters def initialize @working_directory = Dir.pwd @parameters = [] super() end def run_command(name="Command Line", parameters=nil) begin params = Array.new params << parameters unless parameters.nil? params << @parameters unless (@parameters.nil? || @parameters.length==0) cmd = get_command(params) @logger.debug "Executing #{name}: #{cmd}" Dir.chdir(@working_directory) do return system(cmd) end rescue Exception => e puts "Error While Running Command Line Tool: #{e}" raise end end def get_command(params) executable = @command unless command.nil? executable = File.expand_path(@command) if File.exists?(@command) end cmd = "\"#{executable}\"" cmd +=" #{params.join(' ')}" if params.length > 0 cmd end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
albacore-0.2.0.preview2 | lib/albacore/support/runcommand.rb |