airake 0.2.1 → 0.2.2

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.2.2 2007-10-11
2
+
3
+ * Fixed handling of spaces in name
4
+
1
5
  == 0.2.1 2007-10-10
2
6
 
3
7
  * Created browsair generator
data/Manifest.txt CHANGED
@@ -28,6 +28,7 @@ lib/airake.rb
28
28
  lib/airake/commands/adl.rb
29
29
  lib/airake/commands/adt.rb
30
30
  lib/airake/commands/amxmlc.rb
31
+ lib/airake/commands/base.rb
31
32
  lib/airake/core_ext/blank.rb
32
33
  lib/airake/daemonize.rb
33
34
  lib/airake/fcsh.rb
@@ -1,13 +1,14 @@
1
1
  class AirakeGenerator < RubiGen::Base
2
2
 
3
- attr_reader :app_name, :title, :url, :description
3
+ attr_reader :name, :app_name, :title, :url, :description
4
4
 
5
5
  def initialize(runtime_args, runtime_options = {})
6
6
  super
7
7
  usage if args.empty? || args.size < 1
8
- @destination_root = File.expand_path(args.shift)
9
- @app_name = File.basename(@destination_root).camelize
10
- @title = @app_name
8
+ @name = args.shift
9
+ @destination_root = File.expand_path(@name)
10
+ @app_name = File.basename(@destination_root).gsub(/\s+/, "").camelize
11
+ @title = @name
11
12
  @url = "http://airake.rubyforge.org/resources.html"
12
13
  @description = "Put description here"
13
14
  extract_options
@@ -1,14 +1,15 @@
1
1
  class BrowsairGenerator < RubiGen::Base
2
2
 
3
- attr_reader :app_name, :url, :title, :description, :icon_src_path
3
+ attr_reader :name, :app_name, :url, :title, :description, :icon_src_path
4
4
 
5
5
  def initialize(runtime_args, runtime_options = {})
6
6
  super
7
7
  usage if args.empty? || args.size < 2
8
- @destination_root = File.expand_path(args.shift)
9
- @app_name = File.basename(@destination_root)
8
+ @name = args.shift
9
+ @destination_root = File.expand_path(@name)
10
+ @app_name = File.basename(@destination_root).gsub(/\s+/, "")
10
11
  @url = args.shift
11
- @title = "#{@app_name} - #{@url}"
12
+ @title = "#{@name} - #{@url}"
12
13
  @description = "AIR Browser for #{@url}"
13
14
  @icon_src_path = File.expand_path(args.shift) unless args.empty?
14
15
  extract_options
@@ -2,7 +2,7 @@ module Airake
2
2
 
3
3
  module Commands
4
4
 
5
- class Adl
5
+ class Adl < Airake::Commands::Base
6
6
 
7
7
  attr_reader :project, :path, :extra_opts
8
8
 
@@ -17,9 +17,9 @@ module Airake
17
17
  command = []
18
18
  command << @path
19
19
  command << @extra_opts
20
- command << project.appxml_path
21
- command << project.base_dir
22
- command.compact.join(" ")
20
+ command << escape(project.appxml_path)
21
+ command << escape(project.base_dir)
22
+ process(command)
23
23
  end
24
24
 
25
25
  end
@@ -2,7 +2,7 @@ module Airake
2
2
 
3
3
  module Commands
4
4
 
5
- class Adt
5
+ class Adt < Airake::Commands::Base
6
6
 
7
7
  attr_reader :project, :path, :certificate, :extra_opts, :assets
8
8
 
@@ -21,11 +21,11 @@ module Airake
21
21
  command << @extra_opts
22
22
  command << "-package"
23
23
  command << "-certificate #{@certificate}"
24
- command << project.relative_path(project.air_path)
25
- command << project.relative_path(project.appxml_path)
26
- command << project.relative_path(project.swf_path)
24
+ command << escape(project.relative_path(project.air_path))
25
+ command << escape(project.relative_path(project.appxml_path))
26
+ command << escape(project.relative_path(project.swf_path))
27
27
  command << @assets
28
- command.compact.join(" ")
28
+ process(command)
29
29
  end
30
30
 
31
31
  # Generate a certificate
@@ -46,9 +46,9 @@ module Airake
46
46
  command << "-o #{optionals[:o]}" if !optionals[:o].blank?
47
47
  command << "-c #{optionals[:c]}" if !optionals[:c].blank?
48
48
  command << key_type
49
- command << pfx_file
49
+ command << escape(pfx_file)
50
50
  command << password
51
- command.compact.join(" ")
51
+ process(command)
52
52
  end
53
53
 
54
54
  end
@@ -2,7 +2,7 @@ module Airake
2
2
 
3
3
  module Commands
4
4
 
5
- class Amxmlc
5
+ class Amxmlc < Airake::Commands::Base
6
6
 
7
7
  attr_reader :project, :path, :extra_opts
8
8
 
@@ -16,24 +16,25 @@ module Airake
16
16
  def compile
17
17
  command = []
18
18
  command << @path
19
- #command << "+configname=air"
20
19
  command << source_path_option
21
20
  command << library_path_option
22
- command << "-output #{project.swf_path}"
21
+ command << "-output"
22
+ command << escape(project.swf_path)
23
23
  command << project.debug_option
24
24
  command << @extra_opts
25
25
  command << "-disable-incremental-optimizations=true"
26
- command << "-- #{project.mxml_path}"
27
- command.compact.join(" ")
26
+ command << "--"
27
+ command << escape(project.mxml_path)
28
+ process(command)
28
29
  end
