airake 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,5 +1,10 @@
1
+ == 0.1.5 2007-08-30
2
+ * Fixed required include in Rakefile
3
+ * Removing app_id as required argument
4
+ * Refactored deployment.rake
5
+
1
6
  == 0.1.4 2007-08-30
2
- * Fixed minor bug with app_name being titleized
7
+ * Fixed bug with app_name being titleized
3
8
 
4
9
  == 0.1.3 2007-08-29
5
10
 
data/README.txt CHANGED
@@ -18,29 +18,29 @@ The project includes as3corelib and flexunit, and test scaffolding as well.
18
18
 
19
19
  Run: rake --tasks
20
20
 
21
- # Start FCSHD
22
- rake start_fcshd
23
-
24
21
  # Compiling
25
- rake compile
22
+ rake air:compile
26
23
 
27
24
  # Running air debug launcher (ADL)
28
- rake adl
25
+ rake air:adl
26
+
27
+ # Start FCSHD (for faster compilation)
28
+ rake air:start_fcshd
29
29
 
30
30
  # Stop FCSHD
31
- rake stop_fcsh
31
+ rake air:stop_fcsh
32
32
 
33
33
  # Restart FCSHD
34
- rake restart_fcshd
34
+ rake air:restart_fcshd
35
35
 
36
36
  # Running alternate MXML, (the following expects src/Test-app.xml descriptor file)
37
- rake adl MXML=src/Test.mxml
37
+ rake air:adl MXML=src/Test.mxml
38
38
 
39
39
  # Run ADL with debug enabled
40
- rake adl DEBUG=true
40
+ rake air:adl DEBUG=true
41
41
 
42
42
  # Testing
43
- rake test
43
+ rake air:test
44
44
 
45
45
  # Package AIR file
46
- rake package
46
+ rake air:package
@@ -3,14 +3,12 @@ class AirakeGenerator < RubiGen::Base
3
3
  #default_options :author => nil
4
4
 
5
5
  attr_reader :app_name
6
- attr_reader :app_id
7
6
 
8
7
  def initialize(runtime_args, runtime_options = {})
9
8
  super
10
- usage if args.empty? || args.size < 2
9
+ usage if args.empty? || args.size < 1
11
10
  @destination_root = File.expand_path(args.shift)
12
11
  @app_name = File.basename(@destination_root).camelize
13
- @app_id = args.shift
14
12
  extract_options
15
13
  end
16
14
 
@@ -1,36 +1,46 @@
1
1
  == Setup
2
2
 
3
- Path to have access to adl and adt:
3
+ To include mxmlc, adl and adt (from Flex Builder):
4
+ export PATH="/Applications/Adobe Flex Builder 3/sdks/moxie/bin:$PATH"
5
+
6
+ To include adl and adt (from Apollo SDK):
4
7
  export PATH="/Applications/ApolloSDK/bin:$PATH"
5
8
 
6
- Path to have access to mxmlc, etc. (flex compiler):
7
- export PATH="/Applications/Adobe Flex Builder 3/sdks/moxie/bin:$PATH"
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.
8
16
 
9
17
  == Tasks
10
18
 
11
- # Start FCSHD
12
- rake start_fcshd
19
+ Run: rake --tasks
13
20
 
14
21
  # Compiling
15
- rake compile
22
+ rake air:compile
16
23
 
17
24
  # Running air debug launcher (ADL)
18
- rake adl
25
+ rake air:adl
26
+
27
+ # Start FCSHD (for faster compilation)
28
+ rake air:start_fcshd
19
29
 
20
30
  # Stop FCSHD
21
- rake stop_fcsh
31
+ rake air:stop_fcsh
22
32
 
23
33
  # Restart FCSHD
24
- rake restart_fcshd
34
+ rake air:restart_fcshd
25
35
 
26
36
  # Running alternate MXML, (the following expects src/Test-app.xml descriptor file)
27
- rake adl MXML=src/Test.mxml
37
+ rake air:adl MXML=src/Test.mxml
28
38
 
29
39
  # Run ADL with debug enabled
30
- rake adl DEBUG=true
40
+ rake air:adl DEBUG=true
31
41
 
32
42
  # Testing
33
- rake test
43
+ rake air:test
34
44
 
35
45
  # Package AIR file
36
- rake package
46
+ rake air:package
@@ -1,9 +1,10 @@
1
1
  require 'rubygems'
2
2
  require 'airake'
3
3
  require 'pathname'
4
- include PatternPark
5
4
 
6
5
  ENV["BASE_DIR"] ||= File.expand_path(File.dirname(__FILE__))
6
+
7
+ # MXML options
7
8
  ENV["MXML"] ||= "src/<%= app_name %>.mxml"
8
9
  ENV["MXML_TEST"] ||= "test/Test.mxml"
9
10
 
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
3
3
 
