airake 0.2.6 → 0.2.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 CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.2.7 2007-10-24
2
+
3
+ * survived revolutionhealth layoffs
4
+ * removed -disable-incremental-optimizations=true; legacy flag.. use extra opts if you still need it
5
+ * added command for acompc (Component compiler)
6
+ * refactored commands (decoupled commands from project)
7
+
1
8
  == 0.2.6 2007-10-17
2
9
 
3
10
  * fixed compile with fcsh (mxmlc)
data/Manifest.txt CHANGED
@@ -28,6 +28,7 @@ bin/browsair
28
28
  config/hoe.rb
29
29
  config/requirements.rb
30
30
  lib/airake.rb
31
+ lib/airake/commands/acompc.rb
31
32
  lib/airake/commands/adl.rb
32
33
  lib/airake/commands/adt.rb
33
34
  lib/airake/commands/amxmlc.rb
@@ -40,7 +41,6 @@ lib/airake/project.rb
40
41
  lib/airake/runner.rb
41
42
  lib/airake/tasks.rb
42
43
  lib/airake/tasks/air.rake
43
- lib/airake/tasks/deployment.rake
44
44
  lib/airake/tasks/fcsh.rake
45
45
  lib/airake/version.rb
46
46
  script/destroy
data/Rakefile CHANGED
@@ -1,4 +1,7 @@
1
1
  require 'config/requirements'
2
2
  require 'config/hoe' # setup Hoe + all gem configuration
3
3
 
4
- Dir['tasks/**/*.rake'].each { |rake| load rake }
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
5
+
6
+ # Load airake (why not?)
7
+ require 'lib/airake'
@@ -11,5 +11,11 @@ ENV["BASE_DIR"] ||= File.expand_path(File.dirname(__FILE__))
11
11
  ENV["MXML"] ||= "src/<%= app_name %>.mxml"
12
12
  ENV["MXML_TEST"] ||= "test/Test.mxml"
13
13
 
14
- # Assets to package
15
- ENV["ASSETS"] ||= "src/assets"
14
+ # Assets to package, can be multiple items, e.g. "src/assets/app_icons src/assets/tray_icons"
15
+ ENV["ASSETS"] ||= "src/assets"
16
+
17
+ # Aliases
18
+ task :test => [ "air:test" ] do; end
19
+ task :compile => [ "air:compile" ] do; end
20
+ task :package => [ "air:package" ] do; end
21
+ task :adl => [ "air:adl" ] do; end
@@ -0,0 +1,57 @@
1
+ module Airake #:nodoc:
2
+
3
+ module Commands #:nodoc:
4
+
5
+ # ACOMPC (Air component compiler)
6
+ #
7
+ # http://livedocs.adobe.com/labs/flex3/html/help.html?content=CommandLineTools_3.html
8
+ class Acompc < Base
9
+
10
+ attr_reader :path, :extra_opts, :source_path, :include_packages, :output_path
11
+
12
+ # Initialize command
13
+ #
14
+ # options:: :acompc_path, :acompc_extra_opts, :source_path, :include_packages, :output_path
15
+ #
16
+ # :include_packages:
17
+ # com.airake.utils will include all classes from Dir["com/airake/utils/**/*.as"]
18
+ def initialize(options = {})
19
+ @path = options[:acompc_path] || "acompc"
20
+ @extra_opts = options[:acompc_extra_opts]
21
+ with_options(options, { :source_path => "src" })
22
+
23
+ raise "No output path specified" unless output_path
24
+ end
25
+
26
+ def include_classes_option
27
+ classes = []
28
+ paths = []
29
+ include_packages.each do |include_package|
30
+ path = File.join(source_path, include_package.gsub(".", "/")) + "/**/*.as"
31
+ paths << path
32
+ Dir[path].each do |file|
33
+ classes << include_package + "." + File.basename(file).gsub(".as", "")
34
+ end
35
+ end
36
+ raise "No classes found at:\n\t#{paths.join("\n\t")}" if classes.empty?
37
+ classes.join(" ")
38
+ end
39
+
40
+ # Get the acompc compile command
41
+ def compile
42
+ command = []
43
+ command << path
44
+ command << "-source-path"
45
+ command << source_path
46
+ command << "-include-classes"
47
+ command << include_classes_option
48
+ command << "-output"
49
+ command << output_path
50
+ process(command)
51
+ end
52
+
53
+ end
54
+
55
+ end
56
+
57
+ end
@@ -1,28 +1,28 @@
1
- module Airake
1
+ module Airake #:nodoc:
2
2
 
