airake 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.4.4 2008-06-25
2
+
3
+ * Can use to compile flash swfs
4
+
1
5
  === 0.4.3 2008-03-01
2
6
 
3
7
  * Fix test env
data/Manifest.txt CHANGED
@@ -47,6 +47,8 @@ lib/airake/daemonize.rb
47
47
  lib/airake/fcsh.rb
48
48
  lib/airake/fcshd.rb
49
49
  lib/airake/project.rb
50
+ lib/airake/projects/air.rb
51
+ lib/airake/projects/flash.rb
50
52
  lib/airake/runner.rb
51
53
  lib/airake/tasks.rb
52
54
  lib/airake/tasks/air.rake
data/lib/airake.rb CHANGED
@@ -16,6 +16,8 @@ require 'airake/commands/adl'
16
16
  require 'airake/commands/adt'
17
17
  require 'airake/commands/asdoc'
18
18
  require 'airake/project'
19
+ require 'airake/projects/air'
20
+ require 'airake/projects/flash'
19
21
  require 'airake/runner'
20
22
  require 'rake'
21
23
  require 'airake/tasks'
@@ -5,7 +5,7 @@ module Airake #:nodoc:
5
5
  # MXMLC (MXML compiler)
6
6
  class Mxmlc < Base
7
7
 
8
- attr_reader :mxmlc_path, :mxmlc_extra_opts, :swf_path, :mxml_path, :lib_dir, :src_dirs, :debug
8
+ attr_reader :mxmlc_path, :mxmlc_extra_opts, :swf_path, :target_file, :lib_dir, :src_dirs, :debug
9
9
  attr_reader :config_name
10
10
 
11
11
  # Create MXMLC command.
@@ -13,14 +13,14 @@ module Airake #:nodoc:
13
13
  # ==== Options
14
14
  # +mxmlc_path+:: Path to flex compiler, defaults to 'mxmlc'
15
15
  # +swf_path+:: Path to generated swf (required)
16
- # +mxml_path+:: Path to mxml (required)
16
+ # +target_file+:: Path to target file (.mxml file) (required)
17
17
  # +lib_dir+:: Path to lib directory. Will load swc files from here or source directories
18
18
  # +src_dirs+:: Path to source directories (required)
19
19
  # +config_name+:: Config name, like 'air'
20
20
  # +mxmlc_extra_opts+:: Extra options to pass to compiler
21
21
  #
22
22
  def initialize(options = {})
23
- assert_required(options, [ :swf_path, :mxml_path, :src_dirs ])
23
+ assert_required(options, [ :swf_path, :target_file, :src_dirs ])
24
24
 
25
25
  default_mxmlc_path = options[:config_name].blank? ? "mxmlc" : "mxmlc +configname=#{options[:config_name]}"
26
26
 
@@ -42,7 +42,7 @@ module Airake #:nodoc:
42
42
  command << escape(@swf_path)
43
43
  command << "-debug=#{@debug}" unless @debug.nil?
44
44
  command << "--"
45
- command << escape(@mxml_path)
45
+ command << escape(@target_file)
46
46
  process(command)
47
47
  end
48
48
 
@@ -1,12 +1,8 @@
1
1
  module Airake
2
2
 
3
- # Project for AIR application
4
- #
5
3
  class Project
6
4
 
7
- attr_reader :base_dir, :src_dirs, :lib_dir
8
- attr_reader :mxml_path, :appxml_path, :air_path, :swf_path
9
- attr_reader :debug, :assets, :certificate
5
+ attr_reader :env, :base_dir, :src_dirs, :lib_dir, :swf_path, :debug
10
6
 
11
7
  # Create project.
12
8
  #
@@ -14,33 +10,24 @@ module Airake
14
10
  # +env+: Environment, such as development, test, production. Defaults to ENV["AIRAKE_ENV"].
15
11
  # +base_dir+: Base (project) directory. Defaults to ENV["AIRAKE_ROOT"]
16
12
  # +options+: If nil, options are loaded from airake.yml in root. (All paths relative to base directory)
17
- # - +mxml_path+: Path to the ProjectName.mxml
18
- # - +appxml_path+: Path to application descriptor
19
13
  # - +src_dirs+: Paths to source
20
14
  # - +lib_dir+: Path to lib directory
21
- # - +air_path+: Path to AIR file
22
15
  # - +swf_path+: Path to SWF file
23
16
  # - +debug+: "true" or "false"
24
- # - +assets+: Path to assets
25
- # - +certificate+: Path to certificate
26
17
  #
27
18
  # ==== More options:
28
19
  # * mxmlc_path
29
- # * adt_path
30
- # * adl_path
31
20
  # * asdoc_path
