ruboss4ruby 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Generators +5 -0
- data/Manifest.txt +39 -41
- data/Rakefile +2 -1
- data/lib/ruboss4ruby.rb +16 -12
- data/lib/ruboss4ruby/active_foo.rb +39 -3
- data/lib/ruboss4ruby/recipes.rb +62 -0
- data/lib/ruboss4ruby/ruboss_helper.rb +54 -0
- data/lib/ruboss4ruby/ruboss_test_helpers.rb +31 -0
- data/lib/ruboss4ruby/tasks.rb +0 -2
- data/lib/ruboss4ruby/version.rb +2 -2
- data/merb_generators/ruboss_config.rb +19 -19
- data/merb_generators/ruboss_controller.rb +3 -3
- data/merb_generators/ruboss_flex_app.rb +3 -3
- data/merb_generators/ruboss_resource_controller.rb +3 -3
- data/merb_generators/ruboss_scaffold.rb +47 -47
- data/rails_generators/ruboss_config/ruboss_config_generator.rb +2 -2
- data/rails_generators/ruboss_config/templates/index.html.erb +2 -2
- data/rails_generators/ruboss_config/templates/mainapp-config.xml +21 -0
- data/rails_generators/ruboss_config/templates/mainapp.mxml +4 -7
- data/rails_generators/ruboss_config/templates/project-textmate.erb +52 -0
- data/rails_generators/ruboss_controller/ruboss_controller_generator.rb +0 -2
- data/rails_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +0 -2
- data/rails_generators/ruboss_scaffold/templates/component.mxml.erb +4 -3
- data/rails_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb +0 -1
- data/test/controllers/application.rb +15 -0
- data/test/controllers/locations_controller.rb +93 -0
- data/test/controllers/notes_controller.rb +96 -0
- data/test/controllers/projects_controller.rb +93 -0
- data/test/controllers/tasks_controller.rb +93 -0
- data/test/controllers/users_controller.rb +93 -0
- data/test/database.yml +4 -0
- data/test/fixtures/locations.yml +8 -0
- data/test/fixtures/notes.yml +17 -0
- data/test/fixtures/projects.yml +25 -0
- data/test/fixtures/tasks.yml +46 -0
- data/test/fixtures/users.yml +13 -0
- data/test/helpers/controllers.log +8 -0
- data/test/helpers/functional_test_helper.rb +32 -0
- data/test/helpers/models.log +170 -0
- data/test/helpers/test_helper.rb +25 -0
- data/test/helpers/unit_test_helper.rb +23 -0
- data/test/model.yml +35 -0
- data/test/models/location.rb +4 -0
- data/test/models/note.rb +3 -0
- data/test/models/project.rb +6 -0
- data/test/models/task.rb +20 -0
- data/test/models/user.rb +23 -0
- data/test/playing_around_in_a_console.txt +71 -0
- data/test/schema.rb +63 -0
- data/test/test.sqlite3 +0 -0
- data/test/test.swf +1 -0
- data/test/test_active_foo.rb +79 -0
- data/test/test_ruboss_rails_integration_functional.rb +27 -0
- data/test/test_swfobject_helper.rb +63 -0
- data/test/to_fxml_test.rb +79 -0
- data/test/views/notes/empty_params_action.html.erb +1 -0
- data/test/views/notes/index.html.erb +1 -0
- metadata +57 -52
- data/merb_generators/ruboss_config/USAGE +0 -18
- data/merb_generators/ruboss_config/ruboss_config_generator.rb +0 -135
- data/merb_generators/ruboss_config/templates/actionscript.properties +0 -16
- data/merb_generators/ruboss_config/templates/actionscriptair.properties +0 -16
- data/merb_generators/ruboss_config/templates/expressInstall.swf +0 -0
- data/merb_generators/ruboss_config/templates/flex.properties +0 -2
- data/merb_generators/ruboss_config/templates/html-template/AC_OETags.js +0 -276
- data/merb_generators/ruboss_config/templates/html-template/history/history.css +0 -6
- data/merb_generators/ruboss_config/templates/html-template/history/history.js +0 -645
- data/merb_generators/ruboss_config/templates/html-template/history/historyFrame.html +0 -29
- data/merb_generators/ruboss_config/templates/html-template/index.template.html +0 -121
- data/merb_generators/ruboss_config/templates/html-template/playerProductInstall.swf +0 -0
- data/merb_generators/ruboss_config/templates/index.html.erb +0 -18
- data/merb_generators/ruboss_config/templates/mainair-app.xml +0 -134
- data/merb_generators/ruboss_config/templates/mainapp.mxml +0 -34
- data/merb_generators/ruboss_config/templates/project.properties +0 -18
- data/merb_generators/ruboss_config/templates/projectair.properties +0 -24
- data/merb_generators/ruboss_config/templates/swfobject.js +0 -5
- data/merb_generators/ruboss_controller/USAGE +0 -11
- data/merb_generators/ruboss_controller/ruboss_controller_generator.rb +0 -32
- data/merb_generators/ruboss_resource_controller/USAGE +0 -5
- data/merb_generators/ruboss_resource_controller/ruboss_resource_controller_generator.rb +0 -70
- data/merb_generators/ruboss_resource_controller/templates/app/controllers/%controller_file_name%.rb +0 -55
- data/merb_generators/ruboss_resource_controller/templates/app/helpers/%controller_file_name%_helper.rb +0 -16
- data/merb_generators/ruboss_scaffold/USAGE +0 -5
- data/merb_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +0 -127
- data/merb_generators/ruboss_yaml_scaffold/USAGE +0 -5
- data/merb_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb +0 -53
- data/merb_generators/templates/ruboss_scaffold/component.mxml.erb +0 -148
- data/merb_generators/templates/ruboss_scaffold/fixtures.yml.erb +0 -35
- data/merb_generators/templates/ruboss_scaffold/migration.rb.erb +0 -19
- data/merb_generators/templates/ruboss_scaffold/model.as.erb +0 -42
- data/merb_generators/templates/ruboss_scaffold/model.rb.erb +0 -11
- data/test/active_foo_test.rb +0 -16
- data/test/test_generator_helper.rb +0 -29
- data/test/test_helper.rb +0 -2
- data/test/test_ruboss_config_generator.rb +0 -45
- data/test/test_ruboss_controller_generator.rb +0 -45
- data/test/test_ruboss_on_ruby.rb +0 -11
- data/test/test_ruboss_scaffold_generator.rb +0 -45
- data/test/test_ruboss_yaml_scaffold_generator.rb +0 -46
data/Generators
ADDED
data/Manifest.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
Generators
|
1
2
|
History.txt
|
2
3
|
Manifest.txt
|
3
4
|
README.txt
|
@@ -10,41 +11,16 @@ lib/ruboss4ruby/active_foo.rb
|
|
10
11
|
lib/ruboss4ruby/active_record_tasks.rb
|
11
12
|
lib/ruboss4ruby/configuration.rb
|
12
13
|
lib/ruboss4ruby/generated_attribute.rb
|
14
|
+
lib/ruboss4ruby/recipes.rb
|
15
|
+
lib/ruboss4ruby/ruboss_helper.rb
|
16
|
+
lib/ruboss4ruby/ruboss_test_helpers.rb
|
13
17
|
lib/ruboss4ruby/tasks.rb
|
14
18
|
lib/ruboss4ruby/version.rb
|
15
19
|
merb_generators/ruboss_config.rb
|
16
|
-
merb_generators/ruboss_config/USAGE
|
17
|
-
merb_generators/ruboss_config/ruboss_config_generator.rb
|
18
|
-
merb_generators/ruboss_config/templates/actionscript.properties
|
19
|
-
merb_generators/ruboss_config/templates/actionscriptair.properties
|
20
|
-
merb_generators/ruboss_config/templates/expressInstall.swf
|
21
|
-
merb_generators/ruboss_config/templates/flex.properties
|
22
|
-
merb_generators/ruboss_config/templates/html-template/AC_OETags.js
|
23
|
-
merb_generators/ruboss_config/templates/html-template/history/history.css
|
24
|
-
merb_generators/ruboss_config/templates/html-template/history/history.js
|
25
|
-
merb_generators/ruboss_config/templates/html-template/history/historyFrame.html
|
26
|
-
merb_generators/ruboss_config/templates/html-template/index.template.html
|
27
|
-
merb_generators/ruboss_config/templates/html-template/playerProductInstall.swf
|
28
|
-
merb_generators/ruboss_config/templates/index.html.erb
|
29
|
-
merb_generators/ruboss_config/templates/mainair-app.xml
|
30
|
-
merb_generators/ruboss_config/templates/mainapp.mxml
|
31
|
-
merb_generators/ruboss_config/templates/project.properties
|
32
|
-
merb_generators/ruboss_config/templates/projectair.properties
|
33
|
-
merb_generators/ruboss_config/templates/swfobject.js
|
34
20
|
merb_generators/ruboss_controller.rb
|
35
|
-
merb_generators/ruboss_controller/USAGE
|
36
|
-
merb_generators/ruboss_controller/ruboss_controller_generator.rb
|
37
21
|
merb_generators/ruboss_flex_app.rb
|
38
22
|
merb_generators/ruboss_resource_controller.rb
|
39
|
-
merb_generators/ruboss_resource_controller/USAGE
|
40
|
-
merb_generators/ruboss_resource_controller/ruboss_resource_controller_generator.rb
|
41
|
-
merb_generators/ruboss_resource_controller/templates/app/controllers/%controller_file_name%.rb
|
42
|
-
merb_generators/ruboss_resource_controller/templates/app/helpers/%controller_file_name%_helper.rb
|
43
23
|
merb_generators/ruboss_scaffold.rb
|
44
|
-
merb_generators/ruboss_scaffold/USAGE
|
45
|
-
merb_generators/ruboss_scaffold/ruboss_scaffold_generator.rb
|
46
|
-
merb_generators/ruboss_yaml_scaffold/USAGE
|
47
|
-
merb_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb
|
48
24
|
merb_generators/templates/ruboss_config/actionscript.properties
|
49
25
|
merb_generators/templates/ruboss_config/actionscriptair.properties
|
50
26
|
merb_generators/templates/ruboss_config/expressInstall.swf
|
@@ -64,11 +40,6 @@ merb_generators/templates/ruboss_config/swfobject.js
|
|
64
40
|
merb_generators/templates/ruboss_controller/controller.as.erb
|
65
41
|
merb_generators/templates/ruboss_flex_app/mainapp.mxml
|
66
42
|
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
|
72
43
|
rails_generators/ruboss_config/USAGE
|
73
44
|
rails_generators/ruboss_config/ruboss_config_generator.rb
|
74
45
|
rails_generators/ruboss_config/templates/actionscript.properties
|
@@ -83,7 +54,9 @@ rails_generators/ruboss_config/templates/html-template/index.template.html
|
|
83
54
|
rails_generators/ruboss_config/templates/html-template/playerProductInstall.swf
|
84
55
|
rails_generators/ruboss_config/templates/index.html.erb
|
85
56
|
rails_generators/ruboss_config/templates/mainair-app.xml
|
57
|
+
rails_generators/ruboss_config/templates/mainapp-config.xml
|
86
58
|
rails_generators/ruboss_config/templates/mainapp.mxml
|
59
|
+
rails_generators/ruboss_config/templates/project-textmate.erb
|
87
60
|
rails_generators/ruboss_config/templates/project.properties
|
88
61
|
rails_generators/ruboss_config/templates/projectair.properties
|
89
62
|
rails_generators/ruboss_config/templates/ruboss.yml
|
@@ -111,14 +84,39 @@ setup.rb
|
|
111
84
|
tasks/deployment.rake
|
112
85
|
tasks/environment.rake
|
113
86
|
tasks/website.rake
|
114
|
-
test/
|
115
|
-
test/
|
116
|
-
test/
|
117
|
-
test/
|
118
|
-
test/
|
119
|
-
test/
|
120
|
-
test/
|
121
|
-
test/
|
87
|
+
test/controllers/application.rb
|
88
|
+
test/controllers/locations_controller.rb
|
89
|
+
test/controllers/notes_controller.rb
|
90
|
+
test/controllers/projects_controller.rb
|
91
|
+
test/controllers/tasks_controller.rb
|
92
|
+
test/controllers/users_controller.rb
|
93
|
+
test/database.yml
|
94
|
+
test/fixtures/locations.yml
|
95
|
+
test/fixtures/notes.yml
|
96
|
+
test/fixtures/projects.yml
|
97
|
+
test/fixtures/tasks.yml
|
98
|
+
test/fixtures/users.yml
|
99
|
+
test/helpers/controllers.log
|
100
|
+
test/helpers/functional_test_helper.rb
|
101
|
+
test/helpers/models.log
|
102
|
+
test/helpers/test_helper.rb
|
103
|
+
test/helpers/unit_test_helper.rb
|
104
|
+
test/model.yml
|
105
|
+
test/models/location.rb
|
106
|
+
test/models/note.rb
|
107
|
+
test/models/project.rb
|
108
|
+
test/models/task.rb
|
109
|
+
test/models/user.rb
|
110
|
+
test/playing_around_in_a_console.txt
|
111
|
+
test/schema.rb
|
112
|
+
test/test.sqlite3
|
113
|
+
test/test.swf
|
114
|
+
test/test_active_foo.rb
|
115
|
+
test/test_ruboss_rails_integration_functional.rb
|
116
|
+
test/test_swfobject_helper.rb
|
117
|
+
test/to_fxml_test.rb
|
118
|
+
test/views/notes/empty_params_action.html.erb
|
119
|
+
test/views/notes/index.html.erb
|
122
120
|
website/index.html
|
123
121
|
website/index.txt
|
124
122
|
website/javascripts/rounded_corners_lite.inc.js
|
data/Rakefile
CHANGED
data/lib/ruboss4ruby.rb
CHANGED
@@ -4,12 +4,12 @@ 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
|
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
13
|
|
14
14
|
require 'ruboss4ruby/version'
|
15
15
|
require 'ruboss4ruby/configuration'
|
@@ -22,9 +22,13 @@ elsif defined?(ActionController::Base)
|
|
22
22
|
# if we are not running in Merb, we've got to be running in Rails
|
23
23
|
Mime::Type.register_alias "application/xml", :fxml
|
24
24
|
|
25
|
-
require 'ruboss4ruby
|
26
|
-
require 'ruboss4ruby
|
27
|
-
require 'ruboss4ruby
|
25
|
+
require File.join(File.dirname(__FILE__),'ruboss4ruby', 'version')
|
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)
|
28
32
|
|
29
33
|
module ActionController
|
30
34
|
class Base
|
@@ -60,9 +64,9 @@ elsif defined?(ActionController::Base)
|
|
60
64
|
end
|
61
65
|
end
|
62
66
|
|
67
|
+
ActionController::Base.send :include, RubossController
|
68
|
+
ActionController::Base.send :prepend_before_filter, :extract_metadata_from_params
|
69
|
+
|
63
70
|
# temporarily disable forgery protection site-wise
|
64
71
|
ActionController::Base.allow_forgery_protection = false
|
65
|
-
|
66
|
-
ActionController::Base.send :include, RubossController
|
67
|
-
ActionController::Base.send :prepend_before_filter, :extract_metadata_from_params
|
68
72
|
end
|
@@ -41,7 +41,7 @@ module ActiveRecord
|
|
41
41
|
# Flex friendly XML serialization patches
|
42
42
|
class Base
|
43
43
|
class << self
|
44
|
-
alias_method :old_find, :find
|
44
|
+
alias_method :old_find, :find unless method_defined?(:old_find)
|
45
45
|
|
46
46
|
def find(*args)
|
47
47
|
result = old_find(*args)
|
@@ -69,6 +69,41 @@ module ActiveRecord
|
|
69
69
|
end
|
70
70
|
END
|
71
71
|
end
|
72
|
+
|
73
|
+
def default_fxml_hash(already_included = [])
|
74
|
+
# return {} unless self.class.respond_to?(:default_fxml_include_params) || self.class.respond_to?(:default_fxml_methods_array)
|
75
|
+
default_hash = {:include => {}}
|
76
|
+
default_hash[:methods] = self.default_fxml_methods_array if self.respond_to?(:default_fxml_methods_array)
|
77
|
+
if self.respond_to?(:default_fxml_include_params)
|
78
|
+
default_includes = self.default_fxml_include_params
|
79
|
+
default_hash[:include] = default_includes.inject({}) do |include_hash, included|
|
80
|
+
next if already_included.include?(included) # We only want to include things once, to avoid infinite loops
|
81
|
+
included_class = included.to_s.singularize.camelize.constantize
|
82
|
+
include_hash[included] = included_class.default_fxml_hash(already_included + default_includes)
|
83
|
+
include_hash
|
84
|
+
end
|
85
|
+
end
|
86
|
+
default_hash
|
87
|
+
end
|
88
|
+
|
89
|
+
# options[:include] can be a Hash, Array, Symbol or nil.
|
90
|
+
# We always want it as a Hash. This translates includes to a Hash like this:
|
91
|
+
# If it's a nil, return an empty Hash ({})
|
92
|
+
# If it's a Hash, then it is just returned
|
93
|
+
# If it's an array, then it returns a Hash with each array element as a key, and values of empty Hashes.
|
94
|
+
# If it's a symbol, then it returns a Hash with a single key/value pair, with the symbol as the key and an empty Hash as the value.
|
95
|
+
def includes_as_hash(includes = nil)
|
96
|
+
res = case
|
97
|
+
when includes.is_a?(Hash)
|
98
|
+
includes
|
99
|
+
when includes.nil?
|
100
|
+
{}
|
101
|
+
else #Deal with arrays and symbols
|
102
|
+
res = [includes].flatten.inject({}) {|include_hash, included| include_hash[included] = {} ; include_hash}
|
103
|
+
end
|
104
|
+
res
|
105
|
+
end
|
106
|
+
|
72
107
|
end
|
73
108
|
end
|
74
109
|
|
@@ -77,10 +112,11 @@ module ActiveRecord
|
|
77
112
|
options.merge!(:dasherize => false)
|
78
113
|
default_except = [:crypted_password, :salt, :remember_token, :remember_token_expires_at]
|
79
114
|
options[:except] = (options[:except] ? options[:except] + default_except : default_except)
|
80
|
-
options[:methods] = [options[:methods] || []].flatten + self.class.
|
81
|
-
options[:include] = [
|
115
|
+
options[:methods] = [options[:methods] || []].flatten + (self.class.default_fxml_hash[:methods] || [])
|
116
|
+
options[:include] = self.class.default_fxml_hash[:include].merge(self.class.includes_as_hash(options[:include]))
|
82
117
|
to_xml(options)
|
83
118
|
end
|
119
|
+
|
84
120
|
end
|
85
121
|
|
86
122
|
# Change the xml serializer so that '?'s are stripped from attribute names.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
# To use these recipes, add the following to your Capfile:
|
4
|
+
# require 'ruboss4ruby/recipes'
|
5
|
+
|
6
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
7
|
+
|
8
|
+
after "deploy:setup", "deploy:flex:setup"
|
9
|
+
|
10
|
+
namespace :db do
|
11
|
+
desc "runs db:refresh in the latest release directory."
|
12
|
+
task :refresh, :roles => :db do
|
13
|
+
run("cd #{latest_release} && rake db:refresh RAILS_ENV=production")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :deploy do
|
18
|
+
|
19
|
+
namespace :flex do
|
20
|
+
|
21
|
+
desc "Creates the flex_files directory in the shared directory"
|
22
|
+
task :setup do
|
23
|
+
flex_dir = File.join(shared_path, 'flex_files')
|
24
|
+
run "#{try_sudo} mkdir -p #{flex_dir} && #{try_sudo} chmod g+w #{flex_dir}"
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "uploads everything in public/bin up to the server"
|
28
|
+
task :via_dumb_copy, :roles => :app do
|
29
|
+
# the -p flag on mkdir makes intermediate directories (i.e. both /bin and /bin/history),
|
30
|
+
# and doesn't raise an error if any of the directories already exist.
|
31
|
+
rails_root = File.join(File.dirname(__FILE__), '..', '..', '..', '..')
|
32
|
+
base_dir = File.join(rails_root, 'public', 'bin')
|
33
|
+
ec2_base_dir = File.join(shared_path, 'flex_files')
|
34
|
+
|
35
|
+
Find.find(base_dir) do |file|
|
36
|
+
filename_without_base_dir = file.sub(base_dir, '')
|
37
|
+
if File.directory?(file)
|
38
|
+
run "mkdir -p #{File.join(ec2_base_dir, filename_without_base_dir)}"
|
39
|
+
else
|
40
|
+
content = File.open(file, 'rb') {|f| f.read}
|
41
|
+
put content, File.join(ec2_base_dir, filename_without_base_dir)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
desc "synchronizes the local and remote public/bin directories using rsync"
|
47
|
+
task :via_rsync, :roles => :app do
|
48
|
+
username = user || ENV['USER']
|
49
|
+
rails_root = File.join(File.dirname(__FILE__), '..', '..', '..', '..')
|
50
|
+
execute_on_servers do |server|
|
51
|
+
`rsync -r -p -v -e \"ssh -i #{ssh_options[:keys]}\" #{File.join(rails_root, 'public', 'bin')}/ #{username}@#{server}:#{File.join(shared_path, 'flex_files')}/`
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
task :make_symlink, :roles => :app do
|
56
|
+
run "ln -s #{shared_path}/flex_files #{release_path}/public/bin"
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module RubossHelper
|
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
|
+
})
|
18
|
+
arg_order = [:id, :width, :height, :version, :express_install_swf]
|
19
|
+
js_params = ["'#{swf_url}?#{rails_asset_id(swf_url)}'"]
|
20
|
+
js_params += arg_order.collect {|arg| "'#{params[arg]}'" }
|
21
|
+
|
22
|
+
# Add authenticity_token to flashVars. This will only work if flashVars is a Hash or nil
|
23
|
+
# If it's a string representing the name of a Javascript variable, then you need to add it yourself
|
24
|
+
# like this:
|
25
|
+
# <script>
|
26
|
+
# ... other code that defines flashVars and sets some of its parameters
|
27
|
+
# flashVars['authenticity_token'] = <%= form_authenticity_token -%>
|
28
|
+
# </script>
|
29
|
+
# If you include an authenticity_token parameter in flashVars,
|
30
|
+
# then the Flex app will add it to Ruboss.defaultMetadata, so that it will be sent
|
31
|
+
# back up to your Rails app with every request.
|
32
|
+
if params[:include_authenticity_token] && ActionController::Base.allow_forgery_protection
|
33
|
+
params[:flash_vars] = {} if params[:flash_vars].nil?
|
34
|
+
if params[:flash_vars].is_a?(Hash)
|
35
|
+
params[:flash_vars].reverse_merge!(:authenticity_token => form_authenticity_token)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
js_params += [params[:flash_vars], params[:params], params[:attributes]].collect do |hash_or_string|
|
40
|
+
if hash_or_string.is_a?(Hash)
|
41
|
+
hash_or_string.to_json
|
42
|
+
else # If it's not a hash, then it should be a string giving the name of the Javascript variable to use
|
43
|
+
hash_or_string
|
44
|
+
end
|
45
|
+
end.compact
|
46
|
+
|
47
|
+
swf_tag = javascript_tag do
|
48
|
+
"swfobject.embedSWF(#{js_params.join(',')})"
|
49
|
+
end
|
50
|
+
swf_tag += content_tag(:div, nil, :id => params[:id]) if params[:create_div]
|
51
|
+
swf_tag
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RubossTestHelpers
|
2
|
+
|
3
|
+
# Use this to test xml or fxml responses in unit tests. For example,
|
4
|
+
# set_response_to user.to_fxml
|
5
|
+
# assert_xml_select 'user name', 'quentin'
|
6
|
+
def set_response_to(response, content_type = 'xml')
|
7
|
+
@response = MockResponse.new(response, content_type)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Make xml functional testing work.
|
11
|
+
# From http://weblog.jamisbuck.org/2007/1/4/assert_xml_select
|
12
|
+
def xml_document
|
13
|
+
@xml_document ||= HTML::Document.new(@response.body, false, true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def assert_xml_select(*args, &block)
|
17
|
+
@html_document = xml_document
|
18
|
+
assert_select(*args, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
class MockResponse
|
24
|
+
attr_reader :body, :content_type
|
25
|
+
|
26
|
+
def initialize(body, content_type = 'xml')
|
27
|
+
@body = body
|
28
|
+
@content_type = content_type
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/lib/ruboss4ruby/tasks.rb
CHANGED
data/lib/ruboss4ruby/version.rb
CHANGED
@@ -49,36 +49,30 @@ module Merb::Generators
|
|
49
49
|
File.join(File.dirname(__FILE__), 'templates', 'ruboss_config')
|
50
50
|
end
|
51
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
52
|
empty_directory :bin, File.join('public', 'bin')
|
59
53
|
empty_directory :javascripts, File.join('public', 'javascripts')
|
60
54
|
empty_directory :schema, 'schema'
|
61
55
|
|
62
56
|
file :flex_properties, 'flex.properties', '.flexProperties'
|
63
57
|
|
64
|
-
template :actionscript_properties do
|
65
|
-
source
|
66
|
-
destination
|
58
|
+
template :actionscript_properties do |t|
|
59
|
+
t.source = "#{extract_config('actionscript')}.properties"
|
60
|
+
t.destination = '.actionScriptProperties'
|
67
61
|
end
|
68
62
|
|
69
|
-
template :project_properties do
|
70
|
-
source
|
71
|
-
destination
|
63
|
+
template :project_properties do |t|
|
64
|
+
t.source = "#{extract_config('project')}.properties"
|
65
|
+
t.destination = '.project'
|
72
66
|
end
|
73
67
|
|
74
68
|
%w(components controllers commands models events).each do |dir|
|
75
|
-
empty_directory dir.to_sym do
|
76
|
-
destination
|
69
|
+
empty_directory dir.to_sym do |t|
|
70
|
+
t.destination = File.join('app', 'flex', base_folder, dir)
|
77
71
|
end
|
78
72
|
end
|
79
73
|
|
80
|
-
empty_directory :generated do
|
81
|
-
File.join('app', 'flex', base_folder, 'components', 'generated')
|
74
|
+
empty_directory :generated do |t|
|
75
|
+
t.destination = File.join('app', 'flex', base_folder, 'components', 'generated')
|
82
76
|
end
|
83
77
|
|
84
78
|
glob!('html-template')
|
@@ -93,10 +87,16 @@ module Merb::Generators
|
|
93
87
|
|
94
88
|
invoke :ruboss_flex_app
|
95
89
|
|
96
|
-
template :air_descriptor, :air => true do
|
97
|
-
source
|
98
|
-
destination
|
90
|
+
template :air_descriptor, :air => true do |t|
|
91
|
+
t.source = 'mainair-app.xml'
|
92
|
+
t.destination = File.join('app', 'flex', "#{project_name}-app.xml")
|
99
93
|
end
|
94
|
+
|
95
|
+
desc <<-DESC
|
96
|
+
Generates the primary Ruboss directory structure.
|
97
|
+
Sets up Flex Builder specific descriptor files and options fetches
|
98
|
+
the latest published Ruboss Framework SWC file.
|
99
|
+
DESC
|
100
100
|
|
101
101
|
invoke :ruboss_controller
|
102
102
|
end
|