4
- <mx:HTML location="http://airake.rubyforge.org/" width="100%" height="100%"/>
4
+ <mx:HTML location="http://airake.rubyforge.org/resources.html" width="100%" height="100%"/>
5
5
 
6
6
  </mx:WindowedApplication>
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <application xmlns="http://ns.adobe.com/air/application/1.0.M4" appId="<%= app_id %>" version="0.0.1">
2
+ <application xmlns="http://ns.adobe.com/air/application/1.0.M4" appId="com.company.App" version="0.0.1">
3
3
 
4
4
  <!--
5
5
  AIR Application Descriptor File:
data/lib/airake/fcsh.rb CHANGED
@@ -74,6 +74,12 @@ module PatternPark
74
74
  end_time = Time.now - start_time
75
75
  puts "[FCSH] Compilation complete in: #{end_time} seconds"
76
76
  end
77
- end
78
-
77
+
78
+ def self.new_from_rake(env, default_ip = "127.0.0.1", default_port = 20569)
79
+ fcsh_ip = env["FCSH_IP"] || default_ip
80
+ fcsh_port = (env["FCSH_PORT"] || default_port).to_i
81
+ self.new(fcsh_ip, fcsh_port)
82
+ end
83
+
84
+ end
79
85
  end
data/lib/airake/fcshd.rb CHANGED
@@ -98,6 +98,12 @@ module PatternPark
98
98
  cmd.index = @compile_commands.size
99
99
  end
100
100
  end
101
+
102
+ def self.start_from_rake(env, default_ip = "127.0.0.1", default_port = 20569)
103
+ fcsh_ip = env["FCSH_IP"] || default_ip
104
+ fcsh_port = (env["FCSH_PORT"] || default_port).to_i
105
+ self.new(fcsh_ip, fcsh_port)
106
+ end
101
107
  end
102
108
 
103
109
  class FCSHProcess
@@ -1,4 +1,5 @@
1
1
  module Airake
2
+ # Project settings for AIR app
2
3
  class Project
3
4
 
4
5
  attr_reader :project_name, :mxmlc_path, :adt_path
@@ -6,7 +7,7 @@ module Airake
6
7
  attr_reader :mxml_path, :appxml_path, :air_path, :swf_path
7
8
  attr_reader :debug
8
9
 
9
- def initialize(base_dir, mxml_path, env = [], options = {})
10
+ def initialize(base_dir, mxml_path, options = {})
10
11
  @mxmlc_path = "mxmlc"
11
12
  @adt_path = "adt"
12
13
 
@@ -26,22 +27,21 @@ module Airake
26
27
  @air_path = options[:air_path] || "#{@bin_dir}/#{project_name}.air"
27
28
  @swf_path = options[:swf_path] || "#{@bin_dir}/#{project_name}.swf"
28
29
 
29
- @debug = env["DEBUG"] || options[:debug] || false
30
+ @debug = options[:debug] || false
30
31
  end
31
32
 
32
- def lib_source_paths
33
- Dir["#{@lib_dir}/*"].collect { |f| f if File.directory?(f) }.compact + [ @test_dir, @src_dir ]
33
+ def run_adt
34
+ run(adt_command)
34
35
  end
35
36
 
36
- def source_path_option
37
- @source_paths ||= lib_source_paths
38
- @source_paths.empty? ? "" : "-source-path #{@source_paths.join(" ")}"
37
+ def run_mxmlc
38
+ run(mxmlc_command)
39
39
  end
40
40
 
41
- def debug_option
42
- "-debug=#{@debug}" if @debug
41
+ def run_adl
42
+ run(adl_command)
43
43
  end
44
-
44
+
45
45
  def mxmlc_command
46
46
  "#{@mxmlc_path} +configname=air #{source_path_option} -library-path+=#{@lib_dir} -output #{@swf_path} #{debug_option} -disable-incremental-optimizations=true -- #{@mxml_path}"
47
47
  end
@@ -52,8 +52,31 @@ module Airake
52
52
 
53
53
  def adl_command
54
54
  "adl #{@appxml_path} #{@base_dir}"
55
+ end
56
+
57
+ # Create project from ENV (for rake tasks)
58
+ def self.new_from_rake(env, is_test = false)
59
+ base_dir = env["BASE_DIR"]
60
+ mxml = is_test ? env["MXML_TEST"] : env["MXML"]
61
+ options = { :debug => env["DEBUG"] }
62
+ self.new(base_dir, mxml, options)
63
+ end
64
+
65
+ protected
66
+
67
+ def lib_source_paths
68
+ Dir["#{@lib_dir}/*"].collect { |f| f if File.directory?(f) }.compact + [ @test_dir, @src_dir ]
55
69
  end
56
70
 
