ruboss4ruby 1.0.5 → 1.1.0

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.
Files changed (155) hide show
  1. data/History.txt +2 -2
  2. data/Manifest.txt +86 -79
  3. data/README.rdoc +53 -0
  4. data/Rakefile +42 -5
  5. data/app_generators/ruboss_app/USAGE +22 -0
  6. data/app_generators/ruboss_app/ruboss_app_generator.rb +94 -0
  7. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/actionscript.properties +1 -1
  8. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/actionscriptair.properties +0 -0
  9. data/app_generators/ruboss_app/templates/app.yaml.erb +12 -0
  10. data/app_generators/ruboss_app/templates/default_tasks.rake +51 -0
  11. data/app_generators/ruboss_app/templates/empty.txt +0 -0
  12. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/expressInstall.swf +0 -0
  13. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/flex.properties +0 -0
  14. data/app_generators/ruboss_app/templates/generate.rb +17 -0
  15. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/AC_OETags.js +0 -0
  16. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/history.css +0 -0
  17. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/history.js +0 -0
  18. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/history/historyFrame.html +0 -0
  19. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/index.template.html +0 -0
  20. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/html-template/playerProductInstall.swf +0 -0
  21. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/index.html.erb +2 -2
  22. data/app_generators/ruboss_app/templates/index.yaml +11 -0
  23. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/mainair-app.xml +3 -3
  24. data/app_generators/ruboss_app/templates/mainapp-config.xml +21 -0
  25. data/{merb_generators/templates/ruboss_flex_app → app_generators/ruboss_app/templates}/mainapp.mxml +6 -9
  26. data/app_generators/ruboss_app/templates/project-textmate.erb +52 -0
  27. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/project.properties +0 -0
  28. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/projectair.properties +0 -0
  29. data/{merb_generators/templates/ruboss_config → app_generators/ruboss_app/templates}/swfobject.js +0 -0
  30. data/bin/ruboss-gen +31 -0
  31. data/generators/ruboss_config/USAGE +5 -0
  32. data/generators/ruboss_config/ruboss_config_generator.rb +19 -0
  33. data/generators/ruboss_controller/USAGE +10 -0
  34. data/generators/ruboss_controller/ruboss_controller_generator.rb +38 -0
  35. data/generators/ruboss_controller/templates/assist.py +65 -0
  36. data/{merb_generators/templates/ruboss_controller → generators/ruboss_controller/templates}/controller.as.erb +7 -6
  37. data/generators/ruboss_controller/templates/restful.py +136 -0
  38. data/generators/ruboss_main_app/USAGE +8 -0
  39. data/generators/ruboss_main_app/ruboss_main_app_generator.rb +60 -0
  40. data/generators/ruboss_main_app/templates/main.py.erb +29 -0
  41. data/generators/ruboss_main_app/templates/mainapp.mxml +35 -0
  42. data/generators/ruboss_scaffold/USAGE +29 -0
  43. data/generators/ruboss_scaffold/ruboss_scaffold_generator.rb +148 -0
  44. data/generators/ruboss_scaffold/templates/component.mxml.erb +149 -0
  45. data/generators/ruboss_scaffold/templates/controller.py.erb +27 -0
  46. data/generators/ruboss_scaffold/templates/model.as.erb +42 -0
  47. data/generators/ruboss_scaffold/templates/model.py.erb +14 -0
  48. data/generators/ruboss_yaml_scaffold/USAGE +45 -0
  49. data/generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb +47 -0
  50. data/lib/ruboss4ruby/active_foo.rb +109 -86
  51. data/lib/ruboss4ruby/active_record_default_methods.rb +66 -0
  52. data/lib/ruboss4ruby/active_record_tasks.rb +10 -4
  53. data/lib/ruboss4ruby/configuration.rb +48 -34
  54. data/lib/ruboss4ruby/datamapper_foo.rb +31 -0
  55. data/lib/ruboss4ruby/{recipes.rb → rails/recipes.rb} +7 -9
  56. data/lib/ruboss4ruby/{ruboss_helper.rb → rails/swf_helper.rb} +14 -8
  57. data/lib/ruboss4ruby/tasks.rb +9 -4
  58. data/lib/ruboss4ruby.rb +72 -27
  59. data/rails_generators/ruboss_config/ruboss_config_generator.rb +3 -15
  60. data/rails_generators/ruboss_config/templates/mainair-app.xml +2 -2
  61. data/rails_generators/ruboss_config/templates/mainapp-config.xml +1 -1
  62. data/rails_generators/ruboss_config/templates/ruboss.yml +2 -4
  63. data/rails_generators/ruboss_config/templates/ruboss_tasks.rake +5 -15
  64. data/rails_generators/ruboss_controller/USAGE +1 -2
  65. data/rails_generators/ruboss_controller/ruboss_controller_generator.rb +3 -14
  66. data/rails_generators/ruboss_controller/templates/controller.as.erb +11 -6
  67. data/rails_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +67 -76
  68. data/rails_generators/ruboss_scaffold/templates/component.mxml.erb +69 -69
  69. data/rails_generators/ruboss_scaffold/templates/model.as.erb +2 -2
  70. data/rails_generators/ruboss_yaml_scaffold/USAGE +38 -1
  71. data/rcl-1.0.txt +0 -0
  72. data/rdoc/generators/template/html/jamis.rb +588 -0
  73. data/ruboss4ruby.gemspec +43 -0
  74. data/spec/ruboss4ruby_spec.rb +7 -0
  75. data/spec/spec_helper.rb +16 -0
  76. data/tasks/ann.rake +80 -0
  77. data/tasks/bones.rake +20 -0
  78. data/tasks/gem.rake +201 -0
  79. data/tasks/git.rake +40 -0
  80. data/tasks/manifest.rake +48 -0
  81. data/tasks/notes.rake +27 -0
  82. data/tasks/post_load.rake +39 -0
  83. data/tasks/rdoc.rake +50 -0
  84. data/tasks/rubyforge.rake +55 -0
  85. data/tasks/setup.rb +279 -0
  86. data/tasks/spec.rake +54 -0
  87. data/tasks/svn.rake +47 -0
  88. data/tasks/test.rake +40 -0
  89. data/test/{controllers → rails/controllers}/application.rb +0 -0
  90. data/test/{controllers → rails/controllers}/locations_controller.rb +0 -0
  91. data/test/{controllers → rails/controllers}/notes_controller.rb +0 -0
  92. data/test/{controllers → rails/controllers}/projects_controller.rb +0 -0
  93. data/test/{controllers → rails/controllers}/tasks_controller.rb +0 -0
  94. data/test/{controllers → rails/controllers}/users_controller.rb +0 -0
  95. data/test/{database.yml → rails/database.yml} +0 -0
  96. data/test/{fixtures → rails/fixtures}/locations.yml +0 -0
  97. data/test/{fixtures → rails/fixtures}/notes.yml +0 -0
  98. data/test/{fixtures → rails/fixtures}/projects.yml +0 -0
  99. data/test/rails/fixtures/simple_properties.yml +19 -0
  100. data/test/{fixtures → rails/fixtures}/tasks.yml +0 -0
  101. data/test/{fixtures → rails/fixtures}/users.yml +0 -0
  102. data/test/{helpers → rails/helpers}/functional_test_helper.rb +0 -11
  103. data/test/rails/helpers/test_helper.rb +61 -0
  104. data/test/rails/helpers/unit_test_helper.rb +30 -0
  105. data/test/{model.yml → rails/model.yml} +0 -0
  106. data/test/{models → rails/models}/location.rb +0 -0
  107. data/test/{models → rails/models}/note.rb +0 -0
  108. data/test/{models → rails/models}/project.rb +1 -3
  109. data/test/rails/models/simple_property.rb +2 -0
  110. data/test/{models → rails/models}/task.rb +1 -1
  111. data/test/{models → rails/models}/user.rb +1 -2
  112. data/test/{playing_around_in_a_console.txt → rails/playing_around_in_a_console.txt} +0 -0
  113. data/test/{schema.rb → rails/schema.rb} +14 -0
  114. data/test/{test.swf → rails/test.swf} +0 -0
  115. data/test/rails/test_active_foo.rb +81 -0
  116. data/test/{test_ruboss_rails_integration_functional.rb → rails/test_ruboss_rails_integration_functional.rb} +4 -9
  117. data/test/{to_fxml_test.rb → rails/test_to_fxml.rb} +35 -37
  118. data/test/rails/test_to_json.rb +23 -0
  119. data/test/{views → rails/views}/notes/empty_params_action.html.erb +0 -0
  120. data/test/{views → rails/views}/notes/index.html.erb +0 -0
  121. metadata +138 -103
  122. data/Generators +0 -5
  123. data/README.txt +0 -37
  124. data/config/hoe.rb +0 -72
  125. data/config/requirements.rb +0 -15
  126. data/lib/ruboss4ruby/generated_attribute.rb +0 -61
  127. data/lib/ruboss4ruby/ruboss_test_helpers.rb +0 -31
  128. data/lib/ruboss4ruby/version.rb +0 -11
  129. data/merb_generators/ruboss_config.rb +0 -105
  130. data/merb_generators/ruboss_controller.rb +0 -61
  131. data/merb_generators/ruboss_flex_app.rb +0 -69
  132. data/merb_generators/ruboss_resource_controller.rb +0 -4
  133. data/merb_generators/ruboss_scaffold.rb +0 -158
  134. data/merb_generators/templates/ruboss_config/ruboss.yml +0 -16
  135. data/merb_generators/templates/ruboss_resource_controller/controller.rb.erb +0 -49
  136. data/script/console +0 -10
  137. data/script/destroy +0 -14
  138. data/script/generate +0 -14
  139. data/script/txt2html +0 -82
  140. data/setup.rb +0 -1585
  141. data/tasks/deployment.rake +0 -34
  142. data/tasks/environment.rake +0 -7
  143. data/tasks/website.rake +0 -17
  144. data/test/helpers/controllers.log +0 -8
  145. data/test/helpers/models.log +0 -170
  146. data/test/helpers/test_helper.rb +0 -25
  147. data/test/helpers/unit_test_helper.rb +0 -23
  148. data/test/test.sqlite3 +0 -0
  149. data/test/test_active_foo.rb +0 -79
  150. data/test/test_swfobject_helper.rb +0 -63
  151. data/website/index.html +0 -63
  152. data/website/index.txt +0 -34
  153. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  154. data/website/stylesheets/screen.css +0 -138
  155. data/website/template.html.erb +0 -47
