fumoffu 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -7
- data/README.md +20 -46
- data/Rakefile +4 -2
- data/VERSION +1 -1
- data/bin/fumoffu +58 -13
- data/lib/fumoffu/controller.rb +1 -1
- data/lib/fumoffu/generators/fumoffu_config_generator.rb +38 -6
- data/lib/fumoffu/generators/fumoffu_generator.rb +6 -4
- data/lib/fumoffu/generators/fumoffu_lib_generator.rb +6 -4
- data/lib/fumoffu/generators/fumoffu_src_generator.rb +12 -8
- data/lib/fumoffu/generators/tasks/generator.rake +65 -0
- data/lib/fumoffu/generators/tasks/package.rake +7 -27
- data/lib/fumoffu/generators/templates/Rakefile +12 -7
- data/lib/fumoffu/generators/templates/build_configuration.rb +5 -6
- data/lib/fumoffu/generators/templates/{src/ruby → engine}/config/initializers/app_classes.rb +1 -1
- data/lib/fumoffu/generators/templates/{src/ruby/config → engine/config/initializers}/configuration.rb +1 -1
- data/lib/fumoffu/generators/templates/{src/ruby → engine}/config/initializers/init.rb +4 -0
- data/lib/fumoffu/generators/templates/{src/ruby → engine}/config/initializers/java_classes.rb +2 -0
- data/lib/fumoffu/generators/templates/{src/ruby → engine}/config/initializers/ruby_classes.rb +2 -0
- data/lib/fumoffu/generators/templates/{src/ruby/app → engine/src}/actions/controllers/application_controller.rb +0 -0
- data/lib/fumoffu/generators/templates/{src/ruby/app → engine/src}/actions/handlers/application_handler.rb +9 -3
- data/lib/fumoffu/generators/templates/{src/ruby/app → engine/src}/main.rb +3 -1
- data/lib/fumoffu/generators/templates/{src/ruby/app → engine/src}/setup.rb +13 -8
- data/lib/fumoffu/generators/templates/engine/test/spec/spec_helper.rb +4 -0
- data/lib/fumoffu/generators/templates/{lib/java → interface/lib}/AbsoluteLayout.jar +0 -0
- data/lib/fumoffu/generators/templates/{lib/java/swing-layout.jar → interface/lib/SwingLayout.jar} +0 -0
- data/lib/fumoffu/generators/templates/{src/java → interface/src}/org/github/bouba/fumoffu/ActionManager.java +2 -1
- data/lib/fumoffu/generators/templates/{src/java → interface/src}/org/github/bouba/fumoffu/UIActions.java +0 -0
- data/lib/fumoffu/generators/templates/{src/java → interface/src}/org/rubyforge/rawr/Main.java +0 -0
- data/lib/fumoffu/handler.rb +3 -1
- data/tasks/rawr_bundle.rake +2 -0
- data/test/coverage/index.html +11 -11
- data/test/coverage/lib-fumoffu-controller_rb.html +2 -2
- data/test/coverage/lib-fumoffu-generators-fumoffu_config_generator_rb.html +209 -17
- data/test/coverage/lib-fumoffu-generators-fumoffu_generator_rb.html +40 -28
- data/test/coverage/lib-fumoffu-generators-fumoffu_lib_generator_rb.html +33 -21
- data/test/coverage/lib-fumoffu-generators-fumoffu_src_generator_rb.html +41 -17
- data/test/coverage/lib-fumoffu-handler_rb.html +30 -18
- data/test/coverage/lib-fumoffu-java_mapping_rb.html +1 -1
- data/test/coverage/lib-fumoffu-utils-component_search_rb.html +1 -1
- data/test/coverage/lib-fumoffu_rb.html +1 -1
- data/test/fumoffu/fumoffu_test.rb +0 -4
- data/test/fumoffu/generators/fumoffu_config_generator_test.rb +15 -12
- data/test/fumoffu/generators/fumoffu_generator_test.rb +11 -29
- data/test/fumoffu/generators/fumoffu_lib_generator_test.rb +4 -6
- data/test/fumoffu/generators/fumoffu_src_generator_test.rb +10 -30
- data/test/fumoffu/helper/generator_test_helper.rb +10 -5
- metadata +19 -17
- data/lib/fumoffu/generators/templates/src/ruby/app/utils/component_search.rb +0 -22
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,9 +4,14 @@ Lionel Abderemane aka Bouba
|
|
4
4
|
|
5
5
|
http://github.com/bouba/fumoffu
|
6
6
|
|
7
|
-
|
7
|
+
The current version of fumoffu has changed quite a bit. It is still "fresh" but I believe that the structure
|
8
|
+
is much better and easier to understand. I still have not found a satisfactory way to run the tests.
|
8
9
|
|
9
|
-
|
10
|
+
But I think I manage to improve the way the application is packaged.
|
11
|
+
|
12
|
+
Fumoffu is now released as a gem. So you may find it on [Rubygem](https://rubygems.org/gems/fumoffu) website
|
13
|
+
|
14
|
+
So I hope you will be able to enjoy it.
|
10
15
|
|
11
16
|
## Description
|
12
17
|
|
@@ -25,15 +30,23 @@ You can see a tutorial of a sample application made with this framework [here](h
|
|
25
30
|
|
26
31
|
## Installation
|
27
32
|
|
28
|
-
|
33
|
+
### From gem
|
34
|
+
|
35
|
+
gem i fumoffu
|
36
|
+
|
37
|
+
### From sources
|
38
|
+
|
39
|
+
**Setup your [JRuby][jruby] environment**
|
40
|
+
|
41
|
+
First download and install [JRuby][jruby] if do not have it
|
29
42
|
|
30
|
-
_First download and install [JRuby][jruby] if do not have it_
|
31
43
|
__On a terminal__
|
44
|
+
|
32
45
|
To load your [JRuby][jruby] environment in a terminal just make a quick export
|
33
46
|
|
34
47
|
export PATH=/your/local/path/jruby-X.X.X/bin:$PATH
|
35
48
|
|
36
|
-
|
49
|
+
Download and setup the Fumoffu gem
|
37
50
|
|
38
51
|
_Since I still did put the gem on ruby forge to install it you to download and generate the gem manually to install it_
|
39
52
|
|
@@ -43,49 +56,10 @@ To load your [JRuby][jruby] environment in a terminal just make a quick export
|
|
43
56
|
bundle install
|
44
57
|
rake install
|
45
58
|
cd pkg
|
46
|
-
gem i fumoffu-0.0.
|
47
|
-
|
48
|
-
|
49
|
-
- **Setup your project files**
|
50
|
-
|
51
|
-
New project install the gem.
|
52
|
-
Then create a new project
|
53
|
-
|
54
|
-
mkdir MyApp
|
55
|
-
cd MyApp
|
56
|
-
fumoffu -i
|
57
|
-
|
58
|
-
Switch the boolean in the rake file to enable the rawr tasks then execute
|
59
|
-
|
60
|
-
rake rawr:get:current-stable-jruby
|
61
|
-
|
62
|
-
- **Setup your IDE**
|
63
|
-
|
64
|
-
Currently this step is still in my opinion it is still way too complicated to do.
|
65
|
-
(I personally use Netbeans.)
|
66
|
-
|
67
|
-
Here is the basic idea of how I setup my development environment.
|
68
|
-
I create 2 Projects:
|
69
|
-
|
70
|
-
* A Java Project
|
71
|
-
* A Ruby Project (where I switch the compiler to JRuby and add the root folder to the sources to be
|
72
|
-
able to access to my Rake tasks using my IDE)
|
73
|
-
|
74
|
-
_I think will make a video or something regarding the IDE setup, until I script the setup._
|
59
|
+
gem i fumoffu-0.1.0.gem --local
|
75
60
|
|
76
61
|
|
77
62
|
* * *
|
78
|
-
## Packaging
|
79
|
-
|
80
|
-
To package your application first you need to create a jar of all the bundled
|
81
|
-
|
82
|
-
|
83
|
-
bundle install lib/ruby
|
84
|
-
rake pkg:rawr:bundle_jar
|
85
|
-
rake rawr:jar
|
86
|
-
rake rawr:bundle:app
|
87
|
-
|
88
|
-
|
89
|
-
Then configure the rake file in config/tasks/package.rake
|
90
63
|
|
64
|
+
Tutorial to setup your project are available [here](http://github.com/bouba/fumoffu_example).
|
91
65
|
[jruby]: http://jruby.org/download "[JRuby][jruby]"
|
data/Rakefile
CHANGED
@@ -28,6 +28,8 @@ Jeweler::Tasks.new do |gem|
|
|
28
28
|
'lib/**/*.sh',
|
29
29
|
'lib/**/Gemfile',
|
30
30
|
'lib/**/Rakefile',
|
31
|
+
'lib/**/*.erb',
|
32
|
+
"tasks/*.rake",
|
31
33
|
'bin/*',
|
32
34
|
'[A-Z]*',
|
33
35
|
'test/**/*'].to_a
|
@@ -36,7 +38,6 @@ Jeweler::Tasks.new do |gem|
|
|
36
38
|
#gem.add_runtime_dependency 'log4r', '>= 1.1.9'
|
37
39
|
#gem.add_runtime_dependency 'rawr', '>= 1.4.5'
|
38
40
|
#gem.add_runtime_dependency 'bundler', '>= 1.0.10'
|
39
|
-
|
40
41
|
gem.add_development_dependency 'shoulda'
|
41
42
|
end
|
42
43
|
Jeweler::RubygemsDotOrgTasks.new
|
@@ -45,6 +46,7 @@ require 'rake/testtask'
|
|
45
46
|
Rake::TestTask.new(:test) do |test|
|
46
47
|
test.libs << 'lib' << 'test'
|
47
48
|
test.pattern = 'test/**/*_test.rb'
|
49
|
+
test.options = "--verbose"
|
48
50
|
test.verbose = true
|
49
51
|
end
|
50
52
|
|
@@ -68,4 +70,4 @@ Rake::RDocTask.new do |rdoc|
|
|
68
70
|
rdoc.title = "fumoffu #{version}"
|
69
71
|
rdoc.rdoc_files.include('README*')
|
70
72
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
71
|
-
end
|
73
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/bin/fumoffu
CHANGED
@@ -10,27 +10,33 @@ require 'optparse'
|
|
10
10
|
require 'rubygems'
|
11
11
|
require 'fumoffu'
|
12
12
|
require 'rake'
|
13
|
+
|
14
|
+
|
13
15
|
options = {}
|
16
|
+
bundle_format = [:jar, :exe, :app]
|
14
17
|
|
15
18
|
optparse = OptionParser.new do|opts|
|
16
19
|
# Set a banner, displayed at the top
|
17
20
|
# of the help screen.
|
18
21
|
opts.banner = "Usage: fumoffu [options] dir_name"
|
19
22
|
|
20
|
-
# Define the options, and what they do
|
21
|
-
options[:verbose] = false
|
22
|
-
opts.on( '-v', '--verbose', 'Output more information' ) do
|
23
|
-
options[:verbose] = true
|
24
|
-
end
|
25
23
|
|
26
24
|
options[:install] = false
|
27
|
-
|
25
|
+
options[:project_dir] = nil
|
26
|
+
opts.on( '-i', '--install [FILE]', 'Install the skeleton of the fumoffu App' ) do |dir|
|
28
27
|
options[:install] = true
|
28
|
+
options[:project_dir] = dir
|
29
29
|
end
|
30
30
|
|
31
|
-
options[:
|
32
|
-
opts.on(
|
33
|
-
|
31
|
+
options[:bundle] = nil
|
32
|
+
opts.on("-b", "--bundle [BUNDLE]", bundle_format,
|
33
|
+
"Bundle the application to the chosen format (jar, exe, app)") do |format|
|
34
|
+
options[:bundle] = format
|
35
|
+
end
|
36
|
+
|
37
|
+
options[:dependencies] = false
|
38
|
+
opts.on("-d", "--dependencies", "Download and install the dependencies") do
|
39
|
+
options[:dependencies] = true
|
34
40
|
end
|
35
41
|
|
36
42
|
# This displays the help screen, all programs are
|
@@ -43,18 +49,57 @@ end
|
|
43
49
|
|
44
50
|
optparse.parse!
|
45
51
|
|
46
|
-
|
47
|
-
|
48
|
-
|
52
|
+
def jruby_jar
|
53
|
+
# we check if the jruby jar is in the libs if not we download it
|
54
|
+
if not File.exist? Fumoffu::Application.app_dir+"/interface/lib/jruby-complete.jar" then
|
55
|
+
puts "You do not have JRuby Complete jar file in '#{Fumoffu::Application.app_dir}/interface/lib/jruby-complete.jar'. Please download the JRuby Complete version 1.5.6 at http://www.jruby.org/download"
|
56
|
+
# puts "We download the last stable version of jruby-complete jar..."
|
57
|
+
# sh "rake -f #{File.dirname(__FILE__)}/../tasks/rawr_bundle.rake rawr:get:current-stable-jruby"
|
58
|
+
# sh "mv #{Fumoffu::Application.app_dir}/lib/java/jruby-complete.jar #{Fumoffu::Application.app_dir}/interface/lib"
|
59
|
+
# sh "rmdir #{Fumoffu::Application.app_dir}/lib/java"
|
60
|
+
# sh "rmdir #{Fumoffu::Application.app_dir}/lib"
|
61
|
+
end
|
62
|
+
end
|
49
63
|
|
50
64
|
begin
|
51
65
|
if options[:install] then
|
66
|
+
project_dir = "."
|
67
|
+
if not options[:project_dir].nil? then
|
68
|
+
project_dir = options[:project_dir]
|
69
|
+
mkdir_p project_dir
|
70
|
+
Fumoffu::Application.app_dir = project_dir
|
71
|
+
end
|
72
|
+
|
52
73
|
app = Fumoffu::Application.new
|
53
74
|
Fumoffu::Generators::Application.generate
|
54
75
|
# we add the missing gems
|
55
76
|
puts "Installing default packages ..."
|
56
|
-
|
77
|
+
Dir.chdir project_dir do
|
78
|
+
sh "bundle install --path engine/lib/ruby"
|
79
|
+
end
|
80
|
+
exit
|
81
|
+
end
|
82
|
+
|
83
|
+
if not options[:bundle].nil?
|
84
|
+
if bundle_format.include? options[:bundle].to_sym then
|
85
|
+
task = nil
|
86
|
+
jruby_jar
|
87
|
+
if options[:bundle] == :jar
|
88
|
+
task = "rawr:jar"
|
89
|
+
else
|
90
|
+
task = "rawr:bundle:#{options[:bundle]}"
|
91
|
+
end
|
92
|
+
sh "rake -f #{File.dirname(__FILE__)}/../tasks/rawr_bundle.rake #{task}"
|
93
|
+
exit
|
94
|
+
end
|
57
95
|
end
|
96
|
+
|
97
|
+
if options[:dependencies] then
|
98
|
+
jruby_jar
|
99
|
+
exit
|
100
|
+
end
|
101
|
+
|
102
|
+
puts "Invalid command line."
|
58
103
|
end
|
59
104
|
#
|
60
105
|
# Sample to handle argument
|
data/lib/fumoffu/controller.rb
CHANGED
@@ -1,16 +1,48 @@
|
|
1
1
|
module Fumoffu
|
2
2
|
module Generators
|
3
3
|
class Configuration
|
4
|
+
# :call-seq:
|
5
|
+
# generate()
|
6
|
+
#
|
7
|
+
# Use this to generate the application configuration skeleton
|
8
|
+
#
|
9
|
+
# Fumoffu::Generators::Configuration.generate
|
10
|
+
#
|
11
|
+
# Generate default configuration files for the engine component of the application
|
12
|
+
# which by default contains 2 parts the file used for the initialization of the application
|
13
|
+
# and also the tasks related the application engine.
|
14
|
+
#
|
4
15
|
def self.generate
|
5
16
|
source_dir = File.dirname(__FILE__)
|
6
|
-
#
|
7
|
-
mkdir_p "#{Fumoffu::Application.app_dir}/config
|
17
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine", :verbose => false
|
18
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine/config", :verbose => false
|
19
|
+
|
20
|
+
self.generate_engine
|
21
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine/config/tasks", :verbose => false
|
8
22
|
|
9
23
|
# We include the default files
|
10
|
-
cp "#{source_dir}/tasks/package.rake",
|
11
|
-
cp "#{source_dir}/
|
12
|
-
cp "#{source_dir}/templates/
|
13
|
-
cp "#{source_dir}/templates/
|
24
|
+
cp "#{source_dir}/tasks/package.rake", "#{Fumoffu::Application.app_dir}/engine/config/tasks", :verbose => false
|
25
|
+
cp "#{source_dir}/tasks/generator.rake", "#{Fumoffu::Application.app_dir}/engine/config/tasks", :verbose => false
|
26
|
+
cp "#{source_dir}/templates/build_configuration.rb", "#{Fumoffu::Application.app_dir}/", :verbose => false
|
27
|
+
cp "#{source_dir}/templates/Gemfile", "#{Fumoffu::Application.app_dir}/", :verbose => false
|
28
|
+
cp "#{source_dir}/templates/Rakefile", "#{Fumoffu::Application.app_dir}/", :verbose => false
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
def self.generate_engine
|
35
|
+
source_dir = File.dirname(__FILE__)+"/templates"
|
36
|
+
# We generate the containers
|
37
|
+
init_dir = "#{Fumoffu::Application.app_dir}/engine/config/initializers"
|
38
|
+
mkdir_p init_dir, :verbose => false
|
39
|
+
|
40
|
+
# We copy the required files
|
41
|
+
cp "#{source_dir}/engine/config/initializers/app_classes.rb", init_dir, :verbose => false
|
42
|
+
cp "#{source_dir}/engine/config/initializers/configuration.rb", init_dir, :verbose => false
|
43
|
+
cp "#{source_dir}/engine/config/initializers/init.rb", init_dir, :verbose => false
|
44
|
+
cp "#{source_dir}/engine/config/initializers/java_classes.rb", init_dir, :verbose => false
|
45
|
+
cp "#{source_dir}/engine/config/initializers/ruby_classes.rb", init_dir, :verbose => false
|
14
46
|
end
|
15
47
|
end
|
16
48
|
end
|
@@ -3,6 +3,7 @@ Dir[File.dirname(__FILE__).concat("/*.rb")].each {|file| require file }
|
|
3
3
|
module Fumoffu
|
4
4
|
module Generators
|
5
5
|
class Application
|
6
|
+
|
6
7
|
def self.generate
|
7
8
|
# we generate the configuration
|
8
9
|
Configuration.generate
|
@@ -14,11 +15,12 @@ module Fumoffu
|
|
14
15
|
# We generate the sources from where it is executed
|
15
16
|
@dir_structure = [
|
16
17
|
"dist",
|
17
|
-
"log",
|
18
|
-
"resources
|
18
|
+
"engine/log",
|
19
|
+
"engine/resources",
|
20
|
+
"interface/resources/medias",
|
19
21
|
"scripts",
|
20
|
-
"test
|
21
|
-
"test/
|
22
|
+
"interface/test",
|
23
|
+
"engine/test/spec"
|
22
24
|
]
|
23
25
|
|
24
26
|
@dir_structure.each do |dir|
|
@@ -2,20 +2,22 @@ module Fumoffu
|
|
2
2
|
module Generators
|
3
3
|
class Lib
|
4
4
|
def self.generate
|
5
|
-
@@source_dir = File.dirname(__FILE__)
|
6
5
|
generate_dirs
|
7
6
|
copy_libraries
|
8
7
|
end
|
9
8
|
|
10
9
|
def self.generate_dirs
|
11
10
|
# We generate the containers
|
12
|
-
mkdir_p "#{Fumoffu::Application.app_dir}/lib/java/generated", :verbose => false
|
13
|
-
mkdir_p "#{Fumoffu::Application.app_dir}/lib/ruby", :verbose => false
|
11
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine/lib/java/generated", :verbose => false
|
12
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine/lib/ruby", :verbose => false
|
13
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/interface/lib", :verbose => false
|
14
14
|
end
|
15
15
|
|
16
16
|
|
17
17
|
def self.copy_libraries
|
18
|
-
|
18
|
+
source_dir = File.dirname(__FILE__)+"/templates"
|
19
|
+
cp "#{source_dir}/interface/lib/AbsoluteLayout.jar", "#{Fumoffu::Application.app_dir}/interface/lib", :verbose => false
|
20
|
+
cp "#{source_dir}/interface/lib/SwingLayout.jar", "#{Fumoffu::Application.app_dir}/interface/lib", :verbose => false
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -3,20 +3,24 @@ module Fumoffu
|
|
3
3
|
class Source
|
4
4
|
def self.generate
|
5
5
|
@@source_dir = File.dirname(__FILE__)
|
6
|
-
copy_sources
|
7
6
|
generate_dirs
|
7
|
+
copy_sources
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def self.generate_dirs
|
11
11
|
# We generate the containers
|
12
|
-
mkdir_p "#{Fumoffu::Application.app_dir}/src
|
13
|
-
mkdir_p "#{Fumoffu::Application.app_dir}/src
|
14
|
-
mkdir_p "#{Fumoffu::Application.app_dir}/
|
12
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/interface/src", :verbose => false
|
13
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine/src", :verbose => false
|
14
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine/test", :verbose => false
|
15
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine/src/commons", :verbose => false
|
16
|
+
mkdir_p "#{Fumoffu::Application.app_dir}/engine/src/models", :verbose => false
|
15
17
|
end
|
16
|
-
|
17
|
-
|
18
|
+
|
19
|
+
|
18
20
|
def self.copy_sources
|
19
|
-
cp_r "#{@@source_dir}/templates/src
|
21
|
+
cp_r "#{@@source_dir}/templates/engine/src/.", "#{Fumoffu::Application.app_dir}/engine/src", :verbose => false
|
22
|
+
cp_r "#{@@source_dir}/templates/interface/src/.", "#{Fumoffu::Application.app_dir}/interface/src", :verbose => false
|
23
|
+
cp_r "#{@@source_dir}/templates/engine/test/.", "#{Fumoffu::Application.app_dir}/engine/test", :verbose => false
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'fumoffu'
|
2
|
+
# We assume the the name is written in ruby fashion
|
3
|
+
def update_name name, ref_name
|
4
|
+
split_name = name.split "_"
|
5
|
+
# check the controller name
|
6
|
+
if split_name.last != ref_name.downcase then
|
7
|
+
# if it has no controller at the end of the name add it
|
8
|
+
split_name << ref_name.downcase
|
9
|
+
end
|
10
|
+
|
11
|
+
# update the name to class name standard
|
12
|
+
split_name.join("_")
|
13
|
+
end
|
14
|
+
|
15
|
+
def generate_name type_class, param
|
16
|
+
new_name = param
|
17
|
+
raise "Failed to generate a #{type_class}: a #{type_class} name is mandatory." unless not new_name.nil?
|
18
|
+
update_name new_name, type_class.capitalize
|
19
|
+
end
|
20
|
+
|
21
|
+
def generate_file name,dir,content
|
22
|
+
# create the file
|
23
|
+
new_controller_file = File.new("#{dir}/#{name}.rb", "w")
|
24
|
+
# add the content
|
25
|
+
new_controller_file.write(content)
|
26
|
+
# close the file
|
27
|
+
new_controller_file.close
|
28
|
+
end
|
29
|
+
|
30
|
+
namespace :fumoffu do
|
31
|
+
namespace :generate do
|
32
|
+
desc "Generate controller."
|
33
|
+
task :controller, :controller_name do |c,args|
|
34
|
+
name = generate_name "controller",args[:controller_name]
|
35
|
+
|
36
|
+
file_content = "class #{name.split("_").collect{|n|n.capitalize!}.join} < ApplicationController\nend"
|
37
|
+
|
38
|
+
generate_file name, "#{Fumoffu::Application.app_dir}/engine/src/actions/controllers", file_content
|
39
|
+
puts "The new controller #{name} has been generated."
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Generate handler"
|
43
|
+
task :handler, :handler_name do |h,args|
|
44
|
+
name = generate_name "handler",args[:handler_name]
|
45
|
+
|
46
|
+
file_content = "class #{name.split("_").collect{|n|n.capitalize!}.join} < Fumoffu::Handler\n"
|
47
|
+
file_content<< " def initialize\n"
|
48
|
+
file_content<< " super\n"
|
49
|
+
file_content<< " @controller = SampleActionController.new\n"
|
50
|
+
file_content<< " end\n\n\n"
|
51
|
+
file_content<< " def handleAction evt, action, caller\n"
|
52
|
+
file_content<< " # sample of use\n"
|
53
|
+
file_content<< " # if action == UIActions::SAMPLE_ACTION then\n"
|
54
|
+
file_content<< " # component = component_by_name evt.getSource, \"mainPanel\"\n"
|
55
|
+
file_content<< " # label = component_child_by_name component, \"myLabel\"\n"
|
56
|
+
file_content<< " # end\"\n"
|
57
|
+
file_content<< " return false\n"
|
58
|
+
file_content<< " end\n"
|
59
|
+
file_content<< "end\n"
|
60
|
+
|
61
|
+
generate_file name, "#{Fumoffu::Application.app_dir}/engine/src/actions/handlers", file_content
|
62
|
+
puts "The new handler #{name} has been generated."
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|