flex-sdk 0.4.1 → 0.5.0

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/.document CHANGED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # Manual here: http://gembundler.com/
2
+ #
3
+ #source :rubygems
4
+ source "http://rubygems.org"
5
+
6
+ gem 'rake'
7
+ gem 'jeweler'
8
+ gem 'bundler'
9
+ gem 'rspec', "<2"
10
+ gem 'thoughtbot-shoulda'
11
+ gem 'activesupport'
12
+ gem 'i18n'
data/Gemfile.lock ADDED
@@ -0,0 +1,29 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.0.1)
5
+ gemcutter (0.6.1)
6
+ git (1.2.5)
7
+ i18n (0.4.2)
8
+ jeweler (1.4.0)
9
+ gemcutter (>= 0.1.0)
10
+ git (>= 1.2.5)
11
+ rubyforge (>= 2.0.0)
12
+ json_pure (1.4.6)
13
+ rake (0.8.7)
14
+ rspec (1.3.1)
15
+ rubyforge (2.0.4)
16
+ json_pure (>= 1.1.7)
17
+ thoughtbot-shoulda (2.11.1)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ activesupport
24
+ bundler
25
+ i18n
26
+ jeweler
27
+ rake
28
+ rspec (< 2)
29
+ thoughtbot-shoulda
data/Rakefile CHANGED
@@ -1,53 +1,61 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
 
4
+
4
5
  begin
5
6
  require 'jeweler'
6
7
  Jeweler::Tasks.new do |gem|
7
8
  gem.name = "flex-sdk"
8
- gem.summary = %Q{Flex SDK Gem}
9
- gem.description = %Q{Flex SDK Gem for redistribution to build servers and developers}
9
+ gem.summary = %Q{Flex SDK Gem and Thor Built utilities}
10
+ gem.description = %Q{Flex SDK Gem for redistribution to build servers and other developers. Also provides a simple DSL for calling Mxmlc and Compc from Thor tasks}
10
11
  gem.email = "jonathan.hoskin@visfleet.com"
11
12
  gem.homepage = "http://github.com/visfleet/flex-sdk"
12
- gem.authors = ["Jonathan Hoskin"]
13
+ gem.authors = ["Jonathan Hoskin", "Rasheed Abdul-Aziz"]
14
+ gem.add_development_dependency "rspec", ">= 1.2.9"
13
15
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ gem.add_dependency "i18n"
17
+ gem.add_dependency "activesupport"
15
18
  end
16
19
  Jeweler::GemcutterTasks.new
17
20
  rescue LoadError
18
21
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
22
  end
20
23
 
21
- require 'rake/testtask'
22
- Rake::TestTask.new(:test) do |test|
23
- test.libs << 'lib' << 'test'
24
- test.pattern = 'test/**/test_*.rb'
25
- test.verbose = true
24
+ require 'spec/rake/spectask'
25
+ Spec::Rake::SpecTask.new(:spec) do |spec|
26
+ spec.libs << 'lib' << 'spec'
27
+ spec.spec_files = FileList['spec/**/*_spec.rb']
28
+ end
29
+
30
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
31
+ spec.libs << 'lib' << 'spec'
32
+ spec.pattern = 'spec/**/*_spec.rb'
33
+ spec.rcov = true
26
34
  end
27
35
 
36
+ task :spec => :check_dependencies
37
+
28
38
  begin
29
- require 'rcov/rcovtask'
30
- Rcov::RcovTask.new do |test|
31
- test.libs << 'test'
32
- test.pattern = 'test/**/test_*.rb'
33
- test.verbose = true
39
+ require 'reek/adapters/rake_task'
40
+ Reek::RakeTask.new do |t|
41
+ t.fail_on_error = true
42
+ t.verbose = false
43
+ t.source_files = 'lib/**/*.rb'
34
44
  end
35
45
  rescue LoadError
36
- task :rcov do
37
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
46
+ task :reek do
47
+ abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
38
48
  end
39
49
  end
40
50
 
