gator-as3-robotlegs 0.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/.document +5 -0
  2. data/.rakeTasks +7 -0
  3. data/Gemfile +20 -0
  4. data/Gemfile.lock +41 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.rdoc +26 -0
  7. data/Rakefile +55 -0
  8. data/VERSION +1 -0
  9. data/lib/gator/as3/robotlegs/generators.rb +3 -0
  10. data/lib/gator/as3/robotlegs/generators/collection.rb +29 -0
  11. data/lib/gator/as3/robotlegs/generators/command.as.tt +12 -0
  12. data/lib/gator/as3/robotlegs/generators/command.rb +57 -0
  13. data/lib/gator/as3/robotlegs/generators/context.as.tt +35 -0
  14. data/lib/gator/as3/robotlegs/generators/context.rb +57 -0
  15. data/lib/gator/as3/robotlegs/generators/mediator.as.tt +23 -0
  16. data/lib/gator/as3/robotlegs/generators/mediator.rb +68 -0
  17. data/lib/gator/as3/robotlegs/generators/model.as.tt +12 -0
  18. data/lib/gator/as3/robotlegs/generators/model.rb +57 -0
  19. data/lib/gator/as3/robotlegs/generators/service.as.tt +12 -0
  20. data/lib/gator/as3/robotlegs/generators/service.rb +57 -0
  21. data/lib/gator/as3/robotlegs/generators/test/asunit4.rb +3 -0
  22. data/lib/gator/as3/robotlegs/generators/test/asunit4/collection.rb +25 -0
  23. data/lib/gator/as3/robotlegs/generators/test/asunit4/command.as.tt +35 -0
  24. data/lib/gator/as3/robotlegs/generators/test/asunit4/command.rb +63 -0
  25. data/lib/gator/as3/robotlegs/generators/test/asunit4/mediator.as.tt +46 -0
  26. data/lib/gator/as3/robotlegs/generators/test/asunit4/mediator.rb +74 -0
  27. data/lib/gator/as3/robotlegs/generators/test/asunit4/runner.as.tt +21 -0
  28. data/lib/gator/as3/robotlegs/generators/test/asunit4/suite.as.tt +8 -0
  29. data/lib/gator/as3/robotlegs/generators/test/asunit4/suite.rb +43 -0
  30. data/lib/gator/as3/robotlegs/generators/test/asunit4/view.as.tt +41 -0
  31. data/lib/gator/as3/robotlegs/generators/test/asunit4/view.rb +64 -0
  32. data/lib/gator/as3/robotlegs/generators/view.as.tt +17 -0
  33. data/lib/gator/as3/robotlegs/generators/view.rb +57 -0
  34. data/lib/gator/as3/robotlegs/generators/view_with_mediator.rb +24 -0
  35. data/spec/gator.rb +10 -0
  36. data/spec/generators/collection_spec.rb +11 -0
  37. data/spec/generators/command_spec.rb +12 -0
  38. data/spec/sandbox/gator.rb +10 -0
  39. data/spec/spec_helper.rb +81 -0
  40. metadata +208 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gem into pkg/" fullCmd="build" taksId="build" /><RakeTask description="Remove rdoc products" fullCmd="clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Start IRB with all runtime dependencies loaded" fullCmd="console[script]" taksId="console[script]" /><RakeGroup description="" fullCmd="" taksId="gemcutter"><RakeTask description="Release gem to Gemcutter" fullCmd="gemcutter:release" taksId="release" /></RakeGroup><RakeTask description="Generate and validate gemspec" fullCmd="gemspec" taksId="gemspec" /><RakeGroup description="" fullCmd="" taksId="gemspec"><RakeTask description="Display the gemspec for debugging purposes, as jeweler knows it (not from the filesystem)" fullCmd="gemspec:debug" taksId="debug" /><RakeTask description="Regenerate the gemspec on the filesystem" fullCmd="gemspec:generate" taksId="generate" /><RakeTask description="Regenerate and validate gemspec, and then commits and pushes to git" fullCmd="gemspec:release" taksId="release" /><RakeTask description="Validates the gemspec on the filesystem" fullCmd="gemspec:validate" taksId="validate" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="git"><RakeTask description="Tag and push release to git" fullCmd="git:release" taksId="release" /></RakeGroup><RakeTask description="Build and install gem using `gem install`" fullCmd="install" taksId="install" /><RakeTask description="Run RSpec code examples" fullCmd="rcov" taksId="rcov" /><RakeTask description="Build the rdoc HTML Files" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="Release gem" fullCmd="release" taksId="release" /><RakeTask description="Force a rebuild of the RDOC files" fullCmd="rerdoc" taksId="rerdoc" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="Displays the current version" fullCmd="version" taksId="version" /><RakeGroup description="" fullCmd="" taksId="version"><RakeGroup description="" fullCmd="" taksId="bump"><RakeTask description="Bump the major version by 1" fullCmd="version:bump:major" taksId="major" /><RakeTask description="Bump the a minor version by 1" fullCmd="version:bump:minor" taksId="minor" /><RakeTask description="Bump the patch version by 1" fullCmd="version:bump:patch" taksId="patch" /></RakeGroup><RakeTask description="Writes out an explicit version" fullCmd="version:write" taksId="write" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="ci"><RakeGroup description="" fullCmd="" taksId="setup"><RakeTask description="" fullCmd="ci:setup:rspec" taksId="rspec" /><RakeTask description="" fullCmd="ci:setup:rspecdoc" taksId="rspecdoc" /><RakeTask description="" fullCmd="ci:setup:spec_report_cleanup" taksId="spec_report_cleanup" /></RakeGroup></RakeGroup><RakeTask description="" fullCmd="clobber" taksId="clobber" /><RakeTask description="" fullCmd="console" taksId="console" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="gemspec_required" taksId="gemspec_required" /><RakeTask description="" fullCmd="rdoc/index.html" taksId="rdoc/index.html" /><RakeTask description="" fullCmd="test" taksId="test" /><RakeTask description="" fullCmd="version_required" taksId="version_required" /></RakeGroup></Settings>
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem "gator", "~> 0.0.20.pre"
7
+ gem "gator-as3", "~> 0.0.7.pre"
8
+
9
+ # Add dependencies to develop your gem here.
10
+ # Include everything needed to run rake, tests, features, etc.
11
+ group :development do
12
+ gem "shoulda", ">= 0"
13
+ gem "bundler", "~> 1.0.0"
14
+ gem "jeweler", "~> 1.6.4"
15
+ gem "rcov", ">= 0"
16
+ gem "rspec", "~> 2.3.0"
17
+ gem "ci_reporter", "~> 1.6.5"
18
+ gem "gator", "~> 0.0.20.pre"
19
+ gem "gator-as3", "~> 0.0.7.pre"
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ builder (3.0.0)
5
+ ci_reporter (1.6.5)
6
+ builder (>= 2.1.2)
7
+ diff-lcs (1.1.2)
8
+ gator (0.0.20.pre)
9
+ thor (~> 0.14.6)
10
+ gator-as3 (0.0.7.pre)
11
+ gator (~> 0.0.20.pre)
12
+ git (1.2.5)
13
+ jeweler (1.6.4)
14
+ bundler (~> 1.0)
15
+ git (>= 1.2.5)
16
+ rake
17
+ rake (0.9.2)
18
+ rcov (0.9.10)
19
+ rspec (2.3.0)
20
+ rspec-core (~> 2.3.0)
21
+ rspec-expectations (~> 2.3.0)
22
+ rspec-mocks (~> 2.3.0)
23
+ rspec-core (2.3.1)
24
+ rspec-expectations (2.3.0)
25
+ diff-lcs (~> 1.1.2)
26
+ rspec-mocks (2.3.0)
27
+ shoulda (2.11.3)
28
+ thor (0.14.6)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ bundler (~> 1.0.0)
35
+ ci_reporter (~> 1.6.5)
36
+ gator (~> 0.0.20.pre)
37
+ gator-as3 (~> 0.0.7.pre)
38
+ jeweler (~> 1.6.4)
39
+ rcov
40
+ rspec (~> 2.3.0)
41
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 devboy
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,26 @@
1
+ = gator-as3-robotlegs
2
+
3
+ Add this to your gator project file to use the generators:
4
+ require "gator/as3/robotlegs/generators"
5
+
6
+ For FlexUnit4 test generators add:
7
+ require "gator/as3/robotlegs/generators/test/flexunit4"
8
+
9
+ For ASUnit4 test generators add:
10
+ require "gator/as3/robotlegs/generators/test/asunit4"
11
+
12
+ == Contributing to gator-as3-robotlegs
13
+
14
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
15
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
16
+ * Fork the project
17
+ * Start a feature/bugfix branch
18
+ * Commit and push until you are happy with your contribution
19
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
20
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
21
+
22
+ == Copyright
23
+
24
+ Copyright (c) 2011 devboy. See LICENSE.txt for
25
+ further details.
26
+
data/Rakefile ADDED
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "gator-as3-robotlegs"
18
+ gem.homepage = "http://github.com/newtriks/gator-as3-robotlegs"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Gator Generators for RobotLegs}
21
+ gem.description = %Q{Gator Generators for RobotLegs}
22
+ gem.email = "simon@newtriks.com"
23
+ gem.authors = ["devboy","newtriks"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ require 'ci/reporter/rake/rspec'
31
+
32
+ ENV["CI_REPORTS"] ||= File.expand_path( File.join( File.dirname(__FILE__), "test", "report" ) )
33
+ RSpec::Core::RakeTask.new(:spec) do |spec|
34
+ spec.pattern = FileList['spec/**/*_spec.rb']
35
+ end
36
+
37
+ task :spec => "ci:setup:rspec"
38
+
39
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
40
+ spec.pattern = 'spec/**/*_spec.rb'
41
+ spec.rcov = true
42
+ end
43
+
44
+ task :test => :spec
45
+ task :default => :spec
46
+
47
+ require 'rdoc/task'
48
+ Rake::RDocTask.new do |rdoc|
49
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "gator-as3-robotlegs #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2.pre
@@ -0,0 +1,3 @@
1
+ require File.dirname(__FILE__) + '/generators/collection'
2
+
3
+ Gator::AS3::GeneratorCollection.register_subcommand Gator::AS3::RobotLegs::GeneratorCollection
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/context'
2
+ require File.dirname(__FILE__) + '/command'
3
+ require File.dirname(__FILE__) + '/model'
4
+ require File.dirname(__FILE__) + '/service'
5
+ require File.dirname(__FILE__) + '/mediator'
6
+ require File.dirname(__FILE__) + '/view'
7
+ require File.dirname(__FILE__) + '/view_with_mediator'
8
+
9
+ module Gator
10
+ module AS3
11
+ module RobotLegs
12
+
13
+ class GeneratorCollection < Gator::Command
14
+
15
+ define :command => "robotlegs", :short => "rl",
16
+ :usage => "generate as3 robotlegs GENERATOR", :description => "Generators for RobotLegs"
17
+
18
+ register_subcommand ContextGenerator
19
+ register_subcommand CommandGenerator
20
+ register_subcommand ModelGenerator
21
+ register_subcommand ServiceGenerator
22
+ register_subcommand MediatorGenerator
23
+ register_subcommand ViewGenerator
24
+ register_subcommand ViewWithMediatorGenerator
25
+
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ package <%= package_name %>
2
+ {
3
+ import org.robotlegs.mvcs.Command;
4
+
5
+ public class <%= class_name %> extends Command
6
+ {
7
+ override public function execute():void
8
+ {
9
+ // Do something funky
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,57 @@
1
+ module Gator
2
+ module AS3
3
+ module RobotLegs
4
+
5
+ class CommandGenerator < Task
6
+ include Gator::Project
7
+
8
+ define :command => "command",
9
+ :usage => "generate as3 rl command CLASS_NAME", :description => "Creates RobotLegs Command class."
10
+
11
+ argument :classname
12
+
13
+ class_option :test, :default => false
14
+
15
+ def self.source_root
16
+ File.dirname __FILE__
17
+ end
18
+
19
+ def generate
20
+ src = project.path(:source, :main, :as3)
21
+ @package_name, @class_name = split_class_name(classname)
22
+ @class_name += "Command"
23
+ src = File.join(src, @package_name.split(".").join(File::SEPARATOR)) unless @package_name == ""
24
+ template "command.as.tt", File.join(src, "#{@class_name}.as")
25
+ end
26
+
27
+ def generate_test
28
+ return unless options[:test]
29
+ invoke resolve_subcommand(["test", "command"],["test","klass"])
30
+ end
31
+
32
+ no_tasks {
33
+
34
+ def package_name
35
+ @package_name
36
+ end
37
+
38
+ def class_name
39
+ @class_name
40
+ end
41
+
42
+ }
43
+
44
+ protected
45
+
46
+ def split_class_name(class_name)
47
+ pieces = class_name.split "."
48
+ class_name = pieces.pop
49
+ package_name = pieces.join "."
50
+ return package_name, class_name
51
+ end
52
+
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,35 @@
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 %> extends Context
9
+ {
10
+ public function <%= class_name %>Context(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
11
+ {
12
+ super(contextView,autoStartup);
13
+ }
14
+
15
+ override public function startup():void
16
+ {
17
+ //Service
18
+ //injector.mapSingleton(YOUR SERVICE);
19
+
20
+ //Model
21
+ //injector.mapSingleton(YOUR PROXY);
22
+
23
+ //Controller
24
+ //commandMap.mapEvent( YOUR START UP COMMAND, ContextEvent.STARTUP, ContextEvent, true );
25
+
26
+ //View
27
+ //mediatorMap.mapView(YOUR VIEW, YOUR MEDIATOR);
28
+
29
+ //Dispatch a start up event
30
+ dispatchEvent( new ContextEvent( ContextEvent.STARTUP ) );
31
+
32
+ super.startup();
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,57 @@
1
+ module Gator
2
+ module AS3
3
+ module RobotLegs
4
+
5
+ class ContextGenerator < Task
6
+ include Gator::Project
7
+
8
+ define :command => "context",
9
+ :usage => "generate as3 rl context CLASS_NAME", :description => "Creates RobotLegs Context class."
10
+
11
+ argument :classname
12
+
13
+ class_option :test, :default => false
14
+
15
+ def self.source_root
16
+ File.dirname __FILE__
17
+ end
18
+
19
+ def generate
20
+ src = project.path(:source, :main, :as3)
21
+ @package_name, @class_name = split_class_name(classname)
22
+ @class_name += "Context"
23
+ src = File.join(src, @package_name.split(".").join(File::SEPARATOR)) unless @package_name == ""
24
+ template "context.as.tt", File.join(src, "#{@class_name}.as")
25
+ end
26
+
27
+ def generate_test
28
+ return unless options[:test]
29
+ invoke resolve_subcommand(["test", "context"],["test","klass"])
30
+ end
31
+
32
+ no_tasks {
33
+
34
+ def package_name
35
+ @package_name
36
+ end
37
+
38
+ def class_name
39
+ @class_name
40
+ end
41
+
42
+ }
43
+
44
+ protected
45
+
46
+ def split_class_name(class_name)
47
+ pieces = class_name.split "."
48
+ class_name = pieces.pop
49
+ package_name = pieces.join "."
50
+ return package_name, class_name
51
+ end
52
+
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,23 @@
1
+ package <%= package_name %>
2
+ {
3
+ import <%= view_package_name %>.<%= view_class_name %>;
4
+
5
+ import org.robotlegs.mvcs.Mediator;
6
+
7
+ public class <%= class_name %> extends Mediator
8
+ {
9
+ [Inject]
10
+ public var view:<%= view_class_name %>;
11
+
12
+ override public function onRegister():void
13
+ {
14
+ // eventMap.mapListener(YOUR VIEW COMPONENT, YOUR EVENT, YOUR HANDLER);
15
+ }
16
+
17
+ override public function onRemove():void
18
+ {
19
+ // eventMap.unmapListeners();
20
+ super.onRemove();
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,68 @@
1
+ module Gator
2
+ module AS3
3
+ module RobotLegs
4
+
5
+ class MediatorGenerator < Task
6
+ include Gator::Project
7
+
8
+ define :command => "mediator",
9
+ :usage => "generate as3 rl mediator CLASS_NAME", :description => "Creates RobotLegs Mediator class."
10
+
11
+ argument :classname
12
+
13
+ class_option :test, :default => false
14
+
15
+ def self.source_root
16
+ File.dirname __FILE__
17
+ end
18
+
19
+ def generate
20
+ src = project.path(:source, :main, :as3)
21
+ @package_name, @class_name = split_class_name(classname)
22
+ @view_package_name = @package_name.dup << ".components"
23
+ @view_class_name = @class_name.dup
24
+ @class_name += "Mediator"
25
+ @package_name += ".mediators"
26
+ src = File.join(src, @package_name.split(".").join(File::SEPARATOR)) unless @package_name == ""
27
+ template "mediator.as.tt", File.join(src, "#{@class_name}.as")
28
+ end
29
+
30
+ def generate_test
31
+ return unless options[:test]
32
+ invoke resolve_subcommand(["test", "mediator"],["test","klass"])
33
+ end
34
+
35
+ no_tasks {
36
+
37
+ def package_name
38
+ @package_name
39
+ end
40
+
41
+ def class_name
42
+ @class_name
43
+ end
44
+
45
+ def view_package_name
46
+ @view_package_name
47
+ end
48
+
49
+ def view_class_name
50
+ @view_class_name
51
+ end
52
+
53
+ }
54
+
55
+ protected
56
+
57
+ def split_class_name(class_name)
58
+ pieces = class_name.split "."
59
+ class_name = pieces.pop
60
+ package_name = pieces.join "."
61
+ return package_name, class_name
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+ end
68
+ end