3
- module Commands
3
+ module Commands #:nodoc:
4
4
 
5
5
  # ADL (Adobe Debug Lancher)
6
6
  #
7
7
  # http://livedocs.adobe.com/labs/air/1/devappsflex/help.html?content=CommandLineTools_4.html#1031914
8
8
  class Adl < Base
9
9
 
10
- attr_reader :project, :path, :extra_opts
10
+ attr_reader :project, :path, :extra_opts, :appxml_path, :root_dir
11
11
 
12
- # options:: :adl_path, adl_extra_opts
13
- def initialize(project, options = {})
14
- @project = project
12
+ # options:: :adl_path, adl_extra_opts, :appxml_path, :root_dir
13
+ def initialize(options = {})
15
14
  @path = options[:adl_path] || "adl"
16
15
  @extra_opts = options[:adl_extra_opts]
16
+ with_options(options)
17
17
  end
18
-
18
+
19
19
  # Get the ADL launch command
20
20
  def launch
21
21
  command = []
22
- command << @path
23
- command << @extra_opts
24
- command << escape(project.appxml_path)
25
- command << escape(project.base_dir)
22
+ command << path
23
+ command << extra_opts
24
+ command << escape(appxml_path)
25
+ command << escape(root_dir)
26
26
  process(command)
27
27
  end
28
28
 
@@ -1,34 +1,34 @@
1
- module Airake
1
+ module Airake #:nodoc:
2
2
 
3
- module Commands
3
+ module Commands #:nodoc:
4
4
 
5
5
  # ADT (Adobe Developer Tool)
6
6
  #
7
7
  # http://livedocs.adobe.com/labs/air/1/devappsflex/help.html?content=CommandLineTools_5.html
8
8
  class Adt < Base
9
9
 
10
- attr_reader :project, :path, :certificate, :extra_opts, :assets
10
+ attr_reader :path, :certificate, :extra_opts, :assets, :air_path, :appxml_path, :swf_path, :base_dir
11
11
 
12
- # options:: :adt_path, :certificate, :adt_extra_opts, :assets
13
- def initialize(project, options = {})
14
- @project = project
12
+ # options:: :adt_path, :certificate, :adt_extra_opts, :assets, :air_path, :appxml_path, :swf_path, :base_dir
13
+ def initialize(options = {})
15
14
  @path = options[:adt_path] || "adt"
16
- @certificate = options[:certificate]
17
15
  @extra_opts = options[:adt_extra_opts]
18
- @assets = options[:assets]
16
+ with_options(options)
19
17
  end
20
18
 
21
19
  # Get the ADT package command
22
20
  def package
21
+ raise ArgumentError, "Must specify :base_dir" unless base_dir
22
+
23
23
  command = []
24
- command << @path
25
- command << @extra_opts
24
+ command << path
25
+ command << extra_opts
26
26
  command << "-package"
27
- command << "-certificate #{@certificate}"
28
- command << escape(project.relative_path(project.air_path))
29
- command << escape(project.relative_path(project.appxml_path))
30
- command << escape(project.relative_path(project.swf_path))
31
- command << @assets
27
+ command << "-certificate #{certificate}" unless certificate.blank?
28
+ command << escape(relative_path(air_path, base_dir))
29
+ command << escape(relative_path(appxml_path, base_dir))
30
+ command << escape(relative_path(swf_path, base_dir))
31
+ command << assets
32
32
  process(command)
33
33
  end
34
34
 
@@ -38,17 +38,17 @@ module Airake
38
38
  # pfx_file:: Output certificate path
