dima-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 -3
- data/Manifest.txt +46 -37
- data/README.rdoc +12 -10
- data/Rakefile +37 -0
- data/app_generators/ruboss_app/USAGE +13 -0
- data/app_generators/ruboss_app/ruboss_app_generator.rb +88 -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/default_tasks.rake +51 -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 +21 -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/{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 +17 -0
- data/generators/ruboss_config/USAGE +5 -0
- data/generators/ruboss_config/ruboss_config_generator.rb +24 -0
- data/generators/ruboss_controller/USAGE +10 -0
- data/generators/ruboss_controller/ruboss_controller_generator.rb +34 -0
- data/{merb_generators/templates/ruboss_controller → generators/ruboss_controller/templates}/controller.as.erb +0 -4
- data/generators/ruboss_main_app/USAGE +8 -0
- data/generators/ruboss_main_app/ruboss_main_app_generator.rb +46 -0
- data/generators/ruboss_main_app/templates/mainapp.mxml +31 -0
- data/generators/ruboss_scaffold/USAGE +29 -0
- data/generators/ruboss_scaffold/ruboss_scaffold_generator.rb +117 -0
- data/generators/ruboss_scaffold/templates/component.mxml.erb +149 -0
- data/generators/ruboss_scaffold/templates/model.as.erb +42 -0
- data/generators/ruboss_yaml_scaffold/USAGE +7 -0
- data/generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb +43 -0
- data/lib/ruboss4ruby/active_foo.rb +0 -64
- data/lib/ruboss4ruby/active_record_default_methods.rb +54 -0
- data/lib/ruboss4ruby/configuration.rb +13 -28
- data/lib/ruboss4ruby/datamapper_foo.rb +1 -1
- data/lib/ruboss4ruby/rails/recipes.rb +58 -0
- data/lib/ruboss4ruby/rails/swf_helper.rb +59 -0
- data/lib/ruboss4ruby/tasks.rb +1 -1
- data/lib/ruboss4ruby.rb +35 -15
- data/rails_generators/ruboss_config/ruboss_config_generator.rb +2 -2
- data/rails_generators/ruboss_config/templates/mainair-app.xml +2 -2
- data/rails_generators/ruboss_controller/USAGE +1 -2
- data/rails_generators/ruboss_controller/ruboss_controller_generator.rb +1 -1
- data/rails_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +1 -1
- data/rails_generators/ruboss_scaffold/templates/component.mxml.erb +69 -69
- data/rails_generators/ruboss_scaffold/templates/model.as.erb +1 -1
- data/ruboss4ruby.gemspec +43 -0
- data/spec/ruboss4ruby_spec.rb +7 -0
- data/spec/spec_helper.rb +16 -0
- data/test/rails/controllers/application.rb +15 -0
- data/test/rails/controllers/locations_controller.rb +93 -0
- data/test/rails/controllers/notes_controller.rb +96 -0
- data/test/rails/controllers/projects_controller.rb +93 -0
- data/test/rails/controllers/tasks_controller.rb +93 -0
- data/test/rails/controllers/users_controller.rb +93 -0
- data/test/rails/database.yml +4 -0
- data/test/rails/fixtures/locations.yml +8 -0
- data/test/rails/fixtures/notes.yml +17 -0
- data/test/rails/fixtures/projects.yml +25 -0
- data/test/rails/fixtures/simple_properties.yml +19 -0
- data/test/rails/fixtures/tasks.yml +46 -0
- data/test/rails/fixtures/users.yml +13 -0
- data/test/rails/helpers/functional_test_helper.rb +21 -0
- data/test/rails/helpers/test_helper.rb +61 -0
- data/test/rails/helpers/unit_test_helper.rb +30 -0
- data/test/rails/model.yml +35 -0
- data/test/rails/models/location.rb +4 -0
- data/test/rails/models/note.rb +3 -0
- data/test/rails/models/project.rb +4 -0
- data/test/rails/models/simple_property.rb +2 -0
- data/test/rails/models/task.rb +20 -0
- data/test/rails/models/user.rb +22 -0
- data/test/rails/playing_around_in_a_console.txt +71 -0
- data/test/rails/schema.rb +77 -0
- data/test/rails/test.swf +1 -0
- data/test/rails/test_active_foo.rb +81 -0
- data/test/rails/test_ruboss_rails_integration_functional.rb +22 -0
- data/test/rails/test_to_fxml.rb +77 -0
- data/test/rails/test_to_json.rb +23 -0
- data/test/rails/views/notes/empty_params_action.html.erb +1 -0
- data/test/rails/views/notes/index.html.erb +1 -0
- metadata +121 -92
- data/Generators +0 -7
- data/lib/ruboss4ruby/generated_attribute.rb +0 -61
- data/merb_generators/ruboss_config.rb +0 -103
- data/merb_generators/ruboss_controller.rb +0 -59
- data/merb_generators/ruboss_flex_app.rb +0 -67
- data/merb_generators/ruboss_resource.rb +0 -37
- data/merb_generators/ruboss_resource_controller.rb +0 -80
- data/merb_generators/ruboss_scaffold.rb +0 -157
- data/merb_generators/templates/ruboss_config/ruboss.yml +0 -16
- data/merb_generators/templates/ruboss_resource_controller/controller_ar.rb.erb +0 -49
- data/merb_generators/templates/ruboss_resource_controller/controller_dm.rb.erb +0 -46
- data/merb_generators/templates/ruboss_resource_controller/spec/controllers/%file_name%_spec.rb +0 -7
- data/merb_generators/templates/ruboss_resource_controller/spec/requests/%file_name%_spec.rb +0 -1
- data/merb_generators/templates/ruboss_resource_controller/test/controllers/%file_name%_test.rb +0 -17
@@ -1,41 +1,26 @@
|
|
1
1
|
class String
|
2
|
-
def
|
2
|
+
def ucfirst
|
3
3
|
self[0,1].capitalize + self[1..-1]
|
4
4
|
end
|
5
5
|
|
6
|
-
def
|
6
|
+
def dcfirst
|
7
7
|
self[0,1].downcase + self[1..-1]
|
8
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(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
27
|
-
gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase
|
28
|
-
end
|
29
9
|
end
|
30
10
|
|
31
|
-
module
|
11
|
+
module Ruboss4Ruby
|
32
12
|
module Configuration
|
33
|
-
APP_ROOT = defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root
|
34
|
-
|
35
|
-
def extract_names
|
36
|
-
project_name = APP_ROOT.split("/").last.camelcase.gsub(/\s/, '')
|
37
|
-
project_name_downcase = project_name.downcase
|
13
|
+
APP_ROOT = defined?(RAILS_ROOT) ? RAILS_ROOT : defined?(Merb) ? Merb.root : File.expand_path(".")
|
38
14
|
|
15
|
+
def extract_names(project = nil)
|
16
|
+
if project
|
17
|
+
project_name = project.camelcase.gsub(/\s/, '')
|
18
|
+
project_name_downcase = project_name.downcase
|
19
|
+
else
|
20
|
+
project_name = APP_ROOT.split("/").last.camelcase.gsub(/\s/, '')
|
21
|
+
project_name_downcase = project_name.downcase
|
22
|
+
end
|
23
|
+
|
39
24
|
begin
|
40
25
|
config = YAML.load(File.open("#{APP_ROOT}/config/ruboss.yml"))
|
41
26
|
base_package = config['base-package'] || project_name_downcase
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
# To use these recipes, add the following to your Capfile:
|
4
|
+
# require 'ruboss4ruby/rails/recipes'
|
5
|
+
|
6
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
7
|
+
after "deploy:setup", "deploy:flex:setup"
|
8
|
+
|
9
|
+
namespace :db do
|
10
|
+
desc "runs db:refresh in the latest release directory."
|
11
|
+
task :refresh, :roles => :db do
|
12
|
+
run("cd #{latest_release} && rake db:refresh RAILS_ENV=production")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
namespace :deploy do
|
17
|
+
namespace :flex do
|
18
|
+
|
19
|
+
desc "Creates the flex_files directory in the shared directory"
|
20
|
+
task :setup do
|
21
|
+
flex_dir = File.join(shared_path, 'flex_files')
|
22
|
+
run "#{try_sudo} mkdir -p #{flex_dir} && #{try_sudo} chmod g+w #{flex_dir}"
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "uploads everything in public/bin up to the server"
|
26
|
+
task :via_dumb_copy, :roles => :app do
|
27
|
+
# the -p flag on mkdir makes intermediate directories (i.e. both /bin and /bin/history),
|
28
|
+
# and doesn't raise an error if any of the directories already exist.
|
29
|
+
rails_root = Dir.pwd # You have to run cap tasks from RAILS_ROOT anyways
|
30
|
+
base_dir = File.join(rails_root, 'public', 'bin')
|
31
|
+
ec2_base_dir = File.join(shared_path, 'flex_files')
|
32
|
+
|
33
|
+
Find.find(base_dir) do |file|
|
34
|
+
filename_without_base_dir = file.sub(base_dir, '')
|
35
|
+
if File.directory?(file)
|
36
|
+
run "mkdir -p #{File.join(ec2_base_dir, filename_without_base_dir)}"
|
37
|
+
else
|
38
|
+
content = File.open(file, 'rb') {|f| f.read}
|
39
|
+
put content, File.join(ec2_base_dir, filename_without_base_dir)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "synchronizes the local and remote public/bin directories using rsync"
|
45
|
+
task :via_rsync, :roles => :app do
|
46
|
+
username = user || ENV['USER']
|
47
|
+
rails_root = Dir.pwd # You have to run cap tasks from RAILS_ROOT anyways
|
48
|
+
execute_on_servers do |server|
|
49
|
+
`rsync -r -p -v -e \"ssh -i #{ssh_options[:keys]}\" #{File.join(rails_root, 'public', 'bin')}/ #{username}@#{server}:#{File.join(shared_path, 'flex_files')}/`
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
task :make_symlink, :roles => :app do
|
54
|
+
run "ln -s #{shared_path}/flex_files #{release_path}/public/bin"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module SWFHelper
|
2
|
+
|
3
|
+
# Creates a swfObject Javascript call. You must include swfobject.js to use this.
|
4
|
+
# See http://code.google.com/p/swfobject/wiki/documentation for full details and documentation
|
5
|
+
# of the swfobject js library.
|
6
|
+
def swfobject(swf_url, params = {})
|
7
|
+
params.reverse_merge!({:width => '100%',
|
8
|
+
:height => '100%',
|
9
|
+
:id => 'flashContent',
|
10
|
+
:version => '9.0.0',
|
11
|
+
:express_install_swf => '/expressInstall.swf',
|
12
|
+
:flash_vars => nil,
|
13
|
+
:params => nil,
|
14
|
+
:attributes => nil,
|
15
|
+
:create_div => false,
|
16
|
+
:include_authenticity_token => true,
|
17
|
+
:include_session_token => true
|
18
|
+
})
|
19
|
+
arg_order = [:id, :width, :height, :version, :express_install_swf]
|
20
|
+
js_params = ["'#{swf_url}?#{rails_asset_id(swf_url)}'"]
|
21
|
+
js_params += arg_order.collect {|arg| "'#{params[arg]}'" }
|
22
|
+
|
23
|
+
# Add authenticity_token and the session key to flashVars. This will only work if flashVars is a Hash or nil
|
24
|
+
# If it's a string representing the name of a Javascript variable, then you need to add them yourself
|
25
|
+
# like this:
|
26
|
+
# <script>
|
27
|
+
# ... other code that defines flashVars and sets some of its parameters
|
28
|
+
# flashVars['authenticity_token'] = <%= form_authenticity_token -%>
|
29
|
+
# flashVars['session_token'] = <%= session.session_id -%>
|
30
|
+
# </script>
|
31
|
+
# If you include an authenticity_token parameter in flashVars,
|
32
|
+
# then the Flex app will add it to Ruboss.defaultMetadata, so that it will be sent
|
33
|
+
# back up to your Rails app with every request.
|
34
|
+
params[:flash_vars] ||= {}
|
35
|
+
if params[:flash_vars].is_a?(Hash)
|
36
|
+
if params[:include_authenticity_token] && ActionController::Base.allow_forgery_protection
|
37
|
+
params[:flash_vars].reverse_merge!(:authenticity_token => form_authenticity_token)
|
38
|
+
end
|
39
|
+
if params[:include_session_token]
|
40
|
+
params[:flash_vars].reverse_merge!(:session_token => session.session_id)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
js_params += [params[:flash_vars], params[:params], params[:attributes]].collect do |hash_or_string|
|
45
|
+
if hash_or_string.is_a?(Hash)
|
46
|
+
hash_or_string.to_json
|
47
|
+
else # If it's not a hash, then it should be a string giving the name of the Javascript variable to use
|
48
|
+
hash_or_string
|
49
|
+
end
|
50
|
+
end.compact
|
51
|
+
|
52
|
+
swf_tag = javascript_tag do
|
53
|
+
"swfobject.embedSWF(#{js_params.join(',')})"
|
54
|
+
end
|
55
|
+
swf_tag += content_tag(:div, nil, :id => params[:id]) if params[:create_div]
|
56
|
+
swf_tag
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/lib/ruboss4ruby/tasks.rb
CHANGED
@@ -3,7 +3,7 @@ require 'ftools'
|
|
3
3
|
require 'rexml/document'
|
4
4
|
require File.join(File.dirname(__FILE__), 'configuration')
|
5
5
|
|
6
|
-
APP_ROOT =
|
6
|
+
APP_ROOT = Ruboss4Ruby::Configuration::APP_ROOT
|
7
7
|
|
8
8
|
namespace :ruboss do
|
9
9
|
def compile_app(executable, destination, opts = '')
|
data/lib/ruboss4ruby.rb
CHANGED
@@ -1,38 +1,58 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Ruboss4Ruby
|
2
|
+
|
3
|
+
# :stopdoc:
|
4
|
+
VERSION = '1.1.0'
|
5
|
+
RUBOSS_FRAMEWORK_VERSION = '1.1.0'
|
5
6
|
LIB_DIR = File.join(File.dirname(__FILE__), 'ruboss4ruby/')
|
7
|
+
# :startdoc:
|
8
|
+
|
9
|
+
# Returns the version string for the library.
|
10
|
+
#
|
11
|
+
def self.version
|
12
|
+
VERSION
|
13
|
+
end
|
14
|
+
|
15
|
+
# Utility method used to require all files ending in .rb that lie in the
|
16
|
+
# directory below this file that has the same name as the filename passed
|
17
|
+
# in. Optionally, a specific _directory_ name can be passed in such that
|
18
|
+
# the _filename_ does not have to be equivalent to the directory.
|
19
|
+
#
|
20
|
+
def self.require_all_libs_relative_to( fname, dir = nil )
|
21
|
+
dir ||= ::File.basename(fname, '.*')
|
22
|
+
search_me = ::File.expand_path(
|
23
|
+
::File.join(::File.dirname(fname), dir, '*', '*.rb'))
|
24
|
+
|
25
|
+
Dir.glob(search_me).sort.each {|rb| require rb}
|
26
|
+
end
|
27
|
+
|
6
28
|
end
|
7
29
|
|
8
|
-
|
30
|
+
require Ruboss4Ruby::LIB_DIR + 'configuration'
|
31
|
+
|
9
32
|
# make sure we're running inside Merb
|
10
33
|
if defined?(Merb::Plugins)
|
11
34
|
Merb::Plugins.add_rakefiles 'ruboss4ruby/tasks'
|
12
35
|
|
13
36
|
Merb::BootLoader.before_app_loads do
|
14
|
-
require Ruboss::LIB_DIR + 'configuration'
|
15
37
|
|
16
38
|
if defined?(ActiveRecord::Base)
|
17
39
|
Merb.add_mime_type(:fxml, :to_fxml, %w[application/xml text/xml application/x-xml], :charset => "utf-8")
|
18
|
-
require
|
40
|
+
['active_foo', 'active_record_default_methods'].each { |lib| require Ruboss4Ruby::LIB_DIR + lib }
|
19
41
|
Merb::Plugins.add_rakefiles 'ruboss4ruby/active_record_tasks'
|
20
42
|
else
|
21
43
|
Merb.add_mime_type(:fxml, :to_xml, %w[application/xml text/xml application/x-xml], :charset => "utf-8")
|
22
44
|
if defined?(Merb::Orms::DataMapper)
|
23
|
-
require
|
45
|
+
require Ruboss4Ruby::LIB_DIR + 'datamapper_foo'
|
24
46
|
end
|
25
47
|
end
|
26
48
|
end
|
27
49
|
elsif defined?(ActionController::Base)
|
28
|
-
# if we are not running in Merb,
|
50
|
+
# if we are not running in Merb, try to hook up Rails
|
29
51
|
Mime::Type.register_alias "application/xml", :fxml
|
30
52
|
|
31
|
-
['
|
32
|
-
'rails/ruboss_test_helpers'].each { |lib| require Ruboss::LIB_DIR + lib }
|
53
|
+
['active_foo', 'active_record_default_methods', 'rails/swf_helper'].each { |lib| require Ruboss4Ruby::LIB_DIR + lib }
|
33
54
|
|
34
|
-
ActionView::Base.send :include,
|
35
|
-
Test::Unit::TestCase.send :include, RubossTestHelpers unless Test::Unit::TestCase.included_modules.include?(RubossTestHelpers)
|
55
|
+
ActionView::Base.send :include, SWFHelper unless ActionView::Base.included_modules.include?(SWFHelper)
|
36
56
|
|
37
57
|
module ActionController
|
38
58
|
class Base
|
@@ -52,7 +72,7 @@ elsif defined?(ActionController::Base)
|
|
52
72
|
end
|
53
73
|
end
|
54
74
|
|
55
|
-
module
|
75
|
+
module Ruboss4RubyController
|
56
76
|
private
|
57
77
|
|
58
78
|
# Extract any keys named _metadata from the models in the params hash
|
@@ -76,7 +96,7 @@ elsif defined?(ActionController::Base)
|
|
76
96
|
end
|
77
97
|
end
|
78
98
|
|
79
|
-
ActionController::Base.send :include,
|
99
|
+
ActionController::Base.send :include, Ruboss4RubyController
|
80
100
|
ActionController::Base.send :prepend_before_filter, :extract_metadata_from_params
|
81
101
|
|
82
102
|
# temporarily disable forgery protection site-wise
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'open-uri'
|
2
2
|
|
3
3
|
class RubossConfigGenerator < Rails::Generator::Base
|
4
|
-
include
|
4
|
+
include Ruboss4Ruby::Configuration
|
5
5
|
|
6
6
|
attr_reader :project_name,
|
7
7
|
:flex_project_name,
|
@@ -73,7 +73,7 @@ class RubossConfigGenerator < Rails::Generator::Base
|
|
73
73
|
|
74
74
|
m.directory "app/flex/#{base_folder}/components/generated"
|
75
75
|
|
76
|
-
framework_release =
|
76
|
+
framework_release = Ruboss4Ruby::RUBOSS_FRAMEWORK_VERSION
|
77
77
|
framework_distribution_url = "http://ruboss.com/releases/ruboss-#{framework_release}.swc"
|
78
78
|
framework_destination_file = "lib/ruboss-#{framework_release}.swc"
|
79
79
|
|
@@ -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> -->
|
@@ -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,106 +1,106 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" label="<%= class_name %>"
|
3
3
|
xmlns:rcomponents="org.ruboss.components.*">
|
4
|
-
<mx:Script><![CDATA[
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
<mx:Script><![CDATA[
|
5
|
+
import org.ruboss.Ruboss;
|
6
|
+
import org.ruboss.utils.RubossUtils;
|
7
|
+
import <%= base_package %>.models.<%= class_name %>;
|
8
8
|
<% for model in belongs_tos -%>
|
9
|
-
|
9
|
+
import <%= base_package %>.models.<%= model.camelcase %>;
|
10
10
|
<% end -%>
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
[Bindable]
|
13
|
+
private var _<%= class_name.dcfirst %>:<%= class_name %> = new <%= class_name %>();
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
private function new<%= class_name %>():void {
|
16
|
+
_<%= class_name.dcfirst %> = new <%= class_name %>();
|
17
|
+
<%= class_name.dcfirst.pluralize %>List.selectedIndex = -1;
|
18
|
+
}
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
private function save<%= class_name %>():void {
|
21
|
+
if (_<%= class_name.dcfirst %>.id) {
|
22
|
+
update<%= class_name %>();
|
23
|
+
} else {
|
24
|
+
create<%= class_name %>();
|
25
|
+
}
|
25
26
|
}
|
26
|
-
}
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
private function create<%= class_name %>():void {
|
29
|
+
var <%= class_name.dcfirst %>:<%= class_name %> = new <%= class_name %>();
|
30
30
|
<% for attribute in attributes -%>
|
31
31
|
<% if attribute.type == :boolean -%>
|
32
|
-
|
32
|
+
<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>CheckBox.selected;
|
33
33
|
<% elsif attribute.type == :string -%>
|
34
|
-
|
34
|
+
<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>TextInput.text;
|
35
35
|
<% elsif attribute.type == :text -%>
|
36
|
-
|
36
|
+
<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>TextArea.text;
|
37
37
|
<% elsif attribute.type == :datetime || attribute.type == :time -%>
|
38
|
-
|
38
|
+
<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>DateTimeTextInput.date;
|
39
39
|
<% elsif attribute.type == :date -%>
|
40
|
-
|
40
|
+
<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>DateField.selectedDate;
|
41
41
|
<% else -%>
|
42
|
-
|
42
|
+
<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_type %>(<%= attribute.flex_name %>TextInput.text);
|
43
43
|
<% end -%>
|
44
44
|
<% end -%>
|
45
45
|
|
46
46
|
<% for model in belongs_tos -%>
|
47
|
-
|
47
|
+
<%= class_name.dcfirst %>.<%= model.camelcase(:lower) %> = <%= model.camelcase %>(<%= model.camelcase(:lower) %>ComboBox.selectedItem);
|
48
48
|
<% end -%>
|
49
|
-
|
50
|
-
|
49
|
+
<%= class_name.dcfirst %>.create({onSuccess: on<%= class_name %>Create});
|
50
|
+
}
|
51
51
|
|
52
|
-
|
52
|
+
private function update<%= class_name %>():void {
|
53
53
|
<% for attribute in attributes -%>
|
54
54
|
<% if attribute.type == :boolean -%>
|
55
|
-
|
55
|
+
_<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>CheckBox.selected;
|
56
56
|
<% elsif attribute.type == :string -%>
|
57
|
-
|
57
|
+
_<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>TextInput.text;
|
58
58
|
<% elsif attribute.type == :text -%>
|
59
|
-
|
59
|
+
_<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>TextArea.text;
|
60
60
|
<% elsif attribute.type == :datetime || attribute.type == :time -%>
|
61
|
-
|
61
|
+
_<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>DateTimeTextInput.date;
|
62
62
|
<% elsif attribute.type == :date -%>
|
63
|
-
|
63
|
+
_<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_name %>DateField.selectedDate;
|
64
64
|
<% else -%>
|
65
|
-
|
65
|
+
_<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_type %>(<%= attribute.flex_name %>TextInput.text);
|
66
66
|
<% end -%>
|
67
67
|
<% end -%>
|
68
68
|
|
69
69
|
<% for model in belongs_tos -%>
|
70
|
-
|
70
|
+
_<%= class_name.dcfirst %>.<%= model.camelcase(:lower) %> = <%= model.camelcase %>(<%= model.camelcase(:lower) %>ComboBox.selectedItem);
|
71
71
|
<% end -%>
|
72
|
-
|
73
|
-
|
72
|
+
_<%= class_name.dcfirst %>.update({onSuccess: on<%= class_name %>Update});
|
73
|
+
}
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
private function destroy<%= class_name %>():void {
|
76
|
+
_<%= class_name.dcfirst %>.destroy({onSuccess: on<%= class_name %>Destroy});
|
77
|
+
}
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
private function on<%= class_name %>Select():void {
|
80
|
+
_<%= class_name.dcfirst %> = RubossUtils.clone(<%= class_name.dcfirst.pluralize %>List.selectedItem) as <%= class_name %>;
|
81
|
+
}
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
private function on<%= class_name %>Create(<%= class_name.dcfirst %>:<%= class_name %>):void {
|
84
|
+
_<%= class_name.dcfirst %> = new <%= class_name %>;
|
85
|
+
}
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
87
|
+
private function on<%= class_name %>Update(<%= class_name.dcfirst %>:<%= class_name %>):void {
|
88
|
+
<%= class_name.dcfirst.pluralize %>List.selectedItem = <%= class_name.dcfirst %>;
|
89
|
+
_<%= class_name.dcfirst %> = RubossUtils.clone(<%= class_name.dcfirst %>) as <%= class_name %>;
|
90
|
+
}
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
private function on<%= class_name %>Destroy(<%= class_name.dcfirst %>:<%= class_name %>):void {
|
93
|
+
on<%= class_name %>Create(<%= class_name.dcfirst %>);
|
94
|
+
}
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
]]></mx:Script>
|
100
|
-
<mx:Panel id="<%= class_name.
|
96
|
+
private function canDelete<%= class_name %>(<%= class_name.dcfirst %>:<%= class_name %>):Boolean {
|
97
|
+
return <%= class_name.dcfirst %> != null && !RubossUtils.isEmpty(<%= class_name.dcfirst %>.id);
|
98
|
+
}
|
99
|
+
]]></mx:Script>
|
100
|
+
<mx:Panel id="<%= class_name.dcfirst.pluralize %>Panel"
|
101
101
|
title="<%= class_name.pluralize %>" cornerRadius="0" dropShadowEnabled="false" borderStyle="solid"
|
102
102
|
borderThickness="1" backgroundColor="#EEEEEE" width="25%" height="100%">
|
103
|
-
<mx:List id="<%= class_name.
|
103
|
+
<mx:List id="<%= class_name.dcfirst.pluralize %>List"
|
104
104
|
width="100%" height="100%"
|
105
105
|
dataProvider="{Ruboss.models.index(<%= class_name %>)}"
|
106
106
|
change="on<%= class_name %>Select()"/>
|
@@ -113,19 +113,19 @@
|
|
113
113
|
borderThickness="1" backgroundColor="#EEEEEE" width="75%" height="100%">
|
114
114
|
<mx:Form width="100%" height="100%">
|
115
115
|
<% for attribute in attributes -%>
|
116
|
-
<mx:FormItem label="<%= attribute.flex_name.
|
116
|
+
<mx:FormItem label="<%= attribute.flex_name.ucfirst %>" width="100%">
|
117
117
|
<% if attribute.type == :boolean -%>
|
118
|
-
<mx:CheckBox id="<%= attribute.flex_name %>CheckBox" selected="{_<%= class_name.
|
118
|
+
<mx:CheckBox id="<%= attribute.flex_name %>CheckBox" selected="{_<%= class_name.dcfirst %>.<%= attribute.flex_name %>}"/>
|
119
119
|
<% elsif attribute.type == :string -%>
|
120
|
-
<mx:TextInput id="<%= attribute.flex_name %>TextInput" width="100%" text="{_<%= class_name.
|
120
|
+
<mx:TextInput id="<%= attribute.flex_name %>TextInput" width="100%" text="{_<%= class_name.dcfirst %>.<%= attribute.flex_name %>}"/>
|
121
121
|
<% elsif attribute.type == :text -%>
|
122
|
-
<mx:TextArea id="<%= attribute.flex_name %>TextArea" width="100%" height="200" text="{_<%= class_name.
|
122
|
+
<mx:TextArea id="<%= attribute.flex_name %>TextArea" width="100%" height="200" text="{_<%= class_name.dcfirst %>.<%= attribute.flex_name %>}"/>
|
123
123
|
<% elsif attribute.type == :datetime || attribute.type == :time -%>
|
124
|
-
<rcomponents:DateTimeTextInput id="<%= attribute.flex_name %>DateTimeTextInput" width="200" date="{_<%= class_name.
|
124
|
+
<rcomponents:DateTimeTextInput id="<%= attribute.flex_name %>DateTimeTextInput" width="200" date="{_<%= class_name.dcfirst %>.<%= attribute.flex_name %>}"/>
|
125
125
|
<% elsif attribute.type == :date -%>
|
126
|
-
<mx:DateField id="<%= attribute.flex_name %>DateField" selectedDate="{_<%= class_name.
|
126
|
+
<mx:DateField id="<%= attribute.flex_name %>DateField" selectedDate="{_<%= class_name.dcfirst %>.<%= attribute.flex_name %>}"/>
|
127
127
|
<% else -%>
|
128
|
-
<mx:TextInput id="<%= attribute.flex_name %>TextInput" width="100%" text="{_<%= class_name.
|
128
|
+
<mx:TextInput id="<%= attribute.flex_name %>TextInput" width="100%" text="{_<%= class_name.dcfirst %>.<%= attribute.flex_name %>}"/>
|
129
129
|
<% end -%>
|
130
130
|
</mx:FormItem>
|
131
131
|
<% end -%>
|
@@ -134,7 +134,7 @@
|
|
134
134
|
<mx:ComboBox id="<%= model.camelcase(:lower) %>ComboBox" width="200"
|
135
135
|
labelField="{<%= model.camelcase %>.LABEL}"
|
136
136
|
dataProvider="{Ruboss.models.index(<%= model.camelcase %>)}" prompt="<%= model.camelcase %> ..."
|
137
|
-
selectedItem="{_<%= class_name.
|
137
|
+
selectedItem="{_<%= class_name.dcfirst %>.<%= model.camelcase(:lower) %>}" />
|
138
138
|
</mx:FormItem>
|
139
139
|
<% end -%>
|
140
140
|
</mx:Form>
|
@@ -142,7 +142,7 @@
|
|
142
142
|
<mx:Button label="Save <%= class_name %>" width="50%" height="30"
|
143
143
|
click="save<%= class_name %>()"/>
|
144
144
|
<mx:Button label="Delete <%= class_name %>" width="50%" height="30"
|
145
|
-
enabled="{canDelete<%= class_name %>(_<%= class_name.
|
145
|
+
enabled="{canDelete<%= class_name %>(_<%= class_name.dcfirst %>)}"
|
146
146
|
click="destroy<%= class_name %>()"/>
|
147
147
|
</mx:ControlBar>
|
148
148
|
</mx:Panel>
|
data/ruboss4ruby.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{ruboss4ruby}
|
5
|
+
s.version = "1.1.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Dima Berastau"]
|
9
|
+
s.date = %q{2008-12-26}
|
10
|
+
s.default_executable = %q{ruboss-gen}
|
11
|
+
s.description = %q{Ruboss Framework Code Generation Engine / Rails 2.1+ and Merb 1.0 Integration Support}
|
12
|
+
s.email = %q{dima@ruboss.com}
|
13
|
+
s.executables = ["ruboss-gen"]
|
14
|
+
s.extra_rdoc_files = ["History.txt", "README.rdoc", "bin/ruboss-gen", "gpl-3.0.txt", "rcl-1.0.txt", "test/rails/playing_around_in_a_console.txt"]
|
15
|
+
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "app_generators/ruboss_app/USAGE", "app_generators/ruboss_app/ruboss_app_generator.rb", "app_generators/ruboss_app/templates/actionscript.properties", "app_generators/ruboss_app/templates/actionscriptair.properties", "app_generators/ruboss_app/templates/default_tasks.rake", "app_generators/ruboss_app/templates/expressInstall.swf", "app_generators/ruboss_app/templates/flex.properties", "app_generators/ruboss_app/templates/generate.rb", "app_generators/ruboss_app/templates/html-template/AC_OETags.js", "app_generators/ruboss_app/templates/html-template/history/history.css", "app_generators/ruboss_app/templates/html-template/history/history.js", "app_generators/ruboss_app/templates/html-template/history/historyFrame.html", "app_generators/ruboss_app/templates/html-template/index.template.html", "app_generators/ruboss_app/templates/html-template/playerProductInstall.swf", "app_generators/ruboss_app/templates/index.html.erb", "app_generators/ruboss_app/templates/mainair-app.xml", "app_generators/ruboss_app/templates/mainapp-config.xml", "app_generators/ruboss_app/templates/mainapp.mxml", "app_generators/ruboss_app/templates/project-textmate.erb", "app_generators/ruboss_app/templates/project.properties", "app_generators/ruboss_app/templates/projectair.properties", "app_generators/ruboss_app/templates/swfobject.js", "bin/ruboss-gen", "generators/ruboss_config/USAGE", "generators/ruboss_config/ruboss_config_generator.rb", "generators/ruboss_controller/USAGE", "generators/ruboss_controller/ruboss_controller_generator.rb", "generators/ruboss_controller/templates/controller.as.erb", "generators/ruboss_main_app/USAGE", "generators/ruboss_main_app/ruboss_main_app_generator.rb", "generators/ruboss_main_app/templates/mainapp.mxml", "generators/ruboss_scaffold/USAGE", "generators/ruboss_scaffold/ruboss_scaffold_generator.rb", "generators/ruboss_scaffold/templates/component.mxml.erb", "generators/ruboss_scaffold/templates/model.as.erb", "generators/ruboss_yaml_scaffold/USAGE", "generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb", "gpl-3.0.txt", "lib/ruboss4ruby.rb", "lib/ruboss4ruby/active_foo.rb", "lib/ruboss4ruby/active_record_default_methods.rb", "lib/ruboss4ruby/active_record_tasks.rb", "lib/ruboss4ruby/configuration.rb", "lib/ruboss4ruby/datamapper_foo.rb", "lib/ruboss4ruby/rails/recipes.rb", "lib/ruboss4ruby/rails/swf_helper.rb", "lib/ruboss4ruby/tasks.rb", "rails_generators/ruboss_config/USAGE", "rails_generators/ruboss_config/ruboss_config_generator.rb", "rails_generators/ruboss_config/templates/actionscript.properties", "rails_generators/ruboss_config/templates/actionscriptair.properties", "rails_generators/ruboss_config/templates/expressInstall.swf", "rails_generators/ruboss_config/templates/flex.properties", "rails_generators/ruboss_config/templates/html-template/AC_OETags.js", "rails_generators/ruboss_config/templates/html-template/history/history.css", "rails_generators/ruboss_config/templates/html-template/history/history.js", "rails_generators/ruboss_config/templates/html-template/history/historyFrame.html", "rails_generators/ruboss_config/templates/html-template/index.template.html", "rails_generators/ruboss_config/templates/html-template/playerProductInstall.swf", "rails_generators/ruboss_config/templates/index.html.erb", "rails_generators/ruboss_config/templates/mainair-app.xml", "rails_generators/ruboss_config/templates/mainapp-config.xml", "rails_generators/ruboss_config/templates/mainapp.mxml", "rails_generators/ruboss_config/templates/project-textmate.erb", "rails_generators/ruboss_config/templates/project.properties", "rails_generators/ruboss_config/templates/projectair.properties", "rails_generators/ruboss_config/templates/ruboss.yml", "rails_generators/ruboss_config/templates/ruboss_tasks.rake", "rails_generators/ruboss_config/templates/swfobject.js", "rails_generators/ruboss_controller/USAGE", "rails_generators/ruboss_controller/ruboss_controller_generator.rb", "rails_generators/ruboss_controller/templates/controller.as.erb", "rails_generators/ruboss_scaffold/USAGE", "rails_generators/ruboss_scaffold/ruboss_scaffold_generator.rb", "rails_generators/ruboss_scaffold/templates/component.mxml.erb", "rails_generators/ruboss_scaffold/templates/controller.rb.erb", "rails_generators/ruboss_scaffold/templates/fixtures.yml.erb", "rails_generators/ruboss_scaffold/templates/migration.rb.erb", "rails_generators/ruboss_scaffold/templates/model.as.erb", "rails_generators/ruboss_scaffold/templates/model.rb.erb", "rails_generators/ruboss_yaml_scaffold/USAGE", "rails_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb", "rcl-1.0.txt", "ruboss4ruby.gemspec", "spec/ruboss4ruby_spec.rb", "spec/spec_helper.rb", "tasks/ann.rake", "tasks/bones.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/manifest.rake", "tasks/notes.rake", "tasks/post_load.rake", "tasks/rdoc.rake", "tasks/rubyforge.rake", "tasks/setup.rb", "tasks/spec.rake", "tasks/svn.rake", "tasks/test.rake", "test/rails/controllers/application.rb", "test/rails/controllers/locations_controller.rb", "test/rails/controllers/notes_controller.rb", "test/rails/controllers/projects_controller.rb", "test/rails/controllers/tasks_controller.rb", "test/rails/controllers/users_controller.rb", "test/rails/database.yml", "test/rails/fixtures/locations.yml", "test/rails/fixtures/notes.yml", "test/rails/fixtures/projects.yml", "test/rails/fixtures/simple_properties.yml", "test/rails/fixtures/tasks.yml", "test/rails/fixtures/users.yml", "test/rails/helpers/controllers.log", "test/rails/helpers/functional_test_helper.rb", "test/rails/helpers/models.log", "test/rails/helpers/test_helper.rb", "test/rails/helpers/unit_test_helper.rb", "test/rails/model.yml", "test/rails/models/location.rb", "test/rails/models/note.rb", "test/rails/models/project.rb", "test/rails/models/simple_property.rb", "test/rails/models/task.rb", "test/rails/models/user.rb", "test/rails/playing_around_in_a_console.txt", "test/rails/schema.rb", "test/rails/test.sqlite3", "test/rails/test.swf", "test/rails/test_active_foo.rb", "test/rails/test_ruboss_rails_integration_functional.rb", "test/rails/test_to_fxml.rb", "test/rails/test_to_json.rb", "test/rails/views/notes/empty_params_action.html.erb", "test/rails/views/notes/index.html.erb"]
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.homepage = %q{http://github.com/dima/ruboss4ruby/wikis}
|
18
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.rubyforge_project = %q{ruboss4ruby}
|
21
|
+
s.rubygems_version = %q{1.3.1}
|
22
|
+
s.summary = %q{Ruboss Framework Code Generation Engine / Rails 2.1+ and Merb 1.0 Integration Support}
|
23
|
+
s.test_files = ["test/rails/helpers/test_helper.rb", "test/rails/test_active_foo.rb", "test/rails/test_ruboss_rails_integration_functional.rb", "test/rails/test_to_fxml.rb", "test/rails/test_to_json.rb"]
|
24
|
+
|
25
|
+
if s.respond_to? :specification_version then
|
26
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
27
|
+
s.specification_version = 2
|
28
|
+
|
29
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
30
|
+
s.add_runtime_dependency(%q<rubigen>, [">= 1.4.0"])
|
31
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"])
|
32
|
+
s.add_development_dependency(%q<bones>, [">= 2.1.1"])
|
33
|
+
else
|
34
|
+
s.add_dependency(%q<rubigen>, [">= 1.4.0"])
|
35
|
+
s.add_dependency(%q<activesupport>, [">= 2.2.2"])
|
36
|
+
s.add_dependency(%q<bones>, [">= 2.1.1"])
|
37
|
+
end
|
38
|
+
else
|
39
|
+
s.add_dependency(%q<rubigen>, [">= 1.4.0"])
|
40
|
+
s.add_dependency(%q<activesupport>, [">= 2.2.2"])
|
41
|
+
s.add_dependency(%q<bones>, [">= 2.1.1"])
|
42
|
+
end
|
43
|
+
end
|