buildr-as3 0.1.20 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,8 +21,8 @@
21
21
  #
22
22
  module Buildr
23
23
  module AS3
24
- module Apparat
25
- class ApparatToolkit
24
+ module Toolkits
25
+ class ApparatToolkit < Buildr::AS3::Toolkits::ZipToolkiteBase
26
26
  attr_reader :home, :asmifier, :concrete, :coverage, :dump,
27
27
  :jitb, :reducer, :stripper, :tdsi, :asm_swc,
28
28
  :ersatz_swc, :lzma_decoder_swc, :scala_home
@@ -30,55 +30,21 @@ module Buildr
30
30
  def initialize(version)
31
31
  @version = version
32
32
  @spec = "com.googlecode:apparat-bin:zip:#{@version}"
33
- @apparat_zip = Buildr.artifact(@spec)
34
- @apparat_dir = File.join(File.dirname(@apparat_zip.to_s), "apparat-bin-#{@version}", "apparat-#{@version}")
35
- generate_paths @apparat_dir, @version
33
+ @zip = Buildr.artifact(@spec)
34
+ @zip_destination = File.join(File.dirname(@zip.to_s), "apparat-#{@version}", "apparat-#{@version}")
35
+ generate_paths @zip_destination, @version
36
36
  end
37
37
 
38
- def invoke
39
-
40
- if @url
41
- Buildr.artifact(@spec).from(Buildr.download(@url)).invoke unless File.exists? @apparat_zip.to_s
42
- else
43
- Buildr.artifact(@spec).invoke unless File.exists? @apparat_zip.to_s
44
- end
45
-
46
- unless File.exists? @apparat_dir
47
- puts "Unzipping Apparat, this might take a while."
48
- unzip_dir = File.dirname @apparat_dir
49
- if Buildr::Util.win_os?
50
- puts "Please make sure unzip is installed and in your PATH variable!"
51
- unzip @apparat_zip, unzip_dir
52
- else
53
- begin
54
- Buildr.unzip(unzip_dir.to_s=>@apparat_zip.to_s).target.invoke
55
- rescue TypeError
56
- puts "RubyZip extract failed, trying system unzip now."
57
- unzip @apparat_zip, unzip_dir
58
- end
59
- end
60
- end
61
- self
62
- end
63
-
64
- def from(url)
65
- @url = url
66
- self
67
- end
68
-
69
- def scala(scala_home)
70
- @scala_home = scala_home
38
+ def invoke #:nodoc:
39
+ @url ||= generate_url_from_version @version
40
+ super
71
41
  self
72
42
  end
73
43
 
44
+ private
74
45
 
75
- protected
76
-
77
- def unzip(zip, destination)
78
- project_dir = Dir.getwd
79
- Dir.chdir File.dirname(zip.to_s)
80
- system("unzip #{File.basename(zip.to_s).to_s} -d #{File.basename(destination).to_s}")
81
- Dir.chdir project_dir
46
+ def generate_url_from_version(version)
47
+ "http://apparat.googlecode.com/files/apparat-#{version}-bin.zip"
82
48
  end
83
49
 
84
50
  def generate_paths(home_dir, version)
@@ -100,7 +66,7 @@ module Buildr
100
66
  end
101
67
  end
102
68
 
103
- module Tasks
69
+ module ApparatTasks
104
70
  include Extension
105
71
 
106
72
  first_time do
@@ -115,7 +81,7 @@ module Buildr
115
81
  end
116
82
 
117
83
  def apparat_tdsi(options = {})
118
- output = Buildr::AS3::Compiler::CompilerUtils::get_output(project, compile.target, compile.packaging, compile.options)
84
+ output = project.get_as3_output(compile.target, compile.options)
119
85
  apparat_tk = compile.options[:apparat].invoke
120
86
  cmd_args = []
121
87
  cmd_args << "#{apparat_tk.tdsi}"
@@ -124,14 +90,13 @@ module Buildr
124
90
  reserved = []
125
91
  options.to_hash.reject { |key, value| reserved.include?(key) }.
126
92
  each do |key, value|
127
- cmd_args << "-#{key} #{value}"
93
+ cmd_args << "-#{key} #{value}"
128
94
  end
129
- ENV["PATH"] = "#{apparat_tk.scala_home}/bin#{File::PATH_SEPARATOR}#{ENV["PATH"]}" if apparat_tk.scala_home && !ENV["PATH"].include?("#{apparat_tk.scala_home}/bin")
130
- system(cmd_args.join " ")
95
+ call_system(cmd_args)
131
96
  end
