Skip to content
Browse files

Merge pull request #6 from simongregory/master

Hey Simon, it looks like there were some whitespace changes, but can't tell in Github if they were good or bad. Can you confirm that your editor didn't replace spaces with tabs in these change lists?
  • Loading branch information...
2 parents 5308c10 + 4005c60 commit 9fc726ccbaaa7b757babc5511e2adb1e58950d0f @lukebayes committed Jul 8, 2011
Showing with 116 additions and 7 deletions.
  1. +1 −0 lib/flashsdk.rb
  2. +29 −0 lib/flashsdk/acompc.rb
  3. +15 −1 lib/flashsdk/adt.rb
  4. +3 −6 lib/flex4.rb
  5. +11 −0 test/fixtures/acompc/simple/SomeAirFile.as
  6. +37 −0 test/unit/acompc_test.rb
  7. +20 −0 test/unit/adt_test.rb
View
1 lib/flashsdk.rb
@@ -15,6 +15,7 @@
require 'flashsdk/asdoc'
require 'flashsdk/mxmlc'
require 'flashsdk/compc'
+require 'flashsdk/acompc'
require 'flashsdk/amxmlc'
require 'flashsdk/adt'
require 'flashsdk/adl'
View
29 lib/flashsdk/acompc.rb
@@ -0,0 +1,29 @@
+module FlashSDK
+
+ ##
+ # The ACOMPC tool is a wrapper for the acompc tool.
+ #
+ class ACOMPC < COMPC
+
+ ##
+ # The default executable target.
+ #
+ set :executable, :acompc
+
+ ##
+ # TODO: Remove this method once this bug is fixed:
+ # http://www.pivotaltracker.com/story/show/4194771
+ #
+ def execute *args
+ self.executable = :acompc
+ super
+ end
+ end
+end
+
+def acompc args, &block
+ exe = FlashSDK::ACOMPC.new
+ exe.to_rake(args, &block)
+ exe
+end
+
View
16 lib/flashsdk/adt.rb
@@ -228,6 +228,21 @@ class ADT < Sprout::Executable::Base
# they will not be included.
#
add_param :included_paths, Paths, { :hidden_name => true }
+
+ ##
+ # Allows file options in the form of -C <dir> <fileOrDir>+
+ #
+ # For example if you defined:
+ #
+ # t.file_options << 'dir path/to/asset.xml'
+ #
+ # In your adt task defintion, then:
+ #
+ # -C dir path/to/asset.xml
+ #
+ # Would be appended to your arguments.
+ #
+ add_param :file_options, Strings, { :shell_name => '-C', :delimiter => ' ' }
##
# The the Ruby file that will load the expected
@@ -258,4 +273,3 @@ def adt *args, &block
exe.to_rake(*args, &block)
exe
end
-
View
9 lib/flex4.rb
@@ -30,14 +30,13 @@
# end
#
s.name = 'flex4'
- s.version = '4.5.0.20967'
+ s.version = '4.5.1.21328'
s.add_remote_file_target do |t|
t.platform = :universal
t.archive_type = :zip
-
- t.url = "http://fpdownload.adobe.com/pub/flex/sdk/builds/flex4.5/flex_sdk_4.5.0.20967.zip"
- t.md5 = "c92b661eb7b00bb568262851885274dc"
+ t.url = "http://fpdownload.adobe.com/pub/flex/sdk/builds/flex4.5/flex_sdk_4.5.1.21328.zip"
+ t.md5 = "55a59986092195a88cfe7b5796ec8619"
# Executables: (add .exe suffix if it was passed in)
t.add_executable :aasdoc, "bin/aasdoc"
@@ -81,5 +80,3 @@
end
end
end
-
-
View
11 test/fixtures/acompc/simple/SomeAirFile.as
@@ -0,0 +1,11 @@
+package {
+ import flash.display.Sprite;
+
+ public class SomeAirFile extends Sprite {
+
+ public function SomeAirFile() {
+ trace(">> SomeFile instantiated");
+ }
+ }
+}
+
View
37 test/unit/acompc_test.rb
@@ -0,0 +1,37 @@
+require 'test_helper'
+
+class ACOMPCTest < Test::Unit::TestCase
+ include Sprout::TestHelper
+
+ context "An ACOMPC tool" do
+
+ setup do
+ @fixture = File.join 'test', 'fixtures', 'acompc', 'simple'
+ @input = File.join @fixture, 'SomeAirFile.as'
+ @expected_output = File.join @fixture, 'SomeAirFile.swc'
+ end
+
+ teardown do
+ remove_file @expected_output
+ end
+
+ should "accept input" do
+ as_a_unix_system do
+ compc = FlashSDK::ACOMPC.new
+ compc.output = @expected_output
+ compc.include_sources << @fixture
+ assert_equal '--output=test/fixtures/acompc/simple/SomeAirFile.swc --static-link-runtime-shared-libraries --include-sources+=test/fixtures/acompc/simple', compc.to_shell
+ end
+ end
+
+ should "compile a swc" do
+ compc = FlashSDK::ACOMPC.new
+ compc.include_sources << @fixture
+ compc.output = @expected_output
+ compc.execute
+ assert_file @expected_output
+ end
+
+ end
+end
+
View
20 test/unit/adt_test.rb
@@ -45,6 +45,26 @@ class ADTTest < Test::Unit::TestCase
#assert_file @expected_output
end
end
+
+ should "package a SWF and complex assets with an application.xml" do
+ as_a_unix_system do
+ t = adt @expected_output do |t|
+ t.package = true
+ t.target = @target
+ t.package_input = @application_xml
+ t.package_output = @expected_output
+ t.storetype = 'PKCS12'
+ t.keystore = @certificate
+ t.storepass = @cert_password
+ t.included_files << @swf_input
+ t.file_options << 'bin path/to/asset.xml'
+ end
+ assert_equal "-package -target #{@target} -storetype PKCS12 -keystore test/fixtures/air/simple/SomeProject.pfx -storepass samplePassword test/fixtures/air/simple/SomeProject.air test/fixtures/air/simple/SomeProject.xml test/fixtures/air/simple/SomeProject.swf -C bin path/to/asset.xml", t.to_shell
+
+ #t.execute
+ #assert_file @expected_output
+ end
+ end
should "package an iOS swf with a provisioning profile" do
as_a_unix_system do

0 comments on commit 9fc726c

Please sign in to comment.
Something went wrong with that request. Please try again.