Sha256: ac7ccf68898b432d656dddebefdec42a7c98eb321611eb0321c14353a8ff340b

Contents?: true

Size: 937 Bytes

Versions: 6

Compression:

Stored size: 937 Bytes

Contents

module Airake
  
  class Runner
    
    class << self 
      # Handle system command failure
      def fail(cmd, error_status)
        # fail_message = <<-EOS
        # 
        #   The '#{cmd.split.first}' command failed to run. This could be because this executable isn't in the path.
        # 
        #   To include mxmlc and fcsh:
        #     export PATH="/path_to/flex3sdk_b2_100107/bin:$PATH"
        #   
        #   To include adl and adt (from AIR SDK):
        #     export PATH="/path_to/air_sdk/bin:$PATH"
        # 
        # EOS
        # puts fail_message if error_status != 256 && error_status != 4096
        raise "[#{error_status}] Failed to run command: #{cmd}"
      end

      # Run the command using system(..)
      def run(command, method, *args)
        cmd = command.send(method, *args)
        
        puts "Running: #{cmd}"
        system cmd or fail(cmd, $?)
      end
      
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
airake-0.2.1 lib/airake/runner.rb
airake-0.2.3 lib/airake/runner.rb
airake-0.2.2 lib/airake/runner.rb
airake-0.2.4 lib/airake/runner.rb
airake-0.2.5 lib/airake/runner.rb
airake-0.2.6 lib/airake/runner.rb