32
21
  # * mxmlc_extra_opts
33
- # * adt_extra_opts
34
- # * adl_extra_opts
35
22
  # * asdoc_extra_opts
36
23
  #
37
24
  def initialize(env = nil, base_dir = nil, options = nil)
38
-
39
- env = ENV["AIRAKE_ENV"] if env.nil?
25
+ @env = env
26
+ @env = ENV["AIRAKE_ENV"] if @env.nil?
40
27
  base_dir = ENV["AIRAKE_ROOT"] if base_dir.nil?
41
28
  raise "Need to specify an AIRAKE_ROOT (project root)" if base_dir.blank?
42
29
 
43
- #puts "Using environment: #{env}" if ENV["DEBUG"]
30
+ @base_dir = base_dir
44
31
 
45
32
  if options.nil?
46
33
  conf_path = File.join(base_dir, "airake.yml")
@@ -58,62 +45,26 @@ module Airake
58
45
  env_options = options[env]
59
46
  options = options.merge(env_options) if env_options
60
47
  options.symbolize_keys!
61
- #puts "Options: #{options.to_yaml}" if ENV["DEBUG"]
62
48
  end
63
49
 
64
- @base_dir = base_dir
65
-
66
- @mxml_path = File.join(base_dir, options[:mxml_path])
67
- @appxml_path = File.join(base_dir, options[:appxml_path])
68
-
69
- @src_dirs = options[:src_dirs].collect { |src_dir| File.join(base_dir, src_dir) }
70
- @lib_dir = File.join(base_dir, options[:lib_dir]) if options[:lib_dir]
71
-
72
- # Dest package files
73
- @air_path = File.join(base_dir, options[:air_path])
74
- @swf_path = File.join(base_dir, options[:swf_path])
75
-
76
- # Debug options
77
- @debug = options[:debug]
78
-
79
- with_keyed_options([ :assets, :certificate, :mxmlc_path, :adt_path, :adl_path, :asdoc_path,
80
- :mxmlc_extra_opts, :adt_extra_opts, :adl_extra_opts, :asdoc_extra_opts ], options)
81
-
82
- ensure_exists([ @mxml_path, @appxml_path, *@src_dirs ])
83
- end
84
-
85
- # Flex compiler command (under AIR) for this project
86
- def amxmlc
87
- mxmlc({ :config_name => "air" })
50
+ load(options)
51
+
52
+ ensure_exists([ *@src_dirs ])
88
53
  end
89
54
 
90
- # Flex compiler command for this project
91
- def mxmlc(options = {})
92
- options = options.merge({ :swf_path => @swf_path, :mxml_path => @mxml_path, :lib_dir => @lib_dir,
93
- :src_dirs => @src_dirs, :debug => @debug, :mxmlc_extra_opts => @mxmlc_extra_opts,
94
- :mxmlc_path => @mxmlc_path })
95
-
96
- Airake::Commands::Mxmlc.new(options)
97
- end
98
-
99
- # ADL command for this project
100
- def adl
101
- options = { :appxml_path => @appxml_path, :base_dir => @base_dir, :adl_extra_opts => @adl_extra_opts,
102
- :adl_path => @adl_path }
103
- Airake::Commands::Adl.new(options)
104
- end
105
-
106
- # ADT command for this project
107
- def adt
108
- options = { :air_path => @air_path, :appxml_path => @appxml_path, :swf_path => @swf_path,
109
- :base_dir => @base_dir, :assets => @assets, :cert => @certificate, :adt_extra_opts => @adt_extra_opts,
110
- :adt_path => @adt_path }
111
- Airake::Commands::Adt.new(options)
55
+ # Load options
56
+ def load(options = {})
57
+ @src_dirs = []
58
+ @src_dirs = options[:src_dirs].collect { |src_dir| File.join(base_dir, src_dir) } if options[:src_dirs]
59
+
60
+ @lib_dir = File.join(base_dir, options[:lib_dir]) if options[:lib_dir]
61
+ @swf_path = File.join(base_dir, options[:swf_path])
62
+
63
+ with_keyed_options([ :debug ], options)
112
64
  end
113
65
 
114
66
  # AS docs
115
67
  def asdoc
116
- src_dirs = [ @src_dir ]
117
68
  options = { :lib_dir => @lib_dir, :src_dirs => @src_dirs, :asdoc_extra_opts => @asdoc_extra_opts,
118
69
  :asdoc_path => @asdoc_path }
119
70
  Airake::Commands::Asdoc.new(options)
@@ -121,10 +72,7 @@ module Airake
121
72
 
122
73
  # Remove files
123
74
  def clean
