Class: Tidy::Compile
- Inherits:
-
Object
- Object
- Tidy::Compile
- Defined in:
- lib/tidy/compile.rb
Constant Summary collapse
- DEFAULTS =
{ :default_background_color=>"#000000", :default_frame_rate=> 30, #:incremental=>true, :use_network=>false, :verbose_stacktraces=>true, :omit_trace_statements=>false, :static_link_runtime_shared_libraries=>true #:warnings=>true }
- DEFAULT_PATHS =
TODO: introduce config file for things like this.
%w[src ~/.tidy/tidy-as3]
Class Method Summary collapse
-
.air(args) ⇒ Object
args can include: :width, :height, :output, etc…
- .build(args, command) ⇒ Object
-
.demo(args) ⇒ Object
usage: DemoConfig.new(:vars=>:anotherVar=>2.4, :output=>‘variation’).
- .get_compile_command(args, initial_command) ⇒ Object
- .parse_options(args) ⇒ Object
-
.swf(args) ⇒ Object
TODO: make adl launch an air file with a webkit instance and the swf inside it.
-
.swf_url(args) ⇒ Object
:warnings=>true.
Class Method Details
.air(args) ⇒ Object
args can include: :width, :height, :output, etc… and underscore_versions of the compiler arguments
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/tidy/compile.rb', line 41 def self.air(args) build args, "mxmlc +configname=air " + (args) Axml.new( args ) unless args[:do_not_launch] #if File.exists? File.expand_path("~/mm.cfg") # File.rename(File.expand_path("~/mm.cfg"), File.expand_path("~/mm.cfg") + ".bak") #end puts `adl bin/#{args[:output]}.axml` end end |
.build(args, command) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/tidy/compile.rb', line 73 def self.build(args,command) puts "Compiling with TidyFlash #{Tidy::Version.number}" puts "will execute: #{command}" #puts "cd #{FileUtils.pwd} && #{command}" =begin command_result = command filtered_result = command_result.to_a.map{|l| l unless l.match(/^Reason|^Recompile/)}.compact puts filtered_result =end IO.popen(command){ |process| process.each { |line| puts line } } swf_url(args) end |
.demo(args) ⇒ Object
usage: DemoConfig.new(:vars=>:anotherVar=>2.4, :output=>‘variation’)
60 61 62 63 64 65 |
# File 'lib/tidy/compile.rb', line 60 def self.demo(args) DemoConfig.new(:vars=>args[:vars] || {}, :class=>'DemoConfig', :output=>"src/DemoConfig.as") air(args.merge(:paths=>["src"])) end |
.get_compile_command(args, initial_command) ⇒ Object
67 68 69 70 71 |
# File 'lib/tidy/compile.rb', line 67 def self.get_compile_command(args, initial_command) command = initial_command + " " + (args) command_result = command return command end |
.parse_options(args) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/tidy/compile.rb', line 88 def self.(args) = DEFAULTS.dup() .each_pair do |k,v| [k] = args.delete(k) unless args[k].nil? end .merge! args[:mxmlc] unless args[:mxmlc].nil? paths = DEFAULT_PATHS paths = args[:paths].concat(DEFAULT_PATHS) unless args[:paths].nil? paths = paths.map{|path| "-source-path+=#{File. path}" }.join(" ") "#{.to_flex_arguments} -default-size #{args[:width]||WIDTH} #{args[:height]||HEIGHT} #{paths} -o=#{File. swf_url(args)} #{File. args[:main]}" end |
.swf(args) ⇒ Object
TODO: make adl launch an air file with a webkit instance and the swf inside it
56 57 58 |
# File 'lib/tidy/compile.rb', line 56 def self.swf(args) build args, "mxmlc " + (args) end |
.swf_url(args) ⇒ Object
:warnings=>true
33 34 35 |
# File 'lib/tidy/compile.rb', line 33 def self.swf_url(args) "bin/#{args[:output]}.swf" end |