sprout-as3-bundle 0.1.32 → 0.1.34

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ module Sprout # :nodoc:
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 32
6
+ TINY = 34
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  MAJOR_MINOR = [MAJOR, MINOR].join('.')
@@ -1,7 +1,7 @@
1
1
  sprout 'flashplayer'
2
2
  require 'sprout/tasks/flashplayer_task'
3
- require 'sprout/tasks/asunit_task'
4
3
  require 'sprout/tasks/fdb_task'
5
4
  require 'sprout/tasks/mxmlc_task'
6
5
  require 'sprout/tasks/asdoc_task'
7
6
  require 'sprout/tasks/compc_task'
7
+ require 'sprout/tasks/asunit_task'
@@ -0,0 +1,18 @@
1
+
2
+ class ComponentGenerator < Sprout::Generator::NamedBase # :nodoc:
3
+
4
+ def manifest
5
+ record do |m|
6
+ if(!user_requested_test)
7
+ m.directory full_class_dir
8
+ m.template 'Component.mxml', full_class_path.gsub(/.as$/, '.mxml')
9
+ end
10
+
11
+ m.directory full_test_dir
12
+ m.template 'VisualTestCase.as', full_test_case_path
13
+
14
+ m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as')
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">
3
+ </mx:Canvas>
@@ -0,0 +1,18 @@
1
+ package {
2
+ /**
3
+ * This file has been automatically created using
4
+ * #!/usr/bin/ruby script/generate suite
5
+ * If you modify it and run this script, your
6
+ * modifications will be lost!
7
+ */
8
+
9
+ import asunit.framework.TestSuite;<% test_case_classes.each do |test_case| %>
10
+ import <%= test_case %>;<% end %>
11
+
12
+ public class AllTests extends TestSuite {
13
+
14
+ public function AllTests() {<% test_case_classes.each do |test_case| %>
15
+ addTest(new <%= test_case %>());<% end %>
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,32 @@
1
+ package <%= package_name %> {
2
+
3
+ import asunit.framework.TestCase;
4
+
5
+ public class <%= test_case_name %> extends TestCase {
6
+ private var <%= instance_name %>:<%= class_name %>;
7
+
8
+ public function <%= test_case_name %>(methodName:String=null) {
9
+ super(methodName)
10
+ }
11
+
12
+ override protected function setUp():void {
13
+ super.setUp();
14
+ <%= instance_name %> = new <%= class_name %>();
15
+ addChild(<%= instance_name %>);
16
+ }
17
+
18
+ override protected function tearDown():void {
19
+ super.tearDown();
20
+ removeChild(<%= instance_name %>);
21
+ <%= instance_name %> = null;
22
+ }
23
+
24
+ public function testInstantiated():void {
25
+ assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>);
26
+ }
27
+
28
+ public function testFailure():void {
29
+ assertTrue("Failing test", false);
30
+ }
31
+ }
32
+ }
@@ -23,4 +23,21 @@ class ProjectGenerator < Sprout::Generator::NamedBase # :nodoc:
23
23
  m.template 'TestRunner.as', File.join(base, 'src', "#{class_name}Runner.as")
24
24
  end
25
25
  end
26
+
27
+ protected
28
+ # Not sure about the banner...
29
+ # def banner
30
+ # "Usage: #{$0} #{spec.name} ModelName [field:type, field:type]"
31
+ # end
32
+
33
+ def add_options!(opt)
34
+ opt.on('-m', '--mxml', "Create a Flex project") { |v| options[:mxml] = true }
35
+ # opt.on("--skip-migration",
36
+ # "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
37
+ # opt.on("--skip-fixture",
38
+ # "Don't generation a fixture file for this model") { |v| options[:skip_fixture] = v}
39
+ super
40
+
41
+ end
42
+
26
43
  end
@@ -21,12 +21,20 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
21
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  =end
23
23
 
24
+ class Rake::Task
25
+
26
+ # Override Rake::Task.actions so that we can
27
+ # pull them from our dependent tasks
28
+ def actions
29
+ @actions
30
+ end
31
+ end
32
+
24
33
  module Sprout
25
34
  class AsUnitError < StandardError # :nodoc:
26
35
  end
27
- class ExecutionError < StandardError # :nodoc:
28
- end
29
36
 
37
+ # This task does not yet work!
30
38
  # The AsUnitTask provides a shortcut to compiling a test harness
31
39
  # directly from a related MXMLCTask. The first prerequisite
32
40
  # that is an MXMLCTask or MTASCTask will be copied and modified
@@ -39,6 +47,99 @@ module Sprout
39
47
  #
40
48
  # asunit :test => 'bin/SomeProject.swf'
41
49
  #
42
- class AsUnitTask < ToolTask
50
+ class AsUnitTask < Rake::FileTask # :nodoc:
51
+ attr_accessor :input
52
+ attr_accessor :output
53
+ attr_accessor :asunit_gem
54
+ attr_accessor :source_path
55
+
56
+ =begin
57
+ def initialize(name, app) # :nodoc:
58
+ super
59
+ @asunit_gem = :asunit3
60
+ @spawned = []
61
+ @source_path = []
62
+ end
63
+
64
+ def self.define_task(args, &block)
65
+ t = super
66
+ yield t if block_given?
67
+ t.define
68
+ return t
69
+ end
70
+
71
+ def define
72
+ puts ">> DEFINE CALLED with: #{prerequisites.size}"
73
+ library @asunit_gem
74
+
75
+ reqs = prerequisites.dup
76
+ req = nil
77
+ reqs.each_index do |index|
78
+ req = reqs[index]
79
+ puts "req: #{req}"
80
+ t = get_task_instance(req)
81
+ if(is_mxmlc?(t))
82
+ spawn_mxmlc_task(t)
83
+ reqs.slice!(index)
84
+ end
85
+ end
86
+
87
+ @spawned.each do |req|
88
+ @prerequisites << req
89
+ end
90
+
91
+ @spawned = []
92
+ end
93
+
94
+ def get_spawned_task_name
95
+
96
+ end
97
+
98
+ def spawn_mxmlc_task(task)
99
+ puts "SPAWNING MXMLC TASK"
100
+ cloned = task.dup
101
+ task.actions.each do |action|
102
+ cloned.actions << action
103
+ end
104
+ # cloned.name = 'bin/SomeProjectRunner.swf'
105
+ cloned.input = 'src/SomeProjectRunner.as'
106
+ cloned.output = 'bin/SomeProjectRunner.swf'
107
+ cloned.prerequisites << asunit_gem
108
+ cloned.define
109
+
110
+ source_path.each do |path|
111
+ cloned.source_path << path
112
+ end
113
+
114
+ @spawned << cloned
115
+ end
116
+
117
+ # Alias for source_path so that MTASCTasks can also use this feature
118
+ def class_path=(path)
119
+ @source_path = path
120
+ end
121
+
122
+ def class_path
123
+ return self.source_path
124
+ end
125
+
126
+ def is_mxmlc?(task)
127
+ task.is_a?(MXMLCTask)
128
+ end
129
+
130
+ def get_task_instance(name)
131
+ Rake::application[name]
132
+ end
133
+
134
+ def execute(*args)
135
+ puts ">> asunit task"
136
+ # FileUtils.touch(name)
137
+ end
138
+ =end
139
+
43
140
  end
44
141
  end
142
+
143
+ def asunit(args, &block)
144
+ Sprout::AsUnitTask.define_task(args, &block)
145
+ end
@@ -85,7 +85,7 @@ def default_frame_rate=(number)
85
85
  @default_frame_rate = number
86
86
  end
87
87
 
88
- # Defines the default application size, in pixels for example: default_size = '800 600'. This is an advanced option.
88
+ # Defines the default application size, in pixels for example: default_size = '950 550'. This is an advanced option.
89
89
  def default_size=(string)
90
90
  @default_size = string
91
91
  end
@@ -85,7 +85,7 @@ def default_frame_rate=(number)
85
85
  @default_frame_rate = number
86
86
  end
87
87
 
88
- # Defines the default application size, in pixels for example: default_size = '800 600'. This is an advanced option.
88
+ # Defines the default application size, in pixels for example: default_size = '950 550'. This is an advanced option.
89
89
  def default_size=(string)
90
90
  @default_size = string
91
91
  end
@@ -164,7 +164,8 @@ EOF
164
164
 
165
165
  add_param(:default_size, :string) do |p|
166
166
  p.delimiter = ' '
167
- p.description = "Defines the default application size, in pixels for example: default_size = '800 600'. This is an advanced option."
167
+ p.value = '950 550'
168
+ p.description = "Defines the default application size, in pixels for example: default_size = '950 550'. This is an advanced option."
168
169
  end
169
170
 
170
171
  add_param(:default_css_url, :url) do |p|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprout-as3-bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.1.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pattern Park
@@ -9,7 +9,7 @@ autorequire: sprout/as3
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-12 00:00:00 -08:00
12
+ date: 2008-02-23 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,6 @@ extra_rdoc_files:
40
40
  - README
41
41
  files:
42
42
  - lib
43
- - pkg
44
43
  - rakefile.rb
45
44
  - README
46
45
  - samples
@@ -60,6 +59,11 @@ files:
60
59
  - lib/sprout/generators/class/templates/TestSuite.as
61
60
  - lib/sprout/generators/class/USAGE
62
61
  - lib/sprout/generators/component
62
+ - lib/sprout/generators/component/component_generator.rb
63
+ - lib/sprout/generators/component/templates
64
+ - lib/sprout/generators/component/templates/Component.mxml
65
+ - lib/sprout/generators/component/templates/TestSuite.as
66
+ - lib/sprout/generators/component/templates/VisualTestCase.as
63
67
  - lib/sprout/generators/project
64
68
  - lib/sprout/generators/project/project_generator.rb
65
69
  - lib/sprout/generators/project/templates