29
30
 
30
31
  protected
31
32
 
32
33
  def source_path_option
33
34
  # List of directories in lib/ for source_path +=
34
- lib_source_paths = Dir["#{project.lib_dir}/*"].collect { |f| f if File.directory?(f) }.compact
35
- lib_source_paths << project.test_dir if File.directory?(project.test_dir)
36
- lib_source_paths << project.src_dir if File.directory?(project.src_dir)
35
+ lib_source_paths = Dir["#{project.lib_dir}/*"].collect { |f| escape(f) if File.directory?(f) }.compact
36
+ lib_source_paths << escape(project.test_dir) if File.directory?(project.test_dir)
37
+ lib_source_paths << escape(project.src_dir) if File.directory?(project.src_dir)
37
38
 
38
39
  source_paths ||= lib_source_paths
39
40
  source_paths.empty? ? "" : "-source-path #{source_paths.join(" ")}"
@@ -41,7 +42,7 @@ module Airake
41
42
 
42
43
  def library_path_option
43
44
  library_paths = []
44
- library_paths << project.lib_dir if File.directory?(project.lib_dir)
45
+ library_paths << escape(project.lib_dir) if File.directory?(project.lib_dir)
45
46
  library_paths.empty? ? "" : "-library-path+=#{library_paths.join(" ")}"
46
47
  end
47
48
 
@@ -0,0 +1,21 @@
1
+ module Airake
2
+
3
+ module Commands
4
+
5
+ class Base
6
+
7
+ # Process command options array
8
+ def process(command)
9
+ command.compact.join(" ")
10
+ end
11
+
12
+ # Escape any spacing
13
+ def escape(command)
14
+ command.to_s.gsub(" ", "\\ ")
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -4,7 +4,6 @@ module Airake
4
4
  # Project settings for AIR app
5
5
  class Project
6
6
 
7
- attr_reader :project_name
8
7
  attr_reader :base_dir, :bin_dir, :src_dir, :lib_dir, :test_dir
9
8
  attr_reader :mxml_path, :appxml_path, :air_path, :swf_path
10
9
  attr_reader :debug
@@ -21,19 +20,20 @@ module Airake
21
20
  # mxml_path: Path to the project.mxml (relative)
22
21
  # options:: Override default paths, commands, extra opts, etc; See Options class var
23
22
  def initialize(base_dir, mxml_path, options = {})
23
+ raise ArgumentError, "Invalid MXML path: #{mxml_path}" if mxml_path.blank?
24
+
25
+ mxml_dir = File.expand_path(File.dirname(mxml_path))
26
+ project_name = File.basename(mxml_path, ".mxml")
27
+
24
28
  @base_dir = base_dir
25
- @mxml_path = mxml_path
29
+ @mxml_path = File.join(mxml_dir, "#{project_name}.mxml")
26
30
  @options = options
27
31
 
28
- raise ArgumentError, "Invalid MXML path: #{mxml_path}" if mxml_path.blank?
29
-
30
32
  @bin_dir = options[:bin_dir] || File.join(base_dir, "bin")
31
33
  @src_dir = options[:src_dir] || File.join(base_dir, "src")
32
34
  @lib_dir = options[:lib_dir] || File.join(base_dir, "lib")
33
- @test_dir = options[:test_dir] || File.join(base_dir, "test")
35
+ @test_dir = options[:test_dir] || File.join(base_dir, "test")
34
36
 
35
- @project_name = File.basename(@mxml_path, ".mxml")
36
- mxml_dir = File.expand_path(File.dirname(@mxml_path))
37
37
  @appxml_path = options[:appxml_path] || File.join(mxml_dir, "#{project_name}-app.xml")
38
38
 
39
39
  # Dest package files
@@ -30,7 +30,11 @@ namespace :air do
30
30
  end
31
31
 
32
32
  if File.exist?(pfx_file)
33
- raise "Certificate file exists at '#{pfx_file}'. If you want to generate a new certificate, please delete it first."
33
+ raise <<-EOS
34
+ Certificate file exists at '#{pfx_file}'. If you want to generate a new certificate, please delete it first.
35
+ You can override the setting in the Rakefile, e.g.: rake air:certificate CERTIFICATE=path.pfx
36
+ EOS
37
+
34
38
  end
35
39
 
36
40
  puts "Will generate a certificate file at: #{pfx_file}"
@@ -2,7 +2,7 @@ module Airake #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/airake.rb CHANGED
@@ -3,6 +3,7 @@ $:.unshift File.dirname(__FILE__)
3
3
  require 'airake/daemonize'
4
4
  require 'airake/fcsh'
5
5
  require 'airake/fcshd'
6
+ require 'airake/commands/base'
6
7
  require 'airake/commands/amxmlc'
7
8
  require 'airake/commands/adl'
8
9
  require 'airake/commands/adt'
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.2.1
6
+ version: 0.2.2
7
7
  date: 2007-10-11 00:00:00 -04:00
8
8
  summary: Adobe AIR generators and tasks
9
9
  require_paths:
@@ -59,6 +59,7 @@ files:
59
59
  - lib/airake/commands/adl.rb
60
60
  - lib/airake/commands/adt.rb
61
61
  - lib/airake/commands/amxmlc.rb
62
+ - lib/airake/commands/base.rb
62
63
  - lib/airake/core_ext/blank.rb
63
64
  - lib/airake/daemonize.rb
64
65
  - lib/airake/fcsh.rb