39
39
  # key_type:: 1024-RSA, 2048-RSA
40
40
  # password:: Password
41
- # optionals:: :ou, :o, :c
41
+ # optionals:: :org_unit, :org, :country
42
42
  #
43
43
  # Example result: adt -certificate -cn ADigitalID 1024-RSA SigningCert.pfx 39#wnetx3tl
44
- def certificate(cn, pfx_file, key_type, password, optionals = {})
44
+ def generate_certificate(common_name, pfx_file, key_type, password, optionals = {})
45
45
  command = []
46
- command << @path
46
+ command << path
47
47
  command << "-certificate"
48
- command << "-cn #{cn}"
49
- command << "-ou #{optionals[:ou]}" if !optionals[:ou].blank?
50
- command << "-o #{optionals[:o]}" if !optionals[:o].blank?
51
- command << "-c #{optionals[:c]}" if !optionals[:c].blank?
48
+ command << "-cn #{common_name}"
49
+ command << "-ou #{optionals[:org_unit]}" if !optionals[:org_unit].blank?
50
+ command << "-o #{optionals[:org]}" if !optionals[:org].blank?
51
+ command << "-c #{optionals[:country]}" if !optionals[:country].blank?
52
52
  command << key_type
53
53
  command << escape(pfx_file)
54
54
  command << password
@@ -1,34 +1,34 @@
1
- module Airake
1
+ module Airake #:nodoc:
2
2
 
3
- module Commands
3
+ module Commands #:nodoc:
4
4
 
5
5
  # AMXMLC (AIR MXML compiler)
6
6
  #
7
7
  # http://livedocs.adobe.com/labs/air/1/devappsflex/help.html?content=CommandLineTools_2.html#1032546
8
8
  class Amxmlc < Base
9
9
 
10
- attr_reader :project, :path, :extra_opts
10
+ attr_reader :path, :extra_opts, :swf_path, :mxml_path, :lib_dir, :src_dir, :test_dir, :debug_option
11
11
 
12
- # options:: :amxmlc_path, :amxmlc_extra_opts
13
- def initialize(project, options = {})
14
- @project = project
12
+ # options:: :amxmlc_path, :amxmlc_extra_opts, :swf_path, :mxml_path, :lib_dir, :src_dir, :test_dir, :debug_option
13
+ def initialize(options = {})
15
14
  @path = options[:amxmlc_path] || "mxmlc +configname=air"
16
15
  @extra_opts = options[:amxmlc_extra_opts]
16
+ with_options(options)
17
17
  end
18
18
 
19
19
  # Get the amxmlc compile command
20
20
  def compile
21
21
  command = []
22
- command << @path
22
+ command << path
23
23
  command << source_path_option
24
24
  command << library_path_option
25
25
  command << "-output"
26
- command << escape(project.swf_path)
27
- command << project.debug_option
28
- command << @extra_opts
29
- command << "-disable-incremental-optimizations=true"
26
+ command << escape(swf_path)
27
+ command << debug_option
28
+ command << extra_opts
29
+ #command << "-disable-incremental-optimizations=true"
30
30
  command << "--"
31
- command << escape(project.mxml_path)
31
+ command << escape(mxml_path)
32
32
  process(command)
33
33
  end
34
34
 
@@ -36,9 +36,9 @@ module Airake
36
36
 
37
37
  def source_path_option
38
38
  # List of directories in lib/ for source_path +=
39
- lib_source_paths = Dir["#{project.lib_dir}/*"].collect { |f| escape(f) if File.directory?(f) }.compact
40
- lib_source_paths << escape(project.test_dir) if File.directory?(project.test_dir)
41
- lib_source_paths << escape(project.src_dir) if File.directory?(project.src_dir)
39
+ lib_source_paths = Dir["#{lib_dir}/*"].collect { |f| escape(f) if File.directory?(f) }.compact
40
+ lib_source_paths << escape(test_dir) if test_dir and File.directory?(test_dir)
41
+ lib_source_paths << escape(src_dir) if src_dir and File.directory?(src_dir)
42
42
 