124
- paths = [ swf_path, air_path ]
125
- paths.each do |path|
126
- FileUtils.rm(path, :verbose => true) if File.exist?(path)
127
- end
75
+ FileUtils.rm(@swf_path, :verbose => true) if File.exist?(@swf_path)
128
76
  end
129
77
 
130
78
  protected
@@ -0,0 +1,78 @@
1
+ module Airake
2
+
3
+ module Projects
4
+
5
+ # Project for AIR application
6
+ class Air < Airake::Project
7
+
8
+ attr_reader :mxml_path, :appxml_path, :air_path
9
+ attr_reader :assets, :certificate
10
+
11
+ # Load options
12
+ #
13
+ # +options+: If nil, options are loaded from airake.yml in root. (All paths relative to base directory)
14
+ # - +air_path+: Path to AIR file
15
+ # - +mxml_path+: Path to the ProjectName.mxml
16
+ # - +appxml_path+: Path to application descriptor
17
+ # - +assets+: Path to assets
18
+ # - +certificate+: Path to certificate
19
+ #
20
+ # ==== More options
21
+ # * adt_path
22
+ # * adl_path
23
+ # * adt_extra_opts
24
+ # * adl_extra_opts
25
+ #
26
+ def load(options = {})
27
+ super(options)
28
+
29
+ @air_path = File.join(base_dir, options[:air_path])
30
+ @mxml_path = File.join(base_dir, options[:mxml_path])
31
+ @appxml_path = File.join(base_dir, options[:appxml_path])
32
+
33
+ with_keyed_options([ :assets, :certificate, :mxmlc_path, :adt_path, :adl_path, :asdoc_path,
34
+ :mxmlc_extra_opts, :adt_extra_opts, :adl_extra_opts, :asdoc_extra_opts ], options)
35
+
36
+ ensure_exists([ @mxml_path, @appxml_path ])
37
+ end
38
+
39
+ # Flex compiler command (under AIR) for this project
40
+ def amxmlc
41
+ mxmlc({ :config_name => "air" })
42
+ end
43
+
44
+ # Flex compiler command for this project
45
+ def mxmlc(options = {})
46
+ options = options.merge({ :swf_path => @swf_path, :target_file => @mxml_path, :lib_dir => @lib_dir,
47
+ :src_dirs => @src_dirs, :debug => @debug, :mxmlc_extra_opts => @mxmlc_extra_opts,
48
+ :mxmlc_path => @mxmlc_path })
49
+
50
+ Airake::Commands::Mxmlc.new(options)
51
+ end
52
+
53
+ # ADL command for this project
54
+ def adl
55
+ options = { :appxml_path => @appxml_path, :base_dir => @base_dir, :adl_extra_opts => @adl_extra_opts,
56
+ :adl_path => @adl_path }
57
+ Airake::Commands::Adl.new(options)
58
+ end
59
+
60
+ # ADT command for this project
61
+ def adt
62
+ options = { :air_path => @air_path, :appxml_path => @appxml_path, :swf_path => @swf_path,
63
+ :base_dir => @base_dir, :assets => @assets, :cert => @certificate, :adt_extra_opts => @adt_extra_opts,
64
+ :adt_path => @adt_path }
65
+ Airake::Commands::Adt.new(options)
66
+ end
67
+
68
+ def clean
69
+ paths = [ @swf_path, @air_path ]
70
+ paths.each do |path|
71
+ FileUtils.rm(path, :verbose => true) if File.exist?(path)
72
+ end
73
+ end
74
+ end
75
+
76
+ end
77
+
78
+ end
@@ -0,0 +1,34 @@
1
+ module Airake
2
+
3
+ module Projects
4
+
5
+ # Project for Flash
6
+ class Flash < Airake::Project
7
+
8
+ attr_reader :target_file
9
+
10
+ # Load options
11
+ #
12
+ # +options+: If nil, options are loaded from airake.yml in root. (All paths relative to base directory)
13
+ # - +target_file+: Path to target file
14
+ #
15
+ def load(options = {})
16
+ super(options)
17
+ with_keyed_options([ :target_file ], options)
18
+ ensure_exists([ @target_file ])
19
+ end
20
+
21
+ # Flex compiler command for this project
22
+ def mxmlc(options = {})
23
+ options = options.merge({ :swf_path => @swf_path, :target_file => @target_file, :lib_dir => @lib_dir,
24
+ :src_dirs => @src_dirs, :debug => @debug, :mxmlc_extra_opts => @mxmlc_extra_opts,
25
+ :mxmlc_path => @mxmlc_path })
26
+
27
+ Airake::Commands::Mxmlc.new(options)
28
+ end
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -3,7 +3,7 @@ namespace :air do
3
3
  desc "Compile"
