fabricator 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +14 -2
- data/README.rdoc +23 -9
- data/Rakefile +3 -3
- data/app_generators/pureapp/pureapp_generator.rb +6 -2
- data/app_generators/pureapp/templates/actionscript.properties +4 -4
- data/app_generators/pureapp/templates/fabricator.yml +12 -0
- data/app_generators/pureapp/templates/mainapp.mxml +5 -0
- data/app_generators/pureapp/templates/shell/controller/load_all_modules_command.as +23 -0
- data/app_generators/pureapp/templates/shell/controller/load_dashboard_module_command.as +1 -1
- data/generators/pure_module/USAGE +5 -0
- data/generators/pure_module/pure_module_generator.rb +87 -0
- data/generators/pure_module/templates/actionscript.properties +20 -0
- data/generators/pure_module/templates/fabricator.yml +12 -0
- data/generators/pure_module/templates/module.mxml +25 -0
- data/generators/pure_module/templates/module/controller/module_startup_command.as +20 -0
- data/generators/pure_module/templates/module/model/proxy.as +19 -0
- data/generators/pure_module/templates/module/view/components/view.mxml +10 -0
- data/generators/pure_module/templates/module/view/module_mediator.as +31 -0
- data/generators/pure_module/templates/module/view/view_mediator.as +38 -0
- data/generators/pure_module/templates/shell/controller/load_all_modules_command.as +23 -0
- data/lib/fabricator.rb +13 -2
- data/lib/fabricator/configuration.rb +22 -0
- data/test/test_pure_module_generator.rb +45 -0
- metadata +40 -7
- data/app_generators/pureapp/templates/properties.yml +0 -6
data/Manifest.txt
CHANGED
@@ -30,9 +30,10 @@ app_generators/pureapp/templates/modules/dashboard/view/dashboard_module_mediato
|
|
30
30
|
app_generators/pureapp/templates/modules/dashboard/view/nav_bar_mediator.as
|
31
31
|
app_generators/pureapp/templates/modules/dashboard/view/todo_list_mediator.as
|
32
32
|
app_generators/pureapp/templates/project.properties
|
33
|
-
app_generators/pureapp/templates/
|
33
|
+
app_generators/pureapp/templates/fabricator.yml
|
34
34
|
app_generators/pureapp/templates/shell/controller/add_module_command.as
|
35
35
|
app_generators/pureapp/templates/shell/controller/change_selected_module_command.as
|
36
|
+
app_generators/pureapp/templates/shell/controller/load_all_modules_command.as
|
36
37
|
app_generators/pureapp/templates/shell/controller/load_dashboard_module_command.as
|
37
38
|
app_generators/pureapp/templates/shell/controller/remove_module_command.as
|
38
39
|
app_generators/pureapp/templates/shell/controller/startup_command.as
|
@@ -48,12 +49,23 @@ app_generators/pureapp/templates/shell/view/modules_container_mediator.as
|
|
48
49
|
app_generators/pureapp/USAGE
|
49
50
|
bin/pureapp
|
50
51
|
History.txt
|
51
|
-
lib/fabricator
|
52
|
+
lib/fabricator/configuration.rb
|
52
53
|
lib/fabricator.rb
|
53
54
|
Manifest.txt
|
54
55
|
PostInstall.txt
|
55
56
|
Rakefile
|
56
57
|
README.rdoc
|
58
|
+
generators/pure_module/pure_module_generator.rb
|
59
|
+
generators/pure_module/templates/actionscript.properties
|
60
|
+
generators/pure_module/templates/fabricator.yml
|
61
|
+
generators/pure_module/templates/shell/controller/load_all_modules_command.as
|
62
|
+
generators/pure_module/templates/module/controller/module_startup_command.as
|
63
|
+
generators/pure_module/templates/module/model/proxy.as
|
64
|
+
generators/pure_module/templates/module/view/components/view.mxml
|
65
|
+
generators/pure_module/templates/module/view/module_mediator.as
|
66
|
+
generators/pure_module/templates/module/view/view_mediator.as
|
67
|
+
generators/pure_module/templates/module.mxml
|
68
|
+
generators/pure_module/USAGE
|
57
69
|
script/console
|
58
70
|
script/destroy
|
59
71
|
script/generate
|
data/README.rdoc
CHANGED
@@ -1,32 +1,46 @@
|
|
1
1
|
= fabricator
|
2
2
|
|
3
|
-
|
3
|
+
Developed by
|
4
|
+
Steffen Egelund Jensen
|
5
|
+
Software designer
|
6
|
+
Lenio A/S - www.lenio.dk
|
4
7
|
|
5
8
|
== DESCRIPTION:
|
6
9
|
|
7
|
-
|
10
|
+
This gem can generate a scaffold flex application based on PureMVC Multicore using the pipes utility abstracted by the fabrication framework.
|
11
|
+
The initial application will be generated based on custom project name, title, src folder and package. Plus will include two modules:
|
12
|
+
an authentication module and a dashboard module. It is intended that the gem in the future will be able to add new scaffold modules integrated with the application.
|
13
|
+
New commands, proxies etc.
|
8
14
|
|
9
15
|
== FEATURES/PROBLEMS:
|
10
|
-
|
11
|
-
* FIX (list of features or problems)
|
16
|
+
|
12
17
|
|
13
18
|
== SYNOPSIS:
|
14
|
-
|
15
|
-
|
19
|
+
Generate PureMVC Multicore with pipes application abstracted by the Fabrication framework
|
20
|
+
-Install and run
|
21
|
+
pureapp AppName org.my.custom.package 'app title'
|
22
|
+
-Import flex project in Flex Builder
|
23
|
+
-After compile run
|
24
|
+
AppNameShell.mxml
|
25
|
+
|
26
|
+
Generate module
|
27
|
+
cd AppName
|
28
|
+
ruby script/generate pure_module ModuleName
|
29
|
+
i.e. ruby script/generate pure_module Address -> results in AddressModule.mxml plus generated code for the new module.
|
16
30
|
|
17
31
|
== REQUIREMENTS:
|
18
32
|
|
19
|
-
|
33
|
+
rubygems, ruby
|
20
34
|
|
21
35
|
== INSTALL:
|
22
36
|
|
23
|
-
|
37
|
+
sudo gem install fabricator
|
24
38
|
|
25
39
|
== LICENSE:
|
26
40
|
|
27
41
|
(The MIT License)
|
28
42
|
|
29
|
-
Copyright (c) 2009
|
43
|
+
Copyright (c) 2009 Steffen Egelund Jensen
|
30
44
|
|
31
45
|
Permission is hereby granted, free of charge, to any person obtaining
|
32
46
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -8,9 +8,9 @@ $hoe = Hoe.new('fabricator', Fabricator::VERSION) do |p|
|
|
8
8
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
9
|
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
10
|
p.rubyforge_name = 'pure-fab-gen'#p.name # TODO this is default value
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
p.extra_deps = [
|
12
|
+
['activesupport','>= 2.0.2'],['rubigen','1.5.2']
|
13
|
+
]
|
14
14
|
p.extra_dev_deps = [
|
15
15
|
['newgem', ">= #{::Newgem::VERSION}"]
|
16
16
|
]
|
@@ -11,7 +11,9 @@ class PureappGenerator < RubiGen::Base
|
|
11
11
|
:base_folder,
|
12
12
|
:base_src_folder,
|
13
13
|
:base_package_folder,
|
14
|
-
:startup_command_name
|
14
|
+
:startup_command_name,
|
15
|
+
:modules
|
16
|
+
|
15
17
|
|
16
18
|
def initialize(runtime_args, runtime_options = {})
|
17
19
|
super
|
@@ -24,6 +26,7 @@ class PureappGenerator < RubiGen::Base
|
|
24
26
|
@base_package_folder = @base_package.gsub('.', '/').gsub(/\s/, '')
|
25
27
|
@base_folder = @base_src_folder + @base_package_folder
|
26
28
|
@startup_command_name = "#{@name}ShellStartupCommand"
|
29
|
+
@modules = ["Authentication","Dashboard"]
|
27
30
|
extract_options
|
28
31
|
end
|
29
32
|
|
@@ -54,7 +57,7 @@ class PureappGenerator < RubiGen::Base
|
|
54
57
|
end
|
55
58
|
|
56
59
|
# Save generator properties for component generators.
|
57
|
-
m.template "
|
60
|
+
m.template "fabricator.yml", "/script/fabricator.yml"
|
58
61
|
|
59
62
|
# Create template files
|
60
63
|
%w(history.css history.js historyFrame.html).each do |file|
|
@@ -73,6 +76,7 @@ class PureappGenerator < RubiGen::Base
|
|
73
76
|
# Create shell stubs
|
74
77
|
m.template "shell/shell_constants.as", "#{@base_folder}/shell/#{@name}ShellConstants.as"
|
75
78
|
m.template "shell/controller/startup_command.as", "#{@base_folder}/shell/controller/#{@startup_command_name}.as"
|
79
|
+
m.template "shell/controller/load_all_modules_command.as", "#{@base_folder}/shell/controller/LoadAllModulesCommand.as"
|
76
80
|
m.template "shell/controller/add_module_command.as", "#{@base_folder}/shell/controller/AddModuleCommand.as"
|
77
81
|
m.template "shell/controller/remove_module_command.as", "#{@base_folder}/shell/controller/RemoveModuleCommand.as"
|
78
82
|
m.template "shell/controller/change_selected_module_command.as", "#{@base_folder}/shell/controller/ChangeSelectedModuleCommand.as"
|
@@ -12,9 +12,9 @@
|
|
12
12
|
<application path="<%= name %>Shell.mxml"/>
|
13
13
|
</applications>
|
14
14
|
<modules>
|
15
|
-
|
16
|
-
<module application="<%= base_src_folder
|
17
|
-
|
15
|
+
<% for modul in modules -%>
|
16
|
+
<module application="<%= base_src_folder%><%= name %>Shell.mxml" destPath="<%=base_package_folder%>/modules/<%=modul.downcase%>/<%=modul%>Module.swf" optimize="true" sourcePath="<%=base_src_folder%><%=modul%>Module.mxml"/>
|
17
|
+
<% end -%>
|
18
18
|
</modules>
|
19
19
|
<buildCSSFiles/>
|
20
|
-
</actionScriptProperties>
|
20
|
+
</actionScriptProperties>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
package <%= base_package%>.shell.controller {
|
2
|
+
import <%= base_package%>.shell.<%= name%>ShellConstants;
|
3
|
+
import <%= base_package%>.shell.model.ModuleDescriptor;
|
4
|
+
|
5
|
+
import org.puremvc.as3.multicore.interfaces.INotification;
|
6
|
+
import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
|
7
|
+
|
8
|
+
public class LoadAllModulesCommand extends SimpleFabricationCommand {
|
9
|
+
|
10
|
+
override public function execute(note:INotification):void {
|
11
|
+
var moduleDescriptor:ModuleDescriptor = null;
|
12
|
+
<%grid_modules = modules - ["Dashboard", "Authentication"] %>
|
13
|
+
<%if grid_modules.empty?%>
|
14
|
+
trace("no modules but Dashboard, and Authentication created yet. run ruby script/generate pure_module MyNewModule in the root of the project")
|
15
|
+
<%end%>
|
16
|
+
<%for modul in grid_modules%>
|
17
|
+
trace("loading <%=modul.downcase%> module")
|
18
|
+
moduleDescriptor = new ModuleDescriptor("<%=modul%>Module.swf");
|
19
|
+
sendNotification(<%= name%>ShellConstants.ADD_MODULE, moduleDescriptor);
|
20
|
+
<%end%>
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
@@ -8,7 +8,7 @@ package <%= base_package%>.shell.controller {
|
|
8
8
|
public class LoadDashboardModuleCommand extends SimpleFabricationCommand {
|
9
9
|
|
10
10
|
override public function execute(note:INotification):void {
|
11
|
-
trace("
|
11
|
+
trace("loading dashboard module")
|
12
12
|
var moduleDescriptor:ModuleDescriptor = new ModuleDescriptor("DashboardModule.swf");
|
13
13
|
sendNotification(<%= name%>ShellConstants.ADD_MODULE, moduleDescriptor);
|
14
14
|
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'fabricator') if !defined?(Fabricator)
|
2
|
+
|
3
|
+
class PureModuleGenerator < RubiGen::Base
|
4
|
+
include Fabricator::Configuration
|
5
|
+
|
6
|
+
default_options :author => nil
|
7
|
+
|
8
|
+
attr_reader :name,
|
9
|
+
:module_name,
|
10
|
+
:module_folder,
|
11
|
+
:app_name,
|
12
|
+
:base_src_folder,
|
13
|
+
:base_package_folder,
|
14
|
+
:base_package,
|
15
|
+
:modules
|
16
|
+
|
17
|
+
def initialize(runtime_args, runtime_options = {})
|
18
|
+
super
|
19
|
+
usage if args.empty?
|
20
|
+
@module_name = args.shift.capitalize
|
21
|
+
@module_folder = @module_name.downcase
|
22
|
+
|
23
|
+
@name, @base_src_folder, @base_package_folder, @base_package, @modules = extract_config
|
24
|
+
@base_folder = @base_src_folder + @base_package_folder
|
25
|
+
modules << @module_name
|
26
|
+
extract_options
|
27
|
+
end
|
28
|
+
|
29
|
+
def manifest
|
30
|
+
record do |m|
|
31
|
+
# Ensure appropriate folder(s) exists
|
32
|
+
m.directory @base_folder +"/modules/#{@module_folder}/model"
|
33
|
+
m.directory @base_folder +"/modules/#{@module_folder}/view/components"
|
34
|
+
m.directory @base_folder +"/modules/#{@module_folder}/controller"
|
35
|
+
|
36
|
+
# Create module
|
37
|
+
m.template "module.mxml", "#{@base_src_folder}/#{module_name}Module.mxml"
|
38
|
+
m.template "module/controller/module_startup_command.as","#{@base_folder}/modules/#{@module_folder}/controller/#{module_name}ModuleStartupCommand.as"
|
39
|
+
m.template "module/view/module_mediator.as", "#{@base_folder}/modules/#{@module_folder}/view/#{module_name}ModuleMediator.as"
|
40
|
+
m.template "module/view/components/view.mxml", "#{@base_folder}/modules/#{@module_folder}/view/components/#{module_name}View.mxml" #fixme
|
41
|
+
m.template "module/view/view_mediator.as", "#{@base_folder}/modules/#{@module_folder}/view/#{module_name}ViewMediator.as" #fixme
|
42
|
+
m.template "module/model/proxy.as", "#{@base_folder}/modules/#{@module_folder}/model/#{module_name}Proxy.as"
|
43
|
+
|
44
|
+
# Recreate .actionscriptproperty file with all modules
|
45
|
+
m.template 'actionscript.properties', '.actionScriptProperties' #TODO remove common template files to common dir
|
46
|
+
# Resave generator properties for component generators.
|
47
|
+
m.template "fabricator.yml", "/script/fabricator.yml" #TODO remove common template files to common dir
|
48
|
+
# Rebuild load_all_modules_command
|
49
|
+
m.template "shell/controller/load_all_modules_command.as", "#{@base_folder}/shell/controller/LoadAllModulesCommand.as" #TODO remove common template files to common dir
|
50
|
+
|
51
|
+
# Create stubs
|
52
|
+
# m.template "template.rb.erb", "some_file_after_erb.rb"
|
53
|
+
# m.template_copy_each ["template.rb", "template2.rb"]
|
54
|
+
# m.template_copy_each ["template.rb", "template2.rb"], "some/path"
|
55
|
+
# m.file "file", "some_file_copied"
|
56
|
+
# m.file_copy_each ["path/to/file", "path/to/file2"]
|
57
|
+
# m.file_copy_each ["path/to/file", "path/to/file2"], "some/path"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
protected
|
62
|
+
def banner
|
63
|
+
<<-EOS
|
64
|
+
Creates a ...
|
65
|
+
|
66
|
+
USAGE: #{$0} #{spec.name} name
|
67
|
+
EOS
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_options!(opts)
|
71
|
+
# opts.separator ''
|
72
|
+
# opts.separator 'Options:'
|
73
|
+
# For each option below, place the default
|
74
|
+
# at the top of the file next to "default_options"
|
75
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
76
|
+
# "Some comment about this option",
|
77
|
+
# "Default: none") { |o| options[:author] = o }
|
78
|
+
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
79
|
+
end
|
80
|
+
|
81
|
+
def extract_options
|
82
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
83
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
84
|
+
# raw instance variable value.
|
85
|
+
# @author = options[:author]
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<actionScriptProperties mainApplicationPath="<%= name %>Shell.mxml" version="3">
|
3
|
+
<compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin" sourceFolderPath="src/main/flex" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
|
4
|
+
<compilerSourcePath/>
|
5
|
+
<libraryPath defaultLinkType="1">
|
6
|
+
<libraryPathEntry kind="4" path=""/>
|
7
|
+
<libraryPathEntry kind="1" linkType="1" path="libs"/>
|
8
|
+
</libraryPath>
|
9
|
+
<sourceAttachmentPath/>
|
10
|
+
</compiler>
|
11
|
+
<applications>
|
12
|
+
<application path="<%= name %>Shell.mxml"/>
|
13
|
+
</applications>
|
14
|
+
<modules>
|
15
|
+
<% for modul in modules -%>
|
16
|
+
<module application="<%= base_src_folder%><%= name %>Shell.mxml" destPath="<%=base_package_folder%>/modules/<%=modul.downcase%>/<%=modul%>Module.swf" optimize="true" sourcePath="<%=base_src_folder%><%=modul%>Module.mxml"/>
|
17
|
+
<% end -%>
|
18
|
+
</modules>
|
19
|
+
<buildCSSFiles/>
|
20
|
+
</actionScriptProperties>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<fab:FlexModule
|
3
|
+
xmlns:mx="http://www.adobe.com/2006/mxml"
|
4
|
+
xmlns:fab="org.puremvc.as3.multicore.utilities.fabrication.components.*"
|
5
|
+
xmlns:local="<%= base_package%>.modules.<%= module_folder%>.view.components.*" width="100%" height="100%">
|
6
|
+
|
7
|
+
<mx:Script>
|
8
|
+
<![CDATA[
|
9
|
+
import <%= base_package%>.modules.<%= module_folder%>.controller.<%= module_name%>ModuleStartupCommand;
|
10
|
+
|
11
|
+
override public function getStartupCommand():Class {
|
12
|
+
return <%= module_name%>ModuleStartupCommand;
|
13
|
+
}
|
14
|
+
|
15
|
+
override public function getClassByName(path:String):Class {
|
16
|
+
return getDefinitionByName(path) as Class;
|
17
|
+
}
|
18
|
+
|
19
|
+
]]>
|
20
|
+
</mx:Script>
|
21
|
+
<mx:Label text="This is the <%= module_name%> module" color="#FFFFFF" fontSize="30" width="100%" textAlign="center" fontWeight="bold"/>
|
22
|
+
<mx:VBox height="100%" width="100%" horizontalAlign="center" verticalAlign="middle">
|
23
|
+
<local:<%= module_name%>View id="<%= module_folder%>View"/>
|
24
|
+
</mx:VBox>
|
25
|
+
</fab:FlexModule>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
package <%= base_package%>.modules.<%= module_folder%>.controller {
|
2
|
+
import org.puremvc.as3.multicore.interfaces.INotification;
|
3
|
+
import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
|
4
|
+
|
5
|
+
import <%= base_package%>.common.<%= name%>Constants;
|
6
|
+
import <%= base_package%>.modules.<%= module_folder%>.model.<%= module_name%>Proxy;
|
7
|
+
|
8
|
+
import <%= module_name%>Module;
|
9
|
+
import <%= base_package%>.modules.<%= module_folder%>.view.<%= module_name%>ModuleMediator;
|
10
|
+
|
11
|
+
public class <%= module_name%>ModuleStartupCommand extends SimpleFabricationCommand {
|
12
|
+
|
13
|
+
override public function execute(note:INotification):void {
|
14
|
+
trace("starting <%= module_folder%> module")
|
15
|
+
registerProxy(new <%= module_name%>Proxy());
|
16
|
+
registerMediator(new <%= module_name%>ModuleMediator(note.getBody() as <%= module_name%>Module));
|
17
|
+
}
|
18
|
+
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
package <%= base_package%>.modules.<%= module_folder%>.model {
|
2
|
+
import org.puremvc.as3.multicore.utilities.fabrication.patterns.proxy.FabricationProxy;
|
3
|
+
import <%= base_package%>.common.<%= name%>Constants;
|
4
|
+
|
5
|
+
public class <%= module_name%>Proxy extends FabricationProxy {
|
6
|
+
|
7
|
+
static public const NAME:String = "<%= module_name%>Proxy";
|
8
|
+
|
9
|
+
|
10
|
+
public function <%= module_name%>Proxy(name:String = NAME) {
|
11
|
+
super(name);
|
12
|
+
}
|
13
|
+
|
14
|
+
|
15
|
+
public function calcData(input:String):void {
|
16
|
+
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" horizontalCenter="0" verticalCenter="0" title="<%= module_name %>" horizontalAlign="center">
|
3
|
+
<mx:Script>
|
4
|
+
<![CDATA[
|
5
|
+
|
6
|
+
]]>
|
7
|
+
</mx:Script>
|
8
|
+
|
9
|
+
<mx:Button id="moduleButton" label="Module Button" enabled="false" />
|
10
|
+
</mx:Panel>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
package <%= base_package%>.modules.<%= module_folder%>.view {
|
2
|
+
import org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator.FlexMediator;
|
3
|
+
|
4
|
+
import <%= base_package%>.modules.<%= module_folder%>.view.components.<%= module_name%>View;
|
5
|
+
|
6
|
+
public class <%= module_name%>ModuleMediator extends FlexMediator {
|
7
|
+
|
8
|
+
static public const NAME:String = "<%= module_name%>ModuleMediator";
|
9
|
+
|
10
|
+
static public function getDefinitionByName(path:String):Object {
|
11
|
+
return getDefinitionByName(path);
|
12
|
+
}
|
13
|
+
|
14
|
+
public function <%= module_name%>ModuleMediator(viewComponent:<%= module_name%>Module) {
|
15
|
+
super(NAME, viewComponent);
|
16
|
+
}
|
17
|
+
|
18
|
+
public function get application():<%= module_name%>Module {
|
19
|
+
return viewComponent as <%= module_name%>Module;
|
20
|
+
}
|
21
|
+
|
22
|
+
public function get <%= module_folder%>View():<%= module_name%>View {
|
23
|
+
return application.<%= module_folder%>View as <%= module_name%>View;
|
24
|
+
}
|
25
|
+
|
26
|
+
override public function onRegister():void {
|
27
|
+
registerMediator(new <%= module_name%>ViewMediator(<%= module_folder%>View));
|
28
|
+
}
|
29
|
+
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
package <%= base_package%>.modules.<%= module_folder%>.view
|
2
|
+
{
|
3
|
+
import org.puremvc.as3.multicore.utilities.fabrication.patterns.mediator.FlexMediator;
|
4
|
+
import <%= base_package%>.modules.<%= module_folder%>.view.components.<%= module_name%>View;
|
5
|
+
import <%= base_package%>.modules.<%= module_folder%>.model.<%= module_name%>Proxy;
|
6
|
+
|
7
|
+
import mx.controls.Button;
|
8
|
+
import flash.events.MouseEvent;
|
9
|
+
|
10
|
+
import flash.events.Event;
|
11
|
+
|
12
|
+
public class <%= module_name%>ViewMediator extends FlexMediator {
|
13
|
+
|
14
|
+
public static const NAME:String = "<%= module_name%>ViewMediator";
|
15
|
+
|
16
|
+
public function <%= module_name%>ViewMediator( viewComponent:<%= module_name%>View )
|
17
|
+
{
|
18
|
+
super( NAME, viewComponent );
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* The viewComponent cast to type SignInView.
|
23
|
+
*/
|
24
|
+
private function get <%= module_folder%>View():<%= module_name%>View
|
25
|
+
{
|
26
|
+
return viewComponent as <%= module_name%>View;
|
27
|
+
}
|
28
|
+
|
29
|
+
public function get moduleButton():Button {
|
30
|
+
return <%= module_folder%>View.moduleButton as Button;
|
31
|
+
}
|
32
|
+
|
33
|
+
public function reactToModuleButtonClick(e:MouseEvent):void {
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
package <%= base_package%>.shell.controller {
|
2
|
+
import <%= base_package%>.shell.<%= name%>ShellConstants;
|
3
|
+
import <%= base_package%>.shell.model.ModuleDescriptor;
|
4
|
+
|
5
|
+
import org.puremvc.as3.multicore.interfaces.INotification;
|
6
|
+
import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
|
7
|
+
|
8
|
+
public class LoadAllModulesCommand extends SimpleFabricationCommand {
|
9
|
+
|
10
|
+
override public function execute(note:INotification):void {
|
11
|
+
var moduleDescriptor:ModuleDescriptor = null;
|
12
|
+
<%grid_modules = modules - ["Dashboard", "Authentication"] %>
|
13
|
+
<%if grid_modules.empty?%>
|
14
|
+
trace("no modules but Dashboard, and Authentication created yet. run ruby script/generate pure_module MyNewModule in the root of the project")
|
15
|
+
<%end%>
|
16
|
+
<%for modul in grid_modules%>
|
17
|
+
trace("loading <%=modul.downcase%> module")
|
18
|
+
moduleDescriptor = new ModuleDescriptor("<%=modul%>Module.swf");
|
19
|
+
sendNotification(<%= name%>ShellConstants.ADD_MODULE, moduleDescriptor);
|
20
|
+
<%end%>
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
data/lib/fabricator.rb
CHANGED
@@ -2,5 +2,16 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
module Fabricator
|
5
|
-
VERSION = '0.0.
|
6
|
-
|
5
|
+
VERSION = '0.0.5'
|
6
|
+
LIB_DIR = File.join(File.dirname(__FILE__), 'fabricator/')
|
7
|
+
|
8
|
+
def self.require_all_libs_relative_to( fname, dir = nil )
|
9
|
+
dir ||= ::File.basename(fname, '.*')
|
10
|
+
search_me = ::File.expand_path(
|
11
|
+
::File.join(::File.dirname(fname), dir, '*', '*.rb'))
|
12
|
+
|
13
|
+
Dir.glob(search_me).sort.each {|rb| require rb}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require Fabricator::LIB_DIR + 'configuration'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Fabricator
|
2
|
+
module Configuration
|
3
|
+
APP_ROOT = File.expand_path(".")
|
4
|
+
|
5
|
+
def extract_config()
|
6
|
+
begin
|
7
|
+
puts "loading config file #{APP_ROOT}/script/fabricator.yml"
|
8
|
+
config = YAML.load(File.open("#{APP_ROOT}/script/fabricator.yml"))
|
9
|
+
puts config.inspect
|
10
|
+
app_name = config['app_name']
|
11
|
+
base_src_folder = config['base_src_folder']
|
12
|
+
base_package_folder = config['base_package_folder']
|
13
|
+
base_package = base_package_folder.gsub('/', '.').gsub(/\s/, '')
|
14
|
+
module_names = config['module_names'].split(' ')
|
15
|
+
rescue
|
16
|
+
#base_folder = base_package = project_name_downcase
|
17
|
+
#controller_name = "ApplicationController"
|
18
|
+
end
|
19
|
+
[app_name, base_src_folder, base_package_folder, base_package, module_names]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
|
4
|
+
class TestPureModuleGenerator < Test::Unit::TestCase
|
5
|
+
include RubiGen::GeneratorTestHelper
|
6
|
+
|
7
|
+
def setup
|
8
|
+
bare_setup
|
9
|
+
end
|
10
|
+
|
11
|
+
def teardown
|
12
|
+
bare_teardown
|
13
|
+
end
|
14
|
+
|
15
|
+
# Some generator-related assertions:
|
16
|
+
# assert_generated_file(name, &block) # block passed the file contents
|
17
|
+
# assert_directory_exists(name)
|
18
|
+
# assert_generated_class(name, &block)
|
19
|
+
# assert_generated_module(name, &block)
|
20
|
+
# assert_generated_test_for(name, &block)
|
21
|
+
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
22
|
+
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
23
|
+
#
|
24
|
+
# Other helper methods are:
|
25
|
+
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
26
|
+
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
27
|
+
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
28
|
+
|
29
|
+
def test_generator_without_options
|
30
|
+
name = "myapp"
|
31
|
+
run_generator('pure_module', [name], sources)
|
32
|
+
assert_directory_exists "some/directory"
|
33
|
+
assert_generated_file "some_file"
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def sources
|
38
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
39
|
+
]
|
40
|
+
end
|
41
|
+
|
42
|
+
def generator_path
|
43
|
+
"generators"
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fabricator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steffen Egelund Jensen
|
@@ -9,9 +9,29 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-05 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.0.2
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rubigen
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.5.2
|
34
|
+
version:
|
15
35
|
- !ruby/object:Gem::Dependency
|
16
36
|
name: newgem
|
17
37
|
type: :development
|
@@ -32,7 +52,7 @@ dependencies:
|
|
32
52
|
- !ruby/object:Gem::Version
|
33
53
|
version: 1.8.0
|
34
54
|
version:
|
35
|
-
description:
|
55
|
+
description: "This gem can generate a scaffold flex application based on PureMVC Multicore using the pipes utility abstracted by the fabrication framework. The initial application will be generated based on custom project name, title, src folder and package. Plus will include two modules: an authentication module and a dashboard module. It is intended that the gem in the future will be able to add new scaffold modules integrated with the application. New commands, proxies etc."
|
36
56
|
email:
|
37
57
|
- sej@lenio.dk
|
38
58
|
executables:
|
@@ -80,9 +100,10 @@ files:
|
|
80
100
|
- app_generators/pureapp/templates/modules/dashboard/view/nav_bar_mediator.as
|
81
101
|
- app_generators/pureapp/templates/modules/dashboard/view/todo_list_mediator.as
|
82
102
|
- app_generators/pureapp/templates/project.properties
|
83
|
-
- app_generators/pureapp/templates/
|
103
|
+
- app_generators/pureapp/templates/fabricator.yml
|
84
104
|
- app_generators/pureapp/templates/shell/controller/add_module_command.as
|
85
105
|
- app_generators/pureapp/templates/shell/controller/change_selected_module_command.as
|
106
|
+
- app_generators/pureapp/templates/shell/controller/load_all_modules_command.as
|
86
107
|
- app_generators/pureapp/templates/shell/controller/load_dashboard_module_command.as
|
87
108
|
- app_generators/pureapp/templates/shell/controller/remove_module_command.as
|
88
109
|
- app_generators/pureapp/templates/shell/controller/startup_command.as
|
@@ -98,12 +119,23 @@ files:
|
|
98
119
|
- app_generators/pureapp/USAGE
|
99
120
|
- bin/pureapp
|
100
121
|
- History.txt
|
101
|
-
- lib/fabricator
|
122
|
+
- lib/fabricator/configuration.rb
|
102
123
|
- lib/fabricator.rb
|
103
124
|
- Manifest.txt
|
104
125
|
- PostInstall.txt
|
105
126
|
- Rakefile
|
106
127
|
- README.rdoc
|
128
|
+
- generators/pure_module/pure_module_generator.rb
|
129
|
+
- generators/pure_module/templates/actionscript.properties
|
130
|
+
- generators/pure_module/templates/fabricator.yml
|
131
|
+
- generators/pure_module/templates/shell/controller/load_all_modules_command.as
|
132
|
+
- generators/pure_module/templates/module/controller/module_startup_command.as
|
133
|
+
- generators/pure_module/templates/module/model/proxy.as
|
134
|
+
- generators/pure_module/templates/module/view/components/view.mxml
|
135
|
+
- generators/pure_module/templates/module/view/module_mediator.as
|
136
|
+
- generators/pure_module/templates/module/view/view_mediator.as
|
137
|
+
- generators/pure_module/templates/module.mxml
|
138
|
+
- generators/pure_module/USAGE
|
107
139
|
- script/console
|
108
140
|
- script/destroy
|
109
141
|
- script/generate
|
@@ -112,7 +144,7 @@ files:
|
|
112
144
|
- test/test_helper.rb
|
113
145
|
- test/test_pureapp_generator.rb
|
114
146
|
has_rdoc: true
|
115
|
-
homepage:
|
147
|
+
homepage: "Developed by "
|
116
148
|
post_install_message: PostInstall.txt
|
117
149
|
rdoc_options:
|
118
150
|
- --main
|
@@ -137,9 +169,10 @@ rubyforge_project: pure-fab-gen
|
|
137
169
|
rubygems_version: 1.3.1
|
138
170
|
signing_key:
|
139
171
|
specification_version: 2
|
140
|
-
summary:
|
172
|
+
summary: This gem can generate a scaffold flex application based on PureMVC Multicore using the pipes utility abstracted by the fabrication framework
|
141
173
|
test_files:
|
142
174
|
- test/test_fabricator.rb
|
143
175
|
- test/test_generator_helper.rb
|
144
176
|
- test/test_helper.rb
|
177
|
+
- test/test_pure_module_generator.rb
|
145
178
|
- test/test_pureapp_generator.rb
|