restfulx 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +65 -30
- data/VERSION.yml +4 -0
- data/app_generators/rx_app/rx_app_generator.rb +25 -9
- data/app_generators/rx_app/templates/actionscript.properties +3 -3
- data/app_generators/rx_app/templates/actionscriptair.properties +3 -3
- data/app_generators/rx_app/templates/app.yaml.erb +1 -1
- data/app_generators/rx_app/templates/default_tasks.rake +5 -18
- data/app_generators/rx_app/templates/generate.rb +1 -1
- data/app_generators/rx_app/templates/index.html.erb +1 -1
- data/app_generators/rx_app/templates/mainair-app.xml +3 -3
- data/app_generators/rx_app/templates/mainapp.mxml +123 -2
- data/app_generators/rx_app/templates/project-textmate.erb +4 -4
- data/app_generators/rx_app/templates/project.properties +1 -1
- data/app_generators/rx_app/templates/projectair.properties +1 -1
- data/app_generators/rx_app/templates/restfulx.yml +25 -0
- data/bin/rx-gen +1 -1
- data/lib/restfulx/active_foo.rb +0 -8
- data/lib/restfulx/active_record_tasks.rb +9 -0
- data/lib/restfulx/active_record_uuid_helper.rb +17 -0
- data/lib/restfulx/configuration.rb +19 -31
- data/lib/restfulx/rails/schema_to_yaml/extensions/enumerable.rb +8 -0
- data/lib/restfulx/rails/schema_to_yaml/settings/config.rb +17 -0
- data/lib/restfulx/rails/schema_to_yaml/settings/core.rb +70 -0
- data/lib/restfulx/rails/schema_to_yaml.rb +121 -0
- data/lib/restfulx/rails/swf_helper.rb +1 -6
- data/lib/restfulx/tasks.rb +68 -42
- data/lib/restfulx.rb +4 -35
- data/rails_generators/rx_config/USAGE +2 -1
- data/rails_generators/rx_config/rx_config_generator.rb +80 -53
- data/rails_generators/rx_config/templates/actionscript.properties +3 -3
- data/rails_generators/rx_config/templates/actionscriptair.properties +3 -3
- data/rails_generators/rx_config/templates/flex_controller.erb +4 -0
- data/rails_generators/rx_config/templates/{index.html.erb → index.erb} +2 -4
- data/rails_generators/rx_config/templates/mainair-app.xml +3 -3
- data/rails_generators/rx_config/templates/mainapp.mxml +100 -2
- data/rails_generators/rx_config/templates/project-textmate.erb +4 -4
- data/rails_generators/rx_config/templates/project.properties +1 -1
- data/rails_generators/rx_config/templates/projectair.properties +1 -1
- data/rails_generators/rx_config/templates/restfulx.erb +38 -0
- data/rails_generators/rx_config/templates/restfulx.yml +55 -4
- data/rails_generators/rx_config/templates/restfulx_tasks.rake +3 -0
- data/rails_generators/rx_config/templates/routes.erb +47 -0
- data/rails_generators/rx_controller/rx_controller_generator.rb +9 -6
- data/rails_generators/rx_controller/templates/controller.as.erb +7 -9
- data/rails_generators/rx_main_app/rx_main_app_generator.rb +60 -0
- data/rails_generators/rx_main_app/templates/mainapp.mxml +129 -0
- data/rails_generators/rx_scaffold/rx_scaffold_generator.rb +88 -34
- data/rails_generators/rx_scaffold/templates/{controller.rb.erb → controllers/default.rb.erb} +29 -1
- data/rails_generators/rx_scaffold/templates/controllers/resource_controller.rb.erb +23 -0
- data/rails_generators/rx_scaffold/templates/fixtures.yml.erb +9 -5
- data/{generators/rx_scaffold/templates/component.mxml.erb → rails_generators/rx_scaffold/templates/layouts/default.erb} +75 -59
- data/rails_generators/rx_scaffold/templates/migration.rb.erb +29 -2
- data/rails_generators/rx_scaffold/templates/model.as.erb +33 -2
- data/rails_generators/rx_scaffold/templates/model.rb.erb +36 -1
- data/rails_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +29 -10
- data/{generators → rxgen_generators}/rx_controller/rx_controller_generator.rb +7 -5
- data/{generators → rxgen_generators}/rx_controller/templates/assist.py +3 -3
- data/{generators → rxgen_generators}/rx_controller/templates/controller.as.erb +8 -6
- data/rxgen_generators/rx_controller/templates/iso8601.py +92 -0
- data/rxgen_generators/rx_main_app/USAGE +8 -0
- data/{generators → rxgen_generators}/rx_main_app/rx_main_app_generator.rb +10 -5
- data/rxgen_generators/rx_main_app/templates/mainapp.mxml +152 -0
- data/{generators → rxgen_generators}/rx_scaffold/rx_scaffold_generator.rb +6 -5
- data/{rails_generators → rxgen_generators}/rx_scaffold/templates/component.mxml.erb +24 -52
- data/spec/restfulx_spec.rb +1 -4
- data/spec/spec_helper.rb +0 -3
- data/tasks/restfulx.rake +2 -0
- metadata +102 -81
- data/History.txt +0 -7
- data/Manifest.txt +0 -127
- data/generators/rx_main_app/templates/mainapp.mxml +0 -35
- data/rdoc/generators/template/html/jamis.rb +0 -588
- data/tasks/ann.rake +0 -80
- data/tasks/bones.rake +0 -20
- data/tasks/gem.rake +0 -201
- data/tasks/git.rake +0 -40
- data/tasks/manifest.rake +0 -48
- data/tasks/notes.rake +0 -27
- data/tasks/post_load.rake +0 -39
- data/tasks/rdoc.rake +0 -50
- data/tasks/rubyforge.rake +0 -55
- data/tasks/setup.rb +0 -279
- data/tasks/spec.rake +0 -54
- data/tasks/svn.rake +0 -47
- data/tasks/test.rake +0 -40
- data/test/rails/playing_around_in_a_console.txt +0 -71
- /data/{generators → rails_generators}/rx_main_app/USAGE +0 -0
- /data/{generators → rxgen_generators}/rx_config/USAGE +0 -0
- /data/{generators → rxgen_generators}/rx_config/rx_config_generator.rb +0 -0
- /data/{generators → rxgen_generators}/rx_controller/USAGE +0 -0
- /data/{generators → rxgen_generators}/rx_controller/templates/restful.py +0 -0
- /data/{generators → rxgen_generators}/rx_main_app/templates/main.py.erb +0 -0
- /data/{generators → rxgen_generators}/rx_scaffold/USAGE +0 -0
- /data/{generators → rxgen_generators}/rx_scaffold/templates/controller.py.erb +0 -0
- /data/{generators → rxgen_generators}/rx_scaffold/templates/model.as.erb +0 -0
- /data/{generators → rxgen_generators}/rx_scaffold/templates/model.py.erb +0 -0
- /data/{generators → rxgen_generators}/rx_yaml_scaffold/USAGE +0 -0
- /data/{generators → rxgen_generators}/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +0 -0
data/Rakefile
CHANGED
|
@@ -1,42 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
# configured in this Rakefile. The .rake files in the tasks directory
|
|
3
|
-
# are where the options are used.
|
|
1
|
+
require 'rake'
|
|
4
2
|
|
|
5
3
|
begin
|
|
6
|
-
require '
|
|
7
|
-
|
|
4
|
+
require 'jeweler'
|
|
5
|
+
Jeweler::Tasks.new do |gem|
|
|
6
|
+
gem.name = "restfulx"
|
|
7
|
+
gem.summary = "RestfulX Framework Code Generation Engine / Rails 2.1+ Integration Support"
|
|
8
|
+
gem.email = "dima.berastau@gmail.com"
|
|
9
|
+
gem.homepage = "http://restfulx.org"
|
|
10
|
+
gem.rubyforge_project = "restfulx"
|
|
11
|
+
gem.authors = ["Dima Berastau"]
|
|
12
|
+
gem.files = FileList["[A-Z]*", "{bin,app_generators,rails_generators,rxgen_generators,lib,test,spec,tasks}/**/*"]
|
|
13
|
+
gem.add_dependency('rubigen', '>= 1.5.0')
|
|
14
|
+
gem.add_dependency('activesupport', '>=2.0.0')
|
|
15
|
+
end
|
|
8
16
|
rescue LoadError
|
|
9
|
-
|
|
17
|
+
puts "Jeweler not available. Install it with: sudo gem install dima-jeweler -s http://gems.github.com"
|
|
10
18
|
end
|
|
11
19
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
require 'rake/rdoctask'
|
|
21
|
+
Rake::RDocTask.new do |rdoc|
|
|
22
|
+
config = YAML.load(File.read('VERSION.yml'))
|
|
23
|
+
rdoc.rdoc_dir = 'doc/api'
|
|
24
|
+
rdoc.title = "RestfulX #{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
|
25
|
+
rdoc.options << '--line-numbers' << '--inline-source' #<< '-Tjamis'
|
|
26
|
+
rdoc.rdoc_files.include('README*')
|
|
27
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
28
|
+
end
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
begin
|
|
31
|
+
require 'rake/contrib/sshpublisher'
|
|
32
|
+
namespace :rubyforge do
|
|
33
|
+
namespace :release do
|
|
34
|
+
desc "Publish RDoc to RubyForge."
|
|
35
|
+
task :docs => [:rdoc] do
|
|
36
|
+
config = YAML.load(
|
|
37
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
|
38
|
+
)
|
|
26
39
|
|
|
27
|
-
|
|
40
|
+
host = "#{config['username']}@rubyforge.org"
|
|
41
|
+
remote_dir = "/var/www/gforge-projects/restfulx/"
|
|
42
|
+
local_dir = 'doc/api'
|
|
28
43
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
rescue LoadError
|
|
49
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
|
50
|
+
end
|
|
33
51
|
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
require 'rake/testtask'
|
|
53
|
+
Rake::TestTask.new(:test) do |t|
|
|
54
|
+
t.libs << 'lib' << 'test'
|
|
55
|
+
t.pattern = 'test/**/test_*.rb'
|
|
56
|
+
t.verbose = false
|
|
57
|
+
end
|
|
36
58
|
|
|
37
|
-
|
|
59
|
+
begin
|
|
60
|
+
require 'rcov/rcovtask'
|
|
61
|
+
Rcov::RcovTask.new do |t|
|
|
62
|
+
t.libs << 'test'
|
|
63
|
+
t.test_files = FileList['test/**/test_*.rb']
|
|
64
|
+
t.verbose = true
|
|
65
|
+
end
|
|
66
|
+
rescue LoadError
|
|
67
|
+
puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
|
68
|
+
end
|
|
38
69
|
|
|
39
|
-
|
|
40
|
-
|
|
70
|
+
begin
|
|
71
|
+
require 'cucumber/rake/task'
|
|
72
|
+
Cucumber::Rake::Task.new(:features)
|
|
73
|
+
rescue LoadError
|
|
74
|
+
puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
|
75
|
+
end
|
|
41
76
|
|
|
42
|
-
|
|
77
|
+
task :default => :test
|
data/VERSION.yml
ADDED
|
@@ -8,7 +8,11 @@ class RxAppGenerator < RubiGen::Base
|
|
|
8
8
|
:command_controller_name,
|
|
9
9
|
:component_names,
|
|
10
10
|
:application_tag,
|
|
11
|
-
:use_air
|
|
11
|
+
:use_air,
|
|
12
|
+
:use_gae,
|
|
13
|
+
:flex_root,
|
|
14
|
+
:base_flex_package,
|
|
15
|
+
:distributed
|
|
12
16
|
|
|
13
17
|
def initialize(runtime_args, runtime_options = {})
|
|
14
18
|
super
|
|
@@ -16,9 +20,14 @@ class RxAppGenerator < RubiGen::Base
|
|
|
16
20
|
@destination_root = File.expand_path(args.shift)
|
|
17
21
|
|
|
18
22
|
@project_name, @flex_project_name, @command_controller_name,
|
|
19
|
-
@base_package, @base_folder = extract_names(base_name)
|
|
23
|
+
@base_package, @base_folder, @flex_root, @distributed = extract_names(base_name)
|
|
20
24
|
|
|
25
|
+
@base_package = options[:base_flex_package] if options[:base_flex_package]
|
|
26
|
+
@base_folder = options[:base_flex_package].gsub('.', '/').gsub(/\W/, '') if options[:base_flex_package]
|
|
27
|
+
@flex_root = options[:flex_root] if options[:flex_root]
|
|
28
|
+
@use_gae = options[:gae]
|
|
21
29
|
@use_air = options[:air_config]
|
|
30
|
+
@distributed = options[:distributed] unless @distributed
|
|
22
31
|
if @use_air
|
|
23
32
|
@application_tag = 'WindowedApplication'
|
|
24
33
|
else
|
|
@@ -32,7 +41,7 @@ class RxAppGenerator < RubiGen::Base
|
|
|
32
41
|
record do |m|
|
|
33
42
|
m.directory ''
|
|
34
43
|
|
|
35
|
-
%w(script lib db bin-debug).each { |dir| m.directory dir }
|
|
44
|
+
%w(script lib db config bin-debug).each { |dir| m.directory dir }
|
|
36
45
|
|
|
37
46
|
if options[:gae]
|
|
38
47
|
m.file 'index.yaml', 'index.yaml' unless File.exist?('index.yaml')
|
|
@@ -44,6 +53,7 @@ class RxAppGenerator < RubiGen::Base
|
|
|
44
53
|
m.file 'empty.txt', 'app/models/__init__.py'
|
|
45
54
|
end
|
|
46
55
|
|
|
56
|
+
m.template 'restfulx.yml', 'config/restfulx.yml'
|
|
47
57
|
m.file 'default_tasks.rake', 'Rakefile' unless File.exist?('Rakefile')
|
|
48
58
|
m.file 'flex.properties', '.flexProperties'
|
|
49
59
|
m.file 'generate.rb', 'script/generate', { :chmod => 0755 }
|
|
@@ -70,15 +80,15 @@ class RxAppGenerator < RubiGen::Base
|
|
|
70
80
|
end
|
|
71
81
|
|
|
72
82
|
%w(components controllers commands models events).each do |dir|
|
|
73
|
-
m.directory "
|
|
83
|
+
m.directory "#{flex_root}/#{base_folder}/#{dir}"
|
|
74
84
|
end
|
|
75
85
|
|
|
76
|
-
m.directory "
|
|
86
|
+
m.directory "#{flex_root}/#{base_folder}/components/generated"
|
|
77
87
|
|
|
78
|
-
m.template 'project-textmate.erb', "#{project_name
|
|
79
|
-
m.template 'mainapp.mxml', File.join(
|
|
80
|
-
m.template 'mainapp-config.xml', File.join(
|
|
81
|
-
m.template 'mainair-app.xml', File.join(
|
|
88
|
+
m.template 'project-textmate.erb', "#{project_name}.tmproj"
|
|
89
|
+
m.template 'mainapp.mxml', File.join("#{flex_root}", "#{flex_project_name}.mxml")
|
|
90
|
+
m.template 'mainapp-config.xml', File.join("#{flex_root}", "#{flex_project_name}-config.xml")
|
|
91
|
+
m.template 'mainair-app.xml', File.join("#{flex_root}", "#{flex_project_name}-app.xml") if @use_air
|
|
82
92
|
end
|
|
83
93
|
end
|
|
84
94
|
|
|
@@ -90,5 +100,11 @@ class RxAppGenerator < RubiGen::Base
|
|
|
90
100
|
"Default: false") { |v| options[:air_config] = v }
|
|
91
101
|
opt.on("--gae", "Generate Google App Engine Python classes in addition to RestfulX Flex resources.",
|
|
92
102
|
"Default: false") { |v| options[:gae] = v }
|
|
103
|
+
opt.on("--flex-root [FOLDER]", "Root folder for generated flex code.",
|
|
104
|
+
"Default: app/flex") { |v| options[:flex_root] = v }
|
|
105
|
+
opt.on("--base-flex-package [PACKAGE]", "Base package for your application.",
|
|
106
|
+
"Default: #{flex_project_name}") { |v| options[:base_flex_package] = v }
|
|
107
|
+
opt.on("--distributed", "Creates migrations, controllers and models that use UUIDs and are distribution ready",
|
|
108
|
+
"Default: false") { |v| options[:distributed] = v }
|
|
93
109
|
end
|
|
94
110
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<actionScriptProperties mainApplicationPath="<%=
|
|
3
|
-
<compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="public/bin" rootURL="http://localhost:3000/bin" sourceFolderPath="
|
|
2
|
+
<actionScriptProperties mainApplicationPath="<%= flex_project_name %>.mxml" version="3">
|
|
3
|
+
<compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="public/bin" rootURL="http://localhost:3000/bin" sourceFolderPath="<%= flex_root %>" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
|
|
4
4
|
<compilerSourcePath/>
|
|
5
5
|
<libraryPath defaultLinkType="1">
|
|
6
6
|
<libraryPathEntry kind="4" path=""/>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<sourceAttachmentPath/>
|
|
10
10
|
</compiler>
|
|
11
11
|
<applications>
|
|
12
|
-
<application path="<%=
|
|
12
|
+
<application path="<%= flex_project_name %>.mxml"/>
|
|
13
13
|
</applications>
|
|
14
14
|
<modules/>
|
|
15
15
|
<buildCSSFiles/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<actionScriptProperties mainApplicationPath="<%=
|
|
3
|
-
<compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="
|
|
2
|
+
<actionScriptProperties mainApplicationPath="<%= flex_project_name %>.mxml" version="3">
|
|
3
|
+
<compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="<%= flex_root %>" strict="true" useApolloConfig="true" verifyDigests="true" warn="true">
|
|
4
4
|
<compilerSourcePath/>
|
|
5
5
|
<libraryPath defaultLinkType="1">
|
|
6
6
|
<libraryPathEntry kind="4" path=""/>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<sourceAttachmentPath/>
|
|
10
10
|
</compiler>
|
|
11
11
|
<applications>
|
|
12
|
-
<application path="<%=
|
|
12
|
+
<application path="<%= flex_project_name %>.mxml"/>
|
|
13
13
|
</applications>
|
|
14
14
|
<modules/>
|
|
15
15
|
<buildCSSFiles/>
|
|
@@ -15,7 +15,7 @@ namespace :flex do
|
|
|
15
15
|
desc "Build flex application"
|
|
16
16
|
task :build do
|
|
17
17
|
libs = [] # you can add libraries that are not in lib folder here
|
|
18
|
-
|
|
18
|
+
compile_application(:destination => 'bin-debug', :opts => "-library-path+=#{libs.join(',')}")
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -23,29 +23,16 @@ namespace :rx do
|
|
|
23
23
|
namespace :test do
|
|
24
24
|
desc "Build flex test swf file"
|
|
25
25
|
task :build do
|
|
26
|
-
project_path = File.join(APP_ROOT, "app/flex", TEST_APP_NAME)
|
|
27
|
-
|
|
28
26
|
libs = Dir.glob(File.join(APP_ROOT, 'lib', '*.swc'))
|
|
29
27
|
#libs << 'foobar' # you can add libraries that not in lib folder here
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
cmd = "#{get_executable('mxmlc')} +configname=air -library-path+=#{libs.join(',')} " <<
|
|
34
|
-
"-output #{target_project_path} -debug=true #{project_path}"
|
|
35
|
-
|
|
36
|
-
if !system("#{cmd}")
|
|
37
|
-
puts "failed to compile test application"
|
|
38
|
-
end
|
|
28
|
+
|
|
29
|
+
compile_application(:application => TEST_APP_NAME, :destination => 'bin-debug',
|
|
30
|
+
:opts => "+configname=air -library-path+=#{libs.join(',')}")
|
|
39
31
|
end
|
|
40
32
|
|
|
41
33
|
desc "Run flex test application"
|
|
42
34
|
task :run do
|
|
43
|
-
|
|
44
|
-
target_project_air_descriptor = project_path.sub(/.mxml$/, '-app.xml')
|
|
45
|
-
|
|
46
|
-
if !system("#{get_executable('adl')} #{target_project_air_descriptor} #{APP_ROOT}")
|
|
47
|
-
puts "failed to run test application"
|
|
48
|
-
end
|
|
35
|
+
run_air_application(:application => TEST_APP_NAME)
|
|
49
36
|
end
|
|
50
37
|
end
|
|
51
38
|
end
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
5
5
|
<script type="text/javascript" src="javascripts/swfobject.js"></script>
|
|
6
6
|
<script type="text/javascript">
|
|
7
|
-
swfobject.embedSWF("bin/<%=
|
|
7
|
+
swfobject.embedSWF("bin/<%= flex_project_name %>.swf", "mainApp", "100%", "100%", "9.0.0", "expressInstall.swf");
|
|
8
8
|
</script>
|
|
9
9
|
<style>
|
|
10
10
|
body { margin: 0px; overflow: hidden; }
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
-->
|
|
16
16
|
|
|
17
17
|
<!-- The application identifier string, unique to this application. Required. -->
|
|
18
|
-
<id><%=
|
|
18
|
+
<id><%= flex_project_name %></id>
|
|
19
19
|
|
|
20
20
|
<!-- Used as the filename for the application. Required. -->
|
|
21
|
-
<filename><%=
|
|
21
|
+
<filename><%= flex_project_name %></filename>
|
|
22
22
|
|
|
23
23
|
<!-- The name that is displayed in the AIR application installer. Optional. -->
|
|
24
|
-
<name><%=
|
|
24
|
+
<name><%= flex_project_name %></name>
|
|
25
25
|
|
|
26
26
|
<!-- An application version designator (such as "v1", "2.5", or "Alpha 1"). Required. -->
|
|
27
27
|
<version>v1</version>
|
|
@@ -6,20 +6,142 @@
|
|
|
6
6
|
<mx:Script>
|
|
7
7
|
<![CDATA[
|
|
8
8
|
<% if use_air -%>
|
|
9
|
+
<% if distributed -%>
|
|
10
|
+
import air.net.SocketMonitor;
|
|
11
|
+
import org.restfulx.events.PullEndEvent;
|
|
12
|
+
import org.restfulx.events.PullStartEvent;
|
|
13
|
+
import org.restfulx.events.PushEndEvent;
|
|
14
|
+
import org.restfulx.events.PushStartEvent;
|
|
15
|
+
import org.restfulx.controllers.ChangeController;
|
|
16
|
+
import org.restfulx.services.ISyncingServiceProvider;
|
|
17
|
+
<% end -%>
|
|
9
18
|
import org.restfulx.services.air.AIRServiceProvider;
|
|
19
|
+
<% end -%>
|
|
20
|
+
<% if use_gae -%>
|
|
21
|
+
import org.restfulx.services.http.GAEHTTPServiceProvider;
|
|
22
|
+
<% else -%>
|
|
23
|
+
import org.restfulx.services.http.XMLHTTPServiceProvider;
|
|
10
24
|
<% end -%>
|
|
11
25
|
import org.restfulx.Rx;
|
|
12
26
|
import <%= base_package %>.controllers.<%= command_controller_name %>;
|
|
27
|
+
<% if use_air -%>
|
|
28
|
+
<% if distributed -%>
|
|
29
|
+
|
|
30
|
+
[Bindable]
|
|
31
|
+
private var socketMonitor:SocketMonitor;
|
|
32
|
+
|
|
33
|
+
[Bindable]
|
|
34
|
+
private var online:Boolean;
|
|
35
|
+
|
|
36
|
+
[Bindable]
|
|
37
|
+
private var syncStatus:String;
|
|
38
|
+
<% end -%>
|
|
39
|
+
<% end -%>
|
|
13
40
|
|
|
14
41
|
private function init():void {
|
|
15
42
|
<% if use_air -%>
|
|
16
|
-
|
|
43
|
+
<% if distributed -%>
|
|
44
|
+
Rx.httpRootUrl = "http://localhost:3000/";
|
|
45
|
+
Rx.enableSync = true;
|
|
46
|
+
|
|
47
|
+
socketMonitor = new SocketMonitor("localhost", 3000);
|
|
48
|
+
socketMonitor.pollInterval = 2000; /* miliseconds */
|
|
49
|
+
socketMonitor.addEventListener(StatusEvent.STATUS, onNetworkStatusChange);
|
|
50
|
+
socketMonitor.start();
|
|
51
|
+
|
|
52
|
+
<% end -%>
|
|
53
|
+
<%= command_controller_name %>.initialize([AIRServiceProvider],
|
|
54
|
+
AIRServiceProvider.ID, "<%= base_package %>");
|
|
55
|
+
<% if distributed -%>
|
|
56
|
+
|
|
57
|
+
<% if use_gae -%>
|
|
58
|
+
Rx.changes.setSyncProviders(
|
|
59
|
+
ISyncingServiceProvider(Rx.services.getServiceProvider(AIRServiceProvider.ID)),
|
|
60
|
+
Rx.services.getServiceProvider(GAEHTTPServiceProvider.ID));
|
|
61
|
+
<% else -%>
|
|
62
|
+
Rx.changes.setSyncProviders(
|
|
63
|
+
ISyncingServiceProvider(Rx.services.getServiceProvider(AIRServiceProvider.ID)),
|
|
64
|
+
Rx.services.getServiceProvider(XMLHTTPServiceProvider.ID));
|
|
65
|
+
<% end -%>
|
|
66
|
+
|
|
67
|
+
Rx.changes.addEventListener(PushStartEvent.ID, onPushStart);
|
|
68
|
+
Rx.changes.addEventListener(PushEndEvent.ID, onPushEnd);
|
|
69
|
+
Rx.changes.addEventListener(PullStartEvent.ID, onPullStart);
|
|
70
|
+
Rx.changes.addEventListener(PullEndEvent.ID, onPullEnd);
|
|
71
|
+
<% end -%>
|
|
72
|
+
<% else -%>
|
|
73
|
+
<% if use_gae -%>
|
|
74
|
+
<%= command_controller_name %>.initialize([GAEHTTPServiceProvider], GAEHTTPServiceProvider.ID);
|
|
17
75
|
<% else -%>
|
|
18
76
|
<%= command_controller_name %>.initialize();
|
|
77
|
+
<% end -%>
|
|
19
78
|
<% end -%>
|
|
20
79
|
}
|
|
80
|
+
<% if use_air -%>
|
|
81
|
+
<% if distributed -%>
|
|
82
|
+
|
|
83
|
+
private function onPushStart(event:Event):void {
|
|
84
|
+
syncStatus = "Pushing changes ...";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private function onPushEnd(event:Event):void {
|
|
88
|
+
syncStatus = "Push complete.";
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private function onPullStart(event:Event):void {
|
|
92
|
+
syncStatus = "Pulling data...";
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private function onPullEnd(event:Event):void {
|
|
96
|
+
syncStatus = "Pull complete.";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private function onNetworkStatusChange(event:StatusEvent):void {
|
|
100
|
+
online = (socketMonitor.available) ? true : false;
|
|
101
|
+
|
|
102
|
+
if (online) {
|
|
103
|
+
<% if use_gae -%>
|
|
104
|
+
Rx.defaultServiceId = GAEHTTPServiceProvider.ID;
|
|
105
|
+
<% else -%>
|
|
106
|
+
Rx.defaultServiceId = XMLHTTPServiceProvider.ID;
|
|
107
|
+
<% end -%>
|
|
108
|
+
} else {
|
|
109
|
+
Rx.defaultServiceId = AIRServiceProvider.ID;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private function getCurrentProviderName(id:int):String {
|
|
114
|
+
switch (id) {
|
|
115
|
+
<% if use_gae -%>
|
|
116
|
+
case GAEHTTPServiceProvider.ID:
|
|
117
|
+
return "GAE";
|
|
118
|
+
<% else -%>
|
|
119
|
+
case XMLHTTPServiceProvider.ID:
|
|
120
|
+
return "XML/HTTP";
|
|
121
|
+
<% end -%>
|
|
122
|
+
case AIRServiceProvider.ID:
|
|
123
|
+
return "AIR (SQLite)";
|
|
124
|
+
default :
|
|
125
|
+
return "No idea";
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
<% end -%>
|
|
129
|
+
<% end -%>
|
|
21
130
|
]]>
|
|
22
131
|
</mx:Script>
|
|
132
|
+
<% if use_air -%>
|
|
133
|
+
<% if distributed -%>
|
|
134
|
+
<mx:VBox height="100%">
|
|
135
|
+
<mx:Label text="Current Provider: {getCurrentProviderName(Rx.defaultServiceId)}"/>
|
|
136
|
+
<mx:Label text="Status: {online ? 'Online' : 'Offline' }"/>
|
|
137
|
+
<mx:HBox>
|
|
138
|
+
<mx:Button label="Push" click="{Rx.changes.push()}" enabled="{online}"/>
|
|
139
|
+
<mx:Button label="Pull" click="{Rx.changes.pull()}" enabled="{online}"/>
|
|
140
|
+
</mx:HBox>
|
|
141
|
+
<mx:Label text="{syncStatus}"/>
|
|
142
|
+
</mx:VBox>
|
|
143
|
+
<% end -%>
|
|
144
|
+
<% end -%>
|
|
23
145
|
<mx:LinkBar dataProvider="{mainViewStack}" direction="vertical" borderStyle="solid" backgroundColor="#EEEEEE"/>
|
|
24
146
|
<mx:ViewStack id="mainViewStack" width="100%" height="100%">
|
|
25
147
|
<!-- For a simple demo, put all the components here. -->
|
|
@@ -28,4 +150,3 @@
|
|
|
28
150
|
<% end -%>
|
|
29
151
|
</mx:ViewStack>
|
|
30
152
|
</mx:<%= application_tag %>>
|
|
31
|
-
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
<plist version="1.0">
|
|
4
4
|
<dict>
|
|
5
5
|
<key>currentDocument</key>
|
|
6
|
-
<string>app/flex/<%=
|
|
6
|
+
<string>app/flex/<%= flex_project_name %>.mxml</string>
|
|
7
7
|
<key>documents</key>
|
|
8
8
|
<array>
|
|
9
9
|
<dict>
|
|
10
10
|
<key>expanded</key>
|
|
11
11
|
<true/>
|
|
12
12
|
<key>name</key>
|
|
13
|
-
<string><%= project_name
|
|
13
|
+
<string><%= project_name %></string>
|
|
14
14
|
<key>regexFolderFilter</key>
|
|
15
15
|
<string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
|
|
16
16
|
<key>sourceDirectory</key>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<key>enabled</key>
|
|
28
28
|
<true/>
|
|
29
29
|
<key>value</key>
|
|
30
|
-
<string>app/flex/<%=
|
|
30
|
+
<string>app/flex/<%= flex_project_name %>.mxml</string>
|
|
31
31
|
<key>variable</key>
|
|
32
32
|
<string>TM_FLEX_FILE_SPECS</string>
|
|
33
33
|
</dict>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
<key>enabled</key>
|
|
36
36
|
<true/>
|
|
37
37
|
<key>value</key>
|
|
38
|
-
<string>public/bin/<%=
|
|
38
|
+
<string>public/bin/<%= flex_project_name %>.swf</string>
|
|
39
39
|
<key>variable</key>
|
|
40
40
|
<string>TM_FLEX_OUTPUT</string>
|
|
41
41
|
</dict>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# RestfulX code generation configuration options
|
|
2
|
+
|
|
3
|
+
# This option controls what the main Flex application file will be called.
|
|
4
|
+
# By default it will be equal to the name of your rails project camelized
|
|
5
|
+
project-name: <%= project_name %>
|
|
6
|
+
|
|
7
|
+
# This options determines what the root folder for generated Flex code is.
|
|
8
|
+
# By default 'app/flex'
|
|
9
|
+
flex-root: <%= flex_root %>
|
|
10
|
+
|
|
11
|
+
# By default flex models, commands, controllers and components are genearated into
|
|
12
|
+
# <flex-root>/<your rails project name> folder. If you'd like to customize the target folder
|
|
13
|
+
# (to say append a "com" package before your rails project name) uncomment the line below
|
|
14
|
+
# base-package must follow the usual flex package notation (a string separated by ".")
|
|
15
|
+
base-package: <%= base_package %>
|
|
16
|
+
|
|
17
|
+
# Main RestfulX controller is typically named AppicationController. This controller is created in
|
|
18
|
+
# <base-package>.controllers folder. You can customize the name by uncommenting the following line
|
|
19
|
+
# and changing the controller name.
|
|
20
|
+
controller-name: <%= command_controller_name %>
|
|
21
|
+
|
|
22
|
+
# If you are using Rails on the back-end and Adobe AIR as the client you can generate Rails/Flex/AIR
|
|
23
|
+
# code to take advantage of synchronization (online/offline) support in RestfulX by changing the following
|
|
24
|
+
# option to true. By default distribution is disabled.
|
|
25
|
+
distributed: <%= distributed %>
|
data/bin/rx-gen
CHANGED
|
@@ -22,7 +22,7 @@ require 'rubigen'
|
|
|
22
22
|
require File.join(File.dirname(__FILE__), '..', 'lib', 'restfulx')
|
|
23
23
|
|
|
24
24
|
if %w(-v --version).include? ARGV.first
|
|
25
|
-
puts "#{File.basename($0)} #{RestfulX::
|
|
25
|
+
puts "#{File.basename($0)} #{RestfulX::FRAMEWORK_VERSION}"
|
|
26
26
|
exit(0)
|
|
27
27
|
end
|
|
28
28
|
|
data/lib/restfulx/active_foo.rb
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
# ~wrong~ from the point of view of Flex clients.
|
|
3
3
|
#
|
|
4
4
|
# Some of these things are:
|
|
5
|
-
# * Date formats
|
|
6
5
|
# * XML format (Flex *really* doesn't like dashes in XML messages)
|
|
7
6
|
# * Errors (we need to be more specific and communicate what went wrong *where*)
|
|
8
7
|
#
|
|
@@ -11,13 +10,6 @@
|
|
|
11
10
|
# Some of the things that are done can be called _monkey_ _patching_ while others can
|
|
12
11
|
# be called extensions. Caveat emptor.
|
|
13
12
|
|
|
14
|
-
# Flex friendly date, datetime formats
|
|
15
|
-
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(:flex_date => "%Y/%m/%d")
|
|
16
|
-
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(:flex_datetime => "%Y/%m/%d %H:%M:%S")
|
|
17
|
-
|
|
18
|
-
Hash::XML_FORMATTING['date'] = Proc.new { |date| date.to_s(:flex_date) }
|
|
19
|
-
Hash::XML_FORMATTING['datetime'] = Proc.new { |datetime| datetime.to_s(:flex_datetime) }
|
|
20
|
-
|
|
21
13
|
# ActiveSupport specific patches. More specifically we add +to_fxml+ methods to Array and
|
|
22
14
|
# Hash conversion modules
|
|
23
15
|
module ActiveSupport
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# - db:mysql:stage
|
|
3
3
|
# - db:refresh
|
|
4
4
|
require File.join(File.dirname(__FILE__), 'tasks')
|
|
5
|
+
require File.join(File.dirname(__FILE__), 'rails', 'schema_to_yaml')
|
|
5
6
|
|
|
6
7
|
# stores local copy of the application environment ('production', 'test', etc)
|
|
7
8
|
# so that appropriate values in config/database.yml are used
|
|
@@ -78,4 +79,12 @@ namespace :db do
|
|
|
78
79
|
|
|
79
80
|
desc "Refresh the database environment for #{APP_ENV}"
|
|
80
81
|
task :refresh => ['db:drop_if_exists', 'db:create', 'db:migrate', 'db:fixtures:load']
|
|
82
|
+
|
|
83
|
+
# used to analyze your schema and dump out a model.yml file for converting old rails projects
|
|
84
|
+
namespace :schema do
|
|
85
|
+
desc "Create model.yml from schema.rb"
|
|
86
|
+
task :to_yaml => :environment do
|
|
87
|
+
SchemaToYaml.schema_to_yaml
|
|
88
|
+
end
|
|
89
|
+
end
|
|
81
90
|
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Patches ActiveRecord models to use UUID based IDs instead of the default numeric ones
|
|
2
|
+
require 'uuidtools'
|
|
3
|
+
|
|
4
|
+
# Extends ActiveRecord models with UUID based IDs
|
|
5
|
+
module RestfulX
|
|
6
|
+
module UUIDHelper
|
|
7
|
+
def self.included(base)
|
|
8
|
+
base.class_eval do
|
|
9
|
+
before_create :generate_uuid
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def generate_uuid
|
|
14
|
+
self.id = UUID.random_create.to_s.gsub("-", "") unless self.id
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|