43
43
  source_paths ||= lib_source_paths
44
44
  source_paths.empty? ? "" : "-source-path #{source_paths.join(" ")}"
@@ -46,7 +46,7 @@ module Airake
46
46
 
47
47
  def library_path_option
48
48
  library_paths = []
49
- library_paths << escape(project.lib_dir) if File.directory?(project.lib_dir)
49
+ library_paths << escape(lib_dir) if lib_dir and File.directory?(lib_dir)
50
50
  library_paths.empty? ? "" : "-library-path+=#{library_paths.join(" ")}"
51
51
  end
52
52
 
@@ -1,7 +1,10 @@
1
- module Airake
1
+ require 'pathname'
2
+
3
+ module Airake #:nodoc:
2
4
 
3
- module Commands
5
+ module Commands #:nodoc:
4
6
 
7
+ # Base command
5
8
  class Base
6
9
 
7
10
  # Process command options array
@@ -14,6 +17,22 @@ module Airake
14
17
  command.to_s.gsub(" ", "\\ ")
15
18
  end
16
19
 
20
+ # Get relative path
21
+ def relative_path(path, from)
22
+ Pathname.new(path).relative_path_from(Pathname.new(from))
23
+ end
24
+
25
+ def with_options(options, defaults = {})
26
+ options.each do |key, value|
27
+ instance_variable_set("@#{key}", value)
28
+ end
29
+
30
+ defaults.each do |key, value|
31
+ existing = instance_variable_get("@#{key}")
32
+ instance_variable_set("@#{key}", value) unless existing
33
+ end
34
+ end
35
+
17
36
  end
18
37
 
19
38
  end
data/lib/airake/fcshd.rb CHANGED
@@ -64,7 +64,6 @@ module PatternPark
64
64
  def execute(io, path, command)
65
65
  io.puts "[FCSHD] #{path}"
66
66
  io.puts "[FCSHD] #{command}"
67
- #io.puts "#{command} at #{Dir.pwd} and #{path}"
68
67
  begin
69
68
  fcsh = get_fcsh(io, path)
70
69
  rescue => e
@@ -74,7 +73,7 @@ module PatternPark
74
73
 
75
74
  cmd = @compile_commands[command]
76
75
  msg = command
77
- if(!cmd.nil? && cmd.path == path)
76
+ if (!cmd.nil? && cmd.path == path)
78
77
  msg = "compile #{cmd.index}"
79
78
  end
80
79
 
@@ -134,11 +133,11 @@ module PatternPark
134
133
  while(!r.eof?)
135
134
  char = r.getc.chr
136
135
  line += char
137
- if(line == '(fcsh)')
136
+ if (line == '(fcsh)')
138
137
  response += "[PROMPT] #{line}"
139
138
  break
140
139
  end
141
- if(char == "\n")
140
+ if (char == "\n")
142
141
  response += "[FCSH] #{line}"
143
142
  line = ''
144
143
  end
@@ -152,16 +151,7 @@ module PatternPark
152
151
  attr_accessor :index, :path, :command
153
152
 
154
153
  def initialize(command, path)
155
- @command = command
156
- @path = path
154
+ @command, @path = command, path
157
155
  end
158
156
  end
159
157
  end
160
-
161
- if(__FILE__ == $0)
162
- # Send in ip and port
163
- ip = ARGV.shift
164
- port = ARGV.shift
165
- puts "[Starting FCSHD]"
166
- PatternPark::FCSHD.new(ip, port)
167
- end
@@ -1,6 +1,5 @@
1
- require 'pathname'
1
+ module Airake #:nodoc
2
2
 
3
- module Airake
4
3
  # Project settings for AIR app
5
4
  class Project
6
5
 
@@ -44,19 +43,23 @@ module Airake
44
43
  @debug = options[:debug].is_a?(TrueClass) || options[:debug] == "true"
45
44
  end
46
45
 
47
- # Flex compiler command
46
+ # Flex compiler command for this project
48
47
  def amxmlc
