hobo 0.7.5 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. data/{hobo_files/plugin/CHANGES.txt → CHANGES.txt} +391 -0
  2. data/Manifest +146 -0
  3. data/{hobo_files/plugin/README → README} +0 -0
  4. data/bin/hobo +13 -26
  5. data/dryml_generators/rapid/cards.dryml.erb +55 -0
  6. data/dryml_generators/rapid/forms.dryml.erb +43 -0
  7. data/dryml_generators/rapid/pages.dryml.erb +284 -0
  8. data/hobo.gemspec +168 -0
  9. data/init.rb +9 -0
  10. data/lib/action_view_extensions/helpers/tag_helper.rb +7 -0
  11. data/lib/active_record/association_collection.rb +54 -0
  12. data/{hobo_files/plugin/lib → lib}/active_record/association_proxy.rb +12 -4
  13. data/{hobo_files/plugin/lib → lib}/active_record/association_reflection.rb +7 -1
  14. data/{hobo_files/plugin/lib → lib}/extensions/test_case.rb +17 -17
  15. data/{hobo_files/plugin/lib → lib}/hobo.rb +193 -100
  16. data/{hobo_files/plugin/lib → lib}/hobo/authentication_support.rb +8 -8
  17. data/{hobo_files/plugin/lib → lib}/hobo/bundle.rb +90 -89
  18. data/{hobo_files/plugin/lib → lib}/hobo/composite_model.rb +21 -21
  19. data/{hobo_files/plugin/lib → lib}/hobo/controller.rb +38 -25
  20. data/{hobo_files/plugin/lib → lib}/hobo/dev_controller.rb +10 -6
  21. data/lib/hobo/dryml.rb +167 -0
  22. data/{hobo_files/plugin/lib → lib}/hobo/dryml/dryml_builder.rb +28 -25
  23. data/lib/hobo/dryml/dryml_generator.rb +210 -0
  24. data/{hobo_files/plugin/lib → lib}/hobo/dryml/dryml_support_controller.rb +1 -1
  25. data/lib/hobo/dryml/parser.rb +3 -0
  26. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/attribute.rb +6 -6
  27. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/base_parser.rb +16 -16
  28. data/lib/hobo/dryml/parser/document.rb +57 -0
  29. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/element.rb +7 -7
  30. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/elements.rb +9 -9
  31. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/source.rb +3 -3
  32. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/text.rb +3 -3
  33. data/{hobo_files/plugin/lib → lib}/hobo/dryml/parser/tree_parser.rb +3 -3
  34. data/{hobo_files/plugin/lib → lib}/hobo/dryml/part_context.rb +26 -26
  35. data/{hobo_files/plugin/lib → lib}/hobo/dryml/scoped_variables.rb +15 -15
  36. data/{hobo_files/plugin/lib → lib}/hobo/dryml/tag_parameters.rb +10 -10
  37. data/{hobo_files/plugin/lib → lib}/hobo/dryml/taglib.rb +43 -37
  38. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template.rb +290 -208
  39. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template_environment.rb +173 -115
  40. data/{hobo_files/plugin/lib → lib}/hobo/dryml/template_handler.rb +19 -24
  41. data/lib/hobo/find_for.rb +95 -0
  42. data/{hobo_files/plugin/lib → lib}/hobo/generator.rb +2 -1
  43. data/{hobo_files/plugin/lib → lib}/hobo/guest.rb +12 -4
  44. data/{hobo_files/plugin/lib → lib}/hobo/hobo_helper.rb +146 -117
  45. data/lib/hobo/include_in_save.rb +43 -0
  46. data/lib/hobo/lifecycles.rb +94 -0
  47. data/lib/hobo/lifecycles/actions.rb +73 -0
  48. data/lib/hobo/lifecycles/creator.rb +76 -0
  49. data/lib/hobo/lifecycles/lifecycle.rb +205 -0
  50. data/lib/hobo/lifecycles/state.rb +23 -0
  51. data/lib/hobo/lifecycles/transition.rb +66 -0
  52. data/{hobo_files/plugin/lib → lib}/hobo/model.rb +306 -217
  53. data/{hobo_files/plugin/lib → lib}/hobo/model_controller.rb +342 -213
  54. data/{hobo_files/plugin/lib → lib}/hobo/model_router.rb +151 -120
  55. data/{hobo_files/plugin/lib → lib}/hobo/model_support.rb +9 -9
  56. data/{hobo_files/plugin/lib → lib}/hobo/rapid_helper.rb +30 -23
  57. data/{hobo_files/plugin/lib → lib}/hobo/scopes.rb +22 -68
  58. data/{hobo_files/plugin/lib → lib}/hobo/scopes/apply_scopes.rb +5 -5
  59. data/lib/hobo/scopes/association_proxy_extensions.rb +47 -0
  60. data/{hobo_files/plugin/lib → lib}/hobo/scopes/automatic_scopes.rb +104 -79
  61. data/lib/hobo/scopes/named_scope_extensions.rb +27 -0
  62. data/{hobo_files/plugin/lib → lib}/hobo/static_tags +1 -11
  63. data/{hobo_files/plugin/lib → lib}/hobo/undefined.rb +1 -1
  64. data/{hobo_files/plugin/lib → lib}/hobo/undefined_access_error.rb +0 -0
  65. data/{hobo_files/plugin/lib → lib}/hobo/user.rb +27 -25
  66. data/{hobo_files/plugin/lib → lib}/hobo/user_controller.rb +80 -34
  67. data/{hobo_files/plugin/generators → rails_generators}/hobo/hobo_generator.rb +7 -7
  68. data/rails_generators/hobo/templates/application.css +0 -0
  69. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/application.dryml +0 -2
  70. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/dryml-support.js +0 -0
  71. data/{hobo_files/plugin/generators → rails_generators}/hobo/templates/guest.rb +0 -0
  72. data/rails_generators/hobo/templates/initializer.rb +9 -0
  73. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/USAGE +0 -0
  74. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/hobo_front_controller_generator.rb +1 -3
  75. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/controller.rb +1 -1
  76. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/functional_test.rb +0 -0
  77. data/{hobo_files/plugin/generators → rails_generators}/hobo_front_controller/templates/helper.rb +0 -0
  78. data/rails_generators/hobo_front_controller/templates/index.dryml +25 -0
  79. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/USAGE +0 -0
  80. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/hobo_model_generator.rb +0 -0
  81. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/fixtures.yml +0 -0
  82. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/model.rb +0 -0
  83. data/{hobo_files/plugin/generators → rails_generators}/hobo_model/templates/unit_test.rb +0 -0
  84. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/USAGE +0 -0
  85. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/hobo_model_controller_generator.rb +0 -7
  86. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/controller.rb +0 -0
  87. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/functional_test.rb +0 -0
  88. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_controller/templates/helper.rb +0 -0
  89. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/hobo_model_resource_generator.rb +0 -0
  90. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/controller.rb +0 -0
  91. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/functional_test.rb +0 -0
  92. data/{hobo_files/plugin/generators → rails_generators}/hobo_model_resource/templates/helper.rb +0 -0
  93. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/hobo_rapid_generator.rb +21 -11
  94. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/IE7.js +1 -1
  95. data/rails_generators/hobo_rapid/templates/blank.gif +0 -0
  96. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/hobo-rapid.css +0 -0
  97. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/hobo-rapid.js +175 -104
  98. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/lowpro.js +0 -0
  99. data/rails_generators/hobo_rapid/templates/nicEditorIcons.gif +0 -0
  100. data/rails_generators/hobo_rapid/templates/nicedit.js +91 -0
  101. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/reset.css +0 -0
  102. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/fieldbg.gif +0 -0
  103. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/pencil.png +0 -0
  104. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/small_close.png +0 -0
  105. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/images/spinner.gif +0 -0
  106. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/stylesheets/clean.css +80 -71
  107. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/public/stylesheets/rapid-ui.css +6 -1
  108. data/{hobo_files/plugin/generators → rails_generators}/hobo_rapid/templates/themes/clean/views/clean.dryml +4 -4
  109. data/rails_generators/hobo_subsite/hobo_subsite_generator.rb +73 -0
  110. data/rails_generators/hobo_subsite/templates/application.dryml +1 -0
  111. data/rails_generators/hobo_subsite/templates/controller.rb +5 -0
  112. data/rails_generators/hobo_subsite/templates/site_taglib.dryml +13 -0
  113. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/USAGE +0 -0
  114. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/hobo_user_controller_generator.rb +0 -0
  115. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/controller.rb +0 -0
  116. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/functional_test.rb +0 -0
  117. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_controller/templates/helper.rb +0 -0
  118. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/USAGE +0 -0
  119. data/rails_generators/hobo_user_model/hobo_user_model_generator.rb +30 -0
  120. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/templates/fixtures.yml +0 -0
  121. data/rails_generators/hobo_user_model/templates/forgot_password.erb +10 -0
  122. data/rails_generators/hobo_user_model/templates/mailer.rb +14 -0
  123. data/rails_generators/hobo_user_model/templates/model.rb +55 -0
  124. data/{hobo_files/plugin/generators → rails_generators}/hobo_user_model/templates/unit_test.rb +0 -0
  125. data/script/destroy +14 -0
  126. data/script/generate +14 -0
  127. data/{hobo_files/plugin/taglibs → taglibs}/core.dryml +6 -7
  128. data/{hobo_files/plugin/taglibs → taglibs}/rapid.dryml +36 -67
  129. data/{hobo_files/plugin/taglibs → taglibs}/rapid_document_tags.dryml +7 -24
  130. data/{hobo_files/plugin/taglibs → taglibs}/rapid_editing.dryml +51 -50
  131. data/{hobo_files/plugin/taglibs → taglibs}/rapid_forms.dryml +62 -56
  132. data/taglibs/rapid_generics.dryml +33 -0
  133. data/taglibs/rapid_lifecycles.dryml +43 -0
  134. data/{hobo_files/plugin/taglibs → taglibs}/rapid_navigation.dryml +23 -23
  135. data/taglibs/rapid_pages.dryml +183 -0
  136. data/{hobo_files/plugin/taglibs → taglibs}/rapid_plus.dryml +30 -5
  137. data/{hobo_files/plugin/taglibs → taglibs}/rapid_support.dryml +3 -4
  138. data/taglibs/rapid_user_pages.dryml +179 -0
  139. data/{hobo_files/plugin/tasks → tasks}/environments.rake +0 -0
  140. data/{hobo_files/plugin/tasks → tasks}/fix_dryml.rake +0 -0
  141. data/{hobo_files/plugin/tasks → tasks}/generate_tag_reference.rb +21 -22
  142. data/tasks/hobo_tasks.rake +32 -0
  143. data/test/test_generator_helper.rb +29 -0
  144. data/test/test_helper.rb +1 -0
  145. data/test/test_hobo_model_controller_generator.rb +56 -0
  146. data/{hobo_files/plugin/uninstall.rb → uninstall.rb} +0 -0
  147. metadata +240 -225
  148. data/README.txt +0 -18
  149. data/hobo_files/plugin/LICENSE.txt +0 -22
  150. data/hobo_files/plugin/Rakefile +0 -96
  151. data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +0 -24
  152. data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +0 -19
  153. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/banner.gif +0 -0
  154. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-bodytop.gif +0 -0
  155. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-01.gif +0 -0
  156. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-02.gif +0 -0
  157. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-03.gif +0 -0
  158. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-corner-04.gif +0 -0
  159. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-bottom.gif +0 -0
  160. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-left.gif +0 -0
  161. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-right.gif +0 -0
  162. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/bkg-shadow-top.gif +0 -0
  163. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-blue.gif +0 -0
  164. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-dblue.gif +0 -0
  165. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-green.gif +0 -0
  166. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-purple.gif +0 -0
  167. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/header-red.gif +0 -0
  168. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/logo.gif +0 -0
  169. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/plus.png +0 -0
  170. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/spinner.gif +0 -0
  171. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-dblue.gif +0 -0
  172. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-green.gif +0 -0
  173. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-purple.gif +0 -0
  174. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/txt-list-img-red.gif +0 -0
  175. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-01.gif +0 -0
  176. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-02.gif +0 -0
  177. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-03.gif +0 -0
  178. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-corner-04.gif +0 -0
  179. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-bottom.gif +0 -0
  180. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-left.gif +0 -0
  181. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-right.gif +0 -0
  182. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/window-shadow-top.gif +0 -0
  183. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +0 -400
  184. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +0 -96
  185. data/hobo_files/plugin/generators/hobo_user_model/hobo_user_model_generator.rb +0 -25
  186. data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +0 -56
  187. data/hobo_files/plugin/init.rb +0 -101
  188. data/hobo_files/plugin/lib/action_view_extensions/base.rb +0 -15
  189. data/hobo_files/plugin/lib/active_record/has_many_association.rb +0 -55
  190. data/hobo_files/plugin/lib/active_record/has_many_through_association.rb +0 -20
  191. data/hobo_files/plugin/lib/hobo/dryml.rb +0 -165
  192. data/hobo_files/plugin/lib/hobo/dryml/parser/document.rb +0 -53
  193. data/hobo_files/plugin/lib/hobo/scopes/association_proxy_extensions.rb +0 -33
  194. data/hobo_files/plugin/lib/hobo/scopes/defined_scope_proxy_extender.rb +0 -90
  195. data/hobo_files/plugin/lib/hobo/scopes/scope_reflection.rb +0 -18
  196. data/hobo_files/plugin/lib/hobo/scopes/scoped_proxy.rb +0 -55
  197. data/hobo_files/plugin/taglib-docs/core.markdown +0 -165
  198. data/hobo_files/plugin/taglib-docs/rapid.markdown +0 -677
  199. data/hobo_files/plugin/taglib-docs/rapid_document_tags.markdown +0 -240
  200. data/hobo_files/plugin/taglib-docs/rapid_editing.markdown +0 -418
  201. data/hobo_files/plugin/taglib-docs/rapid_forms.markdown +0 -562
  202. data/hobo_files/plugin/taglib-docs/rapid_generics.markdown +0 -187
  203. data/hobo_files/plugin/taglib-docs/rapid_navigation.markdown +0 -214
  204. data/hobo_files/plugin/taglib-docs/rapid_pages.markdown +0 -530
  205. data/hobo_files/plugin/taglib-docs/rapid_plus.markdown +0 -65
  206. data/hobo_files/plugin/taglib-docs/rapid_support.markdown +0 -50
  207. data/hobo_files/plugin/taglib-docs/rapid_user_pages.markdown +0 -129
  208. data/hobo_files/plugin/taglibs/rapid_generics.dryml +0 -117
  209. data/hobo_files/plugin/taglibs/rapid_pages.dryml +0 -359
  210. data/hobo_files/plugin/taglibs/rapid_user_pages.dryml +0 -104
  211. data/hobo_files/plugin/tasks/dump_fixtures.rake +0 -70
  212. data/hobo_files/plugin/tasks/hobo_tasks.rake +0 -17
