Class: FlexUtils::Adl
- Inherits:
-
AbstractTool
- Object
- AbstractTool
- FlexUtils::Adl
- Defined in:
- lib/flexutils/adl.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#arguments ⇒ Object
writeonly
Sets the attribute arguments.
-
#descriptor ⇒ Object
writeonly
Sets the attribute descriptor.
-
#height ⇒ Object
writeonly
Sets the attribute height.
-
#swf ⇒ Object
writeonly
Sets the attribute swf.
-
#system_chrome ⇒ Object
writeonly
Sets the attribute system_chrome.
-
#title ⇒ Object
writeonly
Sets the attribute title.
-
#transparent ⇒ Object
writeonly
Sets the attribute transparent.
-
#visible ⇒ Object
writeonly
Sets the attribute visible.
-
#width ⇒ Object
writeonly
Sets the attribute width.
-
#x ⇒ Object
writeonly
Sets the attribute x.
-
#y ⇒ Object
writeonly
Sets the attribute y.
Class Method Summary collapse
Instance Method Summary collapse
- #command_string ⇒ Object
- #generate_descriptor ⇒ Object
-
#initialize(swf) ⇒ Adl
constructor
A new instance of Adl.
- #run!(extra_args = []) {|$?| ... } ⇒ Object
Constructor Details
#initialize(swf) ⇒ Adl
Returns a new instance of Adl.
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/flexutils/adl.rb', line 17 def initialize( swf ) @swf = swf @title = "Temporary AIR application" @visible = true @transparent = false @width = 1024 @height = 768 @x = 100 @y = 100 @system_chrome = "standard" @arguments = [] end |
Instance Attribute Details
#arguments=(value) ⇒ Object (writeonly)
Sets the attribute arguments
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def arguments=(value) @arguments = value end |
#descriptor=(value) ⇒ Object (writeonly)
Sets the attribute descriptor
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def descriptor=(value) @descriptor = value end |
#height=(value) ⇒ Object (writeonly)
Sets the attribute height
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def height=(value) @height = value end |
#swf=(value) ⇒ Object (writeonly)
Sets the attribute swf
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def swf=(value) @swf = value end |
#system_chrome=(value) ⇒ Object (writeonly)
Sets the attribute system_chrome
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def system_chrome=(value) @system_chrome = value end |
#title=(value) ⇒ Object (writeonly)
Sets the attribute title
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def title=(value) @title = value end |
#transparent=(value) ⇒ Object (writeonly)
Sets the attribute transparent
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def transparent=(value) @transparent = value end |
#visible=(value) ⇒ Object (writeonly)
Sets the attribute visible
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def visible=(value) @visible = value end |
#width=(value) ⇒ Object (writeonly)
Sets the attribute width
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def width=(value) @width = value end |
#x=(value) ⇒ Object (writeonly)
Sets the attribute x
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def x=(value) @x = value end |
#y=(value) ⇒ Object (writeonly)
Sets the attribute y
5 6 7 |
# File 'lib/flexutils/adl.rb', line 5 def y=(value) @y = value end |
Class Method Details
.run(*args) {|c| ... } ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/flexutils/adl.rb', line 53 def self.run( *args ) c = self.new(*args) yield c c.run! end |
Instance Method Details
#command_string ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/flexutils/adl.rb', line 61 def command_string @extra_args ||= [ ] args = (@arguments + @extra_args).join(" ") "#{command_path 'adl'} #{@descriptor} -- #{args}" end |
#generate_descriptor ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/flexutils/adl.rb', line 30 def generate_descriptor return <<-stop <?xml version="1.0"?> <application xmlns="http://ns.adobe.com/air/application/1.5"> <id>net.iconara.tmp</id> <version>1.0</version> <filename>#{@title}</filename> <initialWindow> <title>#{@title}</title> <content>#{File.basename(@swf)}</content> <systemChrome>#{@system_chrome}</systemChrome> <transparent>#{@transparent}</transparent> <visible>#{@visible}</visible> <width>#{@width}</width> <height>#{@height}</height> <x>#{@x}</x> <y>#{@y}</y> </initialWindow> </application> stop end |
#run!(extra_args = []) {|$?| ... } ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/flexutils/adl.rb', line 69 def run!( extra_args=[], &block ) @extra_args = extra_args current_dir = Dir.pwd dir = File.dirname(@swf) Dir.chdir(dir) temporary_descriptor = @descriptor == nil if temporary_descriptor @descriptor = "temporary-application.xml" descriptor = File.new(@descriptor, "w") descriptor.puts(generate_descriptor) descriptor.close end execute_command yield($?) if block_given? File.delete(@descriptor) if temporary_descriptor Dir.chdir(current_dir) end |