robotlegs 1.3.0.1 → 1.3.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/Gemfile +2 -3
  2. data/Gemfile.lock +37 -0
  3. data/README.mkdn +66 -0
  4. data/Rakefile +17 -1
  5. data/bin/rl-command +8 -0
  6. data/bin/rl-context +8 -0
  7. data/bin/rl-mediator +8 -0
  8. data/bin/rl-project +8 -0
  9. data/bin/rl-proxy +8 -0
  10. data/bin/rl-service +8 -0
  11. data/lib/robotlegs.rb +17 -29
  12. data/lib/robotlegs/generators/command_generator.rb +51 -0
  13. data/lib/robotlegs/generators/context_generator.rb +16 -0
  14. data/lib/robotlegs/generators/mediator_generator.rb +12 -0
  15. data/lib/robotlegs/generators/project_generator.rb +123 -0
  16. data/lib/robotlegs/generators/proxy_generator.rb +12 -0
  17. data/lib/robotlegs/generators/robotlegs_class_generator_base.rb +24 -0
  18. data/lib/robotlegs/generators/service_generator.rb +25 -0
  19. data/lib/robotlegs/generators/templates/Flex4TestRunner.mxml +29 -0
  20. data/lib/robotlegs/generators/templates/RobotlegsCommand.as +15 -0
  21. data/lib/robotlegs/generators/templates/RobotlegsContext.as +43 -0
  22. data/lib/robotlegs/generators/templates/RobotlegsGemfile.rb +5 -0
  23. data/lib/robotlegs/generators/templates/RobotlegsMain.mxml +41 -0
  24. data/lib/robotlegs/generators/templates/RobotlegsMediator.as +28 -0
  25. data/lib/robotlegs/generators/templates/RobotlegsProxy.as +27 -0
  26. data/lib/robotlegs/generators/templates/RobotlegsRakefile.rb +45 -0
  27. data/lib/robotlegs/generators/templates/RobotlegsService.as +28 -0
  28. data/lib/robotlegs/version.rb +8 -0
  29. data/robotlegs.gemspec +26 -0
  30. data/test/unit/project_generator_test.rb +149 -0
  31. data/test/unit/service_generator_test.rb +37 -0
  32. data/test/unit/test_helper.rb +11 -0
  33. metadata +95 -23
  34. data/README.textile +0 -67
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
- source "http://rubygems.org"
1
+ source :rubygems
2
2
 
