flashsdk_sqe 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/Gemfile +3 -0
  2. data/Gemfile.lock +41 -0
  3. data/POSTINSTALL.rdoc +81 -0
  4. data/README.textile +79 -0
  5. data/VERSION +1 -0
  6. data/bin/flashlog +8 -0
  7. data/bin/flashplayer +9 -0
  8. data/bin/sprout-as3 +9 -0
  9. data/bin/sprout-flex +8 -0
  10. data/ext/CloseFlashPlayerForDumbassOSX.scpt +6 -0
  11. data/ext/OpenFlashPlayerForDumbassOSX.scpt +12 -0
  12. data/flashsdk_sqe.gemspec +25 -0
  13. data/lib/flashplayer.rb +9 -0
  14. data/lib/flashplayer/errors.rb +12 -0
  15. data/lib/flashplayer/executable.rb +142 -0
  16. data/lib/flashplayer/log_file.rb +100 -0
  17. data/lib/flashplayer/mm_config.rb +96 -0
  18. data/lib/flashplayer/module.rb +51 -0
  19. data/lib/flashplayer/specification.rb +45 -0
  20. data/lib/flashplayer/system_mixins.rb +98 -0
  21. data/lib/flashplayer/task.legacy.rb +293 -0
  22. data/lib/flashplayer/task.rb +62 -0
  23. data/lib/flashplayer/trust.rb +45 -0
  24. data/lib/flashsdk.rb +24 -0
  25. data/lib/flashsdk/acompc.rb +29 -0
  26. data/lib/flashsdk/adl.rb +83 -0
  27. data/lib/flashsdk/adt.rb +276 -0
  28. data/lib/flashsdk/amxmlc.rb +28 -0
  29. data/lib/flashsdk/asdoc.rb +164 -0
  30. data/lib/flashsdk/compc.rb +124 -0
  31. data/lib/flashsdk/compiler_base.rb +1131 -0
  32. data/lib/flashsdk/fcsh.rb +173 -0
  33. data/lib/flashsdk/fcsh_socket.rb +167 -0
  34. data/lib/flashsdk/fdb.rb +833 -0
  35. data/lib/flashsdk/generators/class_generator.rb +87 -0
  36. data/lib/flashsdk/generators/flash_helper.rb +234 -0
  37. data/lib/flashsdk/generators/flex_project_generator.rb +30 -0
  38. data/lib/flashsdk/generators/project_generator.rb +31 -0
  39. data/lib/flashsdk/generators/templates/ActionScript3Class.as +9 -0
  40. data/lib/flashsdk/generators/templates/ActionScript3MainClass.as +11 -0
  41. data/lib/flashsdk/generators/templates/ActionScript3RunnerClass.as +19 -0
  42. data/lib/flashsdk/generators/templates/DefaultProjectImage.png +0 -0
  43. data/lib/flashsdk/generators/templates/Flex4Application.mxml +45 -0
  44. data/lib/flashsdk/generators/templates/Flex4Main.css +7 -0
  45. data/lib/flashsdk/generators/templates/Flex4Rakefile.rb +34 -0
  46. data/lib/flashsdk/generators/templates/Flex4RunnerClass.mxml +29 -0
  47. data/lib/flashsdk/generators/templates/FlexTestRunner.mxml +0 -0
  48. data/lib/flashsdk/generators/templates/Gemfile +5 -0
  49. data/lib/flashsdk/generators/templates/rakefile.rb +79 -0
  50. data/lib/flashsdk/module.rb +107 -0
  51. data/lib/flashsdk/mxmlc.rb +160 -0
  52. data/lib/flex3.rb +54 -0
  53. data/lib/flex4.rb +115 -0
  54. data/pkg/flashsdk_sqe-0.0.1.gem +0 -0
  55. data/rakefile.rb +42 -0
  56. data/test/fixtures/acompc/simple/SomeAirFile.as +11 -0
  57. data/test/fixtures/air/simple/SomeProject.apk +1 -0
  58. data/test/fixtures/air/simple/SomeProject.as +11 -0
  59. data/test/fixtures/air/simple/SomeProject.mxml +9 -0
  60. data/test/fixtures/air/simple/SomeProject.pfx +0 -0
  61. data/test/fixtures/air/simple/SomeProject.swf +0 -0
  62. data/test/fixtures/air/simple/SomeProject.xml +13 -0
  63. data/test/fixtures/asdoc/lib/OtherFile.as +17 -0
  64. data/test/fixtures/asdoc/src/SomeFile.as +11 -0
  65. data/test/fixtures/compc/simple/SomeFile.as +11 -0
  66. data/test/fixtures/flashplayer/AsUnit Runner.swf +0 -0
  67. data/test/fixtures/mxmlc/broken/SomeFile.as +10 -0
  68. data/test/fixtures/mxmlc/simple/SomeFile.as +11 -0
  69. data/test/fixtures/sdk/fdb +90 -0
  70. data/test/fixtures/sdk/mxmlc +56 -0
  71. data/test/unit/acompc_test.rb +37 -0
  72. data/test/unit/adl_test.rb +32 -0
  73. data/test/unit/adt_test.rb +185 -0
  74. data/test/unit/amxmlc_test.rb +55 -0
  75. data/test/unit/asdoc_test.rb +45 -0
  76. data/test/unit/class_generator_test.rb +56 -0
  77. data/test/unit/compc_test.rb +37 -0
  78. data/test/unit/fake_flashplayer_system.rb +11 -0
  79. data/test/unit/fcsh_socket_test.rb +53 -0
  80. data/test/unit/fcsh_test.rb +55 -0
  81. data/test/unit/fdb_test.rb +54 -0
  82. data/test/unit/flash_helper_test.rb +43 -0
  83. data/test/unit/flashplayer_executable_test.rb +69 -0
  84. data/test/unit/flashplayer_log_file_test.rb +47 -0
  85. data/test/unit/flashplayer_mm_config_test.rb +74 -0
  86. data/test/unit/flashplayer_module_test.rb +56 -0
  87. data/test/unit/flashplayer_task_test.rb +91 -0
  88. data/test/unit/flashplayer_trust_test.rb +30 -0
  89. data/test/unit/flex_compiler_options_test.rb +213 -0
  90. data/test/unit/flex_generator_test.rb +37 -0
  91. data/test/unit/mxmlc_test.rb +65 -0
  92. data/test/unit/project_generator_test.rb +57 -0
  93. data/test/unit/test_helper.rb +18 -0
  94. metadata +200 -0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ flashsdk_sqe (0.0.1)