49
- Airake::Commands::Amxmlc.new(self, @options)
48
+ options = @options.merge({ :swf_path => swf_path, :mxml_path => mxml_path, :lib_dir => lib_dir,
49
+ :src_dir => src_dir, :test_dir => test_dir, :debug_option => debug_option })
50
+ Airake::Commands::Amxmlc.new(options)
50
51
  end
51
52
 
52
- # ADL command
53
+ # ADL command for this project
53
54
  def adl
54
- Airake::Commands::Adl.new(self, @options)
55
+ options = @options.merge({ :appxml_path => appxml_path, :root_dir => base_dir })
56
+ Airake::Commands::Adl.new(options)
55
57
  end
56
58
 
57
- # ADT command
59
+ # ADT command for this project
58
60
  def adt
59
- Airake::Commands::Adt.new(self, @options)
61
+ options = @options.merge({ :air_path => air_path, :appxml_path => appxml_path, :swf_path => swf_path, :base_dir => base_dir })
62
+ Airake::Commands::Adt.new(options)
60
63
  end
61
64
 
62
65
  # Create project using parameters from rake ENV
@@ -81,12 +84,7 @@ module Airake
81
84
  def debug_option
82
85
  "-debug=#{@debug}" if @debug
83
86
  end
84
-
85
- # Get relative path from base (project) directory
86
- def relative_path(path)
87
- Pathname.new(path).relative_path_from(Pathname.new(@base_dir))
88
- end
89
-
87
+
90
88
  end
91
89
 
92
90
  end
data/lib/airake/runner.rb CHANGED
@@ -1,26 +1,15 @@
1
- module Airake
1
+ module Airake #:nodoc:
2
2
 
3
+ # Runs commands
3
4
  class Runner
4
5
 
5
6
  class << self
6
- # Handle system command failure
7
- def fail(cmd, error_status)
8
- # fail_message = <<-EOS
9
- #
10
- # The '#{cmd.split.first}' command failed to run. This could be because this executable isn't in the path.
11
- #
12
- # To include mxmlc and fcsh:
13
- # export PATH="/path_to/flex3sdk_b2_100107/bin:$PATH"
14
- #
15
- # To include adl and adt (from AIR SDK):
16
- # export PATH="/path_to/air_sdk/bin:$PATH"
17
- #
18
- # EOS
19
- # puts fail_message if error_status != 256 && error_status != 4096
20
- raise "[#{error_status}] Failed to run command: #{cmd}"
21
- end
22
7
 
23
- # Run the command using system(..)
8
+ def fail(cmd, process_status)
9
+ raise "[exited=#{process_status.exitstatus}, pid=#{process_status.pid}] Failed to run command: #{cmd}"
10
+ end
11
+
12
+ # Run the command
24
13
  def run(command, method, *args)
25
14
  cmd = command.send(method, *args)
26
15
 
@@ -52,18 +52,18 @@ namespace :air do
52
52
 
53
53
  print "Organization name (optional; e.g ducktyper.com): "
54
54
  input = STDIN.gets.chomp!
55
- optionals[:o] = "\"#{input}\"" unless input.blank?
55
+ optionals[:org] = "\"#{input}\"" unless input.blank?
56
56
 
57
57
  print "Organization unit (optional; e.g QE): "
58
- optionals[:ou] = STDIN.gets.chomp!
58
+ optionals[:org_unit] = STDIN.gets.chomp!
59
59
 
60
60
  print "Country (optional; e.g. US): "
61
- optionals[:c] = STDIN.gets.chomp!
61
+ optionals[:country] = STDIN.gets.chomp!
62
62
 
63
63
  print "Password: "
64
64
  password = STDIN.gets.chomp!
65
65
 
66
- Airake::Runner.run(project.adt, :certificate, cn, pfx_file, key_type, password, optionals)
66
+ Airake::Runner.run(project.adt, :generate_certificate, cn, pfx_file, key_type, password, optionals)
67
67
  end
68
68
 
69
69
  # Check certificate configuration for package task
@@ -96,6 +96,42 @@ namespace :air do
96
96
  Airake::Runner.run(project.adl, :launch)
97
97
  end
98
98
 
99
+ desc "Compile component"
100
+ task :acompc do
101
+ source_path = ENV["SOURCE"]
102
+ output_path = ENV["OUTPUT"]
103
+ packages = ENV["PACKAGES"]
104
+
105
+ if source_path.blank? and output_path.blank? and packages.blank?
106
+ puts <<-EOS
107
+ You can run without input by specifying the environment variables, e.g.:
108
+
109
+ rake air:acompc SOURCE=src/ OUTPUT=Foo.swc PACKAGES="com.foo.utils com.bar.baz"
110
+
111
+ EOS
112
+ end
113
+
114
+ if source_path.blank?
115
+ print "Source path [src]: "
116
+ source_path = STDIN.gets.chomp!
117
+ source_path = "src" if source_path.blank?
118
+ end
119
+
120
+ if output_path.blank?
121
+ print "Output path (e.g. Foo.swc): "
122
+ output_path = STDIN.gets.chomp!
123
+ raise "Invalid output path" if output_path.blank?
124
+ end
125
+
126
+ if packages.blank?
127
+ print "Packages (e.g. com.airake.utils com.airake.foo): "
128
+ packages = STDIN.gets.chomp!
129
+ raise "Invalid packages" if packages.blank?
130
+ end
131
+
132
+ Airake::Runner.run(Airake::Commands::Acompc.new(:source_path => source_path, :include_packages => packages.split(" "), :output_path => output_path), :compile)
133
+ end
134
+
99
135
  desc "Clean"
100
136
  task :clean do
101
137
  project = Airake::Project.new_from_rake(ENV)
@@ -2,7 +2,7 @@ module Airake #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 6
5
+ TINY = 7
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/airake.rb CHANGED
@@ -4,6 +4,7 @@ require 'airake/daemonize'
4
4
  require 'airake/fcsh'
5
5
  require 'airake/fcshd'
6
6
  require 'airake/commands/base'
7
+ require 'airake/commands/acompc'
7
8
  require 'airake/commands/amxmlc'
8
9
  require 'airake/commands/adl'
9
10
  require 'airake/commands/adt'
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: airake
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.6
7
- date: 2007-10-17 00:00:00 -04:00
6
+ version: 0.2.7
7
+ date: 2007-11-04 00:00:00 -04:00
8
8
  summary: Tasks and generators for Adobe AIR apps
9
9
  require_paths:
10
10
  - lib
@@ -59,6 +59,7 @@ files:
59
59
  - config/hoe.rb
60
60
  - config/requirements.rb
61
61
  - lib/airake.rb
62
+ - lib/airake/commands/acompc.rb
62
63
  - lib/airake/commands/adl.rb
63
64
  - lib/airake/commands/adt.rb
64
65
  - lib/airake/commands/amxmlc.rb
@@ -71,7 +72,6 @@ files:
71
72
  - lib/airake/runner.rb
72
73
  - lib/airake/tasks.rb
73
74
  - lib/airake/tasks/air.rake
74
- - lib/airake/tasks/deployment.rake
75
75
  - lib/airake/tasks/fcsh.rake
76
76
  - lib/airake/version.rb
77
77
  - script/destroy
@@ -1,27 +0,0 @@
1
- # Deprecated; see fsch.rake
2
-
3
- namespace :air do
4
-
5
- task :start_fcshd do
6
- puts "Starting FCSHD..."
7
- PatternPark::FCSHD.start_from_rake(ENV)
8
- end
9
-
10
- task :fcshd => :start_fcshd # Alias
11
-
12
- task :stop_fcshd do
13
- begin
14
- fcsh = PatternPark::FCSH.new_from_rake(ENV)
15
- fcsh.stop
16
- rescue
17
- puts "Could not stop FCSHD"
18
- end
19
- end
20
-
21
- task :restart_fcshd => [ :stop_fcshd, :sleep, :start_fcshd ]
22
-
23
- task :sleep do
24
- sleep 2
25
- end
26
-
27
- end