132
97
 
133
98
  def apparat_reducer(quality)
134
- output = Buildr::AS3::Compiler::CompilerUtils::get_output(project, compile.target, compile.packaging, compile.options)
99
+ output = project.get_as3_output(compile.target, compile.options)
135
100
  apparat_tk = compile.options[:apparat].invoke
136
101
  cmd_args = []
137
102
  cmd_args << "#{apparat_tk.reducer}"
@@ -139,13 +104,21 @@ module Buildr
139
104
  cmd_args << "-o #{output}"
140
105
  cmd_args << "-q"
141
106
  cmd_args << quality || 100
142
- ENV["PATH"] = "#{apparat_tk.scala_home}#{File::Separator}bin#{File::PATH_SEPARATOR}#{ENV["PATH"]}" if apparat_tk.scala_home && !ENV["PATH"].include?("#{apparat_tk.scala_home}/bin")
143
- system(cmd_args.join " ")
107
+ call_system(cmd_args)
108
+ end
109
+
110
+ private
111
+
112
+ def call_system(args)
113
+ unless system(args.join(" "))
114
+ puts "Failed to execute apparat:\n#{args.join(" ")}"
115
+ end
144
116
  end
117
+
145
118
  end
146
119
  end
147
120
  end
148
121
  class Project
149
- include Buildr::AS3::Apparat::Tasks
122
+ include Buildr::AS3::Toolkits::ApparatTasks
150
123
  end
151
124
  end
@@ -0,0 +1,84 @@
1
+ #
2
+ # Copyright (C) 2011 by Dominic Graefen / http://devboy.org
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in
12
+ # all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #
22
+
23
+ module Buildr
24
+ module AS3
25
+ module Toolkits
26
+ class ZipToolkiteBase
27
+
28
+ def invoke #:nodoc:
29
+
30
+ if @url == :maven
31
+ Buildr::artifact(@spec).invoke
32
+ else
33
+ Buildr::download(Buildr::artifact(@spec) => @url).invoke
34
+ end unless File.exists? @zip.to_s
35
+
36
+ unzip_toolkit(@zip,@zip_destination)
37
+
38
+ self
39
+ end
40
+
41
+ # :call-seq:
42
+ # from(url) => self
43
+ #
44
+ # * You can pass a url where the ToolkitArtifact should be downloaded from as a string:
45
+ # FLEX_SDK.from("http://domain.tld/flex_sdk.zip")
46
+ # * You can pass :maven as a parameter to download it from a maven repository:
47
+ # FLEX_SDK.from(:maven)
48
+ # * If you don't call this function at all, buildr-as3 will try and resolve a url on automatically
49
+ def from(url)
50
+ @url = url
51
+ self
52
+ end
53
+
54
+ protected
55
+
56
+ def system_unzip_toolkit(zip, destination)
57
+ project_dir = Dir.getwd
58
+ Dir.chdir File.dirname(zip.to_s)
59
+ system("unzip #{File.basename(zip.to_s).to_s} -d #{File.basename(destination).to_s}")
60
+ Dir.chdir project_dir
61
+ end
62
+
63
+ def unzip_toolkit(zip,destination)
64
+ unless File.exists? destination
65
+ puts "Unzipping Archive, this might take a while."
66
+ if Buildr::Util.win_os?
67
+ puts "Please make sure unzip is installed and in your PATH variable!"
68
+ system_unzip_toolkit zip, destination
69
+ else
70
+ begin
71
+ # Buildr.unzip(destination.to_s=>zip.to_s).target.invoke
72
+ # rescue TypeError
73
+ # puts "RubyZip extract failed, trying system unzip now."
74
+ puts "Please make sure unzip is installed and in your PATH variable!"
75
+ system_unzip_toolkit zip, destination
76
+ end
77
+ end
78
+ end
79
+ end
80
+
81
+ end
82
+ end
83
+ end
84
+ end
@@ -19,14 +19,11 @@
19
19
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
20
  # THE SOFTWARE.
21
21
  #
22
- require 'tmpdir'
23
- require "open-uri"
24
- require "fileutils"
25
22
 
26
23
  module Buildr
27
24
  module AS3
