Module: Haxe::Cli::Proxy::Command

Defined in:
lib/haxe/cli/proxy/command.rb

Defined Under Namespace

Classes: Result

Constant Summary collapse

HAXE =
::Haxe::Cli::Proxy::Constants::HAXE

Class Method Summary collapse

Class Method Details

.compile(project_dir, options) ⇒ ::Haxe::Cli::Command::Result

Execute haxe compile command.



79
80
81
82
# File 'lib/haxe/cli/proxy/command.rb', line 79

def compile(project_dir, options)
  builder = ::Haxe::Cli::Proxy::CompileOption::Builder.new(options)
  execute "cd #{project_dir} && #{HAXE} #{builder}"
end

.exists?boolean

Check whether command haxe exists.



15
16
17
18
19
20
21
# File 'lib/haxe/cli/proxy/command.rb', line 15

def exists?
  if RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|cygwin|bccwin/
    system "where #{HAXE} > nul"
  else
    system "hash #{HAXE} 2> /dev/null"
  end
end

.help::Haxe::Cli::Command::Result

Execute command ‘haxe -help`



28
29
30
31
# File 'lib/haxe/cli/proxy/command.rb', line 28

def help
  help = ::Haxe::Cli::Proxy::Constants::OPTION_HELP
  execute "#{HAXE} #{help}"
end

.lib(lib_name, version = nil) ⇒ ::Haxe::Cli::Command::Result

Execute command ‘haxe -lib [lib_name]:`



40
41
42
43
44
# File 'lib/haxe/cli/proxy/command.rb', line 40

def lib(lib_name, version=nil)
  lib = ::Haxe::Cli::Proxy::Constants::OPTION_LIB
  lib_name << ":#{version}" unless version.nil?
  execute "#{HAXE} #{lib} #{lib_name}"
end

.xml(file) ⇒ ::Haxe::Cli::Command::Result

Execute command ‘haxe -xml [file]`



52
53
54
55
# File 'lib/haxe/cli/proxy/command.rb', line 52

def xml(file)
  xml = ::Haxe::Cli::Proxy::Constants::OPTION_XML
  execute "#{HAXE} #{xml} #{file}"
end