3
- # Specify your gem's dependencies in robotlegs.gemspec
4
- gemspec
3
+ gemspec
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ robotlegs (1.3.0.2.pre)
5
+ flashsdk (>= 1.0.8.pre)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ archive-tar-minitar (0.5.2)
11
+ flashsdk (1.0.13.pre)
12
+ sprout (>= 1.0.31.pre)
13
+ mocha (0.9.8)
14
+ rake
15
+ open4 (1.0.1)
16
+ rake (0.8.7)
17
+ rcov (0.9.9)
18
+ rdoc (2.5.11)
19
+ rubyzip (0.9.4)
20
+ shoulda (2.11.3)
21
+ sprout (1.0.32.pre)
22
+ archive-tar-minitar (= 0.5.2)
23
+ bundler (>= 0.9.19)
24
+ open4 (>= 0.9.6)
25
+ rake (>= 0.8.7)
26
+ rdoc (>= 2.5.8)
27
+ rubyzip (= 0.9.4)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ flashsdk (>= 1.0.8.pre)
34
+ mocha
35
+ rcov
36
+ robotlegs!
37
+ shoulda
@@ -0,0 +1,66 @@
1
+ # Project Sprouts Robotlegs Gem _*Pre-Alpha_
2
+
3
+ This RubyGem contains templates and libraries for developing [Robotlegs](http://www.robotlegs.org/) based MVCS DI applications in Actionscript 3.0 and Flex 4.0
4
+
5
+ >**WARNING** This is opinionated software.
6
+ This is not and will never be infinitely configurable. Care was taken to allow customization where needed, but it is made and tested to work the way I think it should. Please fork and add whatever features you feel are missing.
7
+
8
+ ## Description
9
+
10
+ This bundle contains generators for creating:
11
+
12
+ * Project
13
+ * Context
14
+ * Proxy
15
+ * Mediator
16
+ * Command
17
+
18
+
19
+ ## Prerequisites
20
+
21
+ * [Ruby](http://www.ruby-lang.org/)
22
+ * [Ruby Gems](http://rubygems.org/pages/download)
23
+ * [git](http://git-scm.com/download)
24
+ * [Sprouts v1-pre](http://github.com/lukebayes/project-sprouts)
25
+
26
+ ## Install
27
+
28
+ cd robotlegs
29
+ gem build robotlegs.gemspec
30
+ gem install robotlegs-1.0.pre.gem
31
+ rl-project SomeProject
32
+ rl-proxy SomeProxy
33
+ rl-mediator SomeMediator
34
+ rl-command SomeCommand
35
+
36
+ ##TODO
37
+
38
+ * Event
39
+ * VO
40
+ * DTO
41
+ * Signal
42
+ * Signals Project
43
+ * Signal Command
44
+
45
+ ## MIT License
46
+
47
+ Copyright (c) 2010 Kristofer Joseph
48
+
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of this software and associated documentation files (the
51
+ 'Software'), to deal in the Software without restriction, including
52
+ without limitation the rights to use, copy, modify, merge, publish,
53
+ distribute, sublicense, and/or sell copies of the Software, and to
54
+ permit persons to whom the Software is furnished to do so, subject to
55
+ the following conditions:
56
+
57
+ The above copyright notice and this permission notice shall be
58
+ included in all copies or substantial portions of the Software.
59
+
60
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
61
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
62
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
63
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
64
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
65
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
66
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,2 +1,18 @@
1
1
  require 'bundler'
2
- Bundler::GemHelper.install_tasks
2
+ Bundler.require
3
+
4
+ require 'rake/clean'
5
+ require 'rake/testtask'
6
+
7
+ namespace :test do
8
+
9
+ Rake::TestTask.new(:units) do |t|
10
+ t.libs << "test/unit"
11
+ t.test_files = FileList["test/unit/*_test.rb"]
12
+ t.verbose = true
13
+ end
14
+
15
+ end
16
+
17
+ desc "Run tests"
18
+ task :test => 'test:units'
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'robotlegs'
5
+
6
+ generator = Robotlegs::CommandGenerator.new
7
+ generator.parse! ARGV
8
+ generator.execute
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'robotlegs'
5
+
6
+ generator = Robotlegs::ContextGenerator.new
7
+ generator.parse! ARGV
8
+ generator.execute
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'robotlegs'
5
+
6
+ generator = Robotlegs::MediatorGenerator.new
7
+ generator.parse! ARGV
8
+ generator.execute
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'robotlegs'
5
+
6
+ generator = Robotlegs::ProjectGenerator.new
7
+ generator.parse! ARGV
8
+ generator.execute
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'robotlegs'
5
+
6
+ generator = Robotlegs::ProxyGenerator.new
7
+ generator.parse! ARGV
8
+ generator.execute
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'robotlegs'
5
+
6
+ generator = Robotlegs::ServiceGenerator.new
7
+ generator.parse! ARGV
8
+ generator.execute
@@ -1,37 +1,25 @@
1
- require 'sprout'
1
+ require 'robotlegs/version'
2
+ require 'flashsdk'
3
+ require 'robotlegs/generators/robotlegs_class_generator_base'
4
+ require 'robotlegs/generators/project_generator'
5
+ require 'robotlegs/generators/context_generator'
6
+ require 'robotlegs/generators/proxy_generator'
7
+ require 'robotlegs/generators/mediator_generator'
8
+ require 'robotlegs/generators/command_generator'
9
+ require 'robotlegs/generators/service_generator'
2
10
 
3
- module Robotlegs
4
-
5
- NAME = "robotlegs"
6
- VERSION = "1.3.0.1"
7
-
8
- ZIP_VERSION = "1.3.0"
9
-
10
- # SVN_URL = "http://svn.puremvc.org/Robotlegs/tags/#{VERSION}/"
11
- # SVN_DIR = "./#{VERSION}/"
12
-
11
+ module Robotlegs
12
+ ZIP_VERSION = '1.3.0'
13
+ ZIP_MD5 = '48ce7343e8d004c3bc9e335dc0c2f190'
13
14
  end
14
15
 
15
16
  Sprout::Specification.new do |s|
16
17
  s.name = Robotlegs::NAME
17
18
  s.version = Robotlegs::VERSION
18
-
19
- # s.add_file_target do |t|
20
- # t.platform = :universal
21
- # t.add_library :swc, "../bin"
22
- # end
23
-
24
- s.add_remote_file_target do |t|
25
- # Apply the windows-specific configuration:
26
- t.platform = :universal
27
- # Apply the shared platform configuration:
28
- # Remote Archive:
29
- t.archive_type = :zip
30
- t.url = "http://downloads.robotlegs.org/robotlegs-framework-v#{Robotlegs::ZIP_VERSION}.zip"
31
- t.md5 = "48ce7343e8d004c3bc9e335dc0c2f190"
32
- t.add_library :swc, "bin/"
19
+ s.add_remote_file_target do |f|
20
+ f.url = "http://downloads.robotlegs.org/robotlegs-framework-v#{Robotlegs::ZIP_VERSION}.zip"
21
+ f.md5 = Robotlegs::ZIP_MD5
22
+ f.archive_type = :zip
23
+ f.add_library :swc, ['bin/']
33
24
  end
34
-
35
25
  end
36
-
37
-
@@ -0,0 +1,51 @@
1
+ module Robotlegs
2
+ class CommandGenerator < RobotlegsClassGeneratorBase
3
+
4
+ def manifest
5
+ directory input.snake_case do
6
+ template "#{input.camel_case}.as", 'RobotlegsCommand.as'
7
+ create_test_case
8
+ end
9
+
10
+ end
11
+
12
+ def class_directory
13
+ parts = input_in_parts
14
+ if parts.size > 1
15
+ parts.pop
16
+ return File.join src, *parts
17
+ end
18
+ return src
19
+ end
20
+
21
+ def package_name
22
+ parts = input_in_parts
23
+ if parts.size > 1
24
+ parts.pop
25
+ return "#{parts.join('.')} "
26
+ end
27
+ return ""
28
+ end
29
+
30
+ def class_name
31
+ parts = input_in_parts
32
+ parts.pop.camel_case
33
+ end
34
+
35
+ def input_in_parts
36
+ provided_input = input
37
+ if provided_input.include?('/')
38
+ provided_input.gsub! /^#{src}\//, ''
39
+ provided_input = provided_input.split('/').join('.')
40
+ end
41
+
42
+ provided_input.gsub!(/\.as$/, '')
43
+ provided_input.gsub!(/\.mxml$/, '')
44
+ provided_input.gsub!(/\.xml$/, '')
45
+
46
+ provided_input.split('.')
47
+ end
48
+
49
+ end
50
+ end
51
+
@@ -0,0 +1,16 @@
1
+ module Robotlegs
2
+ class ContextGenerator < RobotlegsClassGeneratorBase
3
+
4
+ ##
5
+ # This is how you add a parameter to your generator
6
+ # add_param :fwee, String, { :default => "fwee" }
7
+
8
+ def manifest
9
+ directory input.snake_case do
10
+ template input.camel_case
11
+ end
12
+
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ module Robotlegs
2
+ class MediatorGenerator < RobotlegsClassGeneratorBase
3
+
4
+ def manifest
5
+ directory input.snake_case do
6
+ template input.camel_case
7
+ end
8
+
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,123 @@
1
+ module Robotlegs
2
+ class ProjectGenerator < FlashSDK::ProjectGenerator
3
+
4
+ ## These params below are inherited from the AS3 ProjectGenerator and are available
5
+ # add_param :src, String, { :default => "src"}
6
+ # add_param :lib, String, { :default => "lib"}
7
+ # add_param :bin, String, { :default => "bin"}
8
+ # add_param :skins, String, { :default => "skins"}
9
+ # add_param :test, String, { :default => "test"}
10
+
11
+ ##
12
+ # Send flag shallow to prevent subdirectories vo, dto from being created
13
+ add_param :shallow, Boolean
14
+ add_param :package, String, { :default => ""}
15
+ add_param :proxy, String, { :default => "proxy" }
16
+ add_param :vo, String, { :default => "vo" }
17
+ add_param :view, String, { :default => "view" }
18
+ add_param :mediators, String, { :default => "mediators" }
19
+ add_param :components, String, { :default => "components" }
20
+ add_param :model, String, { :default => "model" }
21
+ add_param :controller, String, { :default => "controller" }
22
+ add_param :commands, String, { :default => "commands" }
23
+ add_param :service, String, { :default => "service" }
24
+ add_param :dto, String, { :default => "dto" }
25
+ add_param :notifications, String, { :default => "events" }
26
+
27
+ def manifest
28
+ directory project_name do
29
+
30
+ template "rakefile.rb", "RobotlegsRakefile.rb"
31
+ template "Gemfile", "RobotlegsGemfile.rb"
32
+
33
+ directory lib
34
+ directory bin
35
+
36
+ directory src do
37
+ template "#{project_name}.mxml", "RobotlegsMain.mxml"
38
+ template "#{test_runner_name}.mxml", "Flex4TestRunner.mxml"
39
+
40
+ directory package_directory do
41
+ template "#{project_name}Context.as", "RobotlegsContext.as"
42
+ directory model do
43
+ directory proxy
44
+ directory vo unless shallow
45
+ end
46
+
47
+ directory view do
48
+ directory mediators
49
+ directory components
50
+ directory skins
51
+ end
52
+
53
+ directory controller do
54
+ directory commands
55
+ end
56
+
57
+ directory service do
58
+ directory dto unless shallow
59
+ end
60
+
61
+ directory notifications
62
+ end
63
+ end
64
+ end
65
+
66
+ end
67
+
68
+ protected
69
+
70
+ def project_name
71
+ return input.camel_case
72
+ end
73
+
74
+ def package_directory
75
+ split_parts package
76
+ end
77
+
78
+ def class_directory
79
+ parts = input_in_parts
80
+ if parts.size > 1
81
+ parts.pop
82
+ return File.join src, *parts
83
+ end
84
+ return src
85
+ end
86
+
87
+ def package_name
88
+ parts = split_parts package
89
+ return "#{parts.join('.')}"
90
+ end
91
+
92
+ def class_name
93
+ parts = input_in_parts
94
+ parts.pop.camel_case
95
+ end
96
+
97
+ def context_package
98
+ if package_name != ""
99
+ return package_name + ".*"
100
+ end
101
+ "*"
102
+ end
103
+
104
+ def input_in_parts
105
+ split_parts input
106
+ end
107
+
108
+ def split_parts(value)
109
+ provided_input = value
110
+ if provided_input.include?('/')
111
+ provided_input.gsub! /^#{src}\//, ''
112
+ provided_input = provided_input.split('/').join('.')
113
+ end
114
+
115
+ provided_input.gsub!(/\.as$/, '')
116
+ provided_input.gsub!(/\.mxml$/, '')
117
+ provided_input.gsub!(/\.xml$/, '')
118
+
119
+ provided_input.split('.')
120
+ end
121
+
122
+ end
123
+ end
@@ -0,0 +1,12 @@
1
+ module Robotlegs
2
+ class ProxyGenerator < RobotlegsClassGeneratorBase
3
+
4
+ def manifest
5
+ directory input.snake_case do
6
+ template input.camel_case
7
+ end
8
+
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,24 @@
1
+ module Robotlegs
2
+
3
+ class RobotlegsClassGeneratorBase < Sprout::Generator::Base
4
+ ##
5
+ # The path where source files should be created.
6
+ add_param :src, String, { :default => 'src' }
7
+ add_param :test, String, { :default => 'test' }
8
+ ##
9
+ # Do not create a test case for this class.
10
+ add_param :no_test, Boolean
11
+
12
+ def fully_qualified_class_name
13
+ input
14
+ end
15
+
16
+ def create_test_case
17
+ unless no_test
18
+ generator :test_class, :input => "#{fully_qualified_class_name}Test"
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,25 @@
1
+ module Robotlegs
2
+ class ServiceGenerator < RobotlegsClassGeneratorBase
3
+
4
+ ##
5
+ # This is how you add a parameter to your generator
6
+ # add_param :fwee, String, { :default => "fwee" }
7
+ add_param :package, String, { :default => "com.foo" }
8
+
9
+ def manifest
10
+ directory input.snake_case do
11
+ template "#{input.camel_case}Service.as", "RobotlegsService.as"
12
+ end
13
+
14
+ end
15
+
16
+ def package_name
17
+ package
18
+ end
19
+
20
+ def class_name
21
+ ""
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
3
+ xmlns:s="library://ns.adobe.com/flex/spark"
4
+ xmlns:mx="library://ns.adobe.com/flex/mx"
5
+ creationComplete="creationCompleteHandler(event)">
6
+
7
+ <fx:Script>
8
+
9
+ <![CDATA[
10
+ import asunit.core.TextCore;
11
+ import mx.core.UIComponent;
12
+
13
+ private var core:TextCore;
14
+
15
+ private function creationCompleteHandler(event:Event):void
16
+ {
17
+ // Flex 4 complains when we use UICompenent from MXML... Boo.
18
+ var visualContext:UIComponent = new UIComponent();
19
+ addElement(visualContext);
20
+
21
+ core = new TextCore();
22
+ core.start(AllTests, null, visualContext);
23
+ }
24
+ ]]>
25
+
26
+ </fx:Script>
27
+
28
+ </s:Application>
29
+
@@ -0,0 +1,15 @@
1
+ package <%= package_name %>
2
+ {
3
+ import org.robotlegs.mvcs.Command;
4
+
5
+ public class <%= class_name %> extends Command
6
+ {
7
+ /**
8
+ * @inheritDoc
9
+ */
10
+ override public function execute():void
11
+ {
12
+ //Your command content goes here dude
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,43 @@
1
+ package <%= package_name %>
2
+ {
3
+ import flash.display.DisplayObjectContainer;
4
+
5
+ import org.robotlegs.mvcs.Context;
6
+ import org.robotlegs.base.ContextEvent;
7
+
8
+ public class <%= class_name %>Context extends Context
9
+ {
10
+ //---------------------------------------
11
+ // CONSTRUCTOR
12
+ //---------------------------------------
13
+
14
+ public function <%= class_name %>Context(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
15
+ {
16
+ super(contextView,autoStartup);
17
+ }
18
+
19
+ //---------------------------------------
20
+ // OVERRIDEN METHODS
21
+ //---------------------------------------
22
+
23
+ override public function startup():void
24
+ {
25
+ //Service
26
+ //injector.mapSingleton(YOUR SERVICE);
27
+
28
+ //Model
29
+ //injector.mapSingleton(YOUR PROXY);
30
+
31
+ //Controller
32
+ //commandMap.mapEvent( YOUR START UP COMMAND, ContextEvent.STARTUP, ContextEvent, true );
33
+
34
+ //View
35
+ //mediatorMap.mapView(YOUR VIEW, YOUR MEDIATOR);
36
+
37
+ //Dispatch a start up event
38
+ dispatchEvent( new ContextEvent( ContextEvent.STARTUP ) );
39
+
40
+ super.startup();
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,5 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'flashsdk', '>= 1.0.8.pre'
4
+ gem 'robotlegs', '>= 1.1.1.pre'
5
+ gem 'asunit4', '>= 4.2.2.pre'
@@ -0,0 +1,41 @@
1
+ <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
2
+ xmlns:s="library://ns.adobe.com/flex/spark"
3
+ xmlns:mx="library://ns.adobe.com/flex/mx"
4
+ xmlns:context="<%= context_package %>"
5
+ minWidth="800"
6
+ minHeight="600"
7
+ width="1024"
8
+ height="768"
9
+ backgroundColor="0xFFFFFF"
10
+ pageTitle="<%= project_name.camel_case %>"
11
+ usePreloader="true"
12
+ applicationComplete="<%= project_name.camel_case %>CompleteHandler()">
13
+
14
+ <fx:Declarations>
15
+
16
+ <!-- You have to put all non-visual object declarations here -->
17
+ <context:<%= project_name.camel_case %>Context contextView="{this}" />
18
+
19
+ </fx:Declarations>
20
+
21
+ <fx:Script>
22
+
23
+ <![CDATA[
24
+
25
+ //---------------------------------------
26
+ // PRIVATE METHODS
27
+ //---------------------------------------
28
+
29
+ /**
30
+ * @private
31
+ */
32
+ private function <%= project_name.camel_case %>CompleteHandler():void
33
+ {
34
+ trace("<%= project_name.camel_case %>.mxml::<%= project_name.camel_case %>CompleteHandler()");
35
+ }
36
+ ]]>
37
+
38
+ </fx:Script>
39
+
40
+ </s:Application>
41
+
@@ -0,0 +1,28 @@
1
+ package <%= package_name %>
2
+ {
3
+ import org.robotlegs.mvcs.Mediator;
4
+
5
+ public class <%= class_name %> extends Mediator
6
+ {
7
+ //---------------------------------------
8
+ // OVERRIDEN METHODS
9
+ //---------------------------------------
10
+
11
+ override public function onRegister():void
12
+ {
13
+ //Register your events in the eventMap here
14
+ //eventMap.mapListener(YOUR VIEW COMPOENT, YOUR EVENT, YOUR HANDLER);
15
+
16
+ //Optionally add bindings to your view components public variables
17
+
18
+ super.onRegister();
19
+ }
20
+
21
+ override public function onRemove():void
22
+ {
23
+ //Remove any listeners or bindings here
24
+ //eventMap.unmapListeners();
25
+ super.onRemove();
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,27 @@
1
+ package <%= package_name %>
2
+ {
3
+ import org.robotlegs.mvcs.Actor;
4
+
5
+ public class <%= class_name %> extends Actor
6
+ {
7
+ //---------------------------------------
8
+ // CONSTRUCTOR
9
+ //---------------------------------------
10
+
11
+ public function <%= class_name %>()
12
+ {
13
+ super();
14
+ initialize();
15
+ }
16
+
17
+ //---------------------------------------
18
+ // PROTECTED METHODS
19
+ //---------------------------------------
20
+
21
+ protected function initialize():void
22
+ {
23
+ //Add any initialization here
24
+ //example: myArrayCollection = new ArrayCollection();
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,45 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.require
4
+
5
+ library :robotlegs, :swc
6
+
7
+ ##############################
8
+ # Configure
9
+
10
+ def configure_mxmlc t
11
+ t.library_path << 'lib/robotlegs/robotlegs-framework-v1.1.2.swc'
12
+ end
13
+
14
+ ##############################
15
+ # Debug
16
+
17
+ # Compile the debug swf
18
+ mxmlc "<%= bin %>/<%= debug_swf_name %>" do |t|
19
+ configure_mxmlc t
20
+ t.input = "<%= src %>/<%= class_name %>.mxml"
21
+ t.debug = true
22
+ end
23
+
24
+ desc "Compile and run the debug swf"
25
+ flashplayer :debug => "<%= bin %>/<%= debug_swf_name %>"
26
+
27
+ ##############################
28
+ # Test
29
+
30
+ library :asunit4
31
+
32
+ # Compile the test swf
33
+ mxmlc "<%= bin %>/<%= test_swf_name %>" => :asunit4 do |t|
34
+ configure_mxmlc t
35
+ t.input = "<%= src %>/<%= test_runner_name %>.mxml"
36
+ t.library_path << "lib/asunit4/AsUnit-4.2.2.pre.swc"
37
+ t.source_path << "test"
38
+ t.default_size = "900,550"
39
+ t.debug = true
40
+ end
41
+
42
+ desc "Compile and run the test swf"
43
+ flashplayer :test => "<%= bin %>/<%= test_swf_name %>"
44
+
45
+ task :default => :debug
@@ -0,0 +1,28 @@
1
+ package <%= package_name %>
2
+ {
3
+ import org.robotlegs.mvcs.Actor;
4
+
5
+ public class <%= class_name %> extends Actor
6
+ {
7
+ //---------------------------------------
8
+ // CONSTRUCTOR
9
+ //---------------------------------------
10
+
11
+ public function <%= class_name %>()
12
+ {
13
+ super();
14
+ initialize();
15
+ }
16
+
17
+ //---------------------------------------
18
+ // PROTECTED METHODS
19
+ //---------------------------------------
20
+
21
+ protected function initialize():void
22
+ {
23
+ //Add any initialization here
24
+ //example: myArrayCollection = new ArrayCollection();
25
+ //Your content to assert here
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,8 @@
1
+ module Robotlegs
2
+ NAME = 'robotlegs'
3
+ #
4
+ # Version applies directly to Robotlegs official version. To release patches to
5
+ # the sprout or gem, increment the micro value, or the 4th number in the version sequence.
6
+ VERSION = '1.3.0.2.pre'
7
+ #
8
+ end
@@ -0,0 +1,26 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $:.unshift lib unless $:.include?( lib )
3
+
4
+ require 'robotlegs/version'
5
+ require 'rake'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = Robotlegs::NAME
9
+ s.version = Robotlegs::VERSION
10
+ s.author = "Kristofer Joseph"
11
+ s.email = ["projectsprouts@googlegroups.com"]
12
+ s.homepage = "http://projectsprouts.org"
13
+ s.summary = "A library for developing Robotlegs projects with Project Sprouts"
14
+ s.description = "GO AND CODE"
15
+ s.executables = ["rl-project","rl-context","rl-proxy","rl-mediator","rl-command","rl-service"]
16
+
17
+ s.required_rubygems_version = ">= 1.3.6"
18
+ s.files = FileList["**/*"].exclude /docs|.DS_Store|generated|.svn|.git|vendor/
19
+
20
+ s.add_dependency "flashsdk", '>= 1.0.8.pre'
21
+ s.add_development_dependency "shoulda"
22
+ s.add_development_dependency "mocha"
23
+ s.add_development_dependency "rcov"
24
+
25
+ s.require_paths << 'lib'
26
+ end
@@ -0,0 +1,149 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper")
2
+
3
+ class ProjectGeneratorTest < Test::Unit::TestCase
4
+ include SproutTestCase
5
+
6
+ context "A new Project generator" do
7
+
8
+ setup do
9
+ @temp = File.join(fixtures, 'generators', 'tmp')
10
+ FileUtils.mkdir_p @temp
11
+ @generator = Robotlegs::ProjectGenerator.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 Project" do
21
+ @generator.input = "Fwee"
22
+ @generator.execute
23
+
24
+ input_dir = File.join(@temp, "Fwee")
25
+ assert_directory input_dir
26
+
27
+ rakefile = File.join(input_dir, "rakefile.rb")
28
+ assert_file rakefile
29
+ assert_file rakefile do |content|
30
+ assert_match /src\/Fwee.mxml/, content
31
+ end
32
+
33
+ gemfile = File.join(input_dir, "Gemfile")
34
+ assert_file gemfile
35
+
36
+ src_dir = File.join(input_dir, "src")
37
+ assert_directory src_dir
38
+
39
+ context_file = File.join(src_dir, "FweeContext.as")
40
+ assert_file context_file
41
+
42
+ main_file = File.join(src_dir, "Fwee.mxml")
43
+ assert_file main_file do |content|
44
+ assert_match /FweeCompleteHandler/, content
45
+ assert_match /xmlns:context="*"/, content
46
+ end
47
+
48
+
49
+ lib_dir = File.join(input_dir, "lib")
50
+ assert_directory lib_dir
51
+
52
+ bin_dir = File.join(input_dir, "bin")
53
+ assert_directory bin_dir
54
+
55
+ model_dir = File.join(src_dir, "model")
56
+ assert_directory model_dir
57
+
58
+ view_dir = File.join(src_dir, "view")
59
+ assert_directory view_dir
60
+
61
+ controller_dir = File.join(src_dir, "controller")
62
+ assert_directory controller_dir
63
+
64
+ service_dir = File.join(src_dir, "service")
65
+ assert_directory service_dir
66
+
67
+ notifications_dir = File.join(src_dir, "events")
68
+ assert_directory notifications_dir
69
+
70
+ #Second level directories
71
+
72
+ proxy_dir = File.join(model_dir, "proxy")
73
+ assert_directory proxy_dir
74
+
75
+ vo_dir = File.join(model_dir, "vo")
76
+ assert_directory vo_dir
77
+
78
+ mediators_dir = File.join(view_dir, "mediators")
79
+ assert_directory mediators_dir
80
+
81
+ components_dir = File.join(view_dir, "components")
82
+ assert_directory components_dir
83
+
84
+ skins_dir = File.join(view_dir, "skins")
85
+ assert_directory skins_dir
86
+
87
+ commands_dir = File.join(controller_dir, "commands")
88
+ assert_directory commands_dir
89
+
90
+ dto_dir = File.join(service_dir, "dto")
91
+ assert_directory dto_dir
92
+
93
+ end
94
+
95
+ should "respect shallow" do
96
+ @generator.input = "Fwi"
97
+ @generator.shallow = true
98
+ @generator.execute
99
+
100
+ input_dir = File.join(@temp, "Fwi")
101
+ assert_directory input_dir
102
+
103
+ vo_dir = File.join(input_dir, "src", "model", "vo")
104
+ assert !File.exists?(vo_dir)
105
+
106
+ dto_dir = File.join(input_dir, "src", "service", "dto")
107
+ assert !File.exists?(dto_dir)
108
+
109
+ end
110
+
111
+ should "add package directories" do
112
+ @generator.input = "Fwo"
113
+ @generator.package = "com/developsigner"
114
+ @generator.execute
115
+
116
+ input_dir = File.join(@temp, "Fwo")
117
+ assert_directory input_dir
118
+
119
+ src_dir = File.join(input_dir, "src")
120
+ assert_directory src_dir
121
+
122
+ package_dir = File.join(src_dir, "com", "developsigner")
123
+ assert_directory package_dir
124
+
125
+ context_file = File.join(package_dir, "FwoContext.as")
126
+ assert_file context_file
127
+
128
+ main_file = File.join(src_dir, "Fwo.mxml")
129
+ assert_file main_file do |content|
130
+ assert_match /FwoCompleteHandler/, content
131
+ assert_match /com.developsigner.*/, content
132
+ end
133
+ end
134
+
135
+ should "respect notifications override" do
136
+ @generator.input = "Fwum"
137
+ @generator.notifications = "signals"
138
+ @generator.execute
139
+
140
+ src_dir = File.join(@temp, "Fwum", "src")
141
+ assert_directory src_dir
142
+
143
+ notifications_dir = File.join(src_dir, "signals")
144
+ assert_directory notifications_dir
145
+
146
+ end
147
+
148
+ end
149
+ end
@@ -0,0 +1,37 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper")
2
+
3
+ require 'robotlegs/generators/service_generator'
4
+
5
+ class ServiceGeneratorTest < Test::Unit::TestCase
6
+ include SproutTestCase
7
+
8
+ context "A new Service generator" do
9
+
10
+ setup do
11
+ @temp = File.join(fixtures, 'generators', 'tmp')
12
+ FileUtils.mkdir_p @temp
13
+ @generator = Robotlegs::ServiceGenerator.new
14
+ @generator.path = @temp
15
+ @generator.logger = StringIO.new
16
+ end
17
+
18
+ teardown do
19
+ remove_file @temp
20
+ end
21
+
22
+ should "generate a new Service" do
23
+ @generator.input = "Service"
24
+ @generator.execute
25
+ #
26
+ # input_dir = File.join(@temp, "service")
27
+ # assert_directory input_dir
28
+ #
29
+ # input_file = File.join(input_dir, "RobotlegsService.as")
30
+ # assert_file input_file do |content|
31
+ # assert_matches /Your content to assert here/, content
32
+ # end
33
+
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,11 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+
4
+ Bundler.require :default, :development
5
+
6
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
7
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '..'))
8
+
9
+ require 'robotlegs'
10
+
11
+ require 'sprout/test/sprout_test_case'
metadata CHANGED
@@ -1,57 +1,128 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robotlegs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 69
5
- prerelease: false
4
+ prerelease: true
6
5
  segments:
7
6
  - 1
8
7
  - 3
9
8
  - 0
10
- - 1
11
- version: 1.3.0.1
9
+ - 2
10
+ - pre
11
+ version: 1.3.0.2.pre
12
12
  platform: ruby
13
- authors: []
14
-
13
+ authors:
14
+ - Kristofer Joseph
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-12 00:00:00 -07:00
19
+ date: 2010-10-18 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: sprout
23
+ name: flashsdk
24
24
  prerelease: false
25
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
26
  none: false
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- hash: 961915964
31
30
  segments:
32
31
  - 1
33
32
  - 0
34
- - 26
33
+ - 8
35
34
  - pre
36
- version: 1.0.26.pre
35
+ version: 1.0.8.pre
37
36
  type: :runtime
38
37
  version_requirements: *id001
39
- description:
38
+ - !ruby/object:Gem::Dependency
39
+ name: shoulda
40
+ prerelease: false
41
+ requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: mocha
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: rcov
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ description: GO AND CODE
40
78
  email:
41
- - amoslanka@gmail.com
42
- executables: []
43
-
79
+ - projectsprouts@googlegroups.com
80
+ executables:
81
+ - rl-project
82
+ - rl-context
83
+ - rl-proxy
84
+ - rl-mediator
85
+ - rl-command
86
+ - rl-service
44
87
  extensions: []
45
88
 
46
89
  extra_rdoc_files: []
47
90
 
48
91
  files:
49
- - lib/robotlegs.rb
92
+ - bin/rl-command
93
+ - bin/rl-context
94
+ - bin/rl-mediator
95
+ - bin/rl-project
96
+ - bin/rl-proxy
97
+ - bin/rl-service
50
98
  - Gemfile
99
+ - Gemfile.lock
100
+ - lib/robotlegs/generators/command_generator.rb
101
+ - lib/robotlegs/generators/context_generator.rb
102
+ - lib/robotlegs/generators/mediator_generator.rb
103
+ - lib/robotlegs/generators/project_generator.rb
104
+ - lib/robotlegs/generators/proxy_generator.rb
105
+ - lib/robotlegs/generators/robotlegs_class_generator_base.rb
106
+ - lib/robotlegs/generators/service_generator.rb
107
+ - lib/robotlegs/generators/templates/Flex4TestRunner.mxml
108
+ - lib/robotlegs/generators/templates/RobotlegsCommand.as
109
+ - lib/robotlegs/generators/templates/RobotlegsContext.as
110
+ - lib/robotlegs/generators/templates/RobotlegsGemfile.rb
111
+ - lib/robotlegs/generators/templates/RobotlegsMain.mxml
112
+ - lib/robotlegs/generators/templates/RobotlegsMediator.as
113
+ - lib/robotlegs/generators/templates/RobotlegsProxy.as
114
+ - lib/robotlegs/generators/templates/RobotlegsRakefile.rb
115
+ - lib/robotlegs/generators/templates/RobotlegsService.as
116
+ - lib/robotlegs/version.rb
117
+ - lib/robotlegs.rb
51
118
  - Rakefile
52
- - README.textile
119
+ - README.mkdn
120
+ - robotlegs.gemspec
121
+ - test/unit/project_generator_test.rb
122
+ - test/unit/service_generator_test.rb
123
+ - test/unit/test_helper.rb
53
124
  has_rdoc: true
54
- homepage: http://www.github.com/amoslanka/sprout-robotlegs-framework
125
+ homepage: http://projectsprouts.org
55
126
  licenses: []
56
127
 
57
128
  post_install_message:
@@ -59,12 +130,12 @@ rdoc_options: []
59
130
 
60
131
  require_paths:
61
132
  - lib
133
+ - lib
62
134
  required_ruby_version: !ruby/object:Gem::Requirement
63
135
  none: false
64
136
  requirements:
65
137
  - - ">="
66
138
  - !ruby/object:Gem::Version
67
- hash: 3
68
139
  segments:
69
140
  - 0
70
141
  version: "0"
@@ -73,16 +144,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
144
  requirements:
74
145
  - - ">="
75
146
  - !ruby/object:Gem::Version
76
- hash: 3
77
147
  segments:
78
- - 0
79
- version: "0"
148
+ - 1
149
+ - 3
150
+ - 6
151
+ version: 1.3.6
80
152
  requirements: []
81
153
 
82
154
  rubyforge_project:
83
155
  rubygems_version: 1.3.7
84
156
  signing_key:
85
157
  specification_version: 3
86
- summary: The Robotlegs source wrapped in a Sprout::Specification for implementation into a sprout project and Gem::Specification for distribution as a gem.
158
+ summary: A library for developing Robotlegs projects with Project Sprouts
87
159
  test_files: []
88
160
 
@@ -1,67 +0,0 @@
1
-
2
- h1. The Robotlegs Sprout Gem
3
-
4
- h4. requires sprout, v >= 1.0.26.pre
5
-
6
- Robotlegs ActionScript 3 source wrapped in a Sprout::Specification for implementation into a sprout project and Gem::Specification for distribution as a gem.
7
-
8
- The sprout will download the Robotlegs matching version zip from the Robotlegs website and the swc will be copied to lib/robotlegs of your sprout project.
9
-
10
- h3. Installation
11
-
12
- Intended for use with a project using Project Sprouts.
13
-
14
- See information concerning Project Sprouts here:
15
- * "http://github.com/lukebayes/project-sprouts" http://github.com/lukebayes/project-sprouts
16
- * "http://github.com/lukebayes/sprout-flashsdk" http://github.com/lukebayes/sprout-flashsdk
17
-
18
- Add the Robotlegs gem to your Gemfile:
19
-
20
- <pre><code>gem "robotlegs"</code></pre>
21
-
22
- Add the Robotlegs library dependency to your Rakefile:
23
-
24
- <pre><code>library :robotlegs</code></pre>
25
-
26
- Enter this shell command to resolve gem dependency:
27
-
28
- <pre><code>bundle install</code></pre>
29
-
30
- h3. Ruby Gem
31
-
32
- The gem can be installed independently of a project entering this command:
33
-
34
- <pre><code>gem install robotlegs</code></pre>
35
-
36
- h3. Additional links
37
-
38
- * "Robotlegs Site":http://robotlegs.org
39
- * "Robotlegs on GitHub":http://github.com/robotlegs/robotlegs-framework
40
- * "Sprouts Site":http://projectsprouts.org
41
- * "Sprouts on Github":http://github.com/lukebayes/project-sprouts
42
- * "flashsdk sprout on Github":http://github.com/lukebayes/sprout-flashsdk
43
- * "Sprouts Community":http://groups.google.com/group/projectsprouts
44
-
45
- h3. Robotlegs License
46
-
47
- The MIT License
48
-
49
- Copyright (c) 2009, 2010 the original author or authors
50
-
51
- Permission is hereby granted, free of charge, to any person obtaining a copy
52
- of this software and associated documentation files (the "Software"), to deal
53
- in the Software without restriction, including without limitation the rights
54
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55
- copies of the Software, and to permit persons to whom the Software is
56
- furnished to do so, subject to the following conditions:
57
-
58
- The above copyright notice and this permission notice shall be included in
59
- all copies or substantial portions of the Software.
60
-
61
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
66
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
67
- THE SOFTWARE.