Class: Buildr::AS3::Packaging::AirTask

Inherits:
Rake::FileTask
  • Object
show all
Includes:
Extension
Defined in:
lib/buildr/as3/packaging/air.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AirTask

:nodoc:



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
# File 'lib/buildr/as3/packaging/air.rb', line 36

def initialize(*args) #:nodoc:
  super
  enhance do
    fail "File not found: #{src_swf}" unless File.exists? src_swf
    cmd_args = []
    cmd_args << "-jar" << flexsdk.adt_jar
    cmd_args << "-package"
    cmd_args << "-storetype" << storetype
    cmd_args << "-keystore" << keystore
    cmd_args << "-storepass" << storepass
    cmd_args << target_air
    cmd_args << appdescriptor
    cmd_args << "-C" << File.dirname(src_swf) << File.basename(src_swf)
    libs.each do |key, value|
      puts "key,value", key, value
      cmd_args << "-C" << key << value
    end unless libs.nil?

    puts cmd_args.join " "

    unless Buildr.application.options.dryrun
      Java::Commands.java cmd_args
    end
  end
end

Instance Attribute Details

#appdescriptorObject (readonly)

Returns the value of attribute appdescriptor.



34
35
36
# File 'lib/buildr/as3/packaging/air.rb', line 34

def appdescriptor
  @appdescriptor
end

#flexsdkObject

Returns the value of attribute flexsdk.



34
35
36
# File 'lib/buildr/as3/packaging/air.rb', line 34

def flexsdk
  @flexsdk
end

#keystoreObject (readonly)

Returns the value of attribute keystore.



34
35
36
# File 'lib/buildr/as3/packaging/air.rb', line 34

def keystore
  @keystore
end

#libsObject (readonly)

Returns the value of attribute libs.



34
35
36
# File 'lib/buildr/as3/packaging/air.rb', line 34

def libs
  @libs
end

#src_swfObject

Returns the value of attribute src_swf.



34
35
36
# File 'lib/buildr/as3/packaging/air.rb', line 34

def src_swf
  @src_swf
end

#storepassObject (readonly)

Returns the value of attribute storepass.



34
35
36
# File 'lib/buildr/as3/packaging/air.rb', line 34

def storepass
  @storepass
end

#storetypeObject (readonly)

Returns the value of attribute storetype.



34
35
36
# File 'lib/buildr/as3/packaging/air.rb', line 34

def storetype
  @storetype
end

#target_airObject

Returns the value of attribute target_air.



34
35
36
# File 'lib/buildr/as3/packaging/air.rb', line 34

def target_air
  @target_air
end

Instance Method Details

#needed?Boolean

Returns:

  • (Boolean)


62
63
64
65
# File 'lib/buildr/as3/packaging/air.rb', line 62

def needed?
  return true unless File.exists?(target_air)
  File.stat(src_swf).mtime > File.stat(target_air).mtime
end

#sign(*args) ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'lib/buildr/as3/packaging/air.rb', line 78

def sign(*args)
  args.each do |arg|
    @storetype = arg[:storetype] if arg.has_key? :storetype
    @keystore = arg[:keystore] if arg.has_key? :keystore
    @storepass = arg[:storepass] if arg.has_key? :storepass
    @appdescriptor = arg[:appdescriptor] if arg.has_key? :appdescriptor
  end
  self
end

#with(*args) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/buildr/as3/packaging/air.rb', line 88

def with(*args)
  @libs ||= Hash.new
  args.each do |arg|
    case arg
      when Hash
        arg.each do |key, value|
          @libs[key] = value
        end
    end
  end
  self
end