Skip to content
Browse files

Created an executable wrapper for the acompc tool.

  • Loading branch information...
1 parent 65ec8c6 commit d07ce8c1ece3ed537bad0366f62008b614827366 @simongregory simongregory committed
Showing with 78 additions and 0 deletions.
  1. +1 −0 lib/flashsdk.rb
  2. +29 −0 lib/flashsdk/acompc.rb
  3. +11 −0 test/fixtures/acompc/simple/SomeAirFile.as
  4. +37 −0 test/unit/acompc_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
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
+

0 comments on commit d07ce8c

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