71
+ def source_path_option
72
+ @source_paths ||= lib_source_paths
73
+ @source_paths.empty? ? "" : "-source-path #{@source_paths.join(" ")}"
74
+ end
75
+
76
+ def debug_option
77
+ "-debug=#{@debug}" if @debug
78
+ end
79
+
57
80
  def relative_path(path)
58
81
  Pathname.new(path).relative_path_from(Pathname.new(@base_dir))
59
82
  end
@@ -79,17 +102,5 @@ module Airake
79
102
  system cmd or fail(cmd, $?)
80
103
  end
81
104
 
82
- def run_adt
83
- run(adt_command)
84
- end
85
-
86
- def run_mxmlc
87
- run(mxmlc_command)
88
- end
89
-
90
- def run_adl
91
- run(adl_command)
92
- end
93
-
94
105
  end
95
106
  end
@@ -1,15 +1,10 @@
1
1
  namespace :air do
2
-
3
- task :settings do
4
- ENV["FCSH_IP"] ||= "127.0.0.1"
5
- ENV["FCSH_PORT"] ||= "20569"
6
- end
7
-
2
+
8
3
  desc "Compile"
9
- task :compile => :settings do
4
+ task :compile do
10
5
  begin
11
- project = Airake::Project.new(ENV["BASE_DIR"], ENV["MXML"], ENV)
12
- fcsh = FCSH.new(ENV["FCSH_IP"], ENV["FCSH_PORT"].to_i)
6
+ project = Airake::Project.new_from_rake(ENV)
7
+ fcsh = PatternPark::FCSH.new_from_rake(ENV)
13
8
  fcsh.execute([ project.base_dir, project.mxmlc_command ])
14
9
  rescue FCSHConnectError => e
15
10
  puts "Cannot connect to FCSHD (start by running: rake air:fcshd); Continuing compilation..."
@@ -18,44 +13,47 @@ namespace :air do
18
13
  end
19
14
 
20
15
  desc "Test"
21
- task :test => :settings do
22
- test_project = Airake::Project.new(ENV["BASE_DIR"], ENV["MXML_TEST"], ENV)
16
+ task :test do
17
+ test_project = Airake::Project.new_from_rake(ENV, true)
23
18
  test_project.run_mxmlc
24
19
  test_project.run_adl
25
20
  end
26
21
 
27
22
  desc "Package"
28
23
  task :package => :compile do
29
- project = Airake::Project.new(ENV["BASE_DIR"], ENV["MXML"], ENV)
24
+ project = Airake::Project.new_from_rake(ENV)
30
25
  project.run_adt
31
26
  end
32
27
 
33
28
  desc "Apollo Debug Luncher"
34
29
  task :adl => :compile do
35
- project = Airake::Project.new(ENV["BASE_DIR"], ENV["MXML"], ENV)
30
+ project = Airake::Project.new_from_rake(ENV)
36
31
  project.run_adl
37
32
  end
38
33
 
39
34
  desc "Start the FCSHD process (or use air:fcshd)"
40
- task :start_fcshd => :settings do
41
- puts "Starting FCSHD @ #{ENV["FCSH_IP"]}:#{ENV["FCSH_PORT"].to_i}"
42
- FCSHD.new(ENV["FCSH_IP"], ENV["FCSH_PORT"].to_i)
35
+ task :start_fcshd do
36
+ puts "Starting FCSHD..."
37
+ PatternPark::FCSHD.start_from_rake(ENV)
43
38
  end
39
+
40
+ task :fcshd => :start_fcshd # Alias
44
41
 
45
42
  desc "Stop the FCSHD process"
46
- task :stop_fcshd => :settings do
47
- fcsh = FCSH.new(ENV["FCSH_IP"], ENV["FCSH_PORT"].to_i)
48
- fcsh.stop
43
+ task :stop_fcshd do
44
+ begin
45
+ fcsh = PatternPark::FCSH.new_from_rake(ENV)
46
+ fcsh.stop
47
+ rescue
48
+ puts "Could not stop FCSHD"
49
+ end
49
50
  end
50
51
 
51
52
  desc "Restart the FCSHD process"
52
- task :restart_fcsh => :settings do
53
- Rake::Task[:stop_fcshd].invoke rescue puts "Could not stop FCSHD"
54
- sleep 1
55
- Rake::Task[:start_fcshd].invoke
53
+ task :restart_fcshd => [ :stop_fcshd, :sleep, :start_fcshd ]
54
+
55
+ task :sleep do
56
+ sleep 2
56
57
  end
57
-
58
- # Aliases
59
- task :fcshd => :start_fcshd
60
58
 
61
59
  end
@@ -2,7 +2,7 @@ module Airake #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: airake
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.4
6
+ version: 0.1.5
7
7
  date: 2007-08-30 00:00:00 -04:00
8
8
  summary: Adobe AIR tasks
9
9
  require_paths: