Method: AsProject::MXMLC#execute

Defined in:
lib/tasks/mxmlc.rb

#execute(cmd, args, retries = 0) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/tasks/mxmlc.rb', line 70

def execute(cmd, args, retries=0)
  begin
    sh("#{cmd} #{args}")
  rescue
    default_mxmlc_osx_path = "/Applications/Adobe\ Flex\ Builder\ 2/Flex\ SDK\ 2/bin"
    default_flex_home_path = File.join(ENV['FLEX_HOME'], 'bin', cmd)
    if(retries == 0 && File.exists?(default_mxmlc_osx_path))
      ENV['PATH'] = ENV['PATH'] + ':' + default_mxmlc_osx_path
      execute(cmd, args, 1)
      return
    elsif(retries == 0 && File.exists?(default_flex_home_path))
      execute("'#{default_flex_home_path}'", args, 1)
      return
    end
    puts 'There was an error executing mxmlc, please make sure mxmlc is in your class path and can be executed from the same environment this rake task was run from'
  end
end