5
+ sprout (>= 1.1.18.pre)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ activesupport (3.2.8)
11
+ i18n (~> 0.6)
12
+ multi_json (~> 1.0)
13
+ archive-tar-minitar (0.5.2)
14
+ i18n (0.6.1)
15
+ metaclass (0.0.1)
16
+ mocha (0.12.4)
17
+ metaclass (~> 0.0.1)
18
+ multi_json (1.3.6)
19
+ open4 (1.3.0)
20
+ rake (0.9.2.2)
21
+ rubyzip (0.9.4)
22
+ shoulda (3.1.1)
23
+ shoulda-context (~> 1.0)
24
+ shoulda-matchers (~> 1.2)
25
+ shoulda-context (1.0.0)
26
+ shoulda-matchers (1.3.0)
27
+ activesupport (>= 3.0.0)
28
+ sprout (1.1.18.pre)
29
+ archive-tar-minitar (= 0.5.2)
30
+ bundler (>= 0.9.19)
31
+ open4 (>= 0.9.6)
32
+ rake (>= 0.9.2)
33
+ rubyzip (= 0.9.4)
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ flashsdk_sqe!
40
+ mocha
41
+ shoulda
data/POSTINSTALL.rdoc ADDED
@@ -0,0 +1,81 @@
1
+ SocialQuantum Edition
2
+
3
+ ++++++++++++++++++++++++++++++++
4
+ You have successfully installed the Project Sprouts Flash SDK!
5
+
6
+ To get started with a new ActionScript 3 project:
7
+
8
+ # Generate a project named 'SomeProject'
9
+ sprout-as3 SomeProject
10
+
11
+ # Change directory to the newly-created directory:
12
+ cd SomeProject
13
+
14
+ # Install whatever additional gems are required
15
+ # by this project Gemfile:
16
+ bundle install
17
+
18
+ # Use Rake to run the default task:
19
+ rake
20
+
21
+ ++++++++++++++++++++++++++++++++
22
+ Next Steps:
23
+
24
+ # Generate a new class, test case and test suite:
25
+ sprout-class utils.MathUtil
26
+
27
+ # Compile and run the test harness:
28
+ rake test
29
+
30
+ # List available rake tasks:
31
+ rake -T
32
+
33
+ # List available generators:
34
+ sprout-
35
+ (followed by the TAB key)
36
+
37
+ ++++++++++++++++++++++++++++++++
38
+ To use FCSH, simply start the service,
39
+ and call the fcsh task before any other
40
+ mxmlc or compc task:
41
+
42
+ # Open a new terminal and from your project:
43
+ rake fcsh:start
44
+
45
+ # Open a new terminal and from your project:
46
+ rake fcsh test
47
+
48
+ ++++++++++++++++++++++++++++++++
49
+ To use FDB, simply call the fdb task
50
+ before any flashplayer task:
51
+
52
+ # Run the default task with FDB:
53
+ rake fdb test
54
+
55
+ (type, 'help' for more info when prompted)
56
+
57
+ ++++++++++++++++++++++++++++++++
58
+ You can also launch any SWF file using
59
+ a debug Flash Player with:
60
+
61
+ flashplayer bin/SomeProject.swf
62
+
63
+ Or run a SWF with FDB like:
64
+
65
+ flashplayer --fdb bin/SomeProject.swf
66
+
67
+ ++++++++++++++++++++++++++++++++
68
+ You can also tail your system's flashlog
69
+ while running a SWF or HTML page with:
70
+
71
+ flashlog
72
+
73
+ ++++++++++++++++++++++++++++++++
74
+ Issues or Questions?
75
+
76
+ Troubleshooting at:
77
+ http://projectsprouts.org/troubleshooting.html
78
+
79
+ Email us at:
80
+ projectsprouts@googlegroups.com
81
+
data/README.textile ADDED
@@ -0,0 +1,79 @@
1
+
2
+ h1. The Flash SDK Sprout Gem
3
+
4
+ h3. Installation
5
+
6
+ # "Install Ruby":http://www.ruby-lang.org/en/downloads/ _(>= v 1.8.7)_
7
+ # "Install RubyGems":http://rubyforge.org/frs/?group_id=126 _(>= v 1.3.6)_
8
+ # Install the Flash SDK prerelease gem:
9
+
10
+ <pre><code>gem install flashsdk --pre</code></pre>
11
+
12
+ h3. Getting Started
13
+
14
+ Open a terminal and enter the following commands:
15
+
16
+ Create a new ActionScript 3 project and move into it:
17
+
18
+ <pre><code>sprout-as3 SomeProject
19
+ cd SomeProject</code></pre>
20
+
21
+
22
+ Resolve all dependencies, compile and launch the SWF:
23
+
24
+ <pre><code>rake</code></pre>
25
+
26
+ Generate a new class, test case and test suite:
27
+
28
+ <pre><code>sprout-class utils.MathUtil</code></pre>
29
+
30
+ Compile and launch the test harness:
31
+
32
+ <pre><code>rake test</code></pre>
33
+
34
+ Compile a SWC file:
35
+
36
+ <pre><code>rake swc</code></pre>
37
+
38
+ Generate documentation using "AsDoc":http://labs.adobe.com/wiki/index.php/ASDoc:
39
+
40
+ <pre><code>rake asdoc</code></pre>
41
+
42
+ Execute the test harness, emit a JUnit-compatible test results document, and close the Flash Player when complete or after encountering an uncaught exception:
43
+
44
+ <pre><code>rake ci</code></pre>
45
+
46
+ Display all available Rake tasks:
47
+
48
+ <pre><code>rake -T</code></pre>
49
+
50
+ h3. Some Links
51
+
52
+ * "Web Site":http://projectsprouts.org
53
+ * "See the Documentation":http://projectsprouts.org/rdoc
54
+ * "Meet the Community":http://groups.google.com/group/projectsprouts
55
+
56
+ h3. MIT License
57
+
58
+ <pre>
59
+ Copyright (c) 2007-2010 Pattern Park
60
+
61
+ Permission is hereby granted, free of charge, to any person obtaining
62
+ a copy of this software and associated documentation files (the
63
+ "Software"), to deal in the Software without restriction, including
64
+ without limitation the rights to use, copy, modify, merge, publish,
65
+ distribute, sublicense, and/or sell copies of the Software, and to
66
+ permit persons to whom the Software is furnished to do so, subject to
67
+ the following conditions:
68
+
69
+ The above copyright notice and this permission notice shall be
70
+ included in all copies or substantial portions of the Software.
71
+
72
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
73
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
74
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
75
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
76
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
77
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
78
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
79
+ </pre>
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/flashlog ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'flashsdk'
5
+
6
+ reader = FlashPlayer::LogFile.new
7
+ reader.tail
8
+
data/bin/flashplayer ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'flashsdk'
5
+
6
+ player = FlashPlayer::Executable.new
7
+ player.parse! ARGV
8
+ player.execute
9
+
data/bin/sprout-as3 ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'flashsdk'
5
+
6
+ generator = FlashSDK::ProjectGenerator.new
7
+ generator.parse! ARGV
8
+ generator.execute
9
+
data/bin/sprout-flex ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'flashsdk'
5
+
6
+ generator = FlashSDK::FlexProjectGenerator.new
7
+ generator.parse! ARGV
8
+ generator.execute
@@ -0,0 +1,6 @@
1
+
2
+ on run argv
3
+ set flash_player to item 1 of argv as text
4
+ tell application flash_player to quit
5
+ end run
6
+
@@ -0,0 +1,12 @@
1
+
2
+ on run argv
3
+ set flash_player to item 1 of argv as text
4
+ set swf_file to item 2 of argv as text
5
+ tell application flash_player to activate
6
+ tell application flash_player to open swf_file
7
+ repeat
8
+ if application flash_player is not running then exit repeat
9
+ delay 0.1
10
+ end repeat
11
+ end run
12
+
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'bundler'
6
+ require 'flashsdk/module.rb'
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = 'flashsdk_sqe'
10
+ s.version = FlashSDK::VERSION
11
+ s.author = "realb0t"
12
+ s.email = "kazantsev.nickolay@gmail.com"
13
+ s.homepage = "http://www.adobe.com/products/flex"
14
+ s.summary = "Adobe Flash SDK including mxmlc, compc, asdoc, adl, adt, optimizer and fdb"
15
+ s.description = "The Flash SDK Rubygem is brought to you by Project Sprouts (http://projectsprouts.org)"
16
+ s.executables = ['sprout-as3', 'sprout-flex', 'flashplayer', 'flashlog']
17
+ s.post_install_message = File.read 'POSTINSTALL.rdoc'
18
+ s.files = Dir['**/*']
19
+ s.files.reject! { |fn| fn.match /.git|.svn|.DS_Store/ }
20
+ s.add_dependency('sprout', '>= 1.1.18.pre')
21
+ s.add_development_dependency('shoulda')
22
+ s.add_development_dependency('mocha')
23
+ s.require_paths << 'lib'
24
+ end
25
+
@@ -0,0 +1,9 @@
1
+ require 'flashplayer/system_mixins'
2
+ require 'flashplayer/errors'
3
+ require 'flashplayer/module'
4
+ require 'flashplayer/mm_config'
5
+ require 'flashplayer/trust'
6
+ require 'flashplayer/log_file'
7
+ require 'flashplayer/executable'
8
+ require 'flashplayer/task'
9
+ require 'flashplayer/specification'
@@ -0,0 +1,12 @@
1
+
2
+ module FlashPlayer
3
+
4
+ ##
5
+ # Had trouble finding or resolving a path.
6
+ class PathError < StandardError; end
7
+
8
+ ##
9
+ # There was a problem with an input.
10
+ class UsageError < StandardError; end
11
+ end
12
+
@@ -0,0 +1,142 @@
1
+
2
+ module FlashPlayer
3
+
4
+ class Executable < Sprout::Executable::Base
5
+
6
+ attr_accessor :stdout
7
+ attr_accessor :stderr
8
+
9
+ ##
10
+ # The file that the Flash Player should launch.
11
+ #
12
+ # flashplayer bin/SomeProject.swf
13
+ #
14
+ add_param :input, String, { :hidden_name => true, :required => true }
15
+
16
+ ##
17
+ # Drop into FDB after launching the Player.
18
+ #
19
+ # flashplayer --fdb bin/SomeProject.swf
20
+ #
21
+ add_param :fdb, Boolean, { :hidden_value => true }
22
+
23
+ ##
24
+ # The Flash Player version to use.
25
+ add_param :version, String, { :default => FlashPlayer::VERSION }
26
+
27
+ def initialize
28
+ super
29
+ @mm_config = MMConfig.new
30
+ @reader = LogFile.new
31
+ @trust_config = Trust.new
32
+ @process = nil
33
+ @stdout = $stdout
34
+ @stderr = $stderr
35
+ @logger = $stdout
36
+ self.pkg_name = FlashPlayer::NAME
37
+ self.pkg_version = FlashPlayer::VERSION
38
+ end
39
+
40
+ def execute *args
41
+ execute_safely do
42
+ update_mm_config
43
+ update_trust_config_with input
44
+ end
45
+
46
+ if use_fdb?
47
+ launch_fdb_and_player_with input
48
+ else
49
+ tail_flashlog(*launch_player_with(input))
50
+ end
51
+ end
52
+
53
+ def use_fdb?
54
+ # Check as string b/c this is
55
+ # how the boolean value comes
56
+ # accross the command line input.
57
+ fdb || ENV['USE_FDB'].to_s == 'true'
58
+ end
59
+
60
+ def logger=(logger)
61
+ @logger = logger
62
+ @mm_config.logger = logger
63
+ @reader.logger = logger
64
+ @trust_config.logger = logger
65
+ end
66
+
67
+ def logger
68
+ @logger
69
+ end
70
+
71
+ private
72
+
73
+ def launch_fdb_and_player_with input
74
+ # Keep getting a fatal lock error which I believe
75
+ # is being caused by the FlashPlayer and FDB attempting
76
+ # to write to stdout simultaneously.
77
+ # Trying to give fdb a fake stream until after the
78
+ # player is launched...
79
+ fake_out = Sprout::OutputBuffer.new
80
+ fake_err = Sprout::OutputBuffer.new
81
+
82
+ fdb_instance = FlashSDK::FDB.new
83
+ fdb_instance.stdout = fake_out
84
+ fdb_instance.stderr = fake_err
85
+ fdb_instance.execute false
86
+ fdb_instance.run
87
+ player_thread = launch_player_with input
88
+
89
+ # Emit whatever messages have been passed:
90
+ stdout.puts fake_out.read
91
+ stdout.flush
92
+ stderr.puts fake_err.read
93
+ stdout.flush
94
+ # Replace the fdb instance streams with
95
+ # the real ones:
96
+ fdb_instance.stdout = stdout
97
+ fdb_instance.stderr = stderr
98
+
99
+ # Let the user interact with fdb:
100
+ fdb_instance.handle_user_input
101
+
102
+ fdb_instance.wait
103
+ player_thread.join if player_thread.alive?
104
+ end
105
+
106
+ def execute_safely
107
+ begin
108
+ Thread.abort_on_exception = true
109
+ yield if block_given?
110
+ rescue FlashPlayer::PathError => e
111
+ logger.puts ">> [WARNING] It seems this was the first time FlashPlayer was launched on this system and as a result, the expected folders were not found. Please close the Player and run again - this message should only ever be displayed once."
112
+ end
113
+ end
114
+
115
+ def update_mm_config
116
+ @mm_config.create
117
+ end
118
+
119
+ def update_trust_config_with swf
120
+ @trust_config.add File.dirname(swf)
121
+ end
122
+
123
+ def clean_path path
124
+ current_system.clean_path path
125
+ end
126
+
127
+ def current_system
128
+ @current_system ||= Sprout.current_system
129
+ end
130
+
131
+ def launch_player_with swf
132
+ player = Sprout::Executable.load(:flashplayer, pkg_name, pkg_version).path
133
+ current_system.open_flashplayer_with player, clean_path(swf)
134
+ end
135
+
136
+ def tail_flashlog *args
137
+ @reader.tail(*args)
138
+ end
139
+
140
+ end
141
+ end
142
+