28
- module Flex
29
- class FlexSDK
25
+ module Toolkits
26
+ class FlexSDK < Buildr::AS3::Toolkits::ZipToolkiteBase
30
27
 
31
28
  attr_reader :home, :mxmlc_jar, :compc_jar, :asdoc_jar, :fcsh_jar, :flex_config,
32
29
  :asdoc_templates, :default_options, :air_config, :bin, :adt_jar, :adl
@@ -35,60 +32,35 @@ module Buildr
35
32
 
36
33
  def initialize(version)
37
34
  @version = version
38
- @default_options = {}
35
+ @default_options = []
39
36
  @spec = "com.adobe.flex:sdk:zip:#{@version}"
40
- @sdk_zip = Buildr.artifact(@spec)
41
- @sdk_dir = File.join(File.dirname(@sdk_zip.to_s), "sdk-#{@version}")
42
- generate_paths @sdk_dir
37
+ @zip = Buildr.artifact(@spec)
38
+ @zip_destination = File.join(File.dirname(@zip.to_s), "sdk-#{@version}")
39
+ generate_paths @zip_destination
43
40
  self
44
41
  end
45
42
 
46
- def invoke
43
+ def invoke #:nodoc:
47
44
  @url ||= generate_url_from_version @version
48
-
49
- if Buildr::Util.win_os?
50
- unless File.exists? @sdk_zip.to_s
51
- FileUtils.mkdir_p File.dirname(@sdk_zip.to_s) unless File.directory? File.dirname(@sdk_zip.to_s)
52
- File.open @sdk_zip.to_s, 'w' do |file|
53
- file.binmode()
54
- URI.read(@url, {:progress=>true}) { |chunk| file.write chunk }
55
- end
56
- end
57
- else
58
- Buildr.artifact(@spec).from(Buildr.download(@url)).invoke unless File.exists? @sdk_zip.to_s
59
- end
60
-
61
-
62
- unless File.exists? @sdk_dir
63
- puts "Unzipping FlexSDK, this might take a while."
64
- if Buildr::Util.win_os?
65
- puts "Please make sure unzip is installed and in your PATH variable!"
66
- unzip @sdk_zip, @sdk_dir
67
- else
68
- begin
69
- Buildr.unzip(@sdk_dir.to_s=>@sdk_zip.to_s).target.invoke
70
- rescue TypeError
71
- puts "RubyZip extract failed, trying system unzip now."
72
- unzip @sdk_zip, @sdk_dir
73
- end
74
- end
75
- end
45
+ super
76
46
  self
77
47
  end
78
48
 
49
+ # :call-seq:
50
+ # from(url) => self
51
+ #
52
+ # * You can pass a url where the FlexSDK should be downloaded from as a string:
53
+ # FLEX_SDK.from("http://domain.tld/flex_sdk.zip")
54
+ # * You can pass :maven as a parameter to download it from a maven repository:
55
+ # FLEX_SDK.from(:maven)
56
+ # * If you don't call this function at all, buildr-as3 will try and resolve a url on the adobe-website
57
+ # to download the FlexSDK
79
58
  def from(url)
80
59
  @url = url
81
60
  self
82
61
  end
83
62
 
84
- protected
85
-
86
- def unzip(zip, destination)
87
- project_dir = Dir.getwd
88
- Dir.chdir File.dirname(zip.to_s)
89
- system("unzip #{File.basename(zip.to_s).to_s} -d #{File.basename(destination).to_s}")
90
- Dir.chdir project_dir
91
- end
63
+ private
92
64
 
93
65
  def generate_url_from_version(version)
94
66
  "http://fpdownload.adobe.com/pub/flex/sdk/builds/flex#{version.split(".")[0]}/flex_sdk_#{version}.zip"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildr-as3
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 35
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 20
10
- version: 0.1.20
9
+ - 28
10
+ version: 0.1.28
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dominic Graefen
@@ -15,8 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-23 00:00:00 +01:00
19
- default_executable:
18
+ date: 2011-04-15 00:00:00 +02:00
19
+ default_executable: buildr-as3
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  prerelease: false
@@ -86,18 +86,18 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- hash: 15
89
+ hash: 13
90
90
  segments:
91
91
  - 1
92
92
  - 4
93
- - 4
94
- version: 1.4.4
93
+ - 5
94
+ version: 1.4.5
95
95
  name: buildr
96
96
  version_requirements: *id005
