ruboss4ruby 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +30 -6
- data/config/hoe.rb +1 -1
- data/lib/ruboss4ruby/configuration.rb +24 -0
- data/lib/ruboss4ruby/generated_attribute.rb +61 -0
- data/lib/ruboss4ruby/tasks.rb +3 -3
- data/lib/ruboss4ruby/version.rb +2 -2
- data/lib/ruboss4ruby.rb +7 -0
- data/merb_generators/ruboss_config/templates/index.html.erb +1 -2
- data/merb_generators/ruboss_config.rb +105 -0
- data/merb_generators/ruboss_controller.rb +61 -0
- data/merb_generators/ruboss_flex_app.rb +69 -0
- data/merb_generators/ruboss_resource_controller.rb +4 -0
- data/merb_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +0 -62
- data/merb_generators/ruboss_scaffold.rb +158 -0
- data/merb_generators/templates/ruboss_config/actionscript.properties +16 -0
- data/merb_generators/templates/ruboss_config/actionscriptair.properties +16 -0
- data/merb_generators/templates/ruboss_config/expressInstall.swf +0 -0
- data/merb_generators/templates/ruboss_config/flex.properties +2 -0
- data/merb_generators/templates/ruboss_config/html-template/AC_OETags.js +276 -0
- data/merb_generators/templates/ruboss_config/html-template/history/history.css +6 -0
- data/merb_generators/templates/ruboss_config/html-template/history/history.js +645 -0
- data/merb_generators/templates/ruboss_config/html-template/history/historyFrame.html +29 -0
- data/merb_generators/templates/ruboss_config/html-template/index.template.html +121 -0
- data/merb_generators/templates/ruboss_config/html-template/playerProductInstall.swf +0 -0
- data/merb_generators/templates/ruboss_config/index.html.erb +18 -0
- data/merb_generators/templates/ruboss_config/mainair-app.xml +134 -0
- data/merb_generators/templates/ruboss_config/project.properties +18 -0
- data/merb_generators/templates/ruboss_config/projectair.properties +24 -0
- data/merb_generators/templates/ruboss_config/ruboss.yml +16 -0
- data/merb_generators/templates/ruboss_config/swfobject.js +5 -0
- data/merb_generators/{ruboss_controller/templates → templates/ruboss_controller}/controller.as.erb +0 -0
- data/merb_generators/templates/ruboss_flex_app/mainapp.mxml +34 -0
- data/merb_generators/templates/ruboss_resource_controller/controller.rb.erb +49 -0
- data/merb_generators/{ruboss_scaffold/templates → templates/ruboss_scaffold}/component.mxml.erb +0 -0
- data/merb_generators/{ruboss_scaffold/templates → templates/ruboss_scaffold}/fixtures.yml.erb +0 -0
- data/merb_generators/{ruboss_scaffold/templates → templates/ruboss_scaffold}/migration.rb.erb +0 -0
- data/merb_generators/{ruboss_scaffold/templates → templates/ruboss_scaffold}/model.as.erb +0 -0
- data/merb_generators/{ruboss_scaffold/templates → templates/ruboss_scaffold}/model.rb.erb +0 -0
- data/rails_generators/ruboss_config/templates/index.html.erb +1 -2
- data/website/index.html +1 -1
- metadata +32 -8
data/Manifest.txt
CHANGED
@@ -9,8 +9,10 @@ lib/ruboss4ruby.rb
|
|
9
9
|
lib/ruboss4ruby/active_foo.rb
|
10
10
|
lib/ruboss4ruby/active_record_tasks.rb
|
11
11
|
lib/ruboss4ruby/configuration.rb
|
12
|
+
lib/ruboss4ruby/generated_attribute.rb
|
12
13
|
lib/ruboss4ruby/tasks.rb
|
13
14
|
lib/ruboss4ruby/version.rb
|
15
|
+
merb_generators/ruboss_config.rb
|
14
16
|
merb_generators/ruboss_config/USAGE
|
15
17
|
merb_generators/ruboss_config/ruboss_config_generator.rb
|
16
18
|
merb_generators/ruboss_config/templates/actionscript.properties
|
@@ -29,22 +31,44 @@ merb_generators/ruboss_config/templates/mainapp.mxml
|
|
29
31
|
merb_generators/ruboss_config/templates/project.properties
|
30
32
|
merb_generators/ruboss_config/templates/projectair.properties
|
31
33
|
merb_generators/ruboss_config/templates/swfobject.js
|
34
|
+
merb_generators/ruboss_controller.rb
|
32
35
|
merb_generators/ruboss_controller/USAGE
|
33
36
|
merb_generators/ruboss_controller/ruboss_controller_generator.rb
|
34
|
-
merb_generators/
|
37
|
+
merb_generators/ruboss_flex_app.rb
|
38
|
+
merb_generators/ruboss_resource_controller.rb
|
35
39
|
merb_generators/ruboss_resource_controller/USAGE
|
36
40
|
merb_generators/ruboss_resource_controller/ruboss_resource_controller_generator.rb
|
37
41
|
merb_generators/ruboss_resource_controller/templates/app/controllers/%controller_file_name%.rb
|
38
42
|
merb_generators/ruboss_resource_controller/templates/app/helpers/%controller_file_name%_helper.rb
|
43
|
+
merb_generators/ruboss_scaffold.rb
|
39
44
|
merb_generators/ruboss_scaffold/USAGE
|
40
45
|
merb_generators/ruboss_scaffold/ruboss_scaffold_generator.rb
|
41
|
-
merb_generators/ruboss_scaffold/templates/component.mxml.erb
|
42
|
-
merb_generators/ruboss_scaffold/templates/fixtures.yml.erb
|
43
|
-
merb_generators/ruboss_scaffold/templates/migration.rb.erb
|
44
|
-
merb_generators/ruboss_scaffold/templates/model.as.erb
|
45
|
-
merb_generators/ruboss_scaffold/templates/model.rb.erb
|
46
46
|
merb_generators/ruboss_yaml_scaffold/USAGE
|
47
47
|
merb_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb
|
48
|
+
merb_generators/templates/ruboss_config/actionscript.properties
|
49
|
+
merb_generators/templates/ruboss_config/actionscriptair.properties
|
50
|
+
merb_generators/templates/ruboss_config/expressInstall.swf
|
51
|
+
merb_generators/templates/ruboss_config/flex.properties
|
52
|
+
merb_generators/templates/ruboss_config/html-template/AC_OETags.js
|
53
|
+
merb_generators/templates/ruboss_config/html-template/history/history.css
|
54
|
+
merb_generators/templates/ruboss_config/html-template/history/history.js
|
55
|
+
merb_generators/templates/ruboss_config/html-template/history/historyFrame.html
|
56
|
+
merb_generators/templates/ruboss_config/html-template/index.template.html
|
57
|
+
merb_generators/templates/ruboss_config/html-template/playerProductInstall.swf
|
58
|
+
merb_generators/templates/ruboss_config/index.html.erb
|
59
|
+
merb_generators/templates/ruboss_config/mainair-app.xml
|
60
|
+
merb_generators/templates/ruboss_config/project.properties
|
61
|
+
merb_generators/templates/ruboss_config/projectair.properties
|
62
|
+
merb_generators/templates/ruboss_config/ruboss.yml
|
63
|
+
merb_generators/templates/ruboss_config/swfobject.js
|
64
|
+
merb_generators/templates/ruboss_controller/controller.as.erb
|
65
|
+
merb_generators/templates/ruboss_flex_app/mainapp.mxml
|
66
|
+
merb_generators/templates/ruboss_resource_controller/controller.rb.erb
|
67
|
+
merb_generators/templates/ruboss_scaffold/component.mxml.erb
|
68
|
+
merb_generators/templates/ruboss_scaffold/fixtures.yml.erb
|
69
|
+
merb_generators/templates/ruboss_scaffold/migration.rb.erb
|
70
|
+
merb_generators/templates/ruboss_scaffold/model.as.erb
|
71
|
+
merb_generators/templates/ruboss_scaffold/model.rb.erb
|
48
72
|
rails_generators/ruboss_config/USAGE
|
49
73
|
rails_generators/ruboss_config/ruboss_config_generator.rb
|
50
74
|
rails_generators/ruboss_config/templates/actionscript.properties
|
data/config/hoe.rb
CHANGED
@@ -8,7 +8,7 @@ RUBYFORGE_PROJECT = 'ruboss4ruby' # The unix name for your project
|
|
8
8
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
9
|
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
10
|
EXTRA_DEPENDENCIES = [
|
11
|
-
['activerecord', '>= 2.0.0']
|
11
|
+
# ['activerecord', '>= 2.0.0']
|
12
12
|
] # An array of rubygem dependencies [name, version]
|
13
13
|
|
14
14
|
@config_file = "~/.rubyforge/user-config.yml"
|
@@ -2,9 +2,33 @@ class String
|
|
2
2
|
def capitalize_without_downcasing
|
3
3
|
self[0,1].capitalize + self[1..-1]
|
4
4
|
end
|
5
|
+
|
5
6
|
def downcase_first_letter
|
6
7
|
self[0,1].downcase + self[1..-1]
|
7
8
|
end
|
9
|
+
|
10
|
+
def camelcase(first_letter = :upper)
|
11
|
+
case first_letter
|
12
|
+
when :upper then self.camelize(true)
|
13
|
+
when :lower then self.camelize(false)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def camelize(first_letter_in_uppercase = true)
|
18
|
+
if first_letter_in_uppercase
|
19
|
+
self.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
20
|
+
else
|
21
|
+
self[0,1].downcase + self.camelize[1..-1]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def underscore
|
26
|
+
self.gsub(/::/, '/').
|
27
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
28
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
29
|
+
tr("-", "_").
|
30
|
+
downcase
|
31
|
+
end
|
8
32
|
end
|
9
33
|
|
10
34
|
module Ruboss
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Ruboss
|
2
|
+
module Generator
|
3
|
+
class GeneratedAttribute
|
4
|
+
attr_accessor :name, :type, :flex_name
|
5
|
+
|
6
|
+
def initialize(name, type)
|
7
|
+
@name, @type = name, type.to_sym
|
8
|
+
@flex_name = name.camelcase(:lower)
|
9
|
+
end
|
10
|
+
|
11
|
+
def field_type
|
12
|
+
@field_type ||= case type
|
13
|
+
when :integer, :float, :decimal then :text_field
|
14
|
+
when :datetime, :timestamp, :time then :datetime_select
|
15
|
+
when :date then :date_select
|
16
|
+
when :string then :text_field
|
17
|
+
when :text then :text_area
|
18
|
+
when :boolean then :check_box
|
19
|
+
else
|
20
|
+
:text_field
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def default(prefix = '')
|
25
|
+
@default = case type
|
26
|
+
when :integer then 1
|
27
|
+
when :float then 1.5
|
28
|
+
when :decimal then "9.99"
|
29
|
+
when :datetime, :timestamp, :time then Time.now.to_s(:db)
|
30
|
+
when :date then Date.today.to_s(:db)
|
31
|
+
when :string then prefix + name.camelize + "String"
|
32
|
+
when :text then prefix + name.camelize + "Text"
|
33
|
+
when :boolean then false
|
34
|
+
else
|
35
|
+
""
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def flex_type
|
40
|
+
@flex_type = case type
|
41
|
+
when :integer then 'int'
|
42
|
+
when :date, :datetime, :time then 'Date'
|
43
|
+
when :boolean then 'Boolean'
|
44
|
+
when :float, :decimal then 'Number'
|
45
|
+
else
|
46
|
+
'String'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def flex_default(prefix = '')
|
51
|
+
@flex_default = case type
|
52
|
+
when :integer, :float, :decimal then '0'
|
53
|
+
when :string, :text then '""'
|
54
|
+
when :boolean then 'false'
|
55
|
+
else
|
56
|
+
'null'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/ruboss4ruby/tasks.rb
CHANGED
@@ -7,7 +7,7 @@ require 'ruboss4ruby/configuration'
|
|
7
7
|
APP_ROOT = Ruboss::Configuration::APP_ROOT
|
8
8
|
|
9
9
|
namespace :ruboss do
|
10
|
-
def compile_app(executable, destination)
|
10
|
+
def compile_app(executable, destination, opts = '')
|
11
11
|
app_properties = REXML::Document.new(File.open(File.join(APP_ROOT, ".actionScriptProperties")))
|
12
12
|
app_properties.elements.each("*/applications/application") do |elm|
|
13
13
|
app_path = elm.attributes['path']
|
@@ -17,7 +17,7 @@ namespace :ruboss do
|
|
17
17
|
|
18
18
|
libs = Dir.glob(File.join(APP_ROOT, 'lib', '*.swc'))
|
19
19
|
|
20
|
-
cmd = "#{executable} -library-path+=#{libs.join(',')} " <<
|
20
|
+
cmd = "#{executable} #{opts} -library-path+=#{libs.join(',')} " <<
|
21
21
|
"-keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored #{project_path}"
|
22
22
|
puts "Compiling #{project_path}"
|
23
23
|
if system(cmd)
|
@@ -66,7 +66,7 @@ namespace :ruboss do
|
|
66
66
|
namespace :air do
|
67
67
|
desc "Build project swf file as an AIR application and move it into bin-debug folder"
|
68
68
|
task :build do
|
69
|
-
compile_app(get_executable('
|
69
|
+
compile_app(get_executable('mxmlc'), 'bin-debug', '+configname=air')
|
70
70
|
end
|
71
71
|
|
72
72
|
desc "Run the AIR application (if this project is configured as an AIR project)"
|
data/lib/ruboss4ruby/version.rb
CHANGED
data/lib/ruboss4ruby.rb
CHANGED
@@ -4,6 +4,13 @@ if defined?(Merb::Plugins)
|
|
4
4
|
Merb::BootLoader.before_app_loads do
|
5
5
|
Merb.add_mime_type(:fxml, :to_fxml, %w[application/xml text/xml application/x-xml], :charset => "utf-8")
|
6
6
|
|
7
|
+
generators = File.join(File.dirname(__FILE__), '..', 'merb_generators')
|
8
|
+
Merb.add_generators generators / :ruboss_config
|
9
|
+
Merb.add_generators generators / :ruboss_flex_app
|
10
|
+
Merb.add_generators generators / :ruboss_controller
|
11
|
+
Merb.add_generators generators / :ruboss_scaffold
|
12
|
+
Merb.add_generators generators / :ruboss_resource_controller
|
13
|
+
|
7
14
|
require 'ruboss4ruby/version'
|
8
15
|
require 'ruboss4ruby/configuration'
|
9
16
|
require 'ruboss4ruby/active_foo' if defined?(ActiveRecord::Base)
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
1
|
+
<html>
|
3
2
|
<head>
|
4
3
|
<title><%= project_name %></title>
|
5
4
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'ruboss4ruby/version'
|
4
|
+
require 'ruboss4ruby/configuration'
|
5
|
+
|
6
|
+
module Merb::Generators
|
7
|
+
class RubossConfigGenerator < Generator
|
8
|
+
include Ruboss::Configuration
|
9
|
+
|
10
|
+
option :air, :as => :boolean, :default => false, :desc => 'Configure AIR project instead of Flex. Flex is default.'
|
11
|
+
option :skip_framework, :as => :boolean, :default => false, :desc => "Don't fetch the latest framework binary. You'll have to link/build the framework yourself."
|
12
|
+
|
13
|
+
def initialize(*args)
|
14
|
+
super
|
15
|
+
@project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names
|
16
|
+
|
17
|
+
framework_release = Ruboss::RUBOSS_FRAMEWORK_VERSION
|
18
|
+
framework_distribution_url = "http://ruboss.com/releases/ruboss-#{framework_release}.swc"
|
19
|
+
framework_destination_file = "lib/ruboss-#{framework_release}.swc"
|
20
|
+
|
21
|
+
if !get_option(:skip_framework) && !File.exist?(framework_destination_file)
|
22
|
+
FileUtils.mkdir('lib') unless File.directory?('lib')
|
23
|
+
puts "fetching #{framework_release} framework binary from: #{framework_distribution_url} ..."
|
24
|
+
open(framework_destination_file, "wb").write(open(framework_distribution_url).read)
|
25
|
+
puts "done. saved to #{framework_destination_file}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def extract_config(config_file)
|
30
|
+
if get_option(:air)
|
31
|
+
config_file << 'air'
|
32
|
+
end
|
33
|
+
config_file
|
34
|
+
end
|
35
|
+
|
36
|
+
def project_name
|
37
|
+
@project_name
|
38
|
+
end
|
39
|
+
|
40
|
+
def flex_project_name
|
41
|
+
@flex_project_name
|
42
|
+
end
|
43
|
+
|
44
|
+
def base_folder
|
45
|
+
@base_folder
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.source_root
|
49
|
+
File.join(File.dirname(__FILE__), 'templates', 'ruboss_config')
|
50
|
+
end
|
51
|
+
|
52
|
+
desc <<-DESC
|
53
|
+
Generates the primary Ruboss directory structure.
|
54
|
+
Sets up Flex Builder specific descriptor files and options fetches
|
55
|
+
the latest published Ruboss Framework SWC file.
|
56
|
+
DESC
|
57
|
+
|
58
|
+
empty_directory :bin, File.join('public', 'bin')
|
59
|
+
empty_directory :javascripts, File.join('public', 'javascripts')
|
60
|
+
empty_directory :schema, 'schema'
|
61
|
+
|
62
|
+
file :flex_properties, 'flex.properties', '.flexProperties'
|
63
|
+
|
64
|
+
template :actionscript_properties do
|
65
|
+
source("#{extract_config('actionscript')}.properties")
|
66
|
+
destination('.actionScriptProperties')
|
67
|
+
end
|
68
|
+
|
69
|
+
template :project_properties do
|
70
|
+
source("#{extract_config('project')}.properties")
|
71
|
+
destination('.project')
|
72
|
+
end
|
73
|
+
|
74
|
+
%w(components controllers commands models events).each do |dir|
|
75
|
+
empty_directory dir.to_sym do
|
76
|
+
destination(File.join('app', 'flex', base_folder, dir))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
empty_directory :generated do
|
81
|
+
File.join('app', 'flex', base_folder, 'components', 'generated')
|
82
|
+
end
|
83
|
+
|
84
|
+
glob!('html-template')
|
85
|
+
|
86
|
+
file :swfoject, 'swfobject.js', File.join('public', 'javascripts', 'swfobject.js')
|
87
|
+
|
88
|
+
file :express_install, 'expressInstall.swf', File.join('public', 'expressInstall.swf')
|
89
|
+
|
90
|
+
file :ruboss_yml, 'ruboss.yml', File.join('config', 'ruboss.yml')
|
91
|
+
|
92
|
+
template :index, 'index.html.erb', File.join('app', 'views', 'layout', 'application.html.erb')
|
93
|
+
|
94
|
+
invoke :ruboss_flex_app
|
95
|
+
|
96
|
+
template :air_descriptor, :air => true do
|
97
|
+
source('mainair-app.xml')
|
98
|
+
destination(File.join('app', 'flex', "#{project_name}-app.xml"))
|
99
|
+
end
|
100
|
+
|
101
|
+
invoke :ruboss_controller
|
102
|
+
end
|
103
|
+
|
104
|
+
add :ruboss_config, RubossConfigGenerator
|
105
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'ruboss4ruby/configuration'
|
2
|
+
|
3
|
+
module Merb::Generators
|
4
|
+
class RubossControllerGenerator < Generator
|
5
|
+
include Ruboss::Configuration
|
6
|
+
|
7
|
+
def initialize(*args)
|
8
|
+
super
|
9
|
+
@project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names
|
10
|
+
end
|
11
|
+
|
12
|
+
def project_name
|
13
|
+
@project_name
|
14
|
+
end
|
15
|
+
|
16
|
+
def flex_project_name
|
17
|
+
@flex_project_name
|
18
|
+
end
|
19
|
+
|
20
|
+
def base_folder
|
21
|
+
@base_folder
|
22
|
+
end
|
23
|
+
|
24
|
+
def base_package
|
25
|
+
@base_package
|
26
|
+
end
|
27
|
+
|
28
|
+
def command_controller_name
|
29
|
+
@command_controller_name
|
30
|
+
end
|
31
|
+
|
32
|
+
def model_names
|
33
|
+
list_as_files("app/flex/#{base_folder}/models")
|
34
|
+
end
|
35
|
+
|
36
|
+
def command_names
|
37
|
+
list_as_files("app/flex/#{base_folder}/commands")
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.source_root
|
41
|
+
File.join(File.dirname(__FILE__), 'templates', 'ruboss_controller')
|
42
|
+
end
|
43
|
+
|
44
|
+
template :controller do
|
45
|
+
source('controller.as.erb')
|
46
|
+
destination(File.join('app', 'flex', base_folder, 'controllers', "#{command_controller_name}.as"))
|
47
|
+
end
|
48
|
+
|
49
|
+
desc <<-DESC
|
50
|
+
Generates the main Ruboss Flex application controller.
|
51
|
+
Typically app/flex/<yourappname>/controllers/<YourAppName>Controller.as,
|
52
|
+
e.g. app/flex/pomodo/controllers/PomodoController.as
|
53
|
+
|
54
|
+
It pulls out all available models and commands from respective
|
55
|
+
folders and makes sure they'll be pulled into the Flex application
|
56
|
+
at runtime.
|
57
|
+
DESC
|
58
|
+
end
|
59
|
+
|
60
|
+
add :ruboss_controller, RubossControllerGenerator
|
61
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'ruboss4ruby/version'
|
4
|
+
require 'ruboss4ruby/configuration'
|
5
|
+
|
6
|
+
module Merb::Generators
|
7
|
+
class RubossFlexAppGenerator < Generator
|
8
|
+
include Ruboss::Configuration
|
9
|
+
|
10
|
+
option :air, :as => :boolean, :default => false, :desc => 'Configure AIR project instead of Flex. Flex is default.'
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
@project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names
|
15
|
+
|
16
|
+
@component_names = []
|
17
|
+
if File.exists?("app/flex/#{base_folder}/components/generated")
|
18
|
+
@component_names = list_mxml_files("app/flex/#{base_folder}/components/generated")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def project_name
|
23
|
+
@project_name
|
24
|
+
end
|
25
|
+
|
26
|
+
def flex_project_name
|
27
|
+
@flex_project_name
|
28
|
+
end
|
29
|
+
|
30
|
+
def base_folder
|
31
|
+
@base_folder
|
32
|
+
end
|
33
|
+
|
34
|
+
def base_package
|
35
|
+
@base_package
|
36
|
+
end
|
37
|
+
|
38
|
+
def command_controller_name
|
39
|
+
@command_controller_name
|
40
|
+
end
|
41
|
+
|
42
|
+
def component_names
|
43
|
+
@component_names
|
44
|
+
end
|
45
|
+
|
46
|
+
def application_tag
|
47
|
+
if get_option(:air)
|
48
|
+
'WindowedApplication'
|
49
|
+
else
|
50
|
+
'Application'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.source_root
|
55
|
+
File.join(File.dirname(__FILE__), 'templates', 'ruboss_flex_app')
|
56
|
+
end
|
57
|
+
|
58
|
+
desc <<-DESC
|
59
|
+
Generates main flex application file.
|
60
|
+
DESC
|
61
|
+
|
62
|
+
template :main_app do
|
63
|
+
source('mainapp.mxml')
|
64
|
+
destination(File.join('app', 'flex', "#{project_name}.mxml"))
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
add :ruboss_flex_app, RubossFlexAppGenerator
|
69
|
+
end
|
@@ -1,67 +1,5 @@
|
|
1
1
|
require 'ruboss4ruby/configuration'
|
2
2
|
|
3
|
-
module Ruboss
|
4
|
-
module Generator
|
5
|
-
class GeneratedAttribute
|
6
|
-
attr_accessor :name, :type, :flex_name
|
7
|
-
|
8
|
-
def initialize(name, type)
|
9
|
-
@name, @type = name, type.to_sym
|
10
|
-
@flex_name = name.camelcase(:lower)
|
11
|
-
end
|
12
|
-
|
13
|
-
def field_type
|
14
|
-
@field_type ||= case type
|
15
|
-
when :integer, :float, :decimal then :text_field
|
16
|
-
when :datetime, :timestamp, :time then :datetime_select
|
17
|
-
when :date then :date_select
|
18
|
-
when :string then :text_field
|
19
|
-
when :text then :text_area
|
20
|
-
when :boolean then :check_box
|
21
|
-
else
|
22
|
-
:text_field
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def default(prefix = '')
|
27
|
-
@default = case type
|
28
|
-
when :integer then 1
|
29
|
-
when :float then 1.5
|
30
|
-
when :decimal then "9.99"
|
31
|
-
when :datetime, :timestamp, :time then Time.now.to_s(:db)
|
32
|
-
when :date then Date.today.to_s(:db)
|
33
|
-
when :string then prefix + name.camelize + "String"
|
34
|
-
when :text then prefix + name.camelize + "Text"
|
35
|
-
when :boolean then false
|
36
|
-
else
|
37
|
-
""
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def flex_type
|
42
|
-
@flex_type = case type
|
43
|
-
when :integer then 'int'
|
44
|
-
when :date, :datetime, :time then 'Date'
|
45
|
-
when :boolean then 'Boolean'
|
46
|
-
when :float, :decimal then 'Number'
|
47
|
-
else
|
48
|
-
'String'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def flex_default(prefix = '')
|
53
|
-
@flex_default = case type
|
54
|
-
when :integer, :float, :decimal then '0'
|
55
|
-
when :string, :text then '""'
|
56
|
-
when :boolean then 'false'
|
57
|
-
else
|
58
|
-
'null'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
3
|
class RubossScaffoldGenerator < Merb::GeneratorBase
|
66
4
|
include Ruboss::Configuration
|
67
5
|
|