Module: FlexCompiler
- Defined in:
- lib/flex-compiler.rb,
lib/flex-compiler/version.rb
Defined Under Namespace
Classes: CommandGenerator, NamePath
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
-
.compile(options = nil) ⇒ Object
generates a compc command and execute it.
Class Method Details
.compile(options = nil) ⇒ Object
generates a compc command and execute it.
The options argument can be a hash or a yaml file containing the following values:
required
- flex_home: the folder that contains the flex sdk
optional
- output_folder: (default: "bin")
- output_name: (default: the name of the folder that contains the project)
- src_dir: (default: "src")
- locale_dir: (default: "locale")
- libs: (no default TODO: add default)
-
Args :
-
options
-> either a hash or a string pointing to a yml file.
-
-
Returns :
-
the output from compc
-
-
Raises :
-
ArgumentError
-> if any value is nil or negative
-
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/flex-compiler.rb', line 27 def self.compile( = nil) if( .nil? ) = "flex-compiler-config.yml" end if( .class == "Hash") opts = elsif( .class.to_s == "String" ) yml = YAML.load_file( ) opts = Hash.new opts[:flex_home] = yml["flex_home"] unless yml["flex_home"].nil? opts[:src_dir] = yml["src_dir"] unless yml["src_dir"].nil? opts[:locale_dir] = yml["locale_dir"] unless yml["locale_dir"].nil? opts[:output_name] = yml["output_name"] unless yml["output_name"].nil? opts[:output_folder] = yml["output_folder"] unless yml["output_folder"].nil? opts[:libs] = yml["libs"] unless yml["libs"].nil? opts[:test_mode] = yml["test_mode"] unless yml["test_mode"].nil? opts[:application] = yml["application"] unless yml["application"].nil? opts[:ignore_files] = yml["ignore_files"] unless yml["ignore_files"].nil? end generator = CommandGenerator.new( CompilerOptions.new opts ) command = generator.command puts "-- command --" puts command puts "-- end command --" if( opts[:test_mode] ) return end result = `#{command}` puts result raise "errror executing process" unless $?.to_i == 0 end |