ruboss4ruby 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +2 -2
- data/Manifest.txt +86 -79
- data/README.rdoc +53 -0
- data/Rakefile +42 -5
- data/app_generators/ruboss_app/USAGE +22 -0
- data/app_generators/ruboss_app/ruboss_app_generator.rb +94 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/actionscript.properties +1 -1
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/actionscriptair.properties +0 -0
- data/app_generators/ruboss_app/templates/app.yaml.erb +12 -0
- data/app_generators/ruboss_app/templates/default_tasks.rake +51 -0
- data/app_generators/ruboss_app/templates/empty.txt +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/expressInstall.swf +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/flex.properties +0 -0
- data/app_generators/ruboss_app/templates/generate.rb +17 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/AC_OETags.js +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/history.css +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/history.js +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/historyFrame.html +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/index.template.html +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/playerProductInstall.swf +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/index.html.erb +2 -2
- data/app_generators/ruboss_app/templates/index.yaml +11 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/mainair-app.xml +3 -3
- data/app_generators/ruboss_app/templates/mainapp-config.xml +21 -0
- data/{merb_generators/templates/ruboss_flex_app → app_generators/ruboss_app/templates}/mainapp.mxml +6 -9
- data/app_generators/ruboss_app/templates/project-textmate.erb +52 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/project.properties +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/projectair.properties +0 -0
- data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/swfobject.js +0 -0
- data/bin/ruboss-gen +31 -0
- data/generators/ruboss_config/USAGE +5 -0
- data/generators/ruboss_config/ruboss_config_generator.rb +19 -0
- data/generators/ruboss_controller/USAGE +10 -0
- data/generators/ruboss_controller/ruboss_controller_generator.rb +38 -0
- data/generators/ruboss_controller/templates/assist.py +65 -0
- data/{merb_generators/templates/ruboss_controller → generators/ruboss_controller/templates}/controller.as.erb +7 -6
- data/generators/ruboss_controller/templates/restful.py +136 -0
- data/generators/ruboss_main_app/USAGE +8 -0
- data/generators/ruboss_main_app/ruboss_main_app_generator.rb +60 -0
- data/generators/ruboss_main_app/templates/main.py.erb +29 -0
- data/generators/ruboss_main_app/templates/mainapp.mxml +35 -0
- data/generators/ruboss_scaffold/USAGE +29 -0
- data/generators/ruboss_scaffold/ruboss_scaffold_generator.rb +148 -0
- data/generators/ruboss_scaffold/templates/component.mxml.erb +149 -0
- data/generators/ruboss_scaffold/templates/controller.py.erb +27 -0
- data/generators/ruboss_scaffold/templates/model.as.erb +42 -0
- data/generators/ruboss_scaffold/templates/model.py.erb +14 -0
- data/generators/ruboss_yaml_scaffold/USAGE +45 -0
- data/generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb +47 -0
- data/lib/ruboss4ruby/active_foo.rb +109 -86
- data/lib/ruboss4ruby/active_record_default_methods.rb +66 -0
- data/lib/ruboss4ruby/active_record_tasks.rb +10 -4
- data/lib/ruboss4ruby/configuration.rb +48 -34
- data/lib/ruboss4ruby/datamapper_foo.rb +31 -0
- data/lib/ruboss4ruby/{recipes.rb → rails/recipes.rb} +7 -9
- data/lib/ruboss4ruby/{ruboss_helper.rb → rails/swf_helper.rb} +14 -8
- data/lib/ruboss4ruby/tasks.rb +9 -4
- data/lib/ruboss4ruby.rb +72 -27
- data/rails_generators/ruboss_config/ruboss_config_generator.rb +3 -15
- data/rails_generators/ruboss_config/templates/mainair-app.xml +2 -2
- data/rails_generators/ruboss_config/templates/mainapp-config.xml +1 -1
- data/rails_generators/ruboss_config/templates/ruboss.yml +2 -4
- data/rails_generators/ruboss_config/templates/ruboss_tasks.rake +5 -15
- data/rails_generators/ruboss_controller/USAGE +1 -2
- data/rails_generators/ruboss_controller/ruboss_controller_generator.rb +3 -14
- data/rails_generators/ruboss_controller/templates/controller.as.erb +11 -6
- data/rails_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +67 -76
- data/rails_generators/ruboss_scaffold/templates/component.mxml.erb +69 -69
- data/rails_generators/ruboss_scaffold/templates/model.as.erb +2 -2
- data/rails_generators/ruboss_yaml_scaffold/USAGE +38 -1
- data/rcl-1.0.txt +0 -0
- data/rdoc/generators/template/html/jamis.rb +588 -0
- data/ruboss4ruby.gemspec +43 -0
- data/spec/ruboss4ruby_spec.rb +7 -0
- data/spec/spec_helper.rb +16 -0
- data/tasks/ann.rake +80 -0
- data/tasks/bones.rake +20 -0
- data/tasks/gem.rake +201 -0
- data/tasks/git.rake +40 -0
- data/tasks/manifest.rake +48 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +39 -0
- data/tasks/rdoc.rake +50 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +279 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- data/test/{controllers → rails/controllers}/application.rb +0 -0
- data/test/{controllers → rails/controllers}/locations_controller.rb +0 -0
- data/test/{controllers → rails/controllers}/notes_controller.rb +0 -0
- data/test/{controllers → rails/controllers}/projects_controller.rb +0 -0
- data/test/{controllers → rails/controllers}/tasks_controller.rb +0 -0
- data/test/{controllers → rails/controllers}/users_controller.rb +0 -0
- data/test/{database.yml → rails/database.yml} +0 -0
- data/test/{fixtures → rails/fixtures}/locations.yml +0 -0
- data/test/{fixtures → rails/fixtures}/notes.yml +0 -0
- data/test/{fixtures → rails/fixtures}/projects.yml +0 -0
- data/test/rails/fixtures/simple_properties.yml +19 -0
- data/test/{fixtures → rails/fixtures}/tasks.yml +0 -0
- data/test/{fixtures → rails/fixtures}/users.yml +0 -0
- data/test/{helpers → rails/helpers}/functional_test_helper.rb +0 -11
- data/test/rails/helpers/test_helper.rb +61 -0
- data/test/rails/helpers/unit_test_helper.rb +30 -0
- data/test/{model.yml → rails/model.yml} +0 -0
- data/test/{models → rails/models}/location.rb +0 -0
- data/test/{models → rails/models}/note.rb +0 -0
- data/test/{models → rails/models}/project.rb +1 -3
- data/test/rails/models/simple_property.rb +2 -0
- data/test/{models → rails/models}/task.rb +1 -1
- data/test/{models → rails/models}/user.rb +1 -2
- data/test/{playing_around_in_a_console.txt → rails/playing_around_in_a_console.txt} +0 -0
- data/test/{schema.rb → rails/schema.rb} +14 -0
- data/test/{test.swf → rails/test.swf} +0 -0
- data/test/rails/test_active_foo.rb +81 -0
- data/test/{test_ruboss_rails_integration_functional.rb → rails/test_ruboss_rails_integration_functional.rb} +4 -9
- data/test/{to_fxml_test.rb → rails/test_to_fxml.rb} +35 -37
- data/test/rails/test_to_json.rb +23 -0
- data/test/{views → rails/views}/notes/empty_params_action.html.erb +0 -0
- data/test/{views → rails/views}/notes/index.html.erb +0 -0
- metadata +138 -103
- data/Generators +0 -5
- data/README.txt +0 -37
- data/config/hoe.rb +0 -72
- data/config/requirements.rb +0 -15
- data/lib/ruboss4ruby/generated_attribute.rb +0 -61
- data/lib/ruboss4ruby/ruboss_test_helpers.rb +0 -31
- data/lib/ruboss4ruby/version.rb +0 -11
- data/merb_generators/ruboss_config.rb +0 -105
- data/merb_generators/ruboss_controller.rb +0 -61
- data/merb_generators/ruboss_flex_app.rb +0 -69
- data/merb_generators/ruboss_resource_controller.rb +0 -4
- data/merb_generators/ruboss_scaffold.rb +0 -158
- data/merb_generators/templates/ruboss_config/ruboss.yml +0 -16
- data/merb_generators/templates/ruboss_resource_controller/controller.rb.erb +0 -49
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -82
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/test/helpers/controllers.log +0 -8
- data/test/helpers/models.log +0 -170
- data/test/helpers/test_helper.rb +0 -25
- data/test/helpers/unit_test_helper.rb +0 -23
- data/test/test.sqlite3 +0 -0
- data/test/test_active_foo.rb +0 -79
- data/test/test_swfobject_helper.rb +0 -63
- data/website/index.html +0 -63
- data/website/index.txt +0 -34
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.html.erb +0 -47
data/lib/ruboss4ruby.rb
CHANGED
@@ -1,43 +1,74 @@
|
|
1
|
-
#
|
1
|
+
# Sets up all the relevant configuration options and brings together
|
2
|
+
# patches for Rails, Merb, ActiveRecord and Data Mapper.
|
3
|
+
#
|
4
|
+
# Loads Ruboss specific rake tasks if appropriate.
|
5
|
+
module Ruboss4Ruby
|
6
|
+
|
7
|
+
# :stopdoc:
|
8
|
+
VERSION = '1.1.0'
|
9
|
+
RUBOSS_FRAMEWORK_VERSION = '1.1.0'
|
10
|
+
LIB_DIR = File.join(File.dirname(__FILE__), 'ruboss4ruby/')
|
11
|
+
# :startdoc:
|
12
|
+
|
13
|
+
# Returns the version string for the library.
|
14
|
+
#
|
15
|
+
def self.version
|
16
|
+
VERSION
|
17
|
+
end
|
18
|
+
|
19
|
+
# Utility method used to require all files ending in .rb that lie in the
|
20
|
+
# directory below this file that has the same name as the filename passed
|
21
|
+
# in. Optionally, a specific _directory_ name can be passed in such that
|
22
|
+
# the _filename_ does not have to be equivalent to the directory.
|
23
|
+
#
|
24
|
+
def self.require_all_libs_relative_to( fname, dir = nil )
|
25
|
+
dir ||= ::File.basename(fname, '.*')
|
26
|
+
search_me = ::File.expand_path(
|
27
|
+
::File.join(::File.dirname(fname), dir, '*', '*.rb'))
|
28
|
+
|
29
|
+
Dir.glob(search_me).sort.each {|rb| require rb}
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
require Ruboss4Ruby::LIB_DIR + 'configuration'
|
35
|
+
|
2
36
|
# make sure we're running inside Merb
|
3
37
|
if defined?(Merb::Plugins)
|
4
|
-
Merb::
|
5
|
-
Merb.add_mime_type(:fxml, :to_fxml, %w[application/xml text/xml application/x-xml], :charset => "utf-8")
|
38
|
+
Merb::Plugins.add_rakefiles 'ruboss4ruby/tasks'
|
6
39
|
|
7
|
-
|
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
|
40
|
+
Merb::BootLoader.before_app_loads do
|
13
41
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
42
|
+
if defined?(ActiveRecord::Base)
|
43
|
+
Merb.add_mime_type(:fxml, :to_fxml, %w[application/xml text/xml application/x-xml], :charset => "utf-8")
|
44
|
+
['active_foo', 'active_record_default_methods'].each { |lib| require Ruboss4Ruby::LIB_DIR + lib }
|
45
|
+
Merb::Plugins.add_rakefiles 'ruboss4ruby/active_record_tasks'
|
46
|
+
else
|
47
|
+
Merb.add_mime_type(:fxml, :to_xml, %w[application/xml text/xml application/x-xml], :charset => "utf-8")
|
48
|
+
if defined?(Merb::Orms::DataMapper)
|
49
|
+
require Ruboss4Ruby::LIB_DIR + 'datamapper_foo'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
21
53
|
elsif defined?(ActionController::Base)
|
22
|
-
# if we are not running in Merb,
|
54
|
+
# if we are not running in Merb, try to hook up Rails
|
23
55
|
Mime::Type.register_alias "application/xml", :fxml
|
56
|
+
|
57
|
+
['active_foo', 'active_record_default_methods', 'rails/swf_helper'].each { |lib| require Ruboss4Ruby::LIB_DIR + lib }
|
24
58
|
|
25
|
-
|
26
|
-
require File.join(File.dirname(__FILE__),'ruboss4ruby', 'configuration')
|
27
|
-
require File.join(File.dirname(__FILE__),'ruboss4ruby', 'active_foo')
|
28
|
-
require File.join(File.dirname(__FILE__), 'ruboss4ruby', 'ruboss_helper')
|
29
|
-
ActionView::Base.send :include, RubossHelper unless ActionView::Base.included_modules.include?(RubossHelper)
|
30
|
-
require File.join(File.dirname(__FILE__), 'ruboss4ruby', 'ruboss_test_helpers')
|
31
|
-
Test::Unit::TestCase.send :include, RubossTestHelpers unless Test::Unit::TestCase.included_modules.include?(RubossTestHelpers)
|
59
|
+
ActionView::Base.send :include, SWFHelper unless ActionView::Base.included_modules.include?(SWFHelper)
|
32
60
|
|
61
|
+
# We mess with default +render+ implementation a bit to add support for expressions
|
62
|
+
# such as format.fxml { render :fxml => @foo }
|
33
63
|
module ActionController
|
64
|
+
# Override render to add support for render :fxml
|
34
65
|
class Base
|
35
66
|
alias_method :old_render, :render unless method_defined?(:old_render)
|
36
67
|
|
37
68
|
# so that we can have handling for :fxml option and write code like
|
38
69
|
# format.fxml { render :fxml => @projects }
|
39
70
|
def render(options = nil, extra_options = {}, &block)
|
40
|
-
if options && options[:fxml]
|
71
|
+
if options.is_a?(Hash) && options[:fxml]
|
41
72
|
xml = options[:fxml]
|
42
73
|
response.content_type ||= Mime::XML
|
43
74
|
render_for_text(xml.respond_to?(:to_fxml) ? xml.to_fxml : xml, options[:status])
|
@@ -48,7 +79,9 @@ elsif defined?(ActionController::Base)
|
|
48
79
|
end
|
49
80
|
end
|
50
81
|
|
51
|
-
module
|
82
|
+
# It is possible to pass metadata with any Ruboss model. This module adds support for
|
83
|
+
# extracting that metadata into the standard params hash.
|
84
|
+
module Ruboss4RubyController
|
52
85
|
private
|
53
86
|
|
54
87
|
# Extract any keys named _metadata from the models in the params hash
|
@@ -63,8 +96,20 @@ elsif defined?(ActionController::Base)
|
|
63
96
|
params.merge!(metadata) unless metadata.empty?
|
64
97
|
end
|
65
98
|
end
|
99
|
+
|
100
|
+
module ActiveRecord
|
101
|
+
# ActiveRecord named scopes are computed *before* ruboss4ruby gem gets loaded
|
102
|
+
# this patch addresses that and makes sure +to_fxml+ calls are properly
|
103
|
+
# delegated
|
104
|
+
module NamedScope
|
105
|
+
# make sure we properly delegate +to_fxml+ calls to the proxy
|
106
|
+
class Scope
|
107
|
+
delegate :to_fxml, :to => :proxy_found
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
66
111
|
|
67
|
-
ActionController::Base.send :include,
|
112
|
+
ActionController::Base.send :include, Ruboss4RubyController
|
68
113
|
ActionController::Base.send :prepend_before_filter, :extract_metadata_from_params
|
69
114
|
|
70
115
|
# temporarily disable forgery protection site-wise
|
@@ -1,20 +1,8 @@
|
|
1
|
-
################################################################################
|
2
|
-
# Copyright 2008, Ruboss Technology Corporation.
|
3
|
-
#
|
4
|
-
# This software is dual-licensed under both the terms of the Ruboss Commercial
|
5
|
-
# License v1 (RCL v1) as published by Ruboss Technology Corporation and under
|
6
|
-
# the terms of the GNU General Public License v3 (GPL v3) as published by the
|
7
|
-
# Free Software Foundation.
|
8
|
-
#
|
9
|
-
# Both the RCL v1 (rcl-1.0.txt) and the GPL v3 (gpl-3.0.txt) are included in
|
10
|
-
# the source code. If you have purchased a commercial license then only the
|
11
|
-
# RCL v1 applies; otherwise, only the GPL v3 applies. To learn more or to buy a
|
12
|
-
# commercial license, please go to http://ruboss.com.
|
13
|
-
################################################################################
|
14
1
|
require 'open-uri'
|
2
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'ruboss4ruby') if !defined?(Ruboss4Ruby)
|
15
3
|
|
16
4
|
class RubossConfigGenerator < Rails::Generator::Base
|
17
|
-
include
|
5
|
+
include Ruboss4Ruby::Configuration
|
18
6
|
|
19
7
|
attr_reader :project_name,
|
20
8
|
:flex_project_name,
|
@@ -86,7 +74,7 @@ class RubossConfigGenerator < Rails::Generator::Base
|
|
86
74
|
|
87
75
|
m.directory "app/flex/#{base_folder}/components/generated"
|
88
76
|
|
89
|
-
framework_release =
|
77
|
+
framework_release = Ruboss4Ruby::RUBOSS_FRAMEWORK_VERSION
|
90
78
|
framework_distribution_url = "http://ruboss.com/releases/ruboss-#{framework_release}.swc"
|
91
79
|
framework_destination_file = "lib/ruboss-#{framework_release}.swc"
|
92
80
|
|
@@ -60,10 +60,10 @@
|
|
60
60
|
<!-- <resizable></resizable> -->
|
61
61
|
|
62
62
|
<!-- The window's initial width. Optional. -->
|
63
|
-
|
63
|
+
<width>800</width>
|
64
64
|
|
65
65
|
<!-- The window's initial height. Optional. -->
|
66
|
-
|
66
|
+
<height>600</height>
|
67
67
|
|
68
68
|
<!-- The window's initial x position. Optional. -->
|
69
69
|
<!-- <x></x> -->
|
@@ -7,10 +7,8 @@
|
|
7
7
|
|
8
8
|
#base-package: com.pomodo
|
9
9
|
|
10
|
-
# Main ruboss controller is typically named
|
11
|
-
# Controller appended at the end, e.g. if your application is called "pomodo" the flex application
|
12
|
-
# controller will be called "PomodoController"). This controller is created in
|
10
|
+
# Main ruboss controller is typically named AppicationController. This controller is created in
|
13
11
|
# <base-package>.controllers folder. You can customize the name by uncommenting the following line
|
14
12
|
# and changing the controller name.
|
15
13
|
|
16
|
-
#controller-name:
|
14
|
+
#controller-name: ApplicationController
|
@@ -1,15 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
# the terms of the GNU General Public License v3 (GPL v3) as published by the
|
7
|
-
# Free Software Foundation.
|
8
|
-
#
|
9
|
-
# Both the RCL v1 (rcl-1.0.txt) and the GPL v3 (gpl-3.0.txt) are included in
|
10
|
-
# the source code. If you have purchased a commercial license then only the
|
11
|
-
# RCL v1 applies; otherwise, only the GPL v3 applies. To learn more or to buy a
|
12
|
-
# commercial license, please go to http://ruboss.com.
|
13
|
-
################################################################################
|
14
|
-
require 'ruboss4ruby/active_record_tasks'
|
15
|
-
|
1
|
+
# if the gem is not installed system wide, we'll just skip the tasks
|
2
|
+
begin
|
3
|
+
require 'ruboss4ruby/active_record_tasks'
|
4
|
+
rescue LoadError
|
5
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
Description:
|
2
2
|
Generates/updates the main Flex application controller, typically
|
3
|
-
app/flex/<yourappname>/controllers
|
4
|
-
app/flex/pomodo/controllers/PomodoController.as
|
3
|
+
app/flex/<yourappname>/controllers/ApplicationController.as
|
5
4
|
|
6
5
|
It pulls out all available models and commands from respective
|
7
6
|
folders and makes sure they'll be pulled into the Flex application
|
@@ -1,18 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
# This software is dual-licensed under both the terms of the Ruboss Commercial
|
5
|
-
# License v1 (RCL v1) as published by Ruboss Technology Corporation and under
|
6
|
-
# the terms of the GNU General Public License v3 (GPL v3) as published by the
|
7
|
-
# Free Software Foundation.
|
8
|
-
#
|
9
|
-
# Both the RCL v1 (rcl-1.0.txt) and the GPL v3 (gpl-3.0.txt) are included in
|
10
|
-
# the source code. If you have purchased a commercial license then only the
|
11
|
-
# RCL v1 applies; otherwise, only the GPL v3 applies. To learn more or to buy a
|
12
|
-
# commercial license, please go to http://ruboss.com.
|
13
|
-
################################################################################
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'ruboss4ruby') if !defined?(Ruboss4Ruby)
|
2
|
+
|
14
3
|
class RubossControllerGenerator < Rails::Generator::Base
|
15
|
-
include
|
4
|
+
include Ruboss4Ruby::Configuration
|
16
5
|
|
17
6
|
attr_reader :project_name,
|
18
7
|
:flex_project_name,
|
@@ -1,20 +1,22 @@
|
|
1
1
|
package <%= base_package %>.controllers {
|
2
2
|
import <%= base_package %>.models.*;
|
3
3
|
import <%= base_package %>.commands.*;
|
4
|
-
|
4
|
+
|
5
|
+
import mx.core.Application;
|
5
6
|
import org.ruboss.Ruboss;
|
6
|
-
import org.ruboss.controllers.
|
7
|
+
import org.ruboss.controllers.RubossApplicationController;
|
7
8
|
import org.ruboss.utils.RubossUtils;
|
8
9
|
|
9
|
-
public class <%= command_controller_name %> extends
|
10
|
+
public class <%= command_controller_name %> extends RubossApplicationController {
|
10
11
|
private static var controller:<%= command_controller_name %>;
|
11
12
|
|
12
13
|
public static var models:Array = [<%= model_names %>]; /* Models */
|
13
14
|
|
15
|
+
public static var commands:Array = [<%= command_names %>]; /* Commands */
|
16
|
+
|
14
17
|
public function <%= command_controller_name %>(enforcer:SingletonEnforcer, extraServices:Array,
|
15
18
|
defaultServiceId:int = -1) {
|
16
|
-
super(
|
17
|
-
models, extraServices, defaultServiceId);
|
19
|
+
super(commands, models, extraServices, defaultServiceId);
|
18
20
|
}
|
19
21
|
|
20
22
|
public static function get instance():<%= command_controller_name %> {
|
@@ -27,7 +29,10 @@ package <%= base_package %>.controllers {
|
|
27
29
|
if (!RubossUtils.isEmpty(airDatabaseName)) Ruboss.airDatabaseName = airDatabaseName;
|
28
30
|
controller = new <%= command_controller_name %>(new SingletonEnforcer, extraServices,
|
29
31
|
defaultServiceId);
|
30
|
-
|
32
|
+
Ruboss.sessionToken = Application.application.parameters.session_token;
|
33
|
+
if (Application.application.parameters.authenticity_token) {
|
34
|
+
Ruboss.defaultMetadata = { authenticity_token : Application.application.parameters.authenticity_token };
|
35
|
+
}
|
31
36
|
}
|
32
37
|
}
|
33
38
|
}
|
@@ -1,16 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
# This software is dual-licensed under both the terms of the Ruboss Commercial
|
5
|
-
# License v1 (RCL v1) as published by Ruboss Technology Corporation and under
|
6
|
-
# the terms of the GNU General Public License v3 (GPL v3) as published by the
|
7
|
-
# Free Software Foundation.
|
8
|
-
#
|
9
|
-
# Both the RCL v1 (rcl-1.0.txt) and the GPL v3 (gpl-3.0.txt) are included in
|
10
|
-
# the source code. If you have purchased a commercial license then only the
|
11
|
-
# RCL v1 applies; otherwise, only the GPL v3 applies. To learn more or to buy a
|
12
|
-
# commercial license, please go to http://ruboss.com.
|
13
|
-
################################################################################
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'ruboss4ruby') if !defined?(Ruboss4Ruby)
|
2
|
+
|
14
3
|
module Rails
|
15
4
|
module Generator
|
16
5
|
class GeneratedAttribute
|
@@ -24,50 +13,51 @@ module Rails
|
|
24
13
|
|
25
14
|
def field_type
|
26
15
|
@field_type ||= case type
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
16
|
+
when :integer, :float, :decimal then :text_field
|
17
|
+
when :datetime, :timestamp, :time then :datetime_select
|
18
|
+
when :date then :date_select
|
19
|
+
when :string then :text_field
|
20
|
+
when :text then :text_area
|
21
|
+
when :boolean then :check_box
|
22
|
+
else
|
23
|
+
:text_field
|
35
24
|
end
|
36
25
|
end
|
37
26
|
|
38
27
|
def default(prefix = '')
|
39
28
|
@default = case type
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
29
|
+
when :integer then 1
|
30
|
+
when :float then 1.5
|
31
|
+
when :decimal then "9.99"
|
32
|
+
when :datetime, :timestamp, :time then Time.now.to_s(:db)
|
33
|
+
when :date then Date.today.to_s(:db)
|
34
|
+
when :string then prefix + name.camelize + "String"
|
35
|
+
when :text then prefix + name.camelize + "Text"
|
36
|
+
when :boolean then false
|
37
|
+
else
|
38
|
+
""
|
50
39
|
end
|
51
40
|
end
|
52
41
|
|
53
42
|
def flex_type
|
54
43
|
@flex_type = case type
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
44
|
+
when :integer then 'int'
|
45
|
+
when :date, :datetime, :time then 'Date'
|
46
|
+
when :boolean then 'Boolean'
|
47
|
+
when :float, :decimal then 'Number'
|
48
|
+
else
|
49
|
+
'String'
|
61
50
|
end
|
62
51
|
end
|
63
|
-
|
64
|
-
def flex_default
|
52
|
+
|
53
|
+
def flex_default
|
65
54
|
@flex_default = case type
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
55
|
+
when :integer then '0'
|
56
|
+
when :date, :datetime, :time then 'new Date'
|
57
|
+
when :boolean then 'false'
|
58
|
+
when :float, :decimal then 'new Number'
|
59
|
+
else
|
60
|
+
"\"\""
|
71
61
|
end
|
72
62
|
end
|
73
63
|
end
|
@@ -75,7 +65,7 @@ module Rails
|
|
75
65
|
end
|
76
66
|
|
77
67
|
class RubossScaffoldGenerator < Rails::Generator::NamedBase
|
78
|
-
include
|
68
|
+
include Ruboss4Ruby::Configuration
|
79
69
|
|
80
70
|
attr_reader :project_name,
|
81
71
|
:flex_project_name,
|
@@ -96,9 +86,7 @@ class RubossScaffoldGenerator < Rails::Generator::NamedBase
|
|
96
86
|
:controller_underscore_name,
|
97
87
|
:controller_singular_name,
|
98
88
|
:controller_plural_name
|
99
|
-
|
100
|
-
attr_accessor :constructor_args
|
101
|
-
|
89
|
+
|
102
90
|
alias_method :controller_file_name, :controller_underscore_name
|
103
91
|
alias_method :controller_table_name, :controller_plural_name
|
104
92
|
|
@@ -117,28 +105,7 @@ class RubossScaffoldGenerator < Rails::Generator::NamedBase
|
|
117
105
|
else
|
118
106
|
@controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
|
119
107
|
end
|
120
|
-
|
121
|
-
@belongs_tos = []
|
122
|
-
@has_ones = []
|
123
|
-
@has_manies = []
|
124
|
-
# Figure out has_one, has_many and belongs_to based on args
|
125
|
-
@args.each do |arg|
|
126
|
-
if arg =~ /^has_one:/
|
127
|
-
# arg = "has_one:arg1,arg2", so all the has_one are together
|
128
|
-
@has_ones = arg.split(':')[1].split(',')
|
129
|
-
elsif arg =~ /^has_many:/
|
130
|
-
# arg = "has_many:arg1,arg2", so all the has_many are together
|
131
|
-
@has_manies = arg.split(":")[1].split(",")
|
132
|
-
elsif arg =~ /^belongs_to:/ # belongs_to:arg1,arg2
|
133
|
-
@belongs_tos = arg.split(":")[1].split(',')
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
# Remove the has_one and has_many arguments since they are
|
138
|
-
# not for consumption by the scaffold generator, and since
|
139
|
-
# we have already used them to set the @belongs_tos, @has_ones and
|
140
|
-
# @has_manies.
|
141
|
-
@args.delete_if { |elt| elt =~ /^(has_one|has_many|belongs_to):/ }
|
108
|
+
extract_relationships
|
142
109
|
end
|
143
110
|
|
144
111
|
def manifest
|
@@ -180,11 +147,35 @@ class RubossScaffoldGenerator < Rails::Generator::NamedBase
|
|
180
147
|
end
|
181
148
|
end
|
182
149
|
|
183
|
-
protected
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
150
|
+
protected
|
151
|
+
def extract_relationships
|
152
|
+
@belongs_tos = []
|
153
|
+
@has_ones = []
|
154
|
+
@has_manies = []
|
155
|
+
# Figure out has_one, has_many and belongs_to based on args
|
156
|
+
@args.each do |arg|
|
157
|
+
if arg =~ /^has_one:/
|
158
|
+
# arg = "has_one:arg1,arg2", so all the has_one are together
|
159
|
+
@has_ones = arg.split(':')[1].split(',')
|
160
|
+
elsif arg =~ /^has_many:/
|
161
|
+
# arg = "has_many:arg1,arg2", so all the has_many are together
|
162
|
+
@has_manies = arg.split(":")[1].split(",")
|
163
|
+
elsif arg =~ /^belongs_to:/ # belongs_to:arg1,arg2
|
164
|
+
@belongs_tos = arg.split(":")[1].split(',')
|
165
|
+
end
|
189
166
|
end
|
167
|
+
|
168
|
+
# Remove the has_one and has_many arguments since they are
|
169
|
+
# not for consumption by the scaffold generator, and since
|
170
|
+
# we have already used them to set the @belongs_tos, @has_ones and
|
171
|
+
# @has_manies.
|
172
|
+
@args.delete_if { |elt| elt =~ /^(has_one|has_many|belongs_to):/ }
|
173
|
+
end
|
174
|
+
|
175
|
+
def add_options!(opt)
|
176
|
+
opt.separator ''
|
177
|
+
opt.separator 'Options:'
|
178
|
+
opt.on("-f", "--flex-only", "Scaffold Flex code only",
|
179
|
+
"Default: false") { |v| options[:flex_only] = v}
|
180
|
+
end
|
190
181
|
end
|