97
97
  description: Build like you code - now supporting ActionScript 3 & Flex
98
98
  email: dominic @nospam@ devboy.org
99
- executables: []
100
-
99
+ executables:
100
+ - buildr-as3
101
101
  extensions: []
102
102
 
103
103
  extra_rdoc_files:
@@ -110,16 +110,33 @@ files:
110
110
  - README.rdoc
111
111
  - Rakefile
112
112
  - VERSION
113
+ - bin/buildr-as3
113
114
  - buildr-as3.gemspec
114
115
  - lib/buildr/as3.rb
115
- - lib/buildr/as3/alchemy.rb
116
- - lib/buildr/as3/apparat.rb
117
116
  - lib/buildr/as3/compiler.rb
117
+ - lib/buildr/as3/compiler/aircompc.rb
118
+ - lib/buildr/as3/compiler/airmxmlc.rb
119
+ - lib/buildr/as3/compiler/base.rb
120
+ - lib/buildr/as3/compiler/compc.rb
121
+ - lib/buildr/as3/compiler/mxmlc.rb
118
122
  - lib/buildr/as3/doc.rb
119
- - lib/buildr/as3/flexsdk.rb
123
+ - lib/buildr/as3/doc/asdoc.rb
124
+ - lib/buildr/as3/ide.rb
120
125
  - lib/buildr/as3/ide/fdt4.rb
121
126
  - lib/buildr/as3/packaging.rb
122
- - lib/buildr/as3/tests.rb
127
+ - lib/buildr/as3/packaging/air.rb
128
+ - lib/buildr/as3/packaging/airi.rb
129
+ - lib/buildr/as3/packaging/swc.rb
130
+ - lib/buildr/as3/packaging/swf.rb
131
+ - lib/buildr/as3/project.rb
132
+ - lib/buildr/as3/test.rb
133
+ - lib/buildr/as3/test/base.rb
134
+ - lib/buildr/as3/test/flexunit4.rb
135
+ - lib/buildr/as3/toolkits.rb
136
+ - lib/buildr/as3/toolkits/alchemy.rb
137
+ - lib/buildr/as3/toolkits/apparat.rb
138
+ - lib/buildr/as3/toolkits/base.rb
139
+ - lib/buildr/as3/toolkits/flexsdk.rb
123
140
  - test/helper.rb
124
141
  - test/test_buildr_as3.rb
125
142
  has_rdoc: true
@@ -152,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
169
  requirements: []
153
170
 
154
171
  rubyforge_project:
155
- rubygems_version: 1.5.0
172
+ rubygems_version: 1.6.2
156
173
  signing_key:
157
174
  specification_version: 3
158
175
  summary: Buildr extension to allow ActionScript3/Flex development.
@@ -1,54 +0,0 @@
1
- # Licensed to the Apache Software Foundation (ASF) under one or more
2
- # contributor license agreements. See the NOTICE file distributed with this
3
- # work for additional information regarding copyright ownership. The ASF
4
- # licenses this file to you under the Apache License, Version 2.0 (the
5
- # "License"); you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
- # License for the specific language governing permissions and limitations under
14
- # the License.
15
-
16
- require 'buildr/core/test'
17
- require 'buildr/core/build'
18
- require 'buildr/core/compile'
19
- require 'buildr/java/ant'
20
-
21
-
22
- module Buildr
23
-
24
- class FlexUnit4 < TestFramework::Base
25
-
26
- class << self
27
- taskdef_spec = "org.flexunit:flexUnitTasks:jar:4.1.0"
28
- def applies_to?(project) #:nodoc:
29
- project.test.compile.language == :actionscript
30
- end
31
- end
32
-
33
- # def initialize
34
- # puts "FlexUnit4 init"
35
- # end
36
-
37
- def tests(dependencies) #:nodoc:
38
- puts "FlexUnit4 run"
39
- []
40
- end
41
-
42
- def run(tests, dependencies) #:nodoc:
43
- puts "FlexUnit4 run"
44
- Buildr.ant('flexunit') do |ant|
45
- taskdef = Buildr.artifact(FlexUnit4.taskdef_spec)
46
- taskdef.invoke
47
- ant.taskdef :name=>'flexunit', :resource=>"flexUnitTasks.tasks", :classpath=>taskdef.to_s
48
- end
49
- end
50
- end
51
-
52
- end
53
-
54
- Buildr::TestFramework.add Buildr::FlexUnit4