Skip to content

Commit

Permalink
Added SignalContext generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristofer Joseph committed Mar 10, 2011
1 parent 5eeaa11 commit 1b6c07d
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.mkdn
Expand Up @@ -11,9 +11,11 @@ This bundle contains generators for creating:

* Project
* Context
* SignalContext
* Proxy
* Mediator
* Command
* SignalCommand
* Service


Expand Down Expand Up @@ -90,7 +92,6 @@ This bundle contains generators for creating:
* Event
* Signal
* Signals Project
* Signal Command
* VO
* DTO

Expand Down
10 changes: 10 additions & 0 deletions bin/rl-signal-context
@@ -0,0 +1,10 @@
#!/usr/bin/env ruby

require 'rubygems'
require 'robotlegs'
require 'bundler'
Bundler.require

generator = Robotlegs::SignalContextGenerator.new
generator.parse! ARGV
generator.execute
1 change: 1 addition & 0 deletions lib/robotlegs.rb
Expand Up @@ -9,6 +9,7 @@
require 'robotlegs/generators/command_generator'
require 'robotlegs/generators/service_generator'
require 'robotlegs/generators/signal_command_generator'
require 'robotlegs/generators/signal_context_generator'

Sprout::Specification.new do |s|
s.name = Robotlegs::NAME
Expand Down
27 changes: 27 additions & 0 deletions lib/robotlegs/generators/signal_context_generator.rb
@@ -0,0 +1,27 @@
module Robotlegs
class SignalContextGenerator < FlashSDK::ClassGenerator
include RobotlegsHelper

def manifest
if(!input.match(/Test$/))
directory context_directory do
template "#{class_name}.as", 'RobotlegsSignalContext.as'
end
end

if test_class
generator :test_class, :input => "#{fully_qualified_class_name}Test", :force => true
end
end

def context_directory
src_array = [] << src
src_array += package_directory
end

def package_name
default_package_name.dup
end

end
end
41 changes: 41 additions & 0 deletions lib/robotlegs/generators/templates/RobotlegsSignalContext.as
@@ -0,0 +1,41 @@
package <%= package %>
{
import flash.display.DisplayObjectContainer;

import org.robotlegs.mvcs.SignalContext;

public class <%= class_name %>Context extends SignalContext
{
//---------------------------------------
// CONSTRUCTOR
//---------------------------------------

public function <%= class_name %>Context(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
{
super(contextView,autoStartup);
}

//---------------------------------------
// OVERRIDEN METHODS
//---------------------------------------

override public function startup():void
{
//Service
//injector.mapSingleton(YOUR SERVICE);

//Model
//injector.mapSingleton(YOUR PROXY);

//Controller
//signalCommandMap.mapSignal( YOUR START UP SIGNAL, YOUR START UP COMMAND );

//View
//mediatorMap.mapView(YOUR VIEW, YOUR MEDIATOR);

//Dispatch a start up signal

super.startup();
}
}
}
2 changes: 1 addition & 1 deletion robotlegs.gemspec
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.homepage = "http://projectsprouts.org"
s.summary = "A library for developing Robotlegs projects with Project Sprouts"
s.description = "GO AND CODE"
s.executables = ["rl-project","rl-context","rl-proxy","rl-mediator","rl-command","rl-service","rl-signal-command"]
s.executables = ["rl-project","rl-context","rl-proxy","rl-mediator","rl-command","rl-service","rl-signal-command","rl-signal-context"]
s.rubyforge_project = "sprout-robotlegs"
s.required_rubygems_version = ">= 1.3.7"
s.files = FileList["**/*"].exclude /docs|.DS_Store|generated|.svn|.git|vendor/
Expand Down

0 comments on commit 1b6c07d

Please sign in to comment.