Class: Buildr::AS3::Alchemy::AlchemyToolkit
- Inherits:
-
Object
- Object
- Buildr::AS3::Alchemy::AlchemyToolkit
- Defined in:
- lib/buildr/as3/alchemy.rb
Instance Attribute Summary collapse
-
#achacks ⇒ Object
readonly
Returns the value of attribute achacks.
-
#alchemy_setup ⇒ Object
readonly
Returns the value of attribute alchemy_setup.
-
#bin ⇒ Object
readonly
Returns the value of attribute bin.
-
#flex_sdk ⇒ Object
readonly
Returns the value of attribute flex_sdk.
-
#gcc ⇒ Object
readonly
Returns the value of attribute gcc.
-
#home ⇒ Object
readonly
Returns the value of attribute home.
-
#swfbridge ⇒ Object
readonly
Returns the value of attribute swfbridge.
Instance Method Summary collapse
- #from(url) ⇒ Object
-
#initialize(flex_sdk) ⇒ AlchemyToolkit
constructor
A new instance of AlchemyToolkit.
- #invoke ⇒ Object
Constructor Details
#initialize(flex_sdk) ⇒ AlchemyToolkit
Returns a new instance of AlchemyToolkit.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/buildr/as3/alchemy.rb', line 29 def initialize(flex_sdk) @version = "1.0-PR1" @system = Buildr::Util.win_os? ? "win" : "unix" @spec = "com.adobe.alchemy:toolkit:zip:#{@system}:#{@version}" @flex_sdk = flex_sdk @alchemy_zip = Buildr.artifact(@spec) @alchemy_dir = File.join(File.dirname(@alchemy_zip.to_s), "alchemy-#{@system}-#{@version}", get_alchemy_toolkit_subfolder(@system) ) generate_paths @alchemy_dir self end |
Instance Attribute Details
#achacks ⇒ Object (readonly)
Returns the value of attribute achacks.
27 28 29 |
# File 'lib/buildr/as3/alchemy.rb', line 27 def achacks @achacks end |
#alchemy_setup ⇒ Object (readonly)
Returns the value of attribute alchemy_setup.
27 28 29 |
# File 'lib/buildr/as3/alchemy.rb', line 27 def alchemy_setup @alchemy_setup end |
#bin ⇒ Object (readonly)
Returns the value of attribute bin.
27 28 29 |
# File 'lib/buildr/as3/alchemy.rb', line 27 def bin @bin end |
#flex_sdk ⇒ Object (readonly)
Returns the value of attribute flex_sdk.
27 28 29 |
# File 'lib/buildr/as3/alchemy.rb', line 27 def flex_sdk @flex_sdk end |
#gcc ⇒ Object (readonly)
Returns the value of attribute gcc.
27 28 29 |
# File 'lib/buildr/as3/alchemy.rb', line 27 def gcc @gcc end |
#home ⇒ Object (readonly)
Returns the value of attribute home.
27 28 29 |
# File 'lib/buildr/as3/alchemy.rb', line 27 def home @home end |
#swfbridge ⇒ Object (readonly)
Returns the value of attribute swfbridge.
27 28 29 |
# File 'lib/buildr/as3/alchemy.rb', line 27 def swfbridge @swfbridge end |
Instance Method Details
#from(url) ⇒ Object
74 75 76 77 |
# File 'lib/buildr/as3/alchemy.rb', line 74 def from(url) @url = url self end |
#invoke ⇒ Object
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 67 68 69 70 71 72 |
# File 'lib/buildr/as3/alchemy.rb', line 40 def invoke @url ||= get_alchemy_toolkit_url(@system) if Buildr::Util.win_os? unless File.exists? @alchemy_zip.to_s FileUtils.mkdir_p File.dirname(@alchemy_zip.to_s) unless File.directory? File.dirname(@alchemy_zip.to_s) File.open @alchemy_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? @alchemy_zip.to_s end unless File.exists? @alchemy_dir puts "Unzipping Alchemy, this might take a while." unzip_dir = File.dirname @alchemy_dir if Buildr::Util.win_os? puts "Please make sure unzip is installed and in your PATH variable!" unzip @alchemy_zip, unzip_dir else begin Buildr.unzip(unzip_dir.to_s=>@alchemy_zip.to_s).target.invoke rescue TypeError puts "RubyZip extract failed, trying system unzip now." unzip @alchemy_zip, unzip_dir end end end setup unless File.exists? @alchemy_setup self end |