41
- task :test => :check_dependencies
42
-
43
- task :default => :test
51
+ task :default => :spec
44
52
 
45
53
  require 'rake/rdoctask'
46
54
  Rake::RDocTask.new do |rdoc|
47
55
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
56
 
49
57
  rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "flex-sdk #{version}"
58
+ rdoc.title = "test #{version}"
51
59
  rdoc.rdoc_files.include('README*')
52
60
  rdoc.rdoc_files.include('lib/**/*.rb')
53
61
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.5.0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib')) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__) + '/../lib'))
4
- require 'flex-sdk'
4
+ require 'flex_sdk'
5
5
 
6
6
  flexsdk = FlexSDK.new
7
7
  config = flexsdk.config
data/bin/flex-sdk-path CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib')) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__) + '/../lib'))
4
- require 'flex-sdk'
4
+ require 'flex_sdk'
5
5
 
6
6
  flexsdk = FlexSDK.new
7
7
  config = flexsdk.config
data/bin/flex-sdk-prime CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib')) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__) + '/../lib'))
4
- require 'flex-sdk'
4
+ require 'flex_sdk'
5
5
 
6
6
  flexsdk = FlexSDK.new
7
7
  config = flexsdk.config
data/flex-sdk.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flex-sdk}
8
- s.version = "0.4.1"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jonathan Hoskin"]
12
- s.date = %q{2010-11-03}
13
- s.description = %q{Flex SDK Gem for redistribution to build servers and developers}
11
+ s.authors = ["Jonathan Hoskin", "Rasheed Abdul-Aziz"]
12
+ s.date = %q{2010-11-09}
13
+ s.description = %q{Flex SDK Gem for redistribution to build servers and other developers. Also provides a simple DSL for calling Mxmlc and Compc from Thor tasks}
14
14
  s.email = %q{jonathan.hoskin@visfleet.com}
15
15
  s.executables = ["flex-sdk-copylocale", "flex-sdk-path", "flex-sdk-prime"]
