flashsdk_sqe 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flashsdk_sqe (0.0.2)
4
+ flashsdk_sqe (0.0.3)
5
5
  sprout (>= 1.1.18.pre)
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -5,6 +5,8 @@ module FlashPlayer
5
5
 
6
6
  attr_accessor :logger
7
7
  attr_accessor :player_pid
8
+ attr_accessor :result_string
9
+ attr_accessor :result_failure
8
10
 
9
11
  def initialize
10
12
  @logger = $stdout
@@ -30,33 +32,35 @@ module FlashPlayer
30
32
  lines_put = 0
31
33
 
32
34
  while thread.alive? do
33
- lines_put, last_line = read_from_file path, lines_put
35
+ lines_put = read_from_file path, lines_put
34
36
  logger.flush
35
- sleep(0.1)
36
-
37
- unless last_line.nil?
37
+ if !result_string.nil?
38
38
  thread.kill
39
39
  Process.kill('KILL', self.player_pid) if self.player_pid
40
- raise 'FlexUnit ERROR: ' + last_line
40
+ if self.result_failure
41
+ raise self.result_string.join('')
42
+ else
43
+ logger.puts self.result_string
44
+ end
41
45
  end
46
+ sleep(0.1)
42
47
  end
43
48
  end
44
49
 
45
50
  def read_from_file path, lines_put
46
- last_line = nil
47
51
  File.open(path, 'r') do |file|
48
52
  lines_read = 0
49
- file.readlines.each do |line|
50
- last_line = line if line =~ /ALL TESTS ARE COMPLETED/
53
+ all_lines = file.readlines
54
+ all_lines.each.with_index do |line, index|
51
55
  if(lines_read >= lines_put)
52
- logger.puts "[trace] #{line}"
53
- logger.flush
56
+ self.result_failure = true if line =~ /TESTS HAS FAILURES/
57
+ self.result_string = all_lines[index+1 .. -1] if line =~ /ALL TESTS ARE COMPLETED/ && self.result_string.nil?
54
58
  lines_put += 1
55
59
  end
56
60
  lines_read += 1
57
61
  end
58
62
  end unless !File.exists?(path)
59
- [lines_put, last_line]
63
+ lines_put
60
64
  end
61
65
 
62
66
  def flashlog_path
@@ -1,31 +1,28 @@
1
1
  module FlashSDK
2
2
  class ProjectGenerator < ClassGenerator
3
+ include FlashSDK::FlashHelper
3
4
 
4
5
  add_param :css, Path, { :default => 'css' }
5
6
  add_param :images, Path, { :default => 'images' }
6
- add_param :fonts, Path, { :default => 'fonts' }
7
-
7
+ add_param :fonts, Path, { :default => 'fonts' }
8
+
8
9
  def manifest
9
10
  directory input do
10
11
  template 'rakefile.rb'
11
12
  template 'Gemfile'
12
13
 
13
14
  directory src do
14
- template "#{input.camel_case}.as", 'ActionScript3MainClass.as'
15
15
  template "#{test_runner_name}.as", 'ActionScript3RunnerClass.as'
16
16
  end
17
17
 
18
- directory assets do
19
- directory skins do
20
- file 'DefaultProjectImage.png'
21
- end
22
- end
23
-
24
18
  # Create empty directories:
25
19
  directory lib
26
- directory bin
27
20
  end
28
21
  end
29
22
 
23
+ def test
24
+ "#{class_name}/test"
25
+ end
26
+
30
27
  end
31
28
  end
