airake 0.1.6 → 0.1.7
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.
- data/History.txt +6 -0
- data/License.txt +4 -1
- data/README.txt +35 -6
- data/app_generators/airake/templates/README +35 -10
- data/app_generators/airake/templates/Rakefile +4 -2
- data/lib/airake/fcsh.rb +8 -5
- data/lib/airake/fcshd.rb +9 -3
- data/lib/airake/project.rb +88 -30
- data/lib/airake/version.rb +1 -1
- metadata +2 -2
data/History.txt
CHANGED
data/License.txt
CHANGED
@@ -17,4 +17,7 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
|
23
|
+
Portions of this work are derived from Sprout (http://code.google.com/p/projectsprouts/).
|
data/README.txt
CHANGED
@@ -8,15 +8,12 @@ To include adl and adt (from Apollo SDK):
|
|
8
8
|
|
9
9
|
== Creating an AIR project
|
10
10
|
|
11
|
-
airake
|
12
|
-
|
13
|
-
will build a project scaffold with application name of MyProject and application id (used for AIR descriptor) of com.company.MyProject
|
14
|
-
|
15
|
-
The project includes as3corelib and flexunit, and test scaffolding as well.
|
11
|
+
airake MyProject
|
16
12
|
|
17
13
|
== Tasks
|
18
14
|
|
19
|
-
|
15
|
+
# View all tasks
|
16
|
+
rake --tasks
|
20
17
|
|
21
18
|
# Compiling
|
22
19
|
rake air:compile
|
@@ -44,3 +41,35 @@ The project includes as3corelib and flexunit, and test scaffolding as well.
|
|
44
41
|
|
45
42
|
# Package AIR file
|
46
43
|
rake air:package
|
44
|
+
|
45
|
+
== Adding other tasks
|
46
|
+
|
47
|
+
Add tasks to the rakefile, for example:
|
48
|
+
|
49
|
+
# Run ADL for Catalog mxml
|
50
|
+
task :catalog do
|
51
|
+
ENV["MXML"] = "src/catalog/Catalog.mxml"
|
52
|
+
Rake::Task["air:adl"].invoke
|
53
|
+
end
|
54
|
+
|
55
|
+
== Override default settings for Rakefile
|
56
|
+
|
57
|
+
This is experimental. In the Rakefile, specify:
|
58
|
+
|
59
|
+
# Override default settings, this is experimental
|
60
|
+
# cwd = File.expand_path(File.dirname(__FILE__))
|
61
|
+
#ENV["MXMLC_PATH"] = "mxmlc"
|
62
|
+
#ENV["ADT_PATH"] = "adt"
|
63
|
+
#ENV["BIN_DIR"] = "#{cwd}/bin"
|
64
|
+
#ENV["SRC_DIR"] = "#{cwd}/src"
|
65
|
+
#ENV["LIB_DIR"] = "#{cwd}/lib"
|
66
|
+
#ENV["TEST_DIR"] = "#{cwd}/test"
|
67
|
+
#ENV["APPXML_PATH"] = "#{cwd}/src/MyProject-app.xml"
|
68
|
+
#ENV["AIR_PATH"] = "#{cwd}/bin/MyProject.air"
|
69
|
+
#ENV["SWF_PATH"] = "#{cwd}/bin/MyProject.swf"
|
70
|
+
#ENV["MXMLC_EXTRA_OPTS"] = ...
|
71
|
+
#ENV["ADL_EXTRA_OPTS"] = ...
|
72
|
+
#ENV["ADT_EXTRA_OPTS"] = ...
|
73
|
+
#ENV["MXMLC_COMMAND"] = ...
|
74
|
+
#ENV["ADL_COMMAND"] = ...
|
75
|
+
#ENV["ADT_COMMAND"] = ...
|
@@ -5,18 +5,11 @@ To include mxmlc, adl and adt (from Flex Builder):
|
|
5
5
|
|
6
6
|
To include adl and adt (from Apollo SDK):
|
7
7
|
export PATH="/Applications/ApolloSDK/bin:$PATH"
|
8
|
-
|
9
|
-
== Creating an AIR project
|
10
|
-
|
11
|
-
airake path/to/MyProject com.company.MyProject
|
12
|
-
|
13
|
-
will build a project scaffold with application name of MyProject and application id (used for AIR descriptor) of com.company.MyProject
|
14
|
-
|
15
|
-
The project includes as3corelib and flexunit, and test scaffolding as well.
|
16
|
-
|
8
|
+
|
17
9
|
== Tasks
|
18
10
|
|
19
|
-
|
11
|
+
# View all tasks
|
12
|
+
rake --tasks
|
20
13
|
|
21
14
|
# Compiling
|
22
15
|
rake air:compile
|
@@ -44,3 +37,35 @@ The project includes as3corelib and flexunit, and test scaffolding as well.
|
|
44
37
|
|
45
38
|
# Package AIR file
|
46
39
|
rake air:package
|
40
|
+
|
41
|
+
== Adding other tasks
|
42
|
+
|
43
|
+
Add tasks to the rakefile, for example:
|
44
|
+
|
45
|
+
# Run ADL for Catalog mxml
|
46
|
+
task :catalog do
|
47
|
+
ENV["MXML"] = "src/catalog/Catalog.mxml"
|
48
|
+
Rake::Task["air:adl"].invoke
|
49
|
+
end
|
50
|
+
|
51
|
+
== Override default settings for Rakefile
|
52
|
+
|
53
|
+
This is experimental. In the Rakefile, specify:
|
54
|
+
|
55
|
+
# Override default settings, this is experimental
|
56
|
+
# cwd = File.expand_path(File.dirname(__FILE__))
|
57
|
+
#ENV["MXMLC_PATH"] = "mxmlc"
|
58
|
+
#ENV["ADT_PATH"] = "adt"
|
59
|
+
#ENV["BIN_DIR"] = "#{cwd}/bin"
|
60
|
+
#ENV["SRC_DIR"] = "#{cwd}/src"
|
61
|
+
#ENV["LIB_DIR"] = "#{cwd}/lib"
|
62
|
+
#ENV["TEST_DIR"] = "#{cwd}/test"
|
63
|
+
#ENV["APPXML_PATH"] = "#{cwd}/src/MyProject-app.xml"
|
64
|
+
#ENV["AIR_PATH"] = "#{cwd}/bin/MyProject.air"
|
65
|
+
#ENV["SWF_PATH"] = "#{cwd}/bin/MyProject.swf"
|
66
|
+
#ENV["MXMLC_EXTRA_OPTS"] = ...
|
67
|
+
#ENV["ADL_EXTRA_OPTS"] = ...
|
68
|
+
#ENV["ADT_EXTRA_OPTS"] = ...
|
69
|
+
#ENV["MXMLC_COMMAND"] = ...
|
70
|
+
#ENV["ADL_COMMAND"] = ...
|
71
|
+
#ENV["ADT_COMMAND"] = ...
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'airake'
|
3
|
-
require 'pathname'
|
4
3
|
|
5
4
|
ENV["BASE_DIR"] ||= File.expand_path(File.dirname(__FILE__))
|
6
5
|
|
@@ -8,8 +7,11 @@ ENV["BASE_DIR"] ||= File.expand_path(File.dirname(__FILE__))
|
|
8
7
|
ENV["MXML"] ||= "src/<%= app_name %>.mxml"
|
9
8
|
ENV["MXML_TEST"] ||= "test/Test.mxml"
|
10
9
|
|
10
|
+
# For task list run, rake --tasks
|
11
|
+
|
11
12
|
# Uncomment for custom FCSH settings
|
12
13
|
#ENV["FCSH_IP"] ||= "127.0.0.1"
|
13
14
|
#ENV["FCSH_PORT"] ||= "20569"
|
14
15
|
|
15
|
-
# For
|
16
|
+
# For debug
|
17
|
+
#ENV["DEBUG"] = "true"
|
data/lib/airake/fcsh.rb
CHANGED
@@ -26,6 +26,7 @@ module PatternPark
|
|
26
26
|
|
27
27
|
class FCSHError < StandardError; end
|
28
28
|
class FCSHConnectError < FCSHError; end
|
29
|
+
class FCSHCompileError < FCSHError; end
|
29
30
|
|
30
31
|
class FCSH
|
31
32
|
|
@@ -54,22 +55,24 @@ module PatternPark
|
|
54
55
|
start_time = Time.now
|
55
56
|
|
56
57
|
error_found = false
|
58
|
+
warning_found = false
|
57
59
|
begin
|
58
60
|
@socket = TCPSocket.open(@ip, @port) do |s|
|
59
61
|
puts ">> Opened connection to fcshd on #{@ip}:#{@port}"
|
60
62
|
s.puts args
|
61
63
|
s.close_write
|
62
|
-
while
|
63
|
-
break if
|
64
|
-
error_found = true if
|
65
|
-
|
64
|
+
while line = s.gets
|
65
|
+
break if line =~ /^\[PROMPT\]/
|
66
|
+
error_found = true if line =~ /^\[FCSH ERROR\]/
|
67
|
+
warning_found = true if line =~ /^\[FCSH WARNING\]/
|
68
|
+
puts line
|
66
69
|
end
|
67
70
|
end
|
68
71
|
rescue StandardError => e
|
69
72
|
raise FCSHConnectError.new("[FCSH] Unable to connect to FCSHD process")
|
70
73
|
end
|
71
74
|
|
72
|
-
raise
|
75
|
+
raise FCSHCompileError.new("[ERROR] Compile error encountered") if error_found
|
73
76
|
|
74
77
|
end_time = Time.now - start_time
|
75
78
|
puts "[FCSH] Compilation complete in: #{end_time} seconds"
|
data/lib/airake/fcshd.rb
CHANGED
@@ -80,9 +80,15 @@ module PatternPark
|
|
80
80
|
|
81
81
|
compile_errors = false
|
82
82
|
e = Thread.new {
|
83
|
-
while
|
84
|
-
|
85
|
-
|
83
|
+
while line = fcsh.e.gets
|
84
|
+
if line.strip.empty?
|
85
|
+
io.puts " "
|
86
|
+
elsif line =~ /.?: Warning: .?/
|
87
|
+
io.puts "[FCSH WARNING] #{line}"
|
88
|
+
else
|
89
|
+
io.puts "[FCSH ERROR] #{line}"
|
90
|
+
compile_errors = true
|
91
|
+
end
|
86
92
|
end
|
87
93
|
}
|
88
94
|
|
data/lib/airake/project.rb
CHANGED
@@ -1,69 +1,127 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module Airake
|
2
4
|
# Project settings for AIR app
|
3
5
|
class Project
|
4
6
|
|
5
|
-
attr_reader :project_name
|
7
|
+
attr_reader :project_name
|
6
8
|
attr_reader :base_dir, :bin_dir, :src_dir, :lib_dir, :test_dir
|
7
9
|
attr_reader :mxml_path, :appxml_path, :air_path, :swf_path
|
8
10
|
attr_reader :debug
|
11
|
+
|
12
|
+
attr_reader :mxmlc_path, :adt_path, :adl_path
|
13
|
+
attr_reader :mxmlc_command, :adt_command, :adl_command, :mxmlc_extra_opts
|
14
|
+
|
15
|
+
Options = [ :mxmlc_path, :adt_path, :bin_dir, :src_dir, :lib_dir, :test_dir,
|
16
|
+
:appxml_path, :air_path, :swf_path, :debug, :mxmlc_command, :adt_command,
|
17
|
+
:adl_command, :mxmlc_extra_opts, :adl_extra_opts, :adt_extra_opts ]
|
9
18
|
|
19
|
+
# Settings
|
20
|
+
# Specify base directory, the path to Project.mxml (relative) and options.
|
21
|
+
# Options override default settings, see Options class var.
|
10
22
|
def initialize(base_dir, mxml_path, options = {})
|
11
|
-
@mxmlc_path = "mxmlc"
|
12
|
-
@adt_path = "adt"
|
13
|
-
|
14
23
|
@base_dir = base_dir
|
15
|
-
@bin_dir = File.join(base_dir, "bin")
|
16
|
-
@src_dir = File.join(base_dir, "src")
|
17
|
-
@lib_dir = File.join(base_dir, "lib")
|
18
|
-
@test_dir = File.join(base_dir, "test")
|
19
|
-
|
20
|
-
@project_name = File.basename(mxml_path, ".mxml")
|
21
24
|
@mxml_path = mxml_path
|
22
|
-
|
25
|
+
|
26
|
+
@mxmlc_path = options[:mxmlc_path] || "mxmlc"
|
27
|
+
@adt_path = options[:adt_path] || "adt"
|
28
|
+
@adl_path = options[:adl] || "adl"
|
29
|
+
|
30
|
+
@bin_dir = options[:bin_dir] || File.join(base_dir, "bin")
|
31
|
+
@src_dir = options[:src_dir] || File.join(base_dir, "src")
|
32
|
+
@lib_dir = options[:lib_dir] || File.join(base_dir, "lib")
|
33
|
+
@test_dir = options[:test_dir] || File.join(base_dir, "test")
|
23
34
|
|
24
|
-
@
|
35
|
+
@project_name = File.basename(@mxml_path, ".mxml")
|
36
|
+
mxml_dir = File.expand_path(File.dirname(@mxml_path))
|
37
|
+
@appxml_path = options[:appxml_path] || File.join(mxml_dir, "#{project_name}-app.xml")
|
25
38
|
|
26
39
|
# Dest package files
|
27
|
-
@air_path = options[:air_path] || "#{
|
28
|
-
@swf_path = options[:swf_path] || "#{
|
40
|
+
@air_path = options[:air_path] || File.join(@bin_dir, "#{project_name}.air")
|
41
|
+
@swf_path = options[:swf_path] || File.join(@bin_dir, "#{project_name}.swf")
|
29
42
|
|
30
|
-
@debug = options[:debug] ||
|
43
|
+
@debug = options[:debug].is_a?(TrueClass) || options[:debug] == "true"
|
44
|
+
|
45
|
+
@mxmlc_extra_opts = options[:mxmlc_extra_opts]
|
46
|
+
@adl_extra_opts = options[:adl_extra_opts]
|
47
|
+
@adt_extra_opts = options[:adt_extra_opts]
|
48
|
+
|
49
|
+
@mxmlc_command = options[:mxmlc_command] || load_mxmlc_command
|
50
|
+
@adt_command = options[:adt_command] || load_adt_command
|
51
|
+
@adl_command = options[:adl_command] || load_adl_command
|
31
52
|
end
|
32
53
|
|
54
|
+
# Run the ADT
|
33
55
|
def run_adt
|
34
56
|
run(adt_command)
|
35
57
|
end
|
36
58
|
|
59
|
+
# Run the Flex compiler
|
37
60
|
def run_mxmlc
|
38
61
|
run(mxmlc_command)
|
39
62
|
end
|
40
63
|
|
64
|
+
# Run the Adobe Debug Launcher
|
41
65
|
def run_adl
|
42
66
|
run(adl_command)
|
43
67
|
end
|
44
68
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
def adt_command
|
50
|
-
"#{@adt_path} -package #{relative_path(@air_path)} #{relative_path(@appxml_path)} #{relative_path(@swf_path)}"
|
51
|
-
end
|
52
|
-
|
53
|
-
def adl_command
|
54
|
-
"adl #{@appxml_path} #{@base_dir}"
|
55
|
-
end
|
56
|
-
|
57
|
-
# Create project from ENV (for rake tasks)
|
69
|
+
# Create project using parameters from rake ENV
|
70
|
+
# You can set any of the options via ENV; just upcase it. <tt>:foo_bar => ENV["FOO_BAR"]</tt>
|
71
|
+
# Booleans must be "true" for true and false for anything else.
|
58
72
|
def self.new_from_rake(env, is_test = false)
|
59
73
|
base_dir = env["BASE_DIR"]
|
60
74
|
mxml = is_test ? env["MXML_TEST"] : env["MXML"]
|
61
|
-
|
75
|
+
|
76
|
+
# For any option check to see if its in the ENV
|
77
|
+
options = {}
|
78
|
+
Options.each do |option_key|
|
79
|
+
env_key = option_key.to_s.upcase
|
80
|
+
options[option_key] = env[env_key] if env.has_key?(env_key)
|
81
|
+
end
|
82
|
+
puts "Using options: #{options.inspect}" unless options.empty?
|
62
83
|
self.new(base_dir, mxml, options)
|
63
84
|
end
|
64
85
|
|
65
86
|
protected
|
66
|
-
|
87
|
+
|
88
|
+
# Get the mxmlc command
|
89
|
+
def load_mxmlc_command
|
90
|
+
command = []
|
91
|
+
command << @mxmlc_path
|
92
|
+
command << "+configname=air"
|
93
|
+
command << source_path_option
|
94
|
+
command << "-library-path+=#{@lib_dir}"
|
95
|
+
command << "-output #{@swf_path}"
|
96
|
+
command << debug_option
|
97
|
+
command << @mxmlc_extra_opts
|
98
|
+
command << "-disable-incremental-optimizations=true"
|
99
|
+
command << "-- #{@mxml_path}"
|
100
|
+
command.compact.join(" ")
|
101
|
+
end
|
102
|
+
|
103
|
+
# Get the ADT command
|
104
|
+
def load_adt_command
|
105
|
+
command = []
|
106
|
+
command << @adt_path
|
107
|
+
command << @adt_extra_opts
|
108
|
+
command << "-package #{relative_path(@air_path)}"
|
109
|
+
command << relative_path(@appxml_path)
|
110
|
+
command << relative_path(@swf_path)
|
111
|
+
command.compact.join(" ")
|
112
|
+
end
|
113
|
+
|
114
|
+
# Get the ADL command
|
115
|
+
def load_adl_command
|
116
|
+
command = []
|
117
|
+
command << @adl_path
|
118
|
+
command << @adl_extra_opts
|
119
|
+
command << @appxml_path
|
120
|
+
command << @base_dir
|
121
|
+
command.compact.join(" ")
|
122
|
+
end
|
123
|
+
|
124
|
+
# List of directories in lib/ for source_path +=
|
67
125
|
def lib_source_paths
|
68
126
|
Dir["#{@lib_dir}/*"].collect { |f| f if File.directory?(f) }.compact + [ @test_dir, @src_dir ]
|
69
127
|
end
|
data/lib/airake/version.rb
CHANGED
metadata
CHANGED