16
16
  s.extra_rdoc_files = [
@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
20
20
  s.files = [
21
21
  ".document",
22
22
  ".gitignore",
23
+ "Gemfile",
24
+ "Gemfile.lock",
23
25
  "LICENSE",
24
26
  "README.markdown",
25
27
  "Rakefile",
@@ -29,18 +31,27 @@ Gem::Specification.new do |s|
29
31
  "bin/flex-sdk-prime",
30
32
  "config.yml",
31
33
  "flex-sdk.gemspec",
32
- "lib/flex-sdk.rb",
33
- "test/helper.rb",
34
- "test/test_flex-sdk.rb"
34
+ "lib/flex_compiler.rb",
35
+ "lib/flex_sdk.rb",
36
+ "lib/flex_sdk/flex_sdk.rb",
37
+ "lib/opt_builder.rb",
38
+ "lib/shell.rb",
39
+ "spec/flex-sdk_spec.rb",
40
+ "spec/opts-builder_spec.rb",
41
+ "spec/spec.opts",
42
+ "spec/spec_helper.rb",
43
+ "spec/test.rb"
35
44
  ]
36
45
  s.homepage = %q{http://github.com/visfleet/flex-sdk}
37
46
  s.rdoc_options = ["--charset=UTF-8"]
38
47
  s.require_paths = ["lib"]
39
48
  s.rubygems_version = %q{1.3.7}
40
- s.summary = %q{Flex SDK Gem}
49
+ s.summary = %q{Flex SDK Gem and Thor Built utilities}
41
50
  s.test_files = [
42
- "test/helper.rb",
43
- "test/test_flex-sdk.rb"
51
+ "spec/flex-sdk_spec.rb",
52
+ "spec/opts-builder_spec.rb",
53
+ "spec/spec_helper.rb",
54
+ "spec/test.rb"
44
55
  ]
45
56
 
46
57
  if s.respond_to? :specification_version then
@@ -48,12 +59,21 @@ Gem::Specification.new do |s|
48
59
  s.specification_version = 3
49
60
 
50
61
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
62
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
51
63
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
64
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
65
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
52
66
  else
67
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
53
68
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
69
+ s.add_dependency(%q<i18n>, [">= 0"])
70
+ s.add_dependency(%q<activesupport>, [">= 0"])
54
71
  end
55
72
  else
73
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
56
74
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
75
+ s.add_dependency(%q<i18n>, [">= 0"])
76
+ s.add_dependency(%q<activesupport>, [">= 0"])
57
77
  end
58
78
  end
59
79
 
@@ -0,0 +1,180 @@
1
+ require 'flex_sdk'
2
+ require 'opt_builder'
3
+ require 'shell'
4
+
5
+ module FlexCompiler
6
+
7
+ # Module Methods
8
+
9
+ def self.artifact_root
10
+ "./build/"
11
+ end
12
+
13
+ def self.included(base)
14
+ base.extend(ClassMethods)
15
+ end
16
+
17
+ # Class Methods
18
+ module ClassMethods
19
+ def artifact(type, path_fragment)
20
+ (@artifacts ||= {})[type.to_sym] = path_fragment
21
+ end
22
+
23
+ def artifact_path(type)
24
+ File.join(FlexCompiler.artifact_root,@artifacts[type.to_sym])
25
+ end
26
+ end
27
+
28
+ def artifact_path(type)
29
+ self.class.send(:artifact_path,type)
30
+ end
31
+
32
+ def compc(opts="")
33
+ command = "#{Shell.escape File.join(sdk_dir,"bin","compc")} #{opts.to_s}"
34
+ puts command
35
+ `#{command}`
36
+ end
37
+
38
+ def mxmlc
39
+ puts ("mxmlc")
40
+ end
41
+
42
+ def sdk_dir
43
+ sdk_config["sdk_dir"]
44
+ end
45
+
46
+ def sdk_config
47
+ FlexSDK.new.config
48
+ end
49
+
50
+
51
+ class GenericOpts < OptBuilder
52
+ single :benchmark
53
+ single :accessible, { :alias_for => "compiler.accessible" }
54
+ single :encoding, { :alias_for => "compiler.actionscript-file-encoding" }
55
+ single :allow_source_path_overlap, { :alias_for => "compiler.allow-source-path-overlap" }
56
+ single :as3, { :alias_for => "compiler.as3" }
57
+ single :context_root, { :alias_for => "compiler.context-root" }
58
+ single :debug, { :alias_for => "compiler.debug" }
59
+ collection :default_css_files, { :alias_for => "compiler.defaults-css-files" }
60
+ single :default_css_url, { :alias_for => "compiler.defaults-css-url" }
61
+ single :define, { :alias_for => "compiler.define" }
62
+ single :es, { :alias_for => "compiler.es" }
63
+ collection :external_library_path, { :alias_for => "compiler.external-library-path" }
64
+ single :advanced_anti_aliasing, { :alias_for => "compiler.fonts.advanced-anti-aliasing" }
65
+ single :flash_type, { :alias_for => "compiler.fonts.flash-type" }
66
+ single :language_range, { :alias_for => "compiler.fonts.languages.language-range" }
67
+ single :local_fonts_snapshot, { :alias_for => "compiler.fonts.local-fonts-snapshot" }
68
+ collection :font_managers, { :alias_for => "compiler.fonts.managers" }
69
+ single :max_cached_fonts, { :alias_for => "compiler.fonts.max-cached-fonts" }
70
+ single :max_glyphs, { :alias_for => "compiler.fonts.max-glyphs-per-face" }
71
+ single :headless, { :alias_for => "compiler.headless-server" }
72
+ collection :include_libraries, { :alias_for => "compiler.include-libraries" }
73
+ single :incremental, { :alias_for => "compiler.incremental" }
74
+ single :keep_type_selectors, { :alias_for => "compiler.keep-all-type-selectors" }
75
+ collection :keep_metadata, { :alias_for => "compiler.keep-as3-metadata" }
76
+ single :keep_generated, { :alias_for => "compiler.keep-generated-actionscript" }
77
+ collection :library_path, { :alias_for => "compiler.library-path" }
78
+ collection :locale, { :alias_for => "compiler.locale" }
79
+ single :compatibility_version, { :alias_for => "compiler.mxml.compatibility-version" }
80
+ single :namespace, { :alias_for => "compiler.namespaces.namespace" }
81
+ single :optimize, { :alias_for => "compiler.optimize" }
82
+ single :services, { :alias_for => "compiler.services" }
83
+ single :show_actionscript_warnings, { :alias_for => "compiler.show-actionscript-warnings" }
84
+ single :show_binding_warnings, { :alias_for => "compiler.show-binding-warnings" }
85
+ single :show_shadowed_device_font_warnings, { :alias_for => "compiler.show-shadowed-device-font-warnings" }
86
+ single :show_unused_type_selector_warnings, { :alias_for => "compiler.show-unused-type-selector-warnings" }
87
+ collection :source_path, { :alias_for => "compiler.source-path" }
88
+ single :strict, { :alias_for => "compiler.strict" }
89
+ collection :theme, { :alias_for => "compiler.theme" }
90
+ single :use_resource_bundle_metadata, { :alias_for => "compiler.use-resource-bundle-metadata" }
91
+ single :verbose_stacktraces, { :alias_for => "compiler.verbose-stacktraces" }
92
+ single :warn_array_tostring_changes, { :alias_for => "compiler.warn-array-tostring-changes" }
93
+ single :warn_assignment_within_conditional, { :alias_for => "compiler.warn-assignment-within-conditional" }
94
+ single :warn_bad_array_cast, { :alias_for => "compiler.warn-bad-array-cast" }
95
+ single :warn_bad_bool_assignment, { :alias_for => "compiler.warn-bad-bool-assignment" }
96
+ single :warn_bad_date_cast, { :alias_for => "compiler.warn-bad-date-cast" }
97
+ single :warn_bad_es3_type_method, { :alias_for => "compiler.warn-bad-es3-type-method" }
98
+ single :warn_bad_es3_type_prop, { :alias_for => "compiler.warn-bad-es3-type-prop" }
99
+ single :warn_bad_nan_comparison, { :alias_for => "compiler.warn-bad-nan-comparison" }
100
+ single :warn_bad_null_assignment, { :alias_for => "compiler.warn-bad-null-assignment" }
101
+ single :warn_bad_null_comparison, { :alias_for => "compiler.warn-bad-null-comparison" }
102
+ single :warn_bad_undefined_comparison, { :alias_for => "compiler.warn-bad-undefined-comparison" }
103
+ single :warn_boolean_constructor_with_no_args, { :alias_for => "compiler.warn-boolean-constructor-with-no-args" }
104
+ single :warn_changes_in_resolve, { :alias_for => "compiler.warn-changes-in-resolve" }
105
+ single :warn_class_is_sealed, { :alias_for => "compiler.warn-class-is-sealed" }
106
+ single :warn_const_not_initialized, { :alias_for => "compiler.warn-const-not-initialized" }
107
+ single :warn_constructor_returns_value, { :alias_for => "compiler.warn-constructor-returns-value" }
108
+ single :warn_deprecated_event_handler_error, { :alias_for => "compiler.warn-deprecated-event-handler-error" }
109
+ single :warn_deprecated_function_error, { :alias_for => "compiler.warn-deprecated-function-error" }
110
+ single :warn_deprecated_property_error, { :alias_for => "compiler.warn-deprecated-property-error" }
111
+ single :warn_duplicate_argument_names, { :alias_for => "compiler.warn-duplicate-argument-names" }
112
+ single :warn_duplicate_variable_def, { :alias_for => "compiler.warn-duplicate-variable-def" }
113
+ single :warn_for_var_in_changes, { :alias_for => "compiler.warn-for-var-in-changes" }
114
+ single :warn_import_hides_class, { :alias_for => "compiler.warn-import-hides-class" }
115
+ single :warn_instance_of_changes, { :alias_for => "compiler.warn-instance-of-changes" }
116
+ single :warn_internal_error, { :alias_for => "compiler.warn-internal-error" }
117
+ single :warn_level_not_supported, { :alias_for => "compiler.warn-level-not-supported" }
118
+ single :warn_missing_namespace_decl, { :alias_for => "compiler.warn-missing-namespace-decl" }
119
+ single :warn_negative_uint_literal, { :alias_for => "compiler.warn-negative-uint-literal" }
120
+ single :warn_no_constructor, { :alias_for => "compiler.warn-no-constructor" }
121
+ single :warn_no_explicit_super_call_in_constructor, { :alias_for => "compiler.warn-no-explicit-super-call-in-constructor" }
122
+ single :warn_no_type_decl, { :alias_for => "compiler.warn-no-type-decl" }
123
+ single :warn_number_from_string_changes, { :alias_for => "compiler.warn-number-from-string-changes" }
124
+ single :warn_scoping_change_in_this, { :alias_for => "compiler.warn-scoping-change-in-this" }
125
+ single :warn_slow_text_field_addition, { :alias_for => "compiler.warn-slow-text-field-addition" }
126
+ single :warn_unlikely_function_value, { :alias_for => "compiler.warn-unlikely-function-value" }
127
+ single :warn_xml_class_has_changed, { :alias_for => "compiler.warn-xml-class-has-changed" }
128
+ single :debug_password
129
+ single :default_background_color
130
+ single :default_frame_rate
131
+ single :default_script_limits
132
+ single :default_size
133
+ single :dump_config
134
+ collection :externs
135
+ collection :frame, { :alias_for => "frames.frame" }
136
+ collection :include_resource_bundles
137
+ collection :includes
138
+ single :license, { :alias_for => "licenses.license" }
139
+ single :link_report
140
+ collection :load_config
141
+ single :load_externs
142
+ single :metadata_contributor, { :alias_for => "metadata.contributor" }
143
+ single :metadata_creator, { :alias_for => "metadata.creator" }
144
+ single :metadata_date, { :alias_for => "metadata.date" }
145
+ single :metadata_description, { :alias_for => "metadata.description" }
146
+ single :metadata_language, { :alias_for => "metadata.language" }
147
+ single :metadata_localized_description, { :alias_for => "metadata.localized-description" }
148
+ single :metadata_localized_title, { :alias_for => "metadata.localized-title" }
149
+ single :metadata_publisher, { :alias_for => "metadata.publisher" }
150
+ single :metadata_title, { :alias_for => "metadata.title" }
151
+ single :output
152
+ single :raw_metadata
153
+ single :resource_bundle_list
154
+ collection :runtime_shared_libraries
155
+ single :runtime_shared_library_path
156
+ single :static_link_runtime_shared_libraries
157
+ single :target_player
158
+ single :use_network
159
+ single :verify_digests
160
+ single :version
161
+ single :warnings
162
+ end
163
+
164
+ class CompcOpts < GenericOpts
165
+ single :compute_digest
166
+ single :directory
167
+ collection :include_classes
168
+ collection :include_file
169
+ single :include_lookup_only
170
+ collection :include_namespaces
171
+ collection :include_sources
172
+ single :include_stylesheet
173
+ end
174
+
175
+ class MxmlcOpts < GenericOpts
176
+
177
+ end
178
+
179
+ end
180
+
File without changes
@@ -0,0 +1,82 @@
1
+ class FlexSDK
2
+
3
+ # Create a hash of configuration objects, some from config.yml, the rest figured out
4
+ def config
5
+ require 'yaml'
6
+ config = YAML.load_file(File.expand_path(File.join((File.dirname(__FILE__)), "..", "config.yml")))
7
+ config_hash = config["flex-sdk"]
8
+
9
+ # These variables are provided by config.yml
10
+ sdk_ver = config_hash["sdk_ver"]
11
+ vendor_path = config_hash["vendor_path"]
12
+ cdn_path = config_hash["cdn_path"]
13
+
14
+ # These variables are determined at runtime and combined into one hash
15
+ sdk_name = "flex_sdk_" + sdk_ver
16
+ config_hash["sdk_name"] = sdk_name
17
+ sdk_zipfile = sdk_name + ".zip"
18
+ config_hash["sdk_zipfile"] = sdk_zipfile
19
+ config_hash["cdn_file"] = cdn_path + sdk_zipfile
20
+ dest_dir = File.expand_path(File.join((File.dirname(__FILE__)), "..", vendor_path))
21
+ config_hash["dest_dir"] = dest_dir
22
+ config_hash["dest_file"] = File.join(dest_dir, sdk_zipfile)
23
+ config_hash["sdk_dir"] = File.join(dest_dir, sdk_name)
24
+
25
+ config_hash
26
+ end
27
+
28
+ # Return the full path to the SDK dir, so other things/people can use it
29
+ def sdk_dir
30
+ config = self.config
31
+ sdk_dir = config["sdk_dir"]
32
+ end
33
+
34
+ # Download the SDK zip file to the gem
35
+ def download(config)
36
+
37
+ dest_dir = config["dest_dir"]
38
+ dest_file = config["dest_file"]
39
+ cdn_file = config["cdn_file"]
40
+
41
+ puts "\n"
42
+ unless File.file?(dest_file)
43
+ puts "Downloading SDK\n\tFrom:\t#{cdn_file}\n\tTo:\t#{dest_file}\n\n"
44
+ `curl #{cdn_file} --create-dirs -o #{dest_file} `
45
+ if $?.to_i != 0
46
+ raise "Failed to download Flex SDK\n\n"
47
+ end
48
+ else
49
+ puts "Won't download SDK, file #{dest_file} already exists"
50
+ end
51
+ end
52
+
53
+ # Unzip the downloaded zip file into the target dir
54
+ def unzip(config)
55
+ sdk_dir = config["sdk_dir"]
56
+ dest_file = config["dest_file"]
57
+
58
+ puts "\n"
59
+
60
+ unless File.directory?(sdk_dir)
61
+ puts "Unzipping SDK\n\tFrom:\t#{dest_file}\n\tTo:\t#{sdk_dir}/\n\n"
62
+ `unzip #{dest_file} -d #{sdk_dir}`
63
+ if $?.to_i != 0
64
+ raise "Failed to unzip Flex SDK\n\n"
65
+ end
66
+ else
67
+ puts "Won't unzip SDK, directory #{sdk_dir}/ already exists\n\n"
68
+ end
69
+ end
70
+
71
+ # Perform the copylocale step
72
+ def copylocale(config)
73
+ sdk_name = config["sdk_dir"]
74
+ `#{sdk_dir}/bin/copylocale en_US en_NZ`
75
+ unless $?.to_i != 0
76
+ puts "INFO: Process copylocale completed successfully"
77
+ else
78
+ raise "ERROR: Process copylocale FAILED"
79
+ end
80
+ end
81
+
82
+ end
@@ -0,0 +1,86 @@
1
+ require 'active_support/core_ext'
2
+ require 'shell'
3
+
4
+ class OptBuilder
5
+
6
+ @@single_opts = []
7
+ @@collection_opts = []
8
+
9
+ def self.single(sym,opts={})
10
+ attr_writer sym
11
+
12
+ @@single_opts << {
13
+ :sym => sym,
14
+ :alias_for => opts[:alias_for] || sym.to_s.dasherize
15
+ }
16
+
17
+ self.class_eval do
18
+ define_method sym do
19
+ self.send(:instance_variable_get,"@#{sym.to_s}") || opts[:default]
20
+ end
21
+
22
+ end
23
+ end
24
+
25
+ def self.collection(sym,opts={})
26
+ attr_writer sym
27
+
28
+ @@collection_opts << {
29
+ :sym => sym,
30
+ :force_restart => opts[:force_restart],
31
+ :alias_for => opts[:alias_for] || sym.to_s.dasherize
32
+ }
33
+
34
+ self.class_eval do
35
+ define_method sym do
36
+ value = self.send(:instance_variable_get,"@#{sym.to_s}") || []
37
+ self.send(:instance_variable_set,"@#{sym.to_s}", value)
38
+ value
39
+ end
40
+
41
+ end
42
+ end
43
+
44
+ def value_as_option_value(value)
45
+ # todo:
46
+ # Escape strings for command line
47
+ # leave numbers alone
48
+ # booleans?
49
+ #
50
+ # arrays, treat each element as a value then join with spaces
51
+
52
+
53
+ return value_array_as_option_value(value) if value.is_a? Array
54
+
55
+ Shell.escape value
56
+ end
57
+
58
+ def value_array_as_option_value(value_array)
59
+ ary = value_array.map do |value|
60
+ value_as_option_value(value)
61
+ end
62
+
63
+ ary.join " "
64
+ end
65
+
66
+ def to_s
67
+ opts = @@single_opts.map do |hash|
68
+ sym = hash[:sym]
69
+ "-#{hash[:alias_for]}=#{value_as_option_value(send(sym))}" unless send(sym).nil?
70
+ end
71
+
72
+ collections = @@collection_opts.each do |hash|
73
+ sym = hash[:sym];
74
+ restart = hash[:force_restart]
75
+ add_char = ""
76
+ opts += send(sym).map do |value|
77
+ add_char = "+" unless restart
78
+ restart = false if restart
79
+ "-#{hash[:alias_for]}#{add_char}=#{value_as_option_value(value)}"
80
+ end
81
+ end
82
+
83
+ opts.reject{ |item| item.nil? }.join " "
84
+ end
85
+
86
+ end
data/lib/shell.rb ADDED
@@ -0,0 +1,7 @@
1
+ module Shell
2
+ def self.escape(str)
3
+ String(str).gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').
4
+ gsub(/\n/,"'\n'").
5
+ sub(/^$/,"''")
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Test" do
4
+ it "fails" do
5
+ pending "jonno doin some tests"
6
+ fail "hey buddy, you should probably rename this file and start specing for real"
7
+ end
8
+ end
@@ -0,0 +1,20 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require "opt_builder"
3
+
4
+ describe OptBuilder, "when first created" do
5
+
6
+ before :each do
7
+ @opt_instance = OptBuilder.new
8
+ end
9
+
10
+ it "lets me describe singular command line options" do
11
+ OptBuilder.should respond_to "single_opt"
12
+ end
13
+
14
+ it "lets me assign values to singular command line options" do
15
+ @opt_instance.single_opt :option
16
+ @opt_instance.should respond_to "option"
17
+ end
18
+
19
+ end
20
+
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -1,10 +1,8 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'flex-sdk'
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'spec'
4
+ require 'spec/autorun'
8
5
 
9
- class Test::Unit::TestCase
6
+ Spec::Runner.configure do |config|
7
+
10
8
  end
data/spec/test.rb ADDED
@@ -0,0 +1,49 @@
1
+ require 'lib/opt_builder'
2
+
3
+ # This is my hideous test script until I have a moment to grok testing
4
+ # "class methods by extension" in rspec
5
+
6
+ class Opts < OptBuilder
7
+ single :foo, { :default => "default" }
8
+ single :bar
9
+ single :ninkum_poop
10
+ collection :grapple_boo
11
+ collection :grapple_bee, { :force_restart => true }
12
+ end
13
+
14
+
15
+ puts "\ndefaults create output"
16
+
17
+ a = Opts.new
18
+ puts a.to_s
19
+
20
+ puts "\ndefaults and others can be overridden (and we dasherize opts)"
21
+
22
+ a = Opts.new
23
+ a.foo = "hi"
24
+ a.bar = "there"
25
+ a.ninkum_poop = 1
26
+ puts a.to_s
27
+
28
+
29
+ puts "\ncollections work, just 1"
30
+ a = Opts.new
31
+ a.grapple_boo << "nana"
32
+ puts a.to_s
33
+
34
+ puts "\ncollections work"
35
+ a = Opts.new
36
+ a.grapple_boo << "nana"
37
+ a.grapple_boo << "bana"
38
+ a.grapple_boo << "banana"
39
+ a.grapple_boo << "mascouri"
40
+ puts a.to_s
41
+
42
+ puts "\ncollections work with force restart"
43
+ a = Opts.new
44
+ a.grapple_bee << "nana"
45
+ a.grapple_bee << "bana"
46
+ a.grapple_bee << "banana"
47
+ a.grapple_bee << "mascouri"
48
+ puts a.to_s
49
+
metadata CHANGED
@@ -1,27 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flex-sdk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 1
10
- version: 0.4.1
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Hoskin
14
+ - Rasheed Abdul-Aziz
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-11-03 00:00:00 +13:00
19
+ date: 2010-11-09 00:00:00 +13:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
23
+ type: :development
24
+ name: rspec
25
+ prerelease: false
26
+ version_requirements: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 13
32
+ segments:
33
+ - 1
34
+ - 2
35
+ - 9
36
+ version: 1.2.9
37
+ requirement: *id001
38
+ - !ruby/object:Gem::Dependency
39
+ type: :development
22
40
  name: thoughtbot-shoulda
23
41
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
42
+ version_requirements: &id002 !ruby/object:Gem::Requirement
25
43
  none: false
26
44
  requirements:
27
45
  - - ">="
@@ -30,9 +48,36 @@ dependencies:
30
48
  segments:
31
49
  - 0
32
50
  version: "0"
33
- type: :development
34
- version_requirements: *id001
35
- description: Flex SDK Gem for redistribution to build servers and developers
51
+ requirement: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ type: :runtime
54
+ name: i18n
55
+ prerelease: false
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirement: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ type: :runtime
68
+ name: activesupport
69
+ prerelease: false
70
+ version_requirements: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirement: *id004
80
+ description: Flex SDK Gem for redistribution to build servers and other developers. Also provides a simple DSL for calling Mxmlc and Compc from Thor tasks
36
81
  email: jonathan.hoskin@visfleet.com
37
82
  executables:
38
83
  - flex-sdk-copylocale
@@ -46,6 +91,8 @@ extra_rdoc_files:
46
91
  files:
47
92
  - .document
48
93
  - .gitignore
94
+ - Gemfile
95
+ - Gemfile.lock
49
96
  - LICENSE
50
97
  - README.markdown
51
98
  - Rakefile
@@ -55,9 +102,16 @@ files:
55
102
  - bin/flex-sdk-prime
56
103
  - config.yml
57
104
  - flex-sdk.gemspec
58
- - lib/flex-sdk.rb
59
- - test/helper.rb
60
- - test/test_flex-sdk.rb
105
+ - lib/flex_compiler.rb
106
+ - lib/flex_sdk.rb
107
+ - lib/flex_sdk/flex_sdk.rb
108
+ - lib/opt_builder.rb
109
+ - lib/shell.rb
110
+ - spec/flex-sdk_spec.rb
111
+ - spec/opts-builder_spec.rb
112
+ - spec/spec.opts
113
+ - spec/spec_helper.rb
114
+ - spec/test.rb
61
115
  has_rdoc: true
62
116
  homepage: http://github.com/visfleet/flex-sdk
63
117
  licenses: []
@@ -91,7 +145,9 @@ rubyforge_project:
91
145
  rubygems_version: 1.3.7
92
146
  signing_key:
93
147
  specification_version: 3
94
- summary: Flex SDK Gem
148
+ summary: Flex SDK Gem and Thor Built utilities
95
149
  test_files:
96
- - test/helper.rb
97
- - test/test_flex-sdk.rb
150
+ - spec/flex-sdk_spec.rb
151
+ - spec/opts-builder_spec.rb
152
+ - spec/spec_helper.rb
153
+ - spec/test.rb
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestFlexSdk < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end