@@ -1,19 +1,19 @@
1
1
  package {
2
- import asunit.core.TextCore;
3
- import flash.display.MovieClip;
2
+ import flash.display.Sprite;
3
+ import org.flexunit.runner.FlexUnitCore;
4
+ import org.mockito.integrations.flexunit4.MockitoClassRunner;
5
+ <% test_case_classes.each do |test_case| %>import <%= test_case %>;
6
+ <% end %>
4
7
 
5
- public class <%= test_runner_name %> extends MovieClip {
6
-
7
- private var core:TextCore;
8
+ public class <%= test_runner_name %> extends Sprite {
8
9
 
9
- public function <%= test_runner_name %>() {
10
- core = new TextCore();
11
- // You can run a single Test Case with:
12
- // core.start(SomeTest, null, this);
13
- // Or a single test method with:
14
- // core.start(SomeTest, 'testMethod', this);
15
- core.start(AllTests, null, this);
16
- }
10
+ private var core:FlexUnitCore;
11
+
12
+ public function <%= test_runner_name %>() {
13
+ MockitoClassRunner;
14
+ core = new FlexUnitCore();
15
+ core.addListener(new FlashSDKListener());
16
+ core.run(<%= test_case_classes.map{|test_case| test_case.split('.').last.to_s}.join(',') %>);
17
+ }
17
18
  }
18
19
  }
19
-
@@ -0,0 +1,47 @@
1
+ package
2
+ {
3
+ import org.flexunit.internals.TraceListener;
4
+ import org.flexunit.runner.IDescription;
5
+ import org.flexunit.runner.Result;
6
+ import org.flexunit.runner.notification.Failure;
7
+
8
+ public class FlashSDKListener extends TraceListener
9
+ {
10
+ public function FlashSDKListener ()
11
+ {
12
+ }
13
+
14
+ override public function testRunFinished(result:Result):void
15
+ {
16
+ if (result.failureCount)
17
+ trace("TESTS HAS FAILURES");
18
+ trace("ALL TESTS ARE COMPLETED");
19
+ super.testRunFinished(result);
20
+ }
21
+
22
+ override public function testStarted(description:IDescription):void
23
+ {
24
+ // trace("TEST STARTED", description.displayName, description.testCount);
25
+ // super.testStarted(description);
26
+ }
27
+
28
+ override public function testFailure(failure:Failure):void
29
+ {
30
+ trace("TEST FAILED", failure.testHeader, failure.stackTrace);
31
+ // super.testFailure(failure);
32
+ }
33
+
34
+ override public function testIgnored(description:IDescription):void
35
+ {
36
+ trace("TEST IGNORED", description.displayName, description.testCount);
37
+ // super.testIgnored(description);
38
+ }
39
+
40
+ override public function testFinished(description:IDescription):void
41
+ {
42
+ // trace("TEST FINISHED", description.displayName, description.testCount);
43
+ // super.testFinished(description);
44
+ }
45
+ }
46
+ }
47
+
@@ -1,5 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "flashsdk", ">= 1.0.0.pre"
4
- gem "asunit4", ">= 4.2.3.pre"
3
+ gem "flashsdk_sqe", ">= 0.0.2"
5
4
 
@@ -4,7 +4,6 @@ require 'bundler/setup'
4
4
 
5
5
  require 'rake/clean'
6
6
  require 'flashsdk'
7
- require 'asunit4'
8
7
 
9
8
  ##
10
9
  # Set USE_FCSH to true in order to use FCSH for all compile tasks.
@@ -23,47 +22,23 @@ require 'asunit4'
23
22
  # ENV['FCSH_PKG_VERSION'] = '1.0.14.pre'
24
23
  # ENV['FCSH_PORT'] = 12321
25
24
 
26
- ##############################
27
- # Debug
28
-
29
- # Compile the debug swf
30
- mxmlc "<%= bin %>/<%= debug_swf_name %>" do |t|
31
- t.input = "<%= src %>/<%= class_name %>.as"
32
- t.static_link_runtime_shared_libraries = true
33
- t.debug = true
34
- end
35
-
36
- desc "Compile and run the debug swf"
37
- flashplayer :run => "<%= bin %>/<%= debug_swf_name %>"
38
-
39
25
  ##############################
40
26
  # Test
41
27
 
42
- library :asunit4
43
-
44
28
  # Compile the test swf
45
- mxmlc "<%= bin %>/<%= test_swf_name %>" => :asunit4 do |t|
29
+ mxmlc "<%= bin %>/<%= test_swf_name %>" do |t|
46
30
  t.input = "<%= src %>/<%= test_runner_name %>.as"
47
31
  t.static_link_runtime_shared_libraries = true
48
- t.source_path << 'test'
32
+ t.source_path << 'test' << 'vendor' << 'lib' << 'assets'
33
+ t.library_path << 'swc'
34
+ t.show_actionscript_warnings=false
35
+ t.show_deprecation_warnings=false
49
36
  t.debug = true
50
37
  end
51
38
 
52
39
  desc "Compile and run the test swf"
53
40
  flashplayer :test => "<%= bin %>/<%= test_swf_name %>"
54
41
 
55
- ##############################
56
- # SWC
57
-
58
- compc "<%= bin %>/<%= class_name %>.swc" do |t|
59
- t.input_class = "<%= class_name %>"
60
- t.static_link_runtime_shared_libraries = true
61
- t.source_path << 'src'
62
- end
63
-
64
- desc "Compile the SWC file"
65
- task :swc => '<%= bin %>/<%= class_name %>.swc'
66
-
67
42
  ##############################
68
43
  # DOC
69
44
 
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flashsdk_sqe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-19 00:00:00.000000000Z
12
+ date: 2012-09-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprout
16
- requirement: &70255290710220 !ruby/object:Gem::Requirement
16
+ requirement: &70108878686840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.1.18.pre
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70255290710220
24
+ version_requirements: *70108878686840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &70255290709820 !ruby/object:Gem::Requirement
27
+ requirement: &70108878686420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70255290709820
35
+ version_requirements: *70108878686420
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mocha
38
- requirement: &70255290709360 !ruby/object:Gem::Requirement
38
+ requirement: &70108878685920 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70255290709360
46
+ version_requirements: *70108878685920
47
47
  description: The Flash SDK Rubygem is brought to you by Project Sprouts (http://projectsprouts.org)
48
48
  email: kazantsev.nickolay@gmail.com
49
49
  executables:
@@ -92,6 +92,7 @@ files:
92
92
  - lib/flashsdk/generators/templates/ActionScript3MainClass.as
93
93
  - lib/flashsdk/generators/templates/ActionScript3RunnerClass.as
94
94
  - lib/flashsdk/generators/templates/DefaultProjectImage.png
95
+ - lib/flashsdk/generators/templates/FlashSDKListener.as
95
96
  - lib/flashsdk/generators/templates/Flex4Application.mxml
96
97
  - lib/flashsdk/generators/templates/Flex4Main.css
97
98
  - lib/flashsdk/generators/templates/Flex4Rakefile.rb
@@ -105,6 +106,7 @@ files:
105
106
  - lib/flex3.rb
106
107
  - lib/flex4.rb
107
108
  - pkg/flashsdk_sqe-0.0.1.gem
109
+ - pkg/flashsdk_sqe-0.0.2.gem
108
110
  - POSTINSTALL.rdoc
109
111
  - rakefile.rb
110
112
  - README.textile
@@ -180,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
182
  version: '0'
181
183
  segments:
182
184
  - 0
183
- hash: -2780731179797828062
185
+ hash: -1090058060885181777
184
186
  required_rubygems_version: !ruby/object:Gem::Requirement
185
187
  none: false
186
188
  requirements:
@@ -189,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
191
  version: '0'
190
192
  segments:
191
193
  - 0
192
- hash: -2780731179797828062
194
+ hash: -1090058060885181777
193
195
  requirements: []
194
196
  rubyforge_project:
195
197
  rubygems_version: 1.8.10