h4oflashsdk 1.0.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/Gemfile +3 -0
- data/Gemfile.lock +41 -0
- data/POSTINSTALL.rdoc +79 -0
- data/README.textile +79 -0
- data/VERSION +1 -0
- data/bin/flashlog +8 -0
- data/bin/flashplayer +9 -0
- data/bin/sprout-as3 +9 -0
- data/bin/sprout-flex +8 -0
- data/ext/CloseFlashPlayerForDumbassOSX.scpt +6 -0
- data/ext/OpenFlashPlayerForDumbassOSX.scpt +12 -0
- data/flashsdk.gemspec +25 -0
- data/flashsdk.komodoproject +4 -0
- data/lib/flashplayer/errors.rb +12 -0
- data/lib/flashplayer/executable.rb +143 -0
- data/lib/flashplayer/log_file.rb +94 -0
- data/lib/flashplayer/mm_config.rb +96 -0
- data/lib/flashplayer/module.rb +51 -0
- data/lib/flashplayer/specification.rb +45 -0
- data/lib/flashplayer/system_mixins.rb +98 -0
- data/lib/flashplayer/task.legacy.rb +293 -0
- data/lib/flashplayer/task.rb +62 -0
- data/lib/flashplayer/trust.rb +45 -0
- data/lib/flashplayer.rb +9 -0
- data/lib/flashsdk/acompc.rb +29 -0
- data/lib/flashsdk/adl.rb +83 -0
- data/lib/flashsdk/adt.rb +276 -0
- data/lib/flashsdk/amxmlc.rb +28 -0
- data/lib/flashsdk/asdoc.rb +164 -0
- data/lib/flashsdk/compc.rb +124 -0
- data/lib/flashsdk/compiler_base.rb +1131 -0
- data/lib/flashsdk/fcsh.rb +173 -0
- data/lib/flashsdk/fcsh_socket.rb +167 -0
- data/lib/flashsdk/fdb.rb +833 -0
- data/lib/flashsdk/generators/class_generator.rb +87 -0
- data/lib/flashsdk/generators/flash_helper.rb +234 -0
- data/lib/flashsdk/generators/flex_project_generator.rb +30 -0
- data/lib/flashsdk/generators/project_generator.rb +31 -0
- data/lib/flashsdk/generators/templates/ActionScript3Class.as +9 -0
- data/lib/flashsdk/generators/templates/ActionScript3MainClass.as +11 -0
- data/lib/flashsdk/generators/templates/ActionScript3RunnerClass.as +19 -0
- data/lib/flashsdk/generators/templates/DefaultProjectImage.png +0 -0
- data/lib/flashsdk/generators/templates/Flex4Application.mxml +45 -0
- data/lib/flashsdk/generators/templates/Flex4Main.css +7 -0
- data/lib/flashsdk/generators/templates/Flex4Rakefile.rb +34 -0
- data/lib/flashsdk/generators/templates/Flex4RunnerClass.mxml +29 -0
- data/lib/flashsdk/generators/templates/FlexTestRunner.mxml +0 -0
- data/lib/flashsdk/generators/templates/Gemfile +5 -0
- data/lib/flashsdk/generators/templates/rakefile.rb +79 -0
- data/lib/flashsdk/module.rb +107 -0
- data/lib/flashsdk/mxmlc.rb +160 -0
- data/lib/flashsdk.rb +24 -0
- data/lib/flex3.rb +54 -0
- data/lib/flex4.rb +115 -0
- data/rakefile.rb +42 -0
- data/test/fixtures/acompc/simple/SomeAirFile.as +11 -0
- data/test/fixtures/air/simple/SomeProject.apk +1 -0
- data/test/fixtures/air/simple/SomeProject.as +11 -0
- data/test/fixtures/air/simple/SomeProject.mxml +9 -0
- data/test/fixtures/air/simple/SomeProject.pfx +0 -0
- data/test/fixtures/air/simple/SomeProject.swf +0 -0
- data/test/fixtures/air/simple/SomeProject.xml +13 -0
- data/test/fixtures/asdoc/lib/OtherFile.as +17 -0
- data/test/fixtures/asdoc/src/SomeFile.as +11 -0
- data/test/fixtures/compc/simple/SomeFile.as +11 -0
- data/test/fixtures/flashplayer/AsUnit Runner.swf +0 -0
- data/test/fixtures/mxmlc/broken/SomeFile.as +10 -0
- data/test/fixtures/mxmlc/simple/SomeFile.as +11 -0
- data/test/fixtures/sdk/fdb +90 -0
- data/test/fixtures/sdk/mxmlc +56 -0
- data/test/unit/acompc_test.rb +37 -0
- data/test/unit/adl_test.rb +32 -0
- data/test/unit/adt_test.rb +185 -0
- data/test/unit/amxmlc_test.rb +55 -0
- data/test/unit/asdoc_test.rb +45 -0
- data/test/unit/class_generator_test.rb +56 -0
- data/test/unit/compc_test.rb +37 -0
- data/test/unit/fake_flashplayer_system.rb +11 -0
- data/test/unit/fcsh_socket_test.rb +53 -0
- data/test/unit/fcsh_test.rb +55 -0
- data/test/unit/fdb_test.rb +54 -0
- data/test/unit/flash_helper_test.rb +43 -0
- data/test/unit/flashplayer_executable_test.rb +69 -0
- data/test/unit/flashplayer_log_file_test.rb +47 -0
- data/test/unit/flashplayer_mm_config_test.rb +74 -0
- data/test/unit/flashplayer_module_test.rb +56 -0
- data/test/unit/flashplayer_task_test.rb +91 -0
- data/test/unit/flashplayer_trust_test.rb +30 -0
- data/test/unit/flex_compiler_options_test.rb +213 -0
- data/test/unit/flex_generator_test.rb +37 -0
- data/test/unit/mxmlc_test.rb +65 -0
- data/test/unit/project_generator_test.rb +57 -0
- data/test/unit/test_helper.rb +18 -0
- metadata +284 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FCSHTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "associate FCSH with an MXMLC task" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@fixture = File.join fixtures, 'mxmlc'
|
10
|
+
@input = File.join @fixture, 'simple', 'SomeFile.as'
|
11
|
+
@broken_input = File.join @fixture, 'broken', 'SomeFile.as'
|
12
|
+
@expected_output = File.join @fixture, 'simple', 'SomeFile.swf'
|
13
|
+
|
14
|
+
# Uncomment following to see output:
|
15
|
+
#Sprout.stdout = $stdout
|
16
|
+
#Sprout.stderr = $stderr
|
17
|
+
end
|
18
|
+
|
19
|
+
teardown do
|
20
|
+
remove_file @expected_output
|
21
|
+
end
|
22
|
+
=begin
|
23
|
+
should "collect errors as needed" do
|
24
|
+
mxmlc = FlashSDK::MXMLC.new
|
25
|
+
mxmlc.input = @broken_input
|
26
|
+
|
27
|
+
fcsh = FlashSDK::FCSH.new
|
28
|
+
fcsh.execute false
|
29
|
+
fcsh.mxmlc mxmlc.to_shell
|
30
|
+
fcsh.quit
|
31
|
+
fcsh.wait
|
32
|
+
|
33
|
+
expected_error_message = '1 Error: Syntax error: expecting rightbrace before end of program'
|
34
|
+
assert_matches /#{expected_error_message}/, Sprout.stdout.read
|
35
|
+
end
|
36
|
+
|
37
|
+
should "spin up FCSH" do
|
38
|
+
mxmlc = FlashSDK::MXMLC.new
|
39
|
+
mxmlc.input = @input
|
40
|
+
|
41
|
+
fcsh = FlashSDK::FCSH.new
|
42
|
+
fcsh.execute false
|
43
|
+
fcsh.mxmlc mxmlc.to_shell
|
44
|
+
|
45
|
+
FileUtils.touch @input
|
46
|
+
fcsh.compile 1
|
47
|
+
fcsh.quit
|
48
|
+
fcsh.wait
|
49
|
+
|
50
|
+
assert_file @expected_output
|
51
|
+
end
|
52
|
+
=end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FDBTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "a new fdb task" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
path = File.join fixtures, 'sdk', 'fdb'
|
10
|
+
FlashSDK::FDB.any_instance.stubs(:binary_path).returns path
|
11
|
+
|
12
|
+
#Sprout.stdout = $stdout
|
13
|
+
#Sprout.stderr = $stderr
|
14
|
+
end
|
15
|
+
|
16
|
+
should "execute without shell params" do
|
17
|
+
@fdb = FlashSDK::FDB.new
|
18
|
+
@fdb.run
|
19
|
+
@fdb.break "AsUnitRunner:12"
|
20
|
+
@fdb.continue
|
21
|
+
@fdb.kill
|
22
|
+
@fdb.confirm
|
23
|
+
@fdb.quit
|
24
|
+
|
25
|
+
@fdb.execute
|
26
|
+
end
|
27
|
+
|
28
|
+
should "execute from rake task" do
|
29
|
+
f = fdb :fdb_debug do |t|
|
30
|
+
t.run
|
31
|
+
t.break "AsUnitRunner:12"
|
32
|
+
t.continue
|
33
|
+
t.kill
|
34
|
+
t.confirm
|
35
|
+
t.quit
|
36
|
+
end
|
37
|
+
|
38
|
+
f.execute
|
39
|
+
|
40
|
+
# NOTE: If this call raises, then the
|
41
|
+
# Executable.update_rake_task_name method
|
42
|
+
# must have changed, and the Session override
|
43
|
+
# is no longer preventing non-File tasks
|
44
|
+
# from being added to the CLEAN collection.
|
45
|
+
#
|
46
|
+
# Adding this as a message to the error would
|
47
|
+
# not display for some reason...
|
48
|
+
assert_equal 0, CLEAN.size, "There shouldn't be any tasks waiting to be cleaned up - found: (#{CLEAN.inspect})"
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FlashHelperTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A FlashHelper" do
|
7
|
+
|
8
|
+
[
|
9
|
+
{ :input => 'com.foo.Bar', :expected => 'com.foo.Bar' },
|
10
|
+
{ :input => 'com/foo/Bar.as', :expected => 'com.foo.Bar' },
|
11
|
+
{ :input => 'com.out.HTML', :expected => 'com.out.HTML' }
|
12
|
+
#{ :input => 'bar', :expected => 'Bar' }
|
13
|
+
].each do |input|
|
14
|
+
|
15
|
+
should "return fully qualified classname for #{input[:input]}" do
|
16
|
+
instance = FakeGenerator.new
|
17
|
+
instance.input = input[:input]
|
18
|
+
assert_equal input[:expected], instance.fake_fully_qualified_class_name
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
should "work if :src is not defined" do
|
23
|
+
instance = FakeGenerator.new
|
24
|
+
instance.input = 'com/foo/bar.as'
|
25
|
+
assert_equal ["com","foo","bar"], instance.fake_input_in_parts
|
26
|
+
assert_equal ["com","foo","mommy"], instance.fake_input_in_parts("com.foo.mommy.mxml")
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class FakeGenerator < Sprout::Generator::Base
|
33
|
+
include FlashSDK::FlashHelper
|
34
|
+
|
35
|
+
def fake_fully_qualified_class_name
|
36
|
+
fully_qualified_class_name
|
37
|
+
end
|
38
|
+
|
39
|
+
def fake_input_in_parts value=nil
|
40
|
+
input_in_parts value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'fake_flashplayer_system'
|
3
|
+
|
4
|
+
class FlashPlayerExecutableTest < Test::Unit::TestCase
|
5
|
+
include Sprout::TestHelper
|
6
|
+
|
7
|
+
context "A FlashPlayer Executable" do
|
8
|
+
|
9
|
+
setup do
|
10
|
+
# Force reload of the Specification on each
|
11
|
+
# test method b/c Sprout::TestHelper calls
|
12
|
+
# Executable.clear_entities! but 'require'
|
13
|
+
# only runs once per VM run...
|
14
|
+
load 'flashplayer/specification.rb'
|
15
|
+
@swf = File.join(fixtures, 'flashplayer', 'AsUnit Runner.swf')
|
16
|
+
@missing_home = File.join(fixtures, 'missing_folder')
|
17
|
+
@config_path = File.join(@missing_home, 'fp_config', 'mm.cfg')
|
18
|
+
|
19
|
+
Sprout.stdout = $stdout
|
20
|
+
Sprout.stderr = $stderr
|
21
|
+
end
|
22
|
+
|
23
|
+
teardown do
|
24
|
+
remove_file @missing_home
|
25
|
+
ENV['USE_FDB'] = 'false'
|
26
|
+
end
|
27
|
+
|
28
|
+
## THIS METHOD SHOULD BE COMMENTED OUT....
|
29
|
+
=begin
|
30
|
+
should "launch SWF on os x" do
|
31
|
+
# No creation of expected FlashPlayer folders...
|
32
|
+
|
33
|
+
#FlashPlayer.stubs(:home).returns @missing_home
|
34
|
+
#FlashPlayer::MMConfig.any_instance.stubs(:system_home).returns @missing_home
|
35
|
+
#FlashPlayer::MMConfig.any_instance.stubs(:config_path).returns @config_path
|
36
|
+
#FlashPlayer::MMConfig.any_instance.stubs(:user_confirmation?).returns false
|
37
|
+
|
38
|
+
#ENV['USE_FDB'] = 'true'
|
39
|
+
|
40
|
+
as_a_mac_system do
|
41
|
+
player = FlashPlayer::Executable.new
|
42
|
+
player.input = @swf
|
43
|
+
player.fdb = true
|
44
|
+
player.execute
|
45
|
+
end
|
46
|
+
end
|
47
|
+
=end
|
48
|
+
|
49
|
+
should "work with input" do
|
50
|
+
player = FlashPlayer::Executable.new
|
51
|
+
player.input = @swf
|
52
|
+
configure player
|
53
|
+
player.execute
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def configure player
|
61
|
+
player.logger = StringIO.new
|
62
|
+
|
63
|
+
# Comment following lines to really launch the player:
|
64
|
+
sys = FakeFlashPlayerSystem.new
|
65
|
+
player.stubs(:current_system).returns sys
|
66
|
+
sys.expects(:open_flashplayer_with).returns Thread.new{}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class LogFileTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A LogFile" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@logger = StringIO.new
|
10
|
+
@flashlog = File.join(fixtures, 'flashlog.txt')
|
11
|
+
@reader = FlashPlayer::LogFile.new
|
12
|
+
@reader.logger = @logger
|
13
|
+
@reader.stubs(:flashlog_path).returns @flashlog
|
14
|
+
|
15
|
+
FileUtils.touch @flashlog
|
16
|
+
end
|
17
|
+
|
18
|
+
teardown do
|
19
|
+
remove_file @flashlog
|
20
|
+
end
|
21
|
+
|
22
|
+
should "read until killed" do
|
23
|
+
blocked = true
|
24
|
+
t = Thread.new {
|
25
|
+
@reader.tail
|
26
|
+
blocked = false
|
27
|
+
}
|
28
|
+
|
29
|
+
assert blocked
|
30
|
+
t.kill
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
# This method only works when run alone -
|
35
|
+
# Under normal circumstances, the Sprout::TestHelper
|
36
|
+
# clears out any Rake tasks that have been defined
|
37
|
+
# and we don't have an easy way to redefine the
|
38
|
+
# task...
|
39
|
+
#should "read from rake task" do
|
40
|
+
#FlashPlayer::LogFile.any_instance.stubs(:logger).returns StringIO.new
|
41
|
+
#FlashPlayer::LogFile.any_instance.expects(:read_flashlog_at)
|
42
|
+
#Rake.application[:flashlog].invoke
|
43
|
+
#end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class MMConfigTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "An MMConfig" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@home = File.join(fixtures, 'home')
|
10
|
+
@osx_fp = File.join(@home, 'Application Support', 'Macromedia')
|
11
|
+
@linux_fp = File.join(@home, '.macromedia', 'Flash_Player')
|
12
|
+
|
13
|
+
FileUtils.mkdir_p @home
|
14
|
+
|
15
|
+
@mm_config = FlashPlayer::MMConfig.new
|
16
|
+
@mm_config.stubs(:user_confirmation?).returns true
|
17
|
+
@mm_config.logger = StringIO.new
|
18
|
+
end
|
19
|
+
|
20
|
+
teardown do
|
21
|
+
remove_file @home
|
22
|
+
end
|
23
|
+
|
24
|
+
should "ignore failure if flashplayer has never run" do
|
25
|
+
# No creation of expected FlashPlayer folders...
|
26
|
+
|
27
|
+
as_a_mac_system do
|
28
|
+
@mm_config.stubs(:system_library).returns @home
|
29
|
+
@mm_config.stubs(:flashplayer_home).returns @osx_fp
|
30
|
+
@mm_config.create
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
should "create a config file on OS X with FP 9" do
|
35
|
+
FileUtils.mkdir_p @osx_fp
|
36
|
+
flashlog = File.expand_path(File.join(@osx_fp, 'Logs', 'flashlog.txt'))
|
37
|
+
|
38
|
+
as_a_mac_system do
|
39
|
+
@mm_config.stubs(:system_library).returns @home
|
40
|
+
@mm_config.stubs(:flashplayer_home).returns @osx_fp
|
41
|
+
@mm_config.stubs(:flashlog_path).returns flashlog
|
42
|
+
@mm_config.create
|
43
|
+
mm_cfg = File.join(@osx_fp, mm_config_file)
|
44
|
+
assert_file mm_cfg do |content|
|
45
|
+
assert_matches /#{@flashlog}/, content
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
should "create a config file on linux" do
|
51
|
+
FileUtils.mkdir_p @linux_fp
|
52
|
+
flashlog = File.expand_path(File.join(@linux_fp, 'Logs', 'flashlog.txt'))
|
53
|
+
|
54
|
+
as_a_unix_system do
|
55
|
+
@mm_config.stubs(:system_library).returns @home
|
56
|
+
@mm_config.stubs(:system_home).returns @home
|
57
|
+
@mm_config.stubs(:flashlog_path).returns flashlog
|
58
|
+
@mm_config.stubs(:flashplayer_home).returns @linux_fp
|
59
|
+
@mm_config.create
|
60
|
+
mm_cfg = File.join(@home, mm_config_file)
|
61
|
+
assert_file mm_cfg do |content|
|
62
|
+
assert_matches /#{flashlog}/, content
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def mm_config_file
|
71
|
+
FlashPlayer::MMConfig::FILE_NAME
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FlashPlayerTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "The FlashPlayer module" do
|
7
|
+
|
8
|
+
context "should find home" do
|
9
|
+
|
10
|
+
setup do
|
11
|
+
@fixture = File.join(fixtures, 'home')
|
12
|
+
|
13
|
+
@osx_home1 = File.join(@fixture, 'Preferences', 'Macromedia', 'Flash Player')
|
14
|
+
@osx_home2 = File.join(@fixture, 'Application Support', 'Macromedia')
|
15
|
+
@win_home1 = File.join(@fixture, 'Application Data', 'Macromedia', 'Flash Player')
|
16
|
+
@win_home2 = File.join(@fixture, 'AppData', 'Roaming', 'Macromedia', 'Flash Player')
|
17
|
+
@nix_home1 = File.join(@fixture, '.macromedia', 'Flash_Player')
|
18
|
+
|
19
|
+
# Ensure the looks in our Fixtures folder instead of system:
|
20
|
+
FlashPlayer.stubs(:system_library).returns @fixture
|
21
|
+
FlashPlayer.stubs(:system_home).returns @fixture
|
22
|
+
end
|
23
|
+
|
24
|
+
teardown do
|
25
|
+
remove_file File.join(@fixture)
|
26
|
+
end
|
27
|
+
|
28
|
+
should "find home on osx" do
|
29
|
+
FileUtils.mkdir_p @osx_home1
|
30
|
+
assert_equal @osx_home1, FlashPlayer.home
|
31
|
+
end
|
32
|
+
|
33
|
+
should "find home on osx 2" do
|
34
|
+
FileUtils.mkdir_p @osx_home2
|
35
|
+
assert_equal @osx_home2, FlashPlayer.home
|
36
|
+
end
|
37
|
+
|
38
|
+
should "find home on win 1" do
|
39
|
+
FileUtils.mkdir_p @win_home1
|
40
|
+
assert_equal @win_home1, FlashPlayer.home
|
41
|
+
end
|
42
|
+
|
43
|
+
should "find home on win 2" do
|
44
|
+
FileUtils.mkdir_p @win_home2
|
45
|
+
assert_equal @win_home2, FlashPlayer.home
|
46
|
+
end
|
47
|
+
|
48
|
+
should "find home on nix 1" do
|
49
|
+
FileUtils.mkdir_p @nix_home1
|
50
|
+
assert_equal @nix_home1, FlashPlayer.home
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'fake_flashplayer_system'
|
3
|
+
|
4
|
+
class TaskTest < Test::Unit::TestCase
|
5
|
+
include Sprout::TestHelper
|
6
|
+
|
7
|
+
context "A FlashPlayerTask" do
|
8
|
+
|
9
|
+
setup do
|
10
|
+
# Force reload of the Specification on each
|
11
|
+
# test method b/c Sprout::TestHelper calls
|
12
|
+
# Executable.clear_entities! but 'require'
|
13
|
+
# only runs once per VM run...
|
14
|
+
load 'flashplayer/specification.rb'
|
15
|
+
@swf = File.join(fixtures, 'flashplayer', 'AsUnit Runner.swf')
|
16
|
+
@missing_home = File.join(fixtures, 'missing_folder')
|
17
|
+
@config_path = File.join(@missing_home, 'fp_config', 'mm.cfg')
|
18
|
+
|
19
|
+
#Sprout.stdout = $stdout
|
20
|
+
#Sprout.stderr = $stderr
|
21
|
+
end
|
22
|
+
|
23
|
+
teardown do
|
24
|
+
remove_file @missing_home
|
25
|
+
ENV['USE_FDB'] = 'false'
|
26
|
+
end
|
27
|
+
|
28
|
+
## THIS METHOD WAS COMMENTED OUT....
|
29
|
+
=begin
|
30
|
+
should "wait for SWF even if clean system" do
|
31
|
+
# No creation of expected FlashPlayer folders...
|
32
|
+
|
33
|
+
FlashPlayer.stubs(:home).returns @missing_home
|
34
|
+
FlashPlayer::MMConfig.any_instance.stubs(:system_home).returns @missing_home
|
35
|
+
FlashPlayer::MMConfig.any_instance.stubs(:config_path).returns @config_path
|
36
|
+
FlashPlayer::MMConfig.any_instance.stubs(:user_confirmation?).returns false
|
37
|
+
|
38
|
+
ENV['USE_FDB'] = 'true'
|
39
|
+
|
40
|
+
as_a_mac_system do
|
41
|
+
t = flashplayer @swf
|
42
|
+
t.invoke
|
43
|
+
end
|
44
|
+
end
|
45
|
+
=end
|
46
|
+
|
47
|
+
should "work with swf as task name" do
|
48
|
+
t = flashplayer @swf
|
49
|
+
configure_task t
|
50
|
+
t.invoke
|
51
|
+
end
|
52
|
+
|
53
|
+
should "work with swf in block" do
|
54
|
+
t = flashplayer :run do |t|
|
55
|
+
t.input = @swf
|
56
|
+
end
|
57
|
+
Rake::FileTask.define_task @swf
|
58
|
+
configure_task t
|
59
|
+
t.invoke
|
60
|
+
assert_equal @swf, t.input
|
61
|
+
end
|
62
|
+
|
63
|
+
should "work with swf as prerequisite" do
|
64
|
+
t = flashplayer :run => @swf
|
65
|
+
Rake::FileTask.define_task @swf
|
66
|
+
configure_task t
|
67
|
+
t.invoke
|
68
|
+
assert_equal @swf, t.input
|
69
|
+
end
|
70
|
+
|
71
|
+
should "fire when declared as a dependency" do
|
72
|
+
t = flashplayer :run => @swf
|
73
|
+
Rake::FileTask.define_task @swf
|
74
|
+
configure_task t
|
75
|
+
other = Rake::Task.define_task :parent => :run
|
76
|
+
other.invoke
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def configure_task t
|
83
|
+
t.logger = StringIO.new
|
84
|
+
|
85
|
+
# Comment following lines to really launch the player:
|
86
|
+
sys = FakeFlashPlayerSystem.new
|
87
|
+
FlashPlayer::Executable.any_instance.stubs(:current_system).returns sys
|
88
|
+
sys.expects(:open_flashplayer_with).returns Thread.new{}
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TrustTest < Test::Unit::TestCase
|
4
|
+
include Sprout::TestHelper
|
5
|
+
|
6
|
+
context "A Trust instance" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@fixture = File.join fixtures, 'trust'
|
10
|
+
@file = File.join @fixture, 'trust.cfg'
|
11
|
+
@project = File.join fixtures, 'SomeProject'
|
12
|
+
@trust = FlashPlayer::Trust.new
|
13
|
+
@trust.logger = StringIO.new
|
14
|
+
@trust.stubs(:trust_file).returns @file
|
15
|
+
end
|
16
|
+
|
17
|
+
teardown do
|
18
|
+
remove_file @fixture
|
19
|
+
end
|
20
|
+
|
21
|
+
should "create and update trust config with provided path" do
|
22
|
+
@trust.add @project
|
23
|
+
|
24
|
+
assert_file @file do |content|
|
25
|
+
assert_matches File.expand_path(@project), content
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|