@@ -1,61 +0,0 @@
1
- module Ruboss
2
- module Generator
3
- class GeneratedAttribute
4
- attr_accessor :name, :type, :flex_name
5
-
6
- def initialize(name, type)
7
- @name, @type = name, type.to_sym
8
- @flex_name = name.camelcase(:lower)
9
- end
10
-
11
- def field_type
12
- @field_type ||= case type
13
- when :integer, :float, :decimal then :text_field
14
- when :datetime, :timestamp, :time then :datetime_select
15
- when :date then :date_select
16
- when :string then :text_field
17
- when :text then :text_area
18
- when :boolean then :check_box
19
- else
20
- :text_field
21
- end
22
- end
23
-
24
- def default(prefix = '')
25
- @default = case type
26
- when :integer then 1
27
- when :float then 1.5
28
- when :decimal then "9.99"
29
- when :datetime, :timestamp, :time then Time.now.to_s(:db)
30
- when :date then Date.today.to_s(:db)
31
- when :string then prefix + name.camelize + "String"
32
- when :text then prefix + name.camelize + "Text"
33
- when :boolean then false
34
- else
35
- ""
36
- end
37
- end
38
-
39
- def flex_type
40
- @flex_type = case type
41
- when :integer then 'int'
42
- when :date, :datetime, :time then 'Date'
43
- when :boolean then 'Boolean'
44
- when :float, :decimal then 'Number'
45
- else
46
- 'String'
47
- end
48
- end
49
-
50
- def flex_default(prefix = '')
51
- @flex_default = case type
52
- when :integer, :float, :decimal then '0'
53
- when :string, :text then '""'
54
- when :boolean then 'false'
55
- else
56
- 'null'
57
- end
58
- end
59
- end
60
- end
61
- end
@@ -1,31 +0,0 @@
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
@@ -1,11 +0,0 @@
1
- module Ruboss
2
- RUBOSS_FRAMEWORK_VERSION = '1.0.5'
3
-
4
- module VERSION
5
- MAJOR = 1
6
- MINOR = 0
7
- TINY = 5
8
-
9
- STRING = [MAJOR, MINOR, TINY].join('.')
10
- end
11
- end
@@ -1,105 +0,0 @@
1
- require 'open-uri'
2
- require 'fileutils'
3
- require 'ruboss4ruby/version'
4
- require 'ruboss4ruby/configuration'
5
-
6
- module Merb::Generators
7
- class RubossConfigGenerator < Generator
8
- include Ruboss::Configuration
9
-
10
- option :air, :as => :boolean, :default => false, :desc => 'Configure AIR project instead of Flex. Flex is default.'
11
- option :skip_framework, :as => :boolean, :default => false, :desc => "Don't fetch the latest framework binary. You'll have to link/build the framework yourself."
12
-
13
- def initialize(*args)
14
- super
15
- @project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names
16
-
17
- framework_release = Ruboss::RUBOSS_FRAMEWORK_VERSION
18
- framework_distribution_url = "http://ruboss.com/releases/ruboss-#{framework_release}.swc"
19
- framework_destination_file = "lib/ruboss-#{framework_release}.swc"
20
-
21
- if !get_option(:skip_framework) && !File.exist?(framework_destination_file)
22
- FileUtils.mkdir('lib') unless File.directory?('lib')
23
- puts "fetching #{framework_release} framework binary from: #{framework_distribution_url} ..."
24
- open(framework_destination_file, "wb").write(open(framework_distribution_url).read)
25
- puts "done. saved to #{framework_destination_file}"
26
- end
27
- end
28
-
29
- def extract_config(config_file)
30
- if get_option(:air)
31
- config_file << 'air'
32
- end
33
- config_file
34
- end
35
-
36
- def project_name
37
- @project_name
38
- end
39
-
40
- def flex_project_name
41
- @flex_project_name
42
- end
43
-
44
- def base_folder
45
- @base_folder
46
- end
47
-
48
- def self.source_root
49
- File.join(File.dirname(__FILE__), 'templates', 'ruboss_config')
50
- end
51
-
52
- empty_directory :bin, File.join('public', 'bin')
53
- empty_directory :javascripts, File.join('public', 'javascripts')
54
- empty_directory :schema, 'schema'
55
-
56
- file :flex_properties, 'flex.properties', '.flexProperties'
57
-
58
- template :actionscript_properties do |t|
59
- t.source = "#{extract_config('actionscript')}.properties"
60
- t.destination = '.actionScriptProperties'
61
- end
62
-
63
- template :project_properties do |t|
64
- t.source = "#{extract_config('project')}.properties"
65
- t.destination = '.project'
66
- end
67
-
68
- %w(components controllers commands models events).each do |dir|
69
- empty_directory dir.to_sym do |t|
70
- t.destination = File.join('app', 'flex', base_folder, dir)
71
- end
72
- end
73
-
74
- empty_directory :generated do |t|
75
- t.destination = File.join('app', 'flex', base_folder, 'components', 'generated')
76
- end
77
-
78
- glob!('html-template')
79
-
80
- file :swfoject, 'swfobject.js', File.join('public', 'javascripts', 'swfobject.js')
81
-
82
- file :express_install, 'expressInstall.swf', File.join('public', 'expressInstall.swf')
83
-
84
- file :ruboss_yml, 'ruboss.yml', File.join('config', 'ruboss.yml')
85
-
86
- template :index, 'index.html.erb', File.join('app', 'views', 'layout', 'application.html.erb')
87
-
88
- invoke :ruboss_flex_app
89
-
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")
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
-
101
- invoke :ruboss_controller
102
- end
103
-
104
- add :ruboss_config, RubossConfigGenerator
105
- end
@@ -1,61 +0,0 @@
1
- require 'ruboss4ruby/configuration'
2
-
3
- module Merb::Generators
4
- class RubossControllerGenerator < Generator
5
- include Ruboss::Configuration
6
-
7
- def initialize(*args)
8
- super
9
- @project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names
10
- end
11
-
12
- def project_name
13
- @project_name
14
- end
15
-
16
- def flex_project_name
17
- @flex_project_name
18
- end
19
-
20
- def base_folder
21
- @base_folder
22
- end
23
-
24
- def base_package
25
- @base_package
26
- end
27
-
28
- def command_controller_name
29
- @command_controller_name
30
- end
31
-
32
- def model_names
33
- list_as_files("app/flex/#{base_folder}/models")
34
- end
35
-
36
- def command_names
37
- list_as_files("app/flex/#{base_folder}/commands")
38
- end
39
-
40
- def self.source_root
41
- File.join(File.dirname(__FILE__), 'templates', 'ruboss_controller')
42
- end
43
-
44
- template :controller do |t|
45
- t.source = 'controller.as.erb'
46
- t.destination = File.join('app', 'flex', base_folder, 'controllers', "#{command_controller_name}.as")
47
- end
48
-
49
- desc <<-DESC
50
- Generates the main Ruboss Flex application controller.
51
- Typically app/flex/<yourappname>/controllers/<YourAppName>Controller.as,
52
- e.g. app/flex/pomodo/controllers/PomodoController.as
53
-
54
- It pulls out all available models and commands from respective
55
- folders and makes sure they'll be pulled into the Flex application
56
- at runtime.
57
- DESC
58
- end
59
-
60
- add :ruboss_controller, RubossControllerGenerator
61
- end
@@ -1,69 +0,0 @@
1
- require 'open-uri'
2
- require 'fileutils'
3
- require 'ruboss4ruby/version'
4
- require 'ruboss4ruby/configuration'
5
-
6
- module Merb::Generators
7
- class RubossFlexAppGenerator < Generator
8
- include Ruboss::Configuration
9
-
10
- option :air, :as => :boolean, :default => false, :desc => 'Configure AIR project instead of Flex. Flex is default.'
11
-
12
- def initialize(*args)
13
- super
14
- @project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names
15
-
16
- @component_names = []
17
- if File.exists?("app/flex/#{base_folder}/components/generated")
18
- @component_names = list_mxml_files("app/flex/#{base_folder}/components/generated")
19
- end
20
- end
21
-
22
- def project_name
23
- @project_name
24
- end
25
-
26
- def flex_project_name
27
- @flex_project_name
28
- end
29
-
30
- def base_folder
31
- @base_folder
32
- end
33
-
34
- def base_package
35
- @base_package
36
- end
37
-
38
- def command_controller_name
39
- @command_controller_name
40
- end
41
-
42
- def component_names
43
- @component_names
44
- end
45
-
46
- def application_tag
47
- if get_option(:air)
48
- 'WindowedApplication'
49
- else
50
- 'Application'
51
- end
52
- end
53
-
54
- def self.source_root
55
- File.join(File.dirname(__FILE__), 'templates', 'ruboss_flex_app')
56
- end
57
-
58
- desc <<-DESC
59
- Generates main flex application file.
60
- DESC
61
-
62
- template :main_app do |t|
63
- t.source = 'mainapp.mxml'
64
- t.destination = File.join('app', 'flex', "#{project_name}.mxml")
65
- end
66
- end
67
-
68
- add :ruboss_flex_app, RubossFlexAppGenerator
69
- end
@@ -1,4 +0,0 @@
1
- Merb::Generators::ResourceControllerGenerator.template :ruboss_resource_controller, :orm => :activerecord do |t|
2
- t.source = File.dirname(__FILE__) / "templates/ruboss_resource_controller/controller.rb.erb"
3
- t.destination = "app/controllers" / base_path / "#{file_name}.rb"
4
- end
@@ -1,158 +0,0 @@
1
- require 'ruboss4ruby/configuration'
2
- require 'ruboss4ruby/generated_attribute'
3
-
4
- #NOTE: this is currently (merb 0.9.9 broken and needs to be rethought anyway. This line of thinking was based
5
- # on the kind of code generation you could do with rails, it's a different code generation paradigm with Merb anyway)
6
- module Merb::Generators
7
- class RubossScaffoldGenerator < NamespacedGenerator
8
- include Ruboss::Configuration
9
-
10
- option :flex_only, :as => :boolean, :default => false, :desc => 'Scaffold Flex code only.'
11
- option :skip_migration, :as => :boolean, :default => false, :desc => 'Skip migration for this model.'
12
-
13
- first_argument :name, :required => true, :desc => "model name"
14
- second_argument :properties, :as => :hash, :required => true, :default => {}, :desc => "space separated model properties in form of name:type. Example: state:string"
15
-
16
- def initialize(*args)
17
- @project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names
18
- super
19
- end
20
-
21
- def table_name
22
- file_name.pluralize
23
- end
24
-
25
- alias_method :resource_controller_name, :table_name
26
-
27
- def model_name
28
- name
29
- end
30
-
31
- def controller_name
32
- name.pluralize
33
- end
34
-
35
- def project_name
36
- @project_name
37
- end
38
-
39
- def flex_project_name
40
- @flex_project_name
41
- end
42
-
43
- def base_folder
44
- @base_folder
45
- end
46
-
47
- def base_package
48
- @base_package
49
- end
50
-
51
- def command_controller_name
52
- @command_controller_name
53
- end
54
-
55
- def belongs_tos
56
- @belongs_tos
57
- end
58
-
59
- def has_manies
60
- @has_manies
61
- end
62
-
63
- def has_ones
64
- @has_ones
65
- end
66
-
67
- def attributes
68
- @belongs_tos = []
69
- @has_ones = []
70
- @has_manies = []
71
- # Figure out has_one, has_many and belongs_to based on args
72
- self.properties.each do |key,value|
73
- puts key + value
74
- key = key.to_sym
75
- if key == :has_one
76
- # arg = "has_one:arg1,arg2", so all the has_one are together
77
- @has_ones = value.split(',')
78
- elsif key == :has_many
79
- # arg = "has_many:arg1,arg2", so all the has_many are together
80
- @has_manies = value.split(",")
81
- elsif key == :belongs_to # belongs_to:arg1,arg2
82
- @belongs_tos = value.split(',')
83
- end
84
- end
85
-
86
- puts "does this even run?"
87
-
88
- puts belongs_tos
89
- puts has_manies
90
-
91
- # Remove the has_one and has_many arguments since they are
92
- # not for consumption by the scaffold generator, and since
93
- # we have already used them to set the @belongs_tos, @has_ones and
94
- # @has_manies.
95
- self.properties.delete_if { |key, value| key =~ /^(has_one|has_many|belongs_to)/ }
96
-
97
- @attributes ||= self.properties.collect do |key, value|
98
- Ruboss::Generator::GeneratedAttribute.new(key, value)
99
- end
100
- end
101
-
102
- def self.source_root
103
- File.join(File.dirname(__FILE__), 'templates', 'ruboss_scaffold')
104
- end
105
-
106
- invoke :ruboss_resource_controller do |generator|
107
- generator.new(destination_root, options, controller_name)
108
- end
109
-
110
- template :ar_model, :flex_only => false do |t|
111
- t.source = 'model.rb.erb'
112
- t.destination = File.join('app', 'models', "#{file_name}.rb")
113
- end
114
-
115
- empty_directory :fixtures, File.join('spec', 'fixtures')
116
-
117
- template :fixture, :flex_only => false do |t|
118
- t.source = 'fixtures.yml.erb'
119
- t.destination = File.join('spec', 'fixtures', "#{table_name}.yml")
120
- end
121
-
122
- empty_directory :migrations, File.join('schema', 'migrations')
123
-
124
- template :migration, :flex_only => false, :skip_migration => false do |t|
125
- t.source = 'migration.rb.erb'
126
- t.destination = File.join('schema', 'migrations', "#{migration_file_name}.rb")
127
- end
128
-
129
- template :as_model do |t|
130
- t.source = 'model.as.erb'
131
- t.destination = File.join('app', 'flex', base_folder, 'models', "#{class_name}.as")
132
- end
133
-
134
- template :flex_component do |t|
135
- t.source = 'component.mxml.erb'
136
- t.destination = File.join('app', 'flex', base_folder, 'components', 'generated', "#{class_name}Box.mxml")
137
- end
138
-
139
- invoke :ruboss_controller do |generator|
140
- generator.new(destination_root, options)
141
- end
142
-
143
- def migration_file_name
144
- current_migration_number = Dir[Dir.pwd+'/schema/migrations/*'].map{|f| File.basename(f) =~ /^(\d+)/; $1}.max
145
- migration_file_name = format("%03d_%s", (current_migration_number.to_i+1), file_name) + "_migration"
146
- end
147
-
148
- def migration_name
149
- "#{class_name}Migration"
150
- end
151
-
152
- desc <<-DESC
153
- Foobar.
154
- DESC
155
- end
156
-
157
- add :ruboss_scaffold, RubossScaffoldGenerator
158
- end
@@ -1,16 +0,0 @@
1
- # Ruboss code generation configuration options
2
-
3
- # By default flex models, commands, controllers and components are genearated into
4
- # app/flex/<your rails project name> folder. If you'd like to customize the target folder
5
- # (to say append a "com" package before your rails project name) uncomment the line below
6
- # base-package must follow the usual flex package notation (a string separated by ".")
7
-
8
- #base-package: com.pomodo
9
-
10
- # Main ruboss controller is typically named after your rails project name (camel-cased with a word
11
- # Controller appended at the end, e.g. if your application is called "pomodo" the flex application
12
- # controller will be called "PomodoController"). This controller is created in
13
- # <base-package>.controllers folder. You can customize the name by uncommenting the following line
14
- # and changing the controller name.
15
-
16
- #controller-name: PomodoController
@@ -1,49 +0,0 @@
1
- class <%= class_name %> < Application
2
- provides :xml, :fxml
3
-
4
- # GET /<%= resource_path %>
5
- def index
6
- @<%= plural_model %> = <%= model_class_name %>.find(:all)
7
- display @<%= plural_model %>
8
- end
9
-
10
- # GET /<%= resource_path %>/:id
11
- def show
12
- @<%= singular_model %> = <%= model_class_name %>.find_by_id(params[:id])
13
- raise NotFound unless @<%= singular_model %>
14
- display @<%= singular_model %>
15
- end
16
-
17
- # POST /<%= resource_path %>
18
- def create
19
- @<%= singular_model %> = <%= model_class_name %>.new(params[:<%= singular_model %>])
20
- if @<%= singular_model %>.save
21
- display @<%= singular_model %>
22
- else
23
- display @<%= singular_model %>.errors
24
- end
25
- end
26
-
27
- # PUT /<%= resource_path %>/:id
28
- def update
29
- @<%= singular_model %> = <%= model_class_name %>.find_by_id(params[:id])
30
- raise NotFound unless @<%= singular_model %>
31
- if @<%= singular_model %>.update_attributes(params[:<%= singular_model %>])
32
- display @<%= singular_model %>
33
- else
34
- display @<%= singular_model %>.errors
35
- end
36
- end
37
-
38
- # DELETE /<%= resource_path %>/:id
39
- def destroy
40
- @<%= singular_model %> = <%= model_class_name %>.find_by_id(params[:id])
41
- raise NotFound unless @<%= singular_model %>
42
- if @<%= singular_model %>.destroy
43
- display @<%= singular_model %>
44
- else
45
- display @<%= singular_model %>.errors
46
- end
47
- end
48
-
49
- end
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/ruboss4ruby.rb'}"
9
- puts "Loading ruboss4ruby gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)