@@ -1,53 +0,0 @@
1
- module Hobo::Dryml::Parser
2
-
3
- class Document < REXML::Document
4
-
5
- def initialize(source, path)
6
- super(nil)
7
-
8
- # Replace <%...%> scriptlets with xml-safe references into a hash of scriptlets
9
- @scriptlets = {}
10
- source = source.gsub(/<%(.*?)%>/m) do
11
- _, scriptlet = *Regexp.last_match
12
- id = @scriptlets.size + 1
13
- @scriptlets[id] = scriptlet
14
- newlines = "\n" * scriptlet.count("\n")
15
- "[![DRYML-ERB#{id}#{newlines}]!]"
16
- end
17
-
18
-
19
- @reference_src = "<dryml_page>" + source + "</dryml_page>"
20
- rex_src = Hobo::Dryml::Parser::Source.new(@reference_src)
21
-
22
- @elements = Hobo::Dryml::Parser::Elements.new(self)
23
- build(rex_src)
24
-
25
- rescue REXML::ParseException => e
26
- raise DrymlSyntaxError, "File: #{path}\n#{e}"
27
- end
28
-
29
-
30
- def element_line_num(el)
31
- offset = el.source_offset
32
- @reference_src[0..offset].count("\n") + 1
33
- end
34
-
35
-
36
- def default_attribute_value
37
- "&true"
38
- end
39
-
40
-
41
- def restore_erb_scriptlets(src)
42
- src.gsub(/\[!\[DRYML-ERB(\d+)\s*\]!\]/m) {|s| "<%#{@scriptlets[$1.to_i]}%>" }
43
- end
44
-
45
-
46
- private
47
- def build( source )
48
- Hobo::Dryml::Parser::TreeParser.new( source, self ).parse
49
- end
50
-
51
- end
52
-
53
- end
@@ -1,33 +0,0 @@
1
- # Add support for :scope => :my_scope to has_many and :belongs_to
2
-
3
- module Hobo
4
-
5
- module Scopes
6
-
7
- module AssociationProxyExtensions
8
-
9
- def self.included(base)
10
- base.class_eval do
11
- alias_method_chain :conditions, :hobo_scopes
12
- end
13
- end
14
-
15
- def conditions_with_hobo_scopes
16
- scope_conditions = if (scope_name = @reflection.options[:scope])
17
- target_class = @reflection.klass
18
- target_class.send(scope_name).scope(:find)[:conditions]
19
- end
20
- if scope_conditions && conditions_without_hobo_scopes
21
- "(#{sanitize_sql conditions_without_hobo_scopes}) AND (#{sanitize_sql scope_conditions})"
22
- elsif scope_conditions
23
- sanitize_sql scope_conditions
24
- else
25
- conditions_without_hobo_scopes
26
- end
27
- end
28
-
29
- end
30
-
31
- end
32
-
33
- end
@@ -1,90 +0,0 @@
1
- module Hobo
2
-
3
- module Scopes
4
-
5
- module DefinedScopeProxyExtender
6
-
7
- attr_accessor :reflections
8
-
9
- include AutomaticScopes
10
-
11
- include ApplyScopes
12
-
13
- def method_missing(name, *args, &block)
14
- if (scope = named_scope(name))
15
- association_proxy_for_scope(name, scope, args)
16
- elsif member_class.create_automatic_scope(name)
17
- # create_automatic_scope returned true -- the method now exists
18
- send(name, *args, &block)
19
- else
20
- super
21
- end
22
- end
23
-
24
-
25
- def named_scope(name)
26
- proxy_reflection.klass.try.defined_scopes._?[name.to_sym]
27
- end
28
-
29
-
30
- def association_proxy_for_scope(name, scope_or_proc, args)
31
- if scope_or_proc.is_a?(Proc)
32
- scope = scope_or_proc.call(*args)
33
- create_association_proxy_for_scope(name, scope)
34
- else
35
- # This scope is not parameterised so we can cache the
36
- # association-proxy in an instance variable
37
- scope = scope_or_proc
38
- scope_ivar = "@#{name.to_s.gsub('?','')}_scope"
39
-
40
- # Some craziness here -- calling instance_variable_get or
41
- # set directly causes self to get loaded, hence the 'bind'
42
- # tricks
43
- Kernel.instance_method(:instance_variable_get).bind(self).call(scope_ivar) or
44
- begin
45
- assoc = create_association_proxy_for_scope(name, scope)
46
- Kernel.instance_method(:instance_variable_set).bind(self).call(scope_ivar, assoc)
47
- end
48
- end
49
- end
50
-
51
-
52
- def create_association_proxy_for_scope(name, scope)
53
- options = proxy_reflection.options
54
- has_many_conditions = options[:conditions]
55
- has_many_conditions = nil if has_many_conditions.blank?
56
- source = proxy_reflection.source_reflection
57
- scope_conditions = scope[:conditions]
58
- scope_conditions = nil if scope_conditions.blank?
59
- conditions = if has_many_conditions && scope_conditions
60
- "(#{sanitize_sql scope_conditions}) AND (#{sanitize_sql has_many_conditions})"
61
- else
62
- scope_conditions || has_many_conditions
63
- end
64
-
65
- options = options.merge(scope).update(:class_name => proxy_reflection.klass.name,
66
- :foreign_key => proxy_reflection.primary_key_name)
67
- options[:conditions] = conditions unless conditions.blank?
68
- options[:source] = source.name if source
69
-
70
- options[:limit] = scope[:limit] if scope[:limit]
71
- options[:order] = scope[:order] if scope[:order]
72
- options[:include] = scope[:include] if scope[:include]
73
-
74
- r = ScopeReflection.new(:has_many, name, options, proxy_owner.class, proxy_reflection.association_name)
75
-
76
- @reflections ||= {}
77
- @reflections[name] = r
78
-
79
- if source
80
- ActiveRecord::Associations::HasManyThroughAssociation
81
- else
82
- ActiveRecord::Associations::HasManyAssociation
83
- end.new(proxy_owner, r)
84
- end
85
-
86
- end
87
-
88
- end
89
-
90
- end
@@ -1,18 +0,0 @@
1
- module Hobo
2
-
3
- module Scopes
4
-
5
- class ScopeReflection < ActiveRecord::Reflection::AssociationReflection
6
-
7
- def initialize(macro, name, options, klass, association_name)
8
- super(macro, name, options, klass)
9
- @association_name = association_name
10
- end
11
-
12
- attr_accessor :association_name
13
-
14
- end
15
-
16
- end
17
-
18
- end
@@ -1,55 +0,0 @@
1
- module Hobo
2
-
3
- module Scopes
4
-
5
- class ScopedProxy
6
-
7
- include ApplyScopes
8
-
9
- def initialize(klass, scope)
10
- @klass = klass
11
- @scope = scope
12
- end
13
-
14
-
15
- def method_missing(name, *args, &block)
16
- if name.to_sym.in?(@klass.defined_scopes.keys) || @klass.create_automatic_scope(name)
17
- proxy = @klass.send(name, *args)
18
- proxy.instance_variable_set("@parent_scope", self)
19
- proxy
20
- else
21
- _apply_scope { @klass.send(name, *args, &block) }
22
- end
23
- end
24
-
25
- def first
26
- self.find(:first)
27
- end
28
-
29
- def member_class
30
- @klass
31
- end
32
-
33
- private
34
- def _apply_scope
35
- if @parent_scope
36
- @parent_scope.send(:_apply_scope) do
37
- @scope ? @klass.send(:with_scope, :find => @scope) { yield } : yield
38
- end
39
- else
40
- @scope ? @klass.send(:with_scope, :find => @scope) { yield } : yield
41
- end
42
- end
43
-
44
- end
45
- (Object.instance_methods +
46
- Object.private_instance_methods +
47
- Object.protected_instance_methods).each do |m|
48
- ScopedProxy.send(:undef_method, m) unless
49
- m.in?(%w{initialize method_missing send instance_variable_set instance_variable_get puts}) || m.starts_with?('_')
50
-
51
- end
52
-
53
- end
54
-
55
- end
@@ -1,165 +0,0 @@
1
- # Core
2
-
3
- * [&lt;call-tag&gt;](#call-tag)
4
- * [&lt;wrap&gt;](#wrap)
5
- * [&lt;partial&gt;](#partial)
6
- * [&lt;repeat&gt;](#repeat)
7
- * [&lt;do&gt;](#do)
8
- * [&lt;with&gt;](#with)
9
- * [&lt;if&gt;](#if)
10
- * [&lt;else&gt;](#else)
11
- * [&lt;unless&gt;](#unless)
12
-
13
-
14
- ---
15
-
16
- <a name="call-tag">&nbsp;</a>
17
- ## &lt;call-tag&gt;
18
-
19
-
20
-
21
- ### Attributes
22
-
23
- * tag
24
-
25
-
26
- ### Parameters
27
-
28
- None
29
-
30
-
31
- ---
32
-
33
- <a name="wrap">&nbsp;</a>
34
- ## &lt;wrap&gt;
35
-
36
-
37
-
38
- ### Attributes
39
-
40
- * tag
41
- * when
42
- * parameter
43
-
44
-
45
- ### Parameters
46
-
47
- None
48
-
49
-
50
- ---
51
-
52
- <a name="partial">&nbsp;</a>
53
- ## &lt;partial&gt;
54
-
55
-
56
-
57
- ### Attributes
58
-
59
- * name
60
- * locals
61
-
62
-
63
- ### Parameters
64
-
65
- None
66
-
67
-
68
- ---
69
-
70
- <a name="repeat">&nbsp;</a>
71
- ## &lt;repeat&gt;
72
-
73
-
74
-
75
- ### Attributes
76
-
77
- * even-odd
78
- * join
79
-
80
-
81
- ### Parameters
82
-
83
- None
84
-
85
-
86
- ---
87
-
88
- <a name="do">&nbsp;</a>
89
- ## &lt;do&gt;
90
-
91
-
92
-
93
- ### Attributes
94
-
95
- None
96
-
97
- ### Parameters
98
-
99
- None
100
-
101
-
102
- ---
103
-
104
- <a name="with">&nbsp;</a>
105
- ## &lt;with&gt;
106
-
107
-
108
-
109
- ### Attributes
110
-
111
- None
112
-
113
- ### Parameters
114
-
115
- None
116
-
117
-
118
- ---
119
-
120
- <a name="if">&nbsp;</a>
121
- ## &lt;if&gt;
122
-
123
-
124
-
125
- ### Attributes
126
-
127
- * test
128
-
129
-
130
- ### Parameters
131
-
132
- None
133
-
134
-
135
- ---
136
-
137
- <a name="else">&nbsp;</a>
138
- ## &lt;else&gt;
139
-
140
-
141
-
142
- ### Attributes
143
-
144
- None
145
-
146
- ### Parameters
147
-
148
- None
149
-
150
-
151
- ---
152
-
153
- <a name="unless">&nbsp;</a>
154
- ## &lt;unless&gt;
155
-
156
-
157
-
158
- ### Attributes
159
-
160
- * test
161
-
162
-
163
- ### Parameters
164
-
165
- None
@@ -1,677 +0,0 @@
1
- # Rapid
2
-
3
- * [&lt;field-list&gt;](#field-list)
4
- * [&lt;item&gt;](#item)
5
- * [&lt;nil-view&gt;](#nil-view)
6
- * [&lt;ul&gt;](#ul)
7
- * [&lt;table&gt;](#table)
8
- * [&lt;image&gt;](#image)
9
- * [&lt;spinner&gt;](#spinner)
10
- * [&lt;hobo-rapid-javascripts&gt;](#hobo-rapid-javascripts)
11
- * [&lt;name&gt;](#name)
12
- * [&lt;type-name&gt;](#type-name)
13
- * [&lt;name-for-collection&gt;](#name-for-collection)
14
- * [&lt;a&gt;](#a)
15
- * [&lt;view&gt;](#view)
16
- * [&lt;belongs-to-view&gt;](#belongs-to-view)
17
- * [&lt;has-many-view&gt;](#has-many-view)
18
- * [&lt;view for=`"Date"`&gt;](#view--for-Date)
19
- * [&lt;view for=`"Time"`&gt;](#view--for-Time)
20
- * [&lt;view for=`"Numeric"`&gt;](#view--for-Numeric)
21
- * [&lt;view for=`"string"`&gt;](#view--for-string)
22
- * [&lt;view for=`"boolean"`&gt;](#view--for-boolean)
23
- * [&lt;view for=`"ActiveRecord::Base"`&gt;](#view--for-ActiveRecord::Base)
24
- * [&lt;count&gt;](#count)
25
- * [&lt;theme-stylesheet&gt;](#theme-stylesheet)
26
- * [&lt;has-many-table&gt;](#has-many-table)
27
- * [&lt;add-by-name&gt;](#add-by-name)
28
- * [&lt;you&gt;](#you)
29
- * [&lt;You&gt;](#You)
30
- * [&lt;your&gt;](#your)
31
- * [&lt;Your&gt;](#Your)
32
- * [&lt;live-search&gt;](#live-search)
33
- * [&lt;a-or-an&gt;](#a-or-an)
34
- * [&lt;A-or-An&gt;](#A-or-An)
35
- * [&lt;filter-menu&gt;](#filter-menu)
36
- * [&lt;comma-list&gt;](#comma-list)
37
-
38
-
39
- ---
40
-
41
- <a name="field-list">&nbsp;</a>
42
- ## &lt;field-list&gt;
43
-
44
-
45
-
46
- ### Attributes (merged with [&lt;labelled-item-list&gt;](#labelled-item-list))
47
-
48
- * tag
49
-
50
-
51
- ### Parameters
52
-
53
- <ul><li>(dynamic parameter) (&lt;item-label&gt;)
54
- <ul><li>&lt;label:&gt; (&lt;do&gt;)
55
- </li>
56
- </ul></li>
57
- <li>(dynamic parameter) (&lt;item-value&gt;)
58
- <ul><li>&lt;view:&gt; (&lt;do&gt;)
59
- <ul><li>(dynamic parameter) (&lt;call-tag&gt;)
60
- </li>
61
- </ul></li>
62
- </ul></li>
63
- </ul>
64
-
65
-
66
- ---
67
-
68
- <a name="item">&nbsp;</a>
69
- ## &lt;item&gt;
70
-
71
-
72
-
73
- ### Attributes
74
-
75
- None
76
-
77
- ### Parameters
78
-
79
- None
80
-
81
-
82
- ---
83
-
84
- <a name="nil-view">&nbsp;</a>
85
- ## &lt;nil-view&gt;
86
-
87
-
88
-
89
- ### Attributes
90
-
91
- None
92
-
93
- ### Parameters
94
-
95
- None
96
-
97
-
98
- ---
99
-
100
- <a name="ul">&nbsp;</a>
101
- ## &lt;ul&gt;
102
-
103
-
104
-
105
- ### Attributes (merged with [&lt;li&gt;](#li))
106
-
107
- * empty
108
-
109
-
110
- ### Parameters
111
-
112
- <ul><li>&lt;head:&gt; (&lt;do&gt;)
113
- </li>
114
- <li>&lt;li:&gt;
115
- <ul><li>&lt;default:&gt; (&lt;do&gt;)
116
- </li>
117
- </ul></li>
118
- <li>&lt;foot:&gt; (&lt;do&gt;)
119
- </li>
120
- </ul>
121
-
122
-
123
- ---
124
-
125
- <a name="table">&nbsp;</a>
126
- ## &lt;table&gt;
127
-
128
-
129
-
130
- ### Attributes (merged with [&lt;with-field-names&gt;](#with-field-names))
131
-
132
- * fields
133
- * field-tag
134
- * empty
135
-
136
-
137
- ### Parameters
138
-
139
- <ul><li>&lt;thead:&gt;
140
- <ul><li>&lt;field-heading-row:&gt; (&lt;tr&gt;)
141
- <ul><li>(dynamic parameter) (&lt;th&gt;)
142
- </li>
143
- </ul></li>
144
- </ul></li>
145
- <li>&lt;tr:&gt;
146
- <ul><li>(dynamic parameter) (&lt;td&gt;)
147
- </li>
148
- <li>&lt;controls:&gt; (&lt;td&gt;)
149
- <ul><li>&lt;edit-link:&gt; (&lt;a&gt;)
150
- </li>
151
- <li>&lt;delete-button:&gt;
152
- </li>
153
- </ul></li>
154
- </ul></li>
155
- <li>&lt;tfoot:&gt;
156
- </li>
157
- </ul>
158
-
159
-
160
- ---
161
-
162
- <a name="image">&nbsp;</a>
163
- ## &lt;image&gt;
164
-
165
-
166
-
167
- ### Attributes (merged with [&lt;img&gt;](#img))
168
-
169
- * src
170
-
171
-
172
- ### Parameters
173
-
174
- None
175
-
176
-
177
- ---
178
-
179
- <a name="spinner">&nbsp;</a>
180
- ## &lt;spinner&gt;
181
-
182
-
183
-
184
- ### Attributes (merged with [&lt;img&gt;](#img))
185
-
186
- None
187
-
188
- ### Parameters
189
-
190
- None
191
-
192
-
193
- ---
194
-
195
- <a name="hobo-rapid-javascripts">&nbsp;</a>
196
- ## &lt;hobo-rapid-javascripts&gt;
197
-
198
-
199
-
200
- ### Attributes
201
-
202
- * tiny-mce
203
-
204
-
205
- ### Parameters
206
-
207
- None
208
-
209
-
210
- ---
211
-
212
- <a name="name">&nbsp;</a>
213
- ## &lt;name&gt;
214
-
215
-
216
-
217
- ### Attributes
218
-
219
- None
220
-
221
- ### Parameters
222
-
223
- None
224
-
225
-
226
- ---
227
-
228
- <a name="type-name">&nbsp;</a>
229
- ## &lt;type-name&gt;
230
-
231
-
232
-
233
- ### Attributes
234
-
235
- * type
236
- * plural
237
- * lowercase
238
- * dasherize
239
-
240
-
241
- ### Parameters
242
-
243
- None
244
-
245
-
246
- ---
247
-
248
- <a name="name-for-collection">&nbsp;</a>
249
- ## &lt;name-for-collection&gt;
250
-
251
-
252
-
253
- ### Attributes
254
-
255
- * singular
256
- * lowercase
257
-
258
-
259
- ### Parameters
260
-
261
- None
262
-
263
-
264
- ---
265
-
266
- <a name="a">&nbsp;</a>
267
- ## &lt;a&gt;
268
-
269
-
270
-
271
- ### Attributes
272
-
273
- * action
274
- * to
275
- * params
276
- * query-params
277
- * href
278
- * format
279
- * subsite
280
-
281
-
282
- ### Parameters
283
-
284
- None
285
-
286
-
287
- ---
288
-
289
- <a name="view">&nbsp;</a>
290
- ## &lt;view&gt;
291
-
292
-
293
-
294
- ### Attributes
295
-
296
- * inline
297
- * block
298
- * if-blank
299
- * no-wrapper
300
- * truncate
301
-
302
-
303
- ### Parameters
304
-
305
- None
306
-
307
-
308
- ---
309
-
310
- <a name="belongs-to-view">&nbsp;</a>
311
- ## &lt;belongs-to-view&gt;
312
-
313
-
314
-
315
- ### Attributes (merged with [&lt;a&gt;](#a))
316
-
317
- None
318
-
319
- ### Parameters
320
-
321
- None
322
-
323
-
324
- ---
325
-
326
- <a name="has-many-view">&nbsp;</a>
327
- ## &lt;has-many-view&gt;
328
-
329
-
330
-
331
- ### Attributes
332
-
333
- None
334
-
335
- ### Parameters
336
-
337
- None
338
-
339
-
340
- ---
341
-
342
- <a name="view--for-Date">&nbsp;</a>
343
- ## &lt;view for=`"Date"`&gt;
344
-
345
-
346
-
347
- ### Attributes
348
-
349
- * format
350
-
351
-
352
- ### Parameters
353
-
354
- None
355
-
356
-
357
- ---
358
-
359
- <a name="view--for-Time">&nbsp;</a>
360
- ## &lt;view for=`"Time"`&gt;
361
-
362
-
363
-
364
- ### Attributes
365
-
366
- * format
367
-
368
-
369
- ### Parameters
370
-
371
- None
372
-
373
-
374
- ---
375
-
376
- <a name="view--for-Numeric">&nbsp;</a>
377
- ## &lt;view for=`"Numeric"`&gt;
378
-
379
-
380
-
381
- ### Attributes
382
-
383
- * format
384
-
385
-
386
- ### Parameters
387
-
388
- None
389
-
390
-
391
- ---
392
-
393
- <a name="view--for-string">&nbsp;</a>
394
- ## &lt;view for=`"string"`&gt;
395
-
396
-
397
-
398
- ### Attributes
399
-
400
- None
401
-
402
- ### Parameters
403
-
404
- None
405
-
406
-
407
- ---
408
-
409
- <a name="view--for-boolean">&nbsp;</a>
410
- ## &lt;view for=`"boolean"`&gt;
411
-
412
-
413
-
414
- ### Attributes
415
-
416
- None
417
-
418
- ### Parameters
419
-
420
- None
421
-
422
-
423
- ---
424
-
425
- <a name="view--for-ActiveRecord::Base">&nbsp;</a>
426
- ## &lt;view for=`"ActiveRecord::Base"`&gt;
427
-
428
-
429
-
430
- ### Attributes
431
-
432
- None
433
-
434
- ### Parameters
435
-
436
- None
437
-
438
-
439
- ---
440
-
441
- <a name="count">&nbsp;</a>
442
- ## &lt;count&gt;
443
-
444
-
445
-
446
- ### Attributes
447
-
448
- * label
449
- * prefix
450
- * if-any
451
- * lowercase
452
-
453
-
454
- ### Parameters
455
-
456
- None
457
-
458
-
459
- ---
460
-
461
- <a name="theme-stylesheet">&nbsp;</a>
462
- ## &lt;theme-stylesheet&gt;
463
-
464
-
465
-
466
- ### Attributes
467
-
468
- * name
469
-
470
-
471
- ### Parameters
472
-
473
- None
474
-
475
-
476
- ---
477
-
478
- <a name="has-many-table">&nbsp;</a>
479
- ## &lt;has-many-table&gt;
480
-
481
-
482
-
483
- ### Attributes (merged with [&lt;table-for&gt;](#table-for))
484
-
485
- * part-id
486
- * delete-buttons
487
- * headings
488
- * id
489
-
490
-
491
- ### Parameters
492
-
493
- <ul><li>&lt;default:&gt; (&lt;do&gt;)
494
- </li>
495
- </ul>
496
-
497
-
498
- ---
499
-
500
- <a name="add-by-name">&nbsp;</a>
501
- ## &lt;add-by-name&gt;
502
-
503
-
504
-
505
- ### Attributes
506
-
507
- * action-name
508
- * add-text
509
- * update
510
- * part-id
511
-
512
-
513
- ### Parameters
514
-
515
- <ul><li>&lt;default:&gt; (&lt;do&gt;)
516
- </li>
517
- </ul>
518
-
519
-
520
- ---
521
-
522
- <a name="you">&nbsp;</a>
523
- ## &lt;you&gt;
524
-
525
-
526
-
527
- ### Attributes
528
-
529
- * have
530
- * are
531
- * do
532
- * titleize
533
-
534
-
535
- ### Parameters
536
-
537
- <ul><li>&lt;default:&gt; (&lt;do&gt;)
538
- </li>
539
- </ul>
540
-
541
-
542
- ---
543
-
544
- <a name="You">&nbsp;</a>
545
- ## &lt;You&gt;
546
-
547
-
548
-
549
- ### Attributes (merged with [&lt;you&gt;](#you))
550
-
551
- None
552
-
553
- ### Parameters (merged with [&lt;you&gt;](#you))
554
-
555
- None
556
-
557
-
558
- ---
559
-
560
- <a name="your">&nbsp;</a>
561
- ## &lt;your&gt;
562
-
563
-
564
-
565
- ### Attributes
566
-
567
- None
568
-
569
- ### Parameters
570
-
571
- <ul><li>&lt;default:&gt; (&lt;do&gt;)
572
- </li>
573
- </ul>
574
-
575
-
576
- ---
577
-
578
- <a name="Your">&nbsp;</a>
579
- ## &lt;Your&gt;
580
-
581
-
582
-
583
- ### Attributes
584
-
585
- None
586
-
587
- ### Parameters
588
-
589
- <ul><li>&lt;default:&gt; (&lt;do&gt;)
590
- </li>
591
- </ul>
592
-
593
-
594
- ---
595
-
596
- <a name="live-search">&nbsp;</a>
597
- ## &lt;live-search&gt;
598
-
599
-
600
-
601
- ### Attributes
602
-
603
- None
604
-
605
- ### Parameters
606
-
607
- None
608
-
609
-
610
- ---
611
-
612
- <a name="a-or-an">&nbsp;</a>
613
- ## &lt;a-or-an&gt;
614
-
615
-
616
-
617
- ### Attributes
618
-
619
- * word
620
-
621
-
622
- ### Parameters
623
-
624
- None
625
-
626
-
627
- ---
628
-
629
- <a name="A-or-An">&nbsp;</a>
630
- ## &lt;A-or-An&gt;
631
-
632
-
633
-
634
- ### Attributes
635
-
636
- * word
637
-
638
-
639
- ### Parameters
640
-
641
- None
642
-
643
-
644
- ---
645
-
646
- <a name="filter-menu">&nbsp;</a>
647
- ## &lt;filter-menu&gt;
648
-
649
-
650
-
651
- ### Attributes
652
-
653
- * param-name
654
- * options
655
- * no-filter
656
-
657
-
658
- ### Parameters (merged with [&lt;select-menu&gt;](#select-menu))
659
-
660
- None
661
-
662
-
663
- ---
664
-
665
- <a name="comma-list">&nbsp;</a>
666
- ## &lt;comma-list&gt;
667
-
668
-
669
-
670
- ### Attributes
671
-
672
- * separator
673
-
674
-
675
- ### Parameters
676
-
677
- None