Class: Buildr::AS3::Flex::FlexSDK

Inherits:
Object
  • Object
show all
Defined in:
lib/buildr/as3/flexsdk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ FlexSDK

Returns a new instance of FlexSDK.



36
37
38
39
40
41
42
43
44
# File 'lib/buildr/as3/flexsdk.rb', line 36

def initialize(version)
  @version = version
  @default_options = {}
  @spec = "com.adobe.flex:sdk:zip:#{@version}"
  @sdk_zip = Buildr.artifact(@spec)
  @sdk_dir = File.join(File.dirname(@sdk_zip.to_s), "sdk-#{@version}")
  generate_paths @sdk_dir
  self
end

Instance Attribute Details

#adlObject (readonly)

Returns the value of attribute adl.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def adl
  @adl
end

#adt_jarObject (readonly)

Returns the value of attribute adt_jar.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def adt_jar
  @adt_jar
end

#air_configObject

Returns the value of attribute air_config.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def air_config
  @air_config
end

#asdoc_jarObject (readonly)

Returns the value of attribute asdoc_jar.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def asdoc_jar
  @asdoc_jar
end

#asdoc_templatesObject

Returns the value of attribute asdoc_templates.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def asdoc_templates
  @asdoc_templates
end

#binObject (readonly)

Returns the value of attribute bin.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def bin
  @bin
end

#compc_jarObject (readonly)

Returns the value of attribute compc_jar.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def compc_jar
  @compc_jar
end

#default_optionsObject (readonly)

Returns the value of attribute default_options.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def default_options
  @default_options
end

#fcsh_jarObject (readonly)

Returns the value of attribute fcsh_jar.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def fcsh_jar
  @fcsh_jar
end

#flex_configObject

Returns the value of attribute flex_config.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def flex_config
  @flex_config
end

#homeObject (readonly)

Returns the value of attribute home.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def home
  @home
end

#mxmlc_jarObject (readonly)

Returns the value of attribute mxmlc_jar.



31
32
33
# File 'lib/buildr/as3/flexsdk.rb', line 31

def mxmlc_jar
  @mxmlc_jar
end

Instance Method Details

#from(url) ⇒ Object



79
80
81
82
# File 'lib/buildr/as3/flexsdk.rb', line 79

def from(url)
  @url = url
  self
end

#invokeObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/buildr/as3/flexsdk.rb', line 46

def invoke
  @url ||= generate_url_from_version @version

  if Buildr::Util.win_os?
    unless File.exists? @sdk_zip.to_s
      FileUtils.mkdir_p File.dirname(@sdk_zip.to_s) unless File.directory? File.dirname(@sdk_zip.to_s)
      File.open @sdk_zip.to_s, 'w' do |file|
        file.binmode()
        URI.read(@url, {:progress=>true}) { |chunk| file.write chunk }
      end
    end
  else
    Buildr.artifact(@spec).from(Buildr.download(@url)).invoke unless File.exists? @sdk_zip.to_s
  end


  unless File.exists? @sdk_dir
    puts "Unzipping FlexSDK, this might take a while."
    if Buildr::Util.win_os?
      puts "Please make sure unzip is installed and in your PATH variable!"
      unzip @sdk_zip, @sdk_dir
    else
      begin
        Buildr.unzip(@sdk_dir.to_s=>@sdk_zip.to_s).target.invoke
      rescue TypeError
        puts "RubyZip extract failed, trying system unzip now."
        unzip @sdk_zip, @sdk_dir
      end
    end
  end
  self
end