4
4
  task :compile => :clean do
5
5
  begin
6
- project = Airake::Project.new
6
+ project = Airake::Projects::Air.new
7
7
  fcsh = PatternPark::FCSH.new_from_rake(ENV)
8
8
  fcsh.execute([ project.base_dir, project.amxmlc.compile ])
9
9
  rescue PatternPark::FCSHConnectError => e
@@ -17,7 +17,7 @@ namespace :air do
17
17
  ENV["AIRAKE_ENV"] = "test"
18
18
  Rake::Task["air:clean"].invoke
19
19
 
20
- test_project = Airake::Project.new
20
+ test_project = Airake::Projects::Air.new
21
21
  Airake::Runner.run(test_project.amxmlc, :compile)
22
22
  Airake::Runner.run(test_project.adl, :launch)
23
23
  end
@@ -28,7 +28,7 @@ namespace :air do
28
28
  pfx_file = ENV["CERTIFICATE"]
29
29
 
30
30
  unless pfx_file
31
- project = Airake::Project.new
31
+ project = Airake::Projects::Air.new
32
32
  pfx_file = project.certificate
33
33
  end
34
34
 
@@ -47,7 +47,7 @@ namespace :air do
47
47
 
48
48
  puts "Will generate a certificate file at: #{pfx_file}"
49
49
 
50
- project = Airake::Project.new
50
+ project = Airake::Projects::Air.new
51
51
  optionals = {}
52
52
 
53
53
  print "Specify common name (e.g. SelfSign, ADigitalID) [SelfSign]: "
@@ -79,7 +79,7 @@ namespace :air do
79
79
  pfx_file = ENV["CERTIFICATE"]
80
80
 
81
81
  unless pfx_file
82
- project = Airake::Project.new
82
+ project = Airake::Projects::Air.new
83
83
  pfx_file = project.certificate
84
84
  end
85
85
 
@@ -109,7 +109,7 @@ namespace :air do
109
109
 
110
110
  desc "Package only"
111
111
  task :package_only do
112
- project = Airake::Project.new
112
+ project = Airake::Projects::Air.new
113
113
  Airake::Runner.run(project.adt, :package)
114
114
  end
115
115
 
@@ -122,7 +122,7 @@ namespace :air do
122
122
 
123
123
  desc "Launch ADL only"
124
124
  task :adl_only do
125
- project = Airake::Project.new
125
+ project = Airake::Projects::Air.new
126
126
  Airake::Runner.run(project.adl, :launch)
127
127
  end
128
128
 
@@ -164,13 +164,13 @@ namespace :air do
164
164
 
165
165
  desc "Docs"
166
166
  task :docs do
167
- project = Airake::Project.new
167
+ project = Airake::Projects::Air.new
168
168
  Airake::Runner.run(project.asdoc, :generate)
169
169
  end
170
170
 
171
171
  desc "Clean"
172
172
  task :clean do
173
- project = Airake::Project.new
173
+ project = Airake::Projects::Air.new
174
174
  project.clean
175
175
  end
176
176
 
@@ -3,23 +3,15 @@ namespace :flash do
3
3
  desc "Compile (on flash)"
4
4
  task :compile => :clean do
5
5
  begin
6
- project = Airake::Project.new_from_rake(ENV)
6
+ project = Airake::Projects::Flash.new
7
7
  Airake::Runner.run(project.mxmlc, :compile)
8
8
  end
9
9
  end
10
10
 
11
11
  desc "Clean"
12
12
  task :clean do
13
- project = Airake::Project.new_from_rake(ENV)
14
- paths = project.to_clean
15
-
16
- # Test
17
- test_project = Airake::Project.new_from_rake(ENV, :test)
18
- paths += project.to_clean
19
-
20
- paths.each do |path|
21
- FileUtils.rm(path, :verbose => true) if File.exist?(path)
22
- end
13
+ project = Airake::Projects::Flash.new
14
+ project.clean
23
15
  end
24
16
 
25
17
  desc "Run"
@@ -2,7 +2,7 @@ module Airake #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ""
6
6
  authors:
7
7
  - Gabriel Handford, Min Kim
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-23 00:00:00 -04:00
12
+ date: 2008-06-25 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -92,6 +92,8 @@ files:
92
92
  - lib/airake/fcsh.rb
93
93
  - lib/airake/fcshd.rb
94
94
  - lib/airake/project.rb
95
+ - lib/airake/projects/air.rb
96
+ - lib/airake/projects/flash.rb
95
97
  - lib/airake/runner.rb
96
98
  - lib/airake/tasks.rb
97
99
  - lib/airake/tasks/air.rake