flashsdk 1.0.5.pre → 1.0.12.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +26 -0
- data/POSTINSTALL.rdoc +1 -1
- data/README.textile +79 -0
- data/VERSION +1 -1
- data/bin/sprout-flex +8 -0
- data/doc/adl-list.txt +4 -0
- data/doc/adt-list.txt +12 -0
- data/ext/CloseFlashPlayerForDumbassOSX.scpt +6 -0
- data/ext/OpenFlashPlayerForDumbassOSX.scpt +12 -0
- data/flashsdk-1.0.11.pre.gem +0 -0
- data/flashsdk.gemspec +1 -3
- data/lib/flashplayer/log_file.rb +4 -5
- data/lib/flashplayer/specification.rb +1 -1
- data/lib/flashplayer/system_mixins.rb +91 -0
- data/lib/flashplayer/task.rb +1 -38
- data/lib/flashplayer.rb +1 -0
- data/lib/flashsdk/adl.rb +50 -0
- data/lib/flashsdk/adt.rb +227 -0
- data/lib/flashsdk/amxmlc.rb +29 -0
- data/lib/flashsdk/compc.rb +6 -3
- data/lib/flashsdk/compiler_base.rb +8 -0
- data/lib/flashsdk/generators/flash_helper.rb +27 -7
- data/lib/flashsdk/generators/flex_project_generator.rb +30 -0
- data/lib/flashsdk/generators/project_generator.rb +6 -6
- data/lib/flashsdk/generators/templates/ActionScript3RunnerClass.as +19 -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 +35 -0
- data/lib/flashsdk/generators/templates/Flex4RunnerClass.mxml +29 -0
- data/lib/flashsdk/generators/templates/FlexTestRunner.mxml +0 -0
- data/lib/flashsdk/generators/templates/rakefile.rb +24 -4
- data/lib/flashsdk/module.rb +2 -2
- data/lib/flashsdk/mxmlc.rb +10 -7
- data/lib/flashsdk.rb +4 -0
- data/lib/flex4.rb +2 -2
- data/mate +0 -0
- data/rakefile.rb +22 -3
- 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/flashplayer/AsUnit Runner.swf +0 -0
- data/test/unit/adl_test.rb +30 -0
- data/test/unit/adt_test.rb +68 -0
- data/test/unit/amxmlc_test.rb +54 -0
- data/test/unit/{task_test.rb → flashplayer_task_test.rb} +4 -5
- data/test/unit/flex_generator_test.rb +37 -0
- data/test/unit/mxmlc_test.rb +5 -5
- data/test/unit/project_generator_test.rb +4 -0
- data/test/unit/test_helper.rb +4 -5
- metadata +51 -14
- data/lib/flashplayer/clix_flash_player.rb +0 -91
- data/lib/flashplayer/clix_wrapper.rb +0 -22
- /data/test/unit/{log_file_test.rb → flashplayer_log_file_test.rb} +0 -0
- /data/test/unit/{mm_config_test.rb → flashplayer_mm_config_test.rb} +0 -0
- /data/test/unit/{flashplayer_test.rb → flashplayer_module_test.rb} +0 -0
- /data/test/unit/{trust_test.rb → flashplayer_trust_test.rb} +0 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
class AMXMLCTest < Test::Unit::TestCase
|
4
|
+
include SproutTestCase
|
5
|
+
|
6
|
+
context "An AMXMLC tool" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@fixture = File.join 'test', 'fixtures', 'air', 'simple'
|
10
|
+
@input = File.join @fixture, 'SomeProject.as'
|
11
|
+
@expected_output = File.join @fixture, 'bin', 'SomeProject.swf'
|
12
|
+
#Sprout::Log.debug = false
|
13
|
+
end
|
14
|
+
|
15
|
+
teardown do
|
16
|
+
remove_file File.join(@fixture, 'bin')
|
17
|
+
end
|
18
|
+
|
19
|
+
should "accept input" do
|
20
|
+
as_a_unix_system do
|
21
|
+
amxmlc = FlashSDK::AMXMLC.new
|
22
|
+
amxmlc.input = @input
|
23
|
+
amxmlc.source_path << @fixture
|
24
|
+
assert_equal '-source-path+=test/fixtures/air/simple -static-link-runtime-shared-libraries test/fixtures/air/simple/SomeProject.as', amxmlc.to_shell
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
should "compile a swf" do
|
29
|
+
amxmlc = FlashSDK::AMXMLC.new
|
30
|
+
amxmlc.input = @input
|
31
|
+
amxmlc.output = @expected_output
|
32
|
+
amxmlc.execute
|
33
|
+
assert_file @expected_output
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
should "assign default-size" do
|
38
|
+
amxmlc = FlashSDK::AMXMLC.new
|
39
|
+
amxmlc.default_size = '800,500'
|
40
|
+
amxmlc.static_link_runtime_shared_libraries = false
|
41
|
+
assert_equal '-default-size=800,500', amxmlc.to_shell
|
42
|
+
end
|
43
|
+
|
44
|
+
should "assign simple output" do
|
45
|
+
as_a_unix_system do
|
46
|
+
t = amxmlc 'bin/SomeProject.swf' do |t|
|
47
|
+
t.input = @input
|
48
|
+
end
|
49
|
+
assert_equal '-output=bin/SomeProject.swf -static-link-runtime-shared-libraries test/fixtures/air/simple/SomeProject.as', t.to_shell
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
@@ -11,7 +11,7 @@ class TaskTest < Test::Unit::TestCase
|
|
11
11
|
# Executable.clear_entities! but 'require'
|
12
12
|
# only runs once per VM run...
|
13
13
|
load 'flashplayer/specification.rb'
|
14
|
-
@swf = File.join(fixtures, '
|
14
|
+
@swf = File.join(fixtures, 'flashplayer', 'AsUnit Runner.swf')
|
15
15
|
@missing_home = File.join(fixtures, 'missing_folder')
|
16
16
|
@config_path = File.join(@missing_home, 'fp_config', 'mm.cfg')
|
17
17
|
end
|
@@ -20,7 +20,7 @@ class TaskTest < Test::Unit::TestCase
|
|
20
20
|
remove_file @missing_home
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
## THIS METHOD WAS COMMENTED OUT....
|
24
24
|
should "wait for SWF even if clean system" do
|
25
25
|
# No creation of expected FlashPlayer folders...
|
26
26
|
|
@@ -34,7 +34,6 @@ class TaskTest < Test::Unit::TestCase
|
|
34
34
|
t.invoke
|
35
35
|
end
|
36
36
|
end
|
37
|
-
=end
|
38
37
|
|
39
38
|
should "work with swf as task name" do
|
40
39
|
t = flashplayer @swf
|
@@ -75,13 +74,13 @@ class TaskTest < Test::Unit::TestCase
|
|
75
74
|
t.logger = StringIO.new
|
76
75
|
|
77
76
|
# Comment following lines to really launch the player:
|
78
|
-
sys =
|
77
|
+
sys = FakeFlashPlayerSystem.new
|
79
78
|
t.stubs(:current_system).returns sys
|
80
79
|
sys.expects(:open_flashplayer_with).returns Thread.new{}
|
81
80
|
end
|
82
81
|
end
|
83
82
|
|
84
|
-
class
|
83
|
+
class FakeFlashPlayerSystem
|
85
84
|
|
86
85
|
def clean_path path
|
87
86
|
path
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_helper")
|
2
|
+
|
3
|
+
class FlexGeneratorTest < Test::Unit::TestCase
|
4
|
+
include SproutTestCase
|
5
|
+
|
6
|
+
context "A new Flex generator" do
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@temp = File.join(fixtures, 'generators', 'tmp')
|
10
|
+
FileUtils.mkdir_p @temp
|
11
|
+
@generator = FlashSDK::FlexProjectGenerator.new
|
12
|
+
@generator.path = @temp
|
13
|
+
@generator.logger = StringIO.new
|
14
|
+
end
|
15
|
+
|
16
|
+
teardown do
|
17
|
+
remove_file @temp
|
18
|
+
end
|
19
|
+
|
20
|
+
should "generate a new Flex" do
|
21
|
+
@generator.input = "Flex"
|
22
|
+
@generator.execute
|
23
|
+
|
24
|
+
input_dir = File.join(@temp, "Flex")
|
25
|
+
assert_directory input_dir
|
26
|
+
|
27
|
+
src_dir = File.join(input_dir, "src")
|
28
|
+
assert_directory src_dir
|
29
|
+
|
30
|
+
input_file = File.join(src_dir, "Flex.mxml")
|
31
|
+
assert_file input_file do |content|
|
32
|
+
assert_matches /Flex.mxml::FlexCompleteHandler/, content
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/test/unit/mxmlc_test.rb
CHANGED
@@ -6,7 +6,7 @@ class MXMLCTest < Test::Unit::TestCase
|
|
6
6
|
context "An MXMLC tool" do
|
7
7
|
|
8
8
|
setup do
|
9
|
-
@fixture = File.join
|
9
|
+
@fixture = File.join fixtures, 'mxmlc', 'simple'
|
10
10
|
@input = File.join @fixture, 'SomeFile.as'
|
11
11
|
@expected_output = File.join @fixture, 'SomeFile.swf'
|
12
12
|
#Sprout::Log.debug = false
|
@@ -19,9 +19,9 @@ class MXMLCTest < Test::Unit::TestCase
|
|
19
19
|
should "accept input" do
|
20
20
|
as_a_unix_system do
|
21
21
|
mxmlc = FlashSDK::MXMLC.new
|
22
|
-
mxmlc.input =
|
23
|
-
mxmlc.source_path <<
|
24
|
-
assert_equal '
|
22
|
+
mxmlc.input = 'test/fixtures/mxmlc/simple/SomeFile.as'
|
23
|
+
mxmlc.source_path << 'test/fixtures/mxmlc/simple'
|
24
|
+
assert_equal '-source-path+=test/fixtures/mxmlc/simple -static-link-runtime-shared-libraries test/fixtures/mxmlc/simple/SomeFile.as', mxmlc.to_shell
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -37,7 +37,7 @@ class MXMLCTest < Test::Unit::TestCase
|
|
37
37
|
mxmlc = FlashSDK::MXMLC.new
|
38
38
|
mxmlc.default_size = '800,500'
|
39
39
|
mxmlc.static_link_runtime_shared_libraries = false
|
40
|
-
assert_equal '
|
40
|
+
assert_equal '-default-size=800,500', mxmlc.to_shell
|
41
41
|
end
|
42
42
|
|
43
43
|
should "assign simple output" do
|
@@ -32,6 +32,10 @@ class ProjectGeneratorTest < Test::Unit::TestCase
|
|
32
32
|
assert_file File.join(project, 'src', 'SomeProject.as') do |content|
|
33
33
|
assert_matches /flash.display.Sprite;/, content
|
34
34
|
end
|
35
|
+
assert_file File.join(project, 'src', 'SomeProjectRunner.as') do |content|
|
36
|
+
assert_matches /asunit.core.TextCore;/, content
|
37
|
+
|
38
|
+
end
|
35
39
|
assert_directory File.join(project, 'lib')
|
36
40
|
assert_directory File.join(project, 'bin')
|
37
41
|
end
|
data/test/unit/test_helper.rb
CHANGED
@@ -3,15 +3,14 @@ require "bundler"
|
|
3
3
|
|
4
4
|
Bundler.setup :default, :development
|
5
5
|
|
6
|
+
require 'sprout'
|
6
7
|
# These require statments *must* be in this order:
|
7
8
|
# http://bit.ly/bCC0Ew
|
8
9
|
# Somewhat surprised they're not being required by Bundler...
|
9
10
|
require 'shoulda'
|
10
11
|
require 'mocha'
|
11
|
-
require 'test/unit'
|
12
|
-
|
13
|
-
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'flashsdk')
|
14
|
-
$:.unshift File.dirname(__FILE__)
|
15
12
|
|
13
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
14
|
+
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
15
|
+
require 'flashsdk'
|
16
16
|
require 'sprout/test/sprout_test_case'
|
17
|
-
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flashsdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: -499621543
|
4
5
|
prerelease: true
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
+
- 12
|
9
10
|
- pre
|
10
|
-
version: 1.0.
|
11
|
+
version: 1.0.12.pre
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Luke Bayes
|
@@ -15,30 +16,34 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-10-09 00:00:00 -07:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: sprout
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: -499621631
|
27
30
|
segments:
|
28
31
|
- 1
|
29
32
|
- 0
|
30
|
-
-
|
33
|
+
- 26
|
31
34
|
- pre
|
32
|
-
version: 1.0.
|
35
|
+
version: 1.0.26.pre
|
33
36
|
type: :runtime
|
34
37
|
prerelease: false
|
35
38
|
version_requirements: *id001
|
36
39
|
- !ruby/object:Gem::Dependency
|
37
40
|
name: shoulda
|
38
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
39
43
|
requirements:
|
40
44
|
- - ">="
|
41
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
42
47
|
segments:
|
43
48
|
- 0
|
44
49
|
version: "0"
|
@@ -48,9 +53,11 @@ dependencies:
|
|
48
53
|
- !ruby/object:Gem::Dependency
|
49
54
|
name: mocha
|
50
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
51
57
|
requirements:
|
52
58
|
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
54
61
|
segments:
|
55
62
|
- 0
|
56
63
|
version: "0"
|
@@ -61,39 +68,54 @@ description: The Flash SDK Rubygem is brought to you by Project Sprouts (http://
|
|
61
68
|
email: projectsprouts@googlegroups.com
|
62
69
|
executables:
|
63
70
|
- sprout-as3
|
71
|
+
- sprout-flex
|
64
72
|
extensions: []
|
65
73
|
|
66
74
|
extra_rdoc_files: []
|
67
75
|
|
68
76
|
files:
|
69
77
|
- bin/sprout-as3
|
78
|
+
- bin/sprout-flex
|
70
79
|
- doc/adl-list.txt
|
71
80
|
- doc/adt-list.txt
|
72
81
|
- doc/compc-list.txt
|
73
82
|
- doc/mxmlc-advanced-list.txt
|
74
83
|
- doc/mxmlc-list.txt
|
84
|
+
- ext/CloseFlashPlayerForDumbassOSX.scpt
|
85
|
+
- ext/OpenFlashPlayerForDumbassOSX.scpt
|
86
|
+
- flashsdk-1.0.11.pre.gem
|
75
87
|
- flashsdk.gemspec
|
76
88
|
- Gemfile
|
77
|
-
-
|
78
|
-
- lib/flashplayer/clix_wrapper.rb
|
89
|
+
- Gemfile.lock
|
79
90
|
- lib/flashplayer/errors.rb
|
80
91
|
- lib/flashplayer/log_file.rb
|
81
92
|
- lib/flashplayer/mm_config.rb
|
82
93
|
- lib/flashplayer/module.rb
|
83
94
|
- lib/flashplayer/specification.rb
|
95
|
+
- lib/flashplayer/system_mixins.rb
|
84
96
|
- lib/flashplayer/task.legacy.rb
|
85
97
|
- lib/flashplayer/task.rb
|
86
98
|
- lib/flashplayer/trust.rb
|
87
99
|
- lib/flashplayer.rb
|
100
|
+
- lib/flashsdk/adl.rb
|
101
|
+
- lib/flashsdk/adt.rb
|
102
|
+
- lib/flashsdk/amxmlc.rb
|
88
103
|
- lib/flashsdk/compc.rb
|
89
104
|
- lib/flashsdk/compc_legacy.rb
|
90
105
|
- lib/flashsdk/compiler_base.rb
|
91
106
|
- lib/flashsdk/generators/class_generator.rb
|
92
107
|
- lib/flashsdk/generators/flash_helper.rb
|
108
|
+
- lib/flashsdk/generators/flex_project_generator.rb
|
93
109
|
- lib/flashsdk/generators/project_generator.rb
|
94
110
|
- lib/flashsdk/generators/templates/ActionScript3Class.as
|
95
111
|
- lib/flashsdk/generators/templates/ActionScript3MainClass.as
|
112
|
+
- lib/flashsdk/generators/templates/ActionScript3RunnerClass.as
|
96
113
|
- lib/flashsdk/generators/templates/DefaultProjectImage.png
|
114
|
+
- lib/flashsdk/generators/templates/Flex4Application.mxml
|
115
|
+
- lib/flashsdk/generators/templates/Flex4Main.css
|
116
|
+
- lib/flashsdk/generators/templates/Flex4Rakefile.rb
|
117
|
+
- lib/flashsdk/generators/templates/Flex4RunnerClass.mxml
|
118
|
+
- lib/flashsdk/generators/templates/FlexTestRunner.mxml
|
97
119
|
- lib/flashsdk/generators/templates/Gemfile
|
98
120
|
- lib/flashsdk/generators/templates/rakefile.rb
|
99
121
|
- lib/flashsdk/module.rb
|
@@ -102,22 +124,33 @@ files:
|
|
102
124
|
- lib/flashsdk.rb
|
103
125
|
- lib/flex3.rb
|
104
126
|
- lib/flex4.rb
|
127
|
+
- mate
|
105
128
|
- POSTINSTALL.rdoc
|
106
129
|
- rakefile.rb
|
107
130
|
- README.textile
|
131
|
+
- test/fixtures/air/simple/SomeProject.as
|
132
|
+
- test/fixtures/air/simple/SomeProject.mxml
|
133
|
+
- test/fixtures/air/simple/SomeProject.pfx
|
134
|
+
- test/fixtures/air/simple/SomeProject.swf
|
135
|
+
- test/fixtures/air/simple/SomeProject.xml
|
108
136
|
- test/fixtures/compc/simple/SomeFile.as
|
137
|
+
- test/fixtures/flashplayer/AsUnit Runner.swf
|
109
138
|
- test/fixtures/mxmlc/simple/SomeFile.as
|
139
|
+
- test/unit/adl_test.rb
|
140
|
+
- test/unit/adt_test.rb
|
141
|
+
- test/unit/amxmlc_test.rb
|
110
142
|
- test/unit/class_generator_test.rb
|
111
143
|
- test/unit/compc_test.rb
|
112
144
|
- test/unit/flash_helper_test.rb
|
113
|
-
- test/unit/
|
114
|
-
- test/unit/
|
115
|
-
- test/unit/
|
145
|
+
- test/unit/flashplayer_log_file_test.rb
|
146
|
+
- test/unit/flashplayer_mm_config_test.rb
|
147
|
+
- test/unit/flashplayer_module_test.rb
|
148
|
+
- test/unit/flashplayer_task_test.rb
|
149
|
+
- test/unit/flashplayer_trust_test.rb
|
150
|
+
- test/unit/flex_generator_test.rb
|
116
151
|
- test/unit/mxmlc_test.rb
|
117
152
|
- test/unit/project_generator_test.rb
|
118
|
-
- test/unit/task_test.rb
|
119
153
|
- test/unit/test_helper.rb
|
120
|
-
- test/unit/trust_test.rb
|
121
154
|
- VERSION
|
122
155
|
has_rdoc: true
|
123
156
|
homepage: http://www.adobe.com/products/flex
|
@@ -125,7 +158,7 @@ licenses: []
|
|
125
158
|
|
126
159
|
post_install_message: |+
|
127
160
|
++++++++++++++++++++++++++++++++
|
128
|
-
You have successfully installed the Project Sprouts
|
161
|
+
You have successfully installed the Project Sprouts Flash SDK!
|
129
162
|
|
130
163
|
To get started with a new ActionScript 3 project:
|
131
164
|
|
@@ -170,16 +203,20 @@ require_paths:
|
|
170
203
|
- lib
|
171
204
|
- lib
|
172
205
|
required_ruby_version: !ruby/object:Gem::Requirement
|
206
|
+
none: false
|
173
207
|
requirements:
|
174
208
|
- - ">="
|
175
209
|
- !ruby/object:Gem::Version
|
210
|
+
hash: 3
|
176
211
|
segments:
|
177
212
|
- 0
|
178
213
|
version: "0"
|
179
214
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
|
+
none: false
|
180
216
|
requirements:
|
181
217
|
- - ">"
|
182
218
|
- !ruby/object:Gem::Version
|
219
|
+
hash: 25
|
183
220
|
segments:
|
184
221
|
- 1
|
185
222
|
- 3
|
@@ -188,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
225
|
requirements: []
|
189
226
|
|
190
227
|
rubyforge_project:
|
191
|
-
rubygems_version: 1.3.
|
228
|
+
rubygems_version: 1.3.7
|
192
229
|
signing_key:
|
193
230
|
specification_version: 3
|
194
231
|
summary: Adobe Flash SDK including mxmlc, compc, asdoc, adl, adt, optimizer and fdb
|
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'open4'
|
3
|
-
|
4
|
-
$CLIX_WRAPPER_TARGET = File.join(File.expand_path(File.dirname(__FILE__)), 'clix_wrapper.rb')
|
5
|
-
|
6
|
-
class CLIXFlashPlayerError < StandardError; end
|
7
|
-
|
8
|
-
class CLIXFlashPlayer
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@activate_pid = nil
|
12
|
-
@player_pid = nil
|
13
|
-
@thread = nil
|
14
|
-
end
|
15
|
-
|
16
|
-
def execute(player, swf)
|
17
|
-
cleanup
|
18
|
-
player = clean_path(player)
|
19
|
-
swf = clean_path(swf)
|
20
|
-
validate(player, swf)
|
21
|
-
|
22
|
-
if(!player.match('Contents/MacOS'))
|
23
|
-
player = File.join(player, 'Contents', 'MacOS', 'Flash Player')
|
24
|
-
end
|
25
|
-
|
26
|
-
setup_trap
|
27
|
-
|
28
|
-
@thread = Thread.new {
|
29
|
-
@player_pid = open4.popen4("#{player.split(' ').join('\ ')}")[0]
|
30
|
-
begin
|
31
|
-
raise "clix_wrapper.rb could not be found at: #{wrapper}" if !File.exists?($CLIX_WRAPPER_TARGET)
|
32
|
-
command = "ruby #{$CLIX_WRAPPER_TARGET} '#{player}' '#{swf}'"
|
33
|
-
@activate_pid, stdin, stdout, stderr = open4.popen4(command)
|
34
|
-
$stdout.puts stdout.read
|
35
|
-
error = stderr.read
|
36
|
-
raise error if !error.nil? && error != ''
|
37
|
-
Process.wait(@player_pid)
|
38
|
-
rescue StandardError => e
|
39
|
-
$stdout.puts e.to_s
|
40
|
-
kill
|
41
|
-
raise e
|
42
|
-
end
|
43
|
-
}
|
44
|
-
end
|
45
|
-
|
46
|
-
def kill
|
47
|
-
system("kill -9 #{@player_pid}")
|
48
|
-
end
|
49
|
-
|
50
|
-
def join
|
51
|
-
if(@thread.alive?)
|
52
|
-
@thread.join
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def alive?
|
57
|
-
return @thread.alive?
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def clean_path(path)
|
63
|
-
File.expand_path(path.gsub("'", '').gsub("\\", ''))
|
64
|
-
end
|
65
|
-
|
66
|
-
def cleanup
|
67
|
-
if(@thread && @thread.alive?)
|
68
|
-
kill
|
69
|
-
@thread.join
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def validate(player, swf)
|
74
|
-
raise CLIXFlashPlayerError.new("Player must not be nil") if(player.nil? || player == '')
|
75
|
-
raise CLIXFlashPlayerError.new("Player cannot be found: '#{player}'") if(!File.exists?(player))
|
76
|
-
raise CLIXFlashPlayerError.new("SWF must not be nil") if(swf.nil? || swf == '')
|
77
|
-
raise CLIXFlashPlayerError.new("SWF cannot be found: '#{swf}'") if(!File.exists?(swf))
|
78
|
-
end
|
79
|
-
|
80
|
-
def setup_trap
|
81
|
-
# Trap the CTRL+C Interrupt signal
|
82
|
-
# Which prevents nasty exception messages
|
83
|
-
Kernel.trap('INT') do
|
84
|
-
if(@thread.alive?)
|
85
|
-
@thread.kill
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
require 'rubygems'
|
3
|
-
|
4
|
-
player = ARGV[0]
|
5
|
-
swf = ARGV[1]
|
6
|
-
|
7
|
-
raise "CLIXWrapper requires 'player' argument like:\nruby clix_wrapper [player] [swf]" if(player.nil?)
|
8
|
-
raise "CLIXWrapper could not find player at '#{player}'" if !File.exists?(player)
|
9
|
-
|
10
|
-
raise "CLIXWrapper requires 'swf' argument like:\nruby clix_wrapper [player] [swf]" if(swf.nil?)
|
11
|
-
raise "CLIXWrapper could not find swf at '#{swf}'" if !File.exists?(swf)
|
12
|
-
|
13
|
-
begin
|
14
|
-
require 'appscript'
|
15
|
-
# Give the player focus:
|
16
|
-
Appscript.app(player).activate
|
17
|
-
# Open the SWF:
|
18
|
-
Appscript.app(player).open(MacTypes::Alias.path(swf))
|
19
|
-
rescue LoadError => e
|
20
|
-
raise "\n\n[ERROR] You must install the rb-appscript gem to use the desktop debug Flash Player, you do this by running:\n\ngem install rb-appscript"
|
21
|
-
end
|
22
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|