spiderfw 0.6.22 → 0.6.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (251) hide show
  1. data/CHANGELOG +9 -0
  2. data/VERSION +1 -1
  3. data/apps/app_server/controllers/app_server_controller.rb +7 -2
  4. data/apps/app_server/lib/git_app.rb +5 -3
  5. data/apps/cas_server/controllers/mixins/cas_login_mixin.rb +2 -1
  6. data/apps/core/admin/controllers/admin_controller.rb +4 -4
  7. data/apps/core/admin/controllers/app_admin_controller.rb +3 -2
  8. data/apps/core/admin/public/css/sass/admin.css +56 -31
  9. data/apps/core/admin/public/sass/admin.scss +38 -4
  10. data/apps/core/admin/views/_breadcrumb.shtml +8 -0
  11. data/apps/core/admin/views/admin.layout.shtml +8 -5
  12. data/apps/core/auth/controllers/login_controller.rb +3 -8
  13. data/apps/core/components/assets.rb +37 -1
  14. data/apps/core/components/public/bootstrap/LICENSE +13 -0
  15. data/apps/core/components/public/bootstrap/README.md +28 -0
  16. data/apps/core/components/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
  17. data/apps/core/components/public/bootstrap/img/glyphicons-halflings.png +0 -0
  18. data/apps/core/components/public/bootstrap/js/README.md +106 -0
  19. data/apps/core/components/public/bootstrap/js/bootstrap-alert.js +91 -0
  20. data/apps/core/components/public/bootstrap/js/bootstrap-button.js +98 -0
  21. data/apps/core/components/public/bootstrap/js/bootstrap-carousel.js +154 -0
  22. data/apps/core/components/public/bootstrap/js/bootstrap-collapse.js +136 -0
  23. data/apps/core/components/public/bootstrap/js/bootstrap-dropdown.js +92 -0
  24. data/apps/core/components/public/bootstrap/js/bootstrap-modal.js +209 -0
  25. data/apps/core/components/public/bootstrap/js/bootstrap-popover.js +95 -0
  26. data/apps/core/components/public/bootstrap/js/bootstrap-scrollspy.js +125 -0
  27. data/apps/core/components/public/bootstrap/js/bootstrap-tab.js +130 -0
  28. data/apps/core/components/public/bootstrap/js/bootstrap-tooltip.js +270 -0
  29. data/apps/core/components/public/bootstrap/js/bootstrap-transition.js +51 -0
  30. data/apps/core/components/public/bootstrap/js/bootstrap-typeahead.js +271 -0
  31. data/apps/core/components/public/bootstrap/js/tests/index.html +49 -0
  32. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-alert.js +41 -0
  33. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-button.js +54 -0
  34. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-collapse.js +25 -0
  35. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js +53 -0
  36. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-modal.js +85 -0
  37. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-popover.js +93 -0
  38. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-scrollspy.js +31 -0
  39. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-tab.js +45 -0
  40. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-tooltip.js +62 -0
  41. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-transition.js +13 -0
  42. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-typeahead.js +128 -0
  43. data/apps/core/components/public/bootstrap/js/tests/vendor/jquery.js +9252 -0
  44. data/apps/core/components/public/bootstrap/js/tests/vendor/qunit.css +232 -0
  45. data/apps/core/components/public/bootstrap/js/tests/vendor/qunit.js +1510 -0
  46. data/apps/core/components/public/bootstrap/scss/_accordion.scss +28 -0
  47. data/apps/core/components/public/bootstrap/scss/_alerts.scss +70 -0
  48. data/apps/core/components/public/bootstrap/scss/_breadcrumbs.scss +22 -0
  49. data/apps/core/components/public/bootstrap/scss/_button-groups.scss +146 -0
  50. data/apps/core/components/public/bootstrap/scss/_buttons.scss +165 -0
  51. data/apps/core/components/public/bootstrap/scss/_carousel.scss +121 -0
  52. data/apps/core/components/public/bootstrap/scss/_close.scss +18 -0
  53. data/apps/core/components/public/bootstrap/scss/_code.scss +44 -0
  54. data/apps/core/components/public/bootstrap/scss/_component-animations.scss +18 -0
  55. data/apps/core/components/public/bootstrap/scss/_custom.css +0 -0
  56. data/apps/core/components/public/bootstrap/scss/_dropdowns.scss +131 -0
  57. data/apps/core/components/public/bootstrap/scss/_forms.scss +516 -0
  58. data/apps/core/components/public/bootstrap/scss/_grid.scss +8 -0
  59. data/apps/core/components/public/bootstrap/scss/_hero-unit.scss +20 -0
  60. data/apps/core/components/public/bootstrap/scss/_labels.scss +16 -0
  61. data/apps/core/components/public/bootstrap/scss/_layouts.scss +17 -0
  62. data/apps/core/components/public/bootstrap/scss/_mixins.scss +538 -0
  63. data/apps/core/components/public/bootstrap/scss/_modals.scss +72 -0
  64. data/apps/core/components/public/bootstrap/scss/_navbar.scss +292 -0
  65. data/apps/core/components/public/bootstrap/scss/_navs.scss +343 -0
  66. data/apps/core/components/public/bootstrap/scss/_pager.scss +30 -0
  67. data/apps/core/components/public/bootstrap/scss/_pagination.scss +64 -0
  68. data/apps/core/components/public/bootstrap/scss/_patterns.scss +13 -0
  69. data/apps/core/components/public/bootstrap/scss/_popovers.scss +49 -0
  70. data/apps/core/components/public/bootstrap/scss/_print.scss +18 -0
  71. data/apps/core/components/public/bootstrap/scss/_progress-bars.scss +95 -0
  72. data/apps/core/{admin/public/sass/bootstrap/reset.scss → components/public/bootstrap/scss/_reset.scss} +36 -51
  73. data/apps/core/components/public/bootstrap/scss/_scaffolding.scss +29 -0
  74. data/apps/core/components/public/bootstrap/scss/_sprites.scss +156 -0
  75. data/apps/core/components/public/bootstrap/scss/_tables.scss +139 -0
  76. data/apps/core/components/public/bootstrap/scss/_thumbnails.scss +35 -0
  77. data/apps/core/components/public/bootstrap/scss/_tooltip.scss +35 -0
  78. data/apps/core/components/public/bootstrap/scss/_type.scss +217 -0
  79. data/apps/core/components/public/bootstrap/scss/_utilities.scss +23 -0
  80. data/apps/core/components/public/bootstrap/scss/_variables.scss +99 -0
  81. data/apps/core/components/public/bootstrap/scss/_wells.scss +17 -0
  82. data/apps/core/components/public/bootstrap/scss/bootstrap-responsive.css +707 -0
  83. data/apps/core/components/public/bootstrap/scss/bootstrap-responsive.scss +323 -0
  84. data/apps/core/components/public/bootstrap/scss/bootstrap.css +4604 -0
  85. data/apps/core/components/public/bootstrap/scss/bootstrap.scss +62 -0
  86. data/apps/core/components/public/bootstrap/scss/config.rb +36 -0
  87. data/apps/core/components/public/css/admin.css +2 -1
  88. data/apps/core/components/public/css/sass/bootstrap/bootstrap.css +3107 -0
  89. data/apps/core/components/public/css/table_base.css +9 -0
  90. data/apps/core/components/public/widgets/month_calendar.js +9 -0
  91. data/apps/core/components/widgets/crud/crud.rb +9 -1
  92. data/apps/core/components/widgets/crud/crud.shtml +2 -2
  93. data/apps/core/components/widgets/month_calendar/month_calendar.shtml +1 -0
  94. data/apps/core/components/widgets/table/table.rb +84 -55
  95. data/apps/core/components/widgets/table/table.shtml +2 -1
  96. data/apps/core/forms/public/ckeditor/CHANGES.html +139 -1
  97. data/apps/core/forms/public/ckeditor/LICENSE.html +1 -8
  98. data/apps/core/forms/public/ckeditor/ckeditor.js +141 -137
  99. data/apps/core/forms/public/ckeditor/ckeditor_basic.js +3 -3
  100. data/apps/core/forms/public/ckeditor/ckeditor_basic_source.js +1 -1
  101. data/apps/core/forms/public/ckeditor/ckeditor_source.js +13 -3
  102. data/apps/core/forms/public/ckeditor/contents.css +4 -2
  103. data/apps/core/forms/public/ckeditor/lang/_translationstatus.txt +59 -59
  104. data/apps/core/forms/public/ckeditor/lang/af.js +1 -1
  105. data/apps/core/forms/public/ckeditor/lang/ar.js +1 -1
  106. data/apps/core/forms/public/ckeditor/lang/bg.js +1 -1
  107. data/apps/core/forms/public/ckeditor/lang/bn.js +1 -1
  108. data/apps/core/forms/public/ckeditor/lang/bs.js +1 -1
  109. data/apps/core/forms/public/ckeditor/lang/ca.js +1 -1
  110. data/apps/core/forms/public/ckeditor/lang/cs.js +1 -1
  111. data/apps/core/forms/public/ckeditor/lang/cy.js +1 -1
  112. data/apps/core/forms/public/ckeditor/lang/da.js +1 -1
  113. data/apps/core/forms/public/ckeditor/lang/de.js +1 -1
  114. data/apps/core/forms/public/ckeditor/lang/el.js +1 -1
  115. data/apps/core/forms/public/ckeditor/lang/en-au.js +1 -1
  116. data/apps/core/forms/public/ckeditor/lang/en-ca.js +1 -1
  117. data/apps/core/forms/public/ckeditor/lang/en-gb.js +1 -1
  118. data/apps/core/forms/public/ckeditor/lang/en.js +1 -1
  119. data/apps/core/forms/public/ckeditor/lang/eo.js +1 -1
  120. data/apps/core/forms/public/ckeditor/lang/es.js +1 -1
  121. data/apps/core/forms/public/ckeditor/lang/et.js +1 -1
  122. data/apps/core/forms/public/ckeditor/lang/eu.js +1 -1
  123. data/apps/core/forms/public/ckeditor/lang/fa.js +1 -1
  124. data/apps/core/forms/public/ckeditor/lang/fi.js +1 -1
  125. data/apps/core/forms/public/ckeditor/lang/fo.js +1 -1
  126. data/apps/core/forms/public/ckeditor/lang/fr-ca.js +1 -1
  127. data/apps/core/forms/public/ckeditor/lang/fr.js +1 -1
  128. data/apps/core/forms/public/ckeditor/lang/gl.js +1 -1
  129. data/apps/core/forms/public/ckeditor/lang/gu.js +1 -1
  130. data/apps/core/forms/public/ckeditor/lang/he.js +1 -1
  131. data/apps/core/forms/public/ckeditor/lang/hi.js +1 -1
  132. data/apps/core/forms/public/ckeditor/lang/hr.js +1 -1
  133. data/apps/core/forms/public/ckeditor/lang/hu.js +1 -1
  134. data/apps/core/forms/public/ckeditor/lang/is.js +1 -1
  135. data/apps/core/forms/public/ckeditor/lang/it.js +1 -1
  136. data/apps/core/forms/public/ckeditor/lang/ja.js +1 -1
  137. data/apps/core/forms/public/ckeditor/lang/ka.js +1 -1
  138. data/apps/core/forms/public/ckeditor/lang/km.js +1 -1
  139. data/apps/core/forms/public/ckeditor/lang/ko.js +1 -1
  140. data/apps/core/forms/public/ckeditor/lang/lt.js +1 -1
  141. data/apps/core/forms/public/ckeditor/lang/lv.js +1 -1
  142. data/apps/core/forms/public/ckeditor/lang/mn.js +1 -1
  143. data/apps/core/forms/public/ckeditor/lang/ms.js +1 -1
  144. data/apps/core/forms/public/ckeditor/lang/nb.js +1 -1
  145. data/apps/core/forms/public/ckeditor/lang/nl.js +1 -1
  146. data/apps/core/forms/public/ckeditor/lang/no.js +1 -1
  147. data/apps/core/forms/public/ckeditor/lang/pl.js +1 -1
  148. data/apps/core/forms/public/ckeditor/lang/pt-br.js +1 -1
  149. data/apps/core/forms/public/ckeditor/lang/pt.js +1 -1
  150. data/apps/core/forms/public/ckeditor/lang/ro.js +1 -1
  151. data/apps/core/forms/public/ckeditor/lang/ru.js +1 -1
  152. data/apps/core/forms/public/ckeditor/lang/sk.js +1 -1
  153. data/apps/core/forms/public/ckeditor/lang/sl.js +1 -1
  154. data/apps/core/forms/public/ckeditor/lang/sr-latn.js +1 -1
  155. data/apps/core/forms/public/ckeditor/lang/sr.js +1 -1
  156. data/apps/core/forms/public/ckeditor/lang/sv.js +1 -1
  157. data/apps/core/forms/public/ckeditor/lang/th.js +1 -1
  158. data/apps/core/forms/public/ckeditor/lang/tr.js +1 -1
  159. data/apps/core/forms/public/ckeditor/lang/uk.js +1 -1
  160. data/apps/core/forms/public/ckeditor/lang/vi.js +1 -1
  161. data/apps/core/forms/public/ckeditor/lang/zh-cn.js +1 -1
  162. data/apps/core/forms/public/ckeditor/lang/zh.js +1 -1
  163. data/apps/core/forms/public/ckeditor/plugins/autogrow/plugin.js +1 -1
  164. data/apps/core/forms/public/ckeditor/plugins/bbcode/plugin.js +4 -4
  165. data/apps/core/forms/public/ckeditor/plugins/docprops/dialogs/docprops.js +2 -2
  166. data/apps/core/forms/public/ckeditor/plugins/find/dialogs/find.js +5 -4
  167. data/apps/core/forms/public/ckeditor/plugins/flash/dialogs/flash.js +4 -4
  168. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/select.js +2 -2
  169. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/textarea.js +1 -1
  170. data/apps/core/forms/public/ckeditor/plugins/iframe/dialogs/iframe.js +2 -2
  171. data/apps/core/forms/public/ckeditor/plugins/image/dialogs/image.js +6 -6
  172. data/apps/core/forms/public/ckeditor/plugins/link/dialogs/link.js +6 -5
  173. data/apps/core/forms/public/ckeditor/plugins/liststyle/dialogs/liststyle.js +2 -1
  174. data/apps/core/forms/public/ckeditor/plugins/pastefromword/filter/default.js +5 -5
  175. data/apps/core/forms/public/ckeditor/plugins/specialchar/dialogs/specialchar.js +1 -1
  176. data/apps/core/forms/public/ckeditor/plugins/specialchar/lang/en.js +1 -1
  177. data/apps/core/forms/public/ckeditor/plugins/table/dialogs/table.js +4 -4
  178. data/apps/core/forms/public/ckeditor/plugins/tableresize/plugin.js +2 -2
  179. data/apps/core/forms/public/ckeditor/plugins/wsc/dialogs/wsc.js +1 -1
  180. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/README.md +26 -0
  181. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/dialog.css +616 -0
  182. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/editor.css +1088 -0
  183. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/icons.png +0 -0
  184. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/images/dialog_sides.gif +0 -0
  185. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/images/dialog_sides.png +0 -0
  186. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/images/dialog_sides_rtl.png +0 -0
  187. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/images/mini.png +0 -0
  188. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/images/noimage.png +0 -0
  189. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/images/sprites.png +0 -0
  190. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/images/sprites_ie6.png +0 -0
  191. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/images/toolbar_start.gif +0 -0
  192. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/skin.js +7 -0
  193. data/apps/core/forms/public/ckeditor/skins/BootstrapCK-Skin/templates.css +54 -0
  194. data/apps/core/forms/public/ckeditor/skins/kama/dialog.css +4 -3
  195. data/apps/core/forms/public/ckeditor/skins/kama/editor.css +3 -3
  196. data/apps/core/forms/public/ckeditor/themes/default/theme.js +2 -2
  197. data/apps/core/forms/public/css/form.css +5 -5
  198. data/apps/core/forms/public/html_area.js +5 -5
  199. data/apps/core/forms/tags/element_label.erb +1 -1
  200. data/apps/core/forms/tags/row.erb +1 -1
  201. data/apps/core/forms/widgets/form/form.rb +2 -1
  202. data/apps/core/forms/widgets/form/form.shtml +3 -3
  203. data/apps/core/forms/widgets/inputs/checkbox/checkbox.shtml +1 -1
  204. data/apps/core/forms/widgets/inputs/date_time/date_time.shtml +1 -1
  205. data/apps/core/forms/widgets/inputs/file_input/file_input.shtml +1 -1
  206. data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +1 -1
  207. data/apps/core/forms/widgets/inputs/input/input.shtml +1 -1
  208. data/apps/core/forms/widgets/inputs/input/readonly.shtml +1 -1
  209. data/apps/core/forms/widgets/inputs/password/password.shtml +1 -1
  210. data/apps/core/forms/widgets/inputs/search_select/search_select.shtml +1 -1
  211. data/apps/core/forms/widgets/inputs/select/select.shtml +1 -1
  212. data/apps/core/forms/widgets/inputs/text/text.shtml +1 -1
  213. data/apps/core/forms/widgets/inputs/text_area/text_area.shtml +1 -1
  214. data/apps/core/forms/widgets/inputs/time_span/time_span.shtml +1 -1
  215. data/apps/messenger/controllers/messenger_admin_controller.rb +19 -4
  216. data/apps/messenger/views/admin/_admin.layout.shtml +1 -1
  217. data/apps/messenger/views/admin/queue.shtml +6 -6
  218. data/apps/messenger/views/admin/view_email.shtml +7 -0
  219. data/apps/messenger/views/admin/view_sms.shtml +4 -0
  220. data/blueprints/app/.dirs +2 -1
  221. data/blueprints/app/test/features/support/env.rb +4 -0
  222. data/data/locale/it/LC_MESSAGES/spider.mo +0 -0
  223. data/lib/spiderfw/cmd/commands/config.rb +6 -3
  224. data/lib/spiderfw/config/configuration.rb +11 -2
  225. data/lib/spiderfw/config/options/spider.rb +1 -1
  226. data/lib/spiderfw/controller/controller.rb +27 -15
  227. data/lib/spiderfw/controller/dispatcher.rb +8 -4
  228. data/lib/spiderfw/controller/http_controller.rb +9 -5
  229. data/lib/spiderfw/controller/mixins/static_content.rb +1 -0
  230. data/lib/spiderfw/controller/mixins/visual.rb +48 -31
  231. data/lib/spiderfw/home.rb +8 -0
  232. data/lib/spiderfw/i18n/cldr.rb +1 -0
  233. data/lib/spiderfw/model/base_model.rb +2 -2
  234. data/lib/spiderfw/model/mappers/db_mapper.rb +1 -0
  235. data/lib/spiderfw/model/unit_of_work.rb +2 -2
  236. data/lib/spiderfw/requires.rb +1 -0
  237. data/lib/spiderfw/setup/app_manager.rb +16 -8
  238. data/lib/spiderfw/spider.rb +2 -2
  239. data/lib/spiderfw/templates/layout.rb +16 -9
  240. data/lib/spiderfw/templates/template.rb +28 -8
  241. data/lib/spiderfw/utils/logger.rb +9 -9
  242. data/views/errors/error.layout.shtml +9 -4
  243. metadata +98 -13
  244. data/apps/core/admin/public/sass/bootstrap/bootstrap.scss +0 -29
  245. data/apps/core/admin/public/sass/bootstrap/forms.scss +0 -478
  246. data/apps/core/admin/public/sass/bootstrap/mixins.scss +0 -220
  247. data/apps/core/admin/public/sass/bootstrap/patterns.scss +0 -1062
  248. data/apps/core/admin/public/sass/bootstrap/scaffolding.scss +0 -136
  249. data/apps/core/admin/public/sass/bootstrap/tables.scss +0 -224
  250. data/apps/core/admin/public/sass/bootstrap/type.scss +0 -187
  251. data/apps/core/admin/public/sass/bootstrap/variables.scss +0 -60
@@ -0,0 +1,7 @@
1
+ <div>
2
+ <h4>{ @message.subject }</h4>
3
+ <pre>{ @message.headers }
4
+
5
+ { @message.body }
6
+ </pre>
7
+ </div>
@@ -0,0 +1,4 @@
1
+ <div>
2
+ <h4>{ @message.to }</h4>
3
+ <pre>{ @message.text }</pre>
4
+ </div>
data/blueprints/app/.dirs CHANGED
@@ -2,4 +2,5 @@ controllers
2
2
  models
3
3
  public
4
4
  views
5
- widgets
5
+ widgets
6
+ test/features/step_definitions
@@ -0,0 +1,4 @@
1
+ $SPIDER_RUNMODE = 'test'
2
+ require 'spiderfw/test/cucumber'
3
+ require 'spiderfw/test/capybara'
4
+ Spider.init
Binary file
@@ -43,13 +43,16 @@ class ConfigCommand < CmdParse::Command
43
43
  print args[0]
44
44
  print ":\n"+option[:description]+"\n" if option[:description] && !option[:description].empty?
45
45
  puts
46
- puts "#{(_('Type')+':').ljust(10)} #{option[:params][:type]}" if option[:params][:type]
46
+ puts "#{( _('Type') +':').ljust(10)} #{option[:params][:type]}" if option[:params][:type]
47
47
  default_str = nil
48
48
  if default = option[:params][:default]
49
49
  default_str = default.is_a?(Proc) ? _('Dynamic') : default
50
50
  end
51
- puts "#{(_('Default')+':').ljust(10)} #{default_str}" if default_str
52
- puts "#{(_('Choices')+':').ljust(10)} #{option[:params][:choices].join(', ')}" if option[:params][:choices]
51
+ puts "#{( _('Default') +':').ljust(10)} #{default_str}" if default_str
52
+ if choices = option[:params][:choices]
53
+ choices = choices.call if choices.is_a?(Proc)
54
+ puts "#{( _('Choices') +':').ljust(10)} #{choices.join(', ')}"
55
+ end
53
56
  else
54
57
  puts _("Configuration option not found")
55
58
  end
@@ -139,8 +139,16 @@ module Spider
139
139
  def [](key)
140
140
  key = translate_key(key)
141
141
  val = @values[key]
142
+ return val unless @options[key]
142
143
 
143
- if (val.nil? && @options[key] && @options[key][:params][:default])
144
+ if val.nil? && fallback = @options[key][:params][:fallback]
145
+ fallback = [fallback] unless fallback.is_a?(Array)
146
+ fallback.each do |fb|
147
+ val = Spider.conf.get(fb)
148
+ break if val
149
+ end
150
+ end
151
+ if val.nil? && @options[key][:params][:default]
144
152
  default = @options[key][:params][:default]
145
153
  val = default
146
154
  if (default.class == Proc)
@@ -185,7 +193,8 @@ module Spider
185
193
  # Sets an allowed configuration option
186
194
  # Possible params are:
187
195
  # -:default the default value for the option; if it is a proc, it will be called
188
- # -:choiches an array of allowed values
196
+ # -:fallback like default, but use another config key instead (an array may be specified)
197
+ # -:choices an array of allowed values
189
198
  # -:type parameter type; can be one of int, string, bool
190
199
  def config_option(name, description=nil, params={}, &proc)
191
200
  name = name.to_s
@@ -130,7 +130,7 @@ module Spider
130
130
  :default => :ERROR,
131
131
  :choices => [false, :DEBUG, :WARN, :INFO, :ERROR]
132
132
  config_option 'log.non_static_extensions_list', _('Allow logging for some file extensions'),
133
- :type => Array, :default => []
133
+ :type => Array, :default => ['html', 'xml', 'json']
134
134
 
135
135
 
136
136
 
@@ -183,6 +183,7 @@ module Spider
183
183
  method = action
184
184
  end
185
185
  method = method[0..-2] if !method.blank? && method[-1].chr == '/'
186
+ method, rest = method.split('.', 2) if method
186
187
  method = self.class.default_action if !method || method.empty?
187
188
  return nil if method.empty?
188
189
  return [method.to_sym, additional_arguments]
@@ -202,11 +203,7 @@ module Spider
202
203
 
203
204
  def execute(action='', *arguments)
204
205
  return if @__done
205
- # return if self.is_a?(Spider::Widget) # FIXME: this is obviously wrong. Widgets must override the behaviour
206
- # # somewhere else, or probably just not inherit controller.
207
206
  debug("Controller #{self} executing #{action} with arguments #{arguments}")
208
- # before(action, *arguments)
209
- # do_dispatch(:before, action, *arguments)
210
207
  catch(:done) do
211
208
  if can_dispatch?(:execute, action)
212
209
  d_next = dispatch_next(action)
@@ -216,10 +213,9 @@ module Spider
216
213
  arguments = d_next.params
217
214
  end
218
215
  if d_next && d_next.dest == self
219
- @executed_method = d_next.action.to_sym
220
- @executed_method_arguments = []
216
+ set_executed_method(d_next.action)
221
217
  end
222
- if (@executed_method)
218
+ if @executed_method
223
219
  meth = self.method(@executed_method)
224
220
  args = arguments + @executed_method_arguments
225
221
  @controller_action = args[0]
@@ -230,6 +226,7 @@ module Spider
230
226
  args = [nil] if meth.arity == 1 && args.empty?
231
227
  end
232
228
  Spider.logger.info("Executing: #{self.class.name}##{@executed_method}.#{@request.format}")
229
+ spider_main_controller_send = true
233
230
  send(@executed_method, *args)
234
231
  else
235
232
  raise NotFound.new(action)
@@ -313,14 +310,24 @@ module Spider
313
310
  return scene
314
311
  end
315
312
 
313
+ def get_route(*args)
314
+ route = super
315
+ return route unless route
316
+ action = route.path.split('/').first
317
+ action_method, action_params = get_action_method(action)
318
+ if route.nil_route && !action.blank? && self.respond_to?(action_method)
319
+ route.action = action
320
+ end
321
+ route
322
+ end
323
+
316
324
  protected
317
325
 
318
326
  def dispatched_object(route)
319
327
  klass = route.dest
320
328
  if klass.class != Class
321
- if (klass == self) # route to self
322
- @executed_method = route.action.to_sym
323
- @executed_method_arguments = []
329
+ if klass == self # route to self
330
+ set_executed_method(route.action)
324
331
  end
325
332
  return klass
326
333
  end
@@ -340,12 +347,17 @@ module Spider
340
347
  @executed_method = nil
341
348
  @executed_method_arguments = nil
342
349
  if !can_dispatch?(:execute, action)
343
- method, additional_arguments = get_action_method(action)
344
- if (method && controller_action?(method))
345
- @executed_method = method.to_sym
346
- @executed_method_arguments = additional_arguments || []
347
- end
350
+ set_executed_method(action)
351
+ end
352
+ end
353
+
354
+ def set_executed_method(action)
355
+ method, additional_arguments = get_action_method(action)
356
+ if (method && controller_action?(method))
357
+ @executed_method = method.to_sym
358
+ @executed_method_arguments = additional_arguments || []
348
359
  end
360
+ return @executed_method
349
361
  end
350
362
 
351
363
 
@@ -130,10 +130,12 @@ module Spider
130
130
  r.each do |route|
131
131
  try, dest, options = route
132
132
  action = nil
133
+ nil_route = false
133
134
  case try
134
135
  when true, nil
135
136
  action = path
136
- matched = ''
137
+ matched = nil
138
+ nil_route = true
137
139
  when String
138
140
  test_path = path
139
141
  if (options[:ignore_case])
@@ -165,7 +167,8 @@ module Spider
165
167
  end
166
168
  end
167
169
  end
168
- if (action)
170
+ if action
171
+ action = action[1..-1] if action[0] && action[0].chr == '/'
169
172
  if (options[:prepend])
170
173
  action = options[:prepend] + action
171
174
  end
@@ -181,7 +184,7 @@ module Spider
181
184
  action.sub!(/^\/+/, '') # no leading slash
182
185
 
183
186
  return Route.new(:path => path, :dest => dest, :action => action, :matched => matched,
184
- :params => params, :options => options)
187
+ :nil_route => nil_route, :params => params, :options => options)
185
188
  end
186
189
  end
187
190
  return nil
@@ -270,7 +273,7 @@ module Spider
270
273
  end
271
274
 
272
275
  class Route
273
- attr_accessor :path, :dest, :action, :params, :options, :matched, :obj
276
+ attr_accessor :path, :dest, :action, :params, :options, :matched, :obj, :nil_route
274
277
 
275
278
  def initialize(args)
276
279
  @path = args[:path]
@@ -279,6 +282,7 @@ module Spider
279
282
  @params = args[:params] || []
280
283
  @options = args[:options] || {}
281
284
  @matched = args[:matched]
285
+ @nil_route = args[:nil_route]
282
286
  @obj = nil
283
287
  end
284
288
 
@@ -21,6 +21,14 @@ module Spider
21
21
  request.extend(HTTPRequest)
22
22
  super(request, response, scene)
23
23
  end
24
+
25
+ def call_before(action, *arguments)
26
+ if action =~ /(.+)\.(\w+)$/ # strip extension, set format
27
+ action = $1
28
+ @request.format = $2.to_sym
29
+ end
30
+ super(action, *arguments)
31
+ end
24
32
 
25
33
  def before(action='', *arguments)
26
34
  if (@request.env['HTTP_TRANSFER_ENCODING'] == 'Chunked' && !@request.server.supports?(:chunked_request))
@@ -94,17 +102,13 @@ module Spider
94
102
  l = $1 if l =~ /(\w\w)_+/
95
103
  FastGettext.locale = l
96
104
  FastGettext.text_domain = 'spider'
97
- if (action =~ /(.+)\.(\w+)$/) # strip extension, set format
98
- action = $1
99
- @request.format = $2.to_sym
100
- end
101
105
  # Spider.reload_sources if Spider.conf.get('webserver.reload_sources')
102
106
  static_level = Spider.conf.get('log.static_extensions')
103
107
  if @request.format && @request.get? && static_level != true
104
108
  allowed = Spider.conf.get('log.non_static_extensions_list')
105
109
  unless allowed.include?(@request.format.to_s)
106
110
  Spider.logger.info("GET #{@request.path}")
107
- @logger_static_prev = Spider.logger.set_thread_level(static_level)
111
+ @logger_static_prev = Spider.logger.set_request_level(static_level)
108
112
  end
109
113
  end
110
114
  Spider::Logger.debug("REQUEST:")
@@ -11,6 +11,7 @@ module Spider; module ControllerMixins
11
11
  def self.included(klass)
12
12
  super
13
13
  @static_content_route ||= 'public/'
14
+ klass.controller_actions(:serve_static)
14
15
  klass.route(@static_content_route, :serve_static, :do => lambda{ @serving_static = true })
15
16
  if (klass < Visual)
16
17
  klass.no_layout('public')
@@ -24,6 +24,7 @@ module Spider; module ControllerMixins
24
24
  def before(action='', *params)
25
25
  @layout ||= self.class.get_layout(action)
26
26
  @layout ||= @dispatcher_layout
27
+ return super unless action_target?
27
28
  format = nil
28
29
  req_format = self.is_a?(Widget) && @is_target && @request.params['_wf'] ? @request.params['_wf'].to_sym : @request.format
29
30
  if (req_format && self.class.output_formats[@executed_method])
@@ -45,7 +46,7 @@ module Spider; module ControllerMixins
45
46
  end
46
47
  n_route = dispatch_next(action)
47
48
  obj = n_route.obj if n_route
48
- if obj.is_a?(Visual) && !(obj.respond_to?(:serving_static?) && obj.serving_static?(n_route.path))
49
+ if obj.is_a?(Visual) && !(obj.respond_to?(:serving_static?) && obj.serving_static?)
49
50
  set_layout = @layout || @dispatcher_layout
50
51
  if set_layout
51
52
  set_layout = [set_layout] unless set_layout.is_a?(Array)
@@ -228,6 +229,15 @@ module Spider; module ControllerMixins
228
229
  end
229
230
  return template
230
231
  end
232
+
233
+ def render_to_string(*args)
234
+ res = StringIO.new
235
+ $out.output_to(res) do
236
+ render(*args)
237
+ end
238
+ res.rewind
239
+ res.read
240
+ end
231
241
 
232
242
  def render_error(path, options)
233
243
  options[:no_prepare_scene] = true
@@ -249,7 +259,7 @@ module Spider; module ControllerMixins
249
259
  def try_rescue(exc)
250
260
  if exc.respond_to?(:uuid=)
251
261
  return super if exc.uuid # Error page already outputted
252
- exc.uuid = UUIDTools::UUID.random_create.to_s
262
+ exc.uuid = SecureRandom.hex(12)
253
263
  end
254
264
  format = self.class.output_format(:error) || :html
255
265
  unless exc.is_a?(Spider::Controller::Maintenance) || exc.is_a?(Spider::Controller::NotFound)
@@ -355,12 +365,17 @@ module Spider; module ControllerMixins
355
365
  return bt
356
366
  end
357
367
  context = exc.__debug_context
368
+ seen_obj = {}
358
369
  0.upto(Debugger.current_context.stack_size - 2) do |i|
359
370
  begin
360
371
  file = context.frame_file(i)
361
372
  line = context.frame_line(i)
362
373
  klass = context.frame_class(i)
363
374
  method = context.frame_method(i)
375
+ #break if File.basename(file) == 'controller.rb' && locals.key?("spider_main_controller_send")
376
+ unless Spider.conf.get('devel.trace.show_framework')
377
+ next if file.index($SPIDER_PATH) == 0
378
+ end
364
379
  args = context.frame_args(i)
365
380
  locals = context.frame_locals(i)
366
381
  frame_self = context.frame_self(i)
@@ -379,35 +394,34 @@ module Spider; module ControllerMixins
379
394
  dest_str = ""
380
395
  end
381
396
  self_str = frame_self.is_a?(Class) ? frame_self.inspect : "#<#{frame_self.class}:#{frame_self.object_id}>"
382
- if (i == -1)
383
- info = ""
384
- else
385
- # if (frame_self == dest)
386
- # info = "#{dest_str}"
387
- # else
388
- # info = "#{self_str}: #{dest_str}"
389
- # end
390
- info = "#{self_str}: #{dest_str}"
391
- info += ".#{ex_method}("
392
- info += args.map{ |arg|
393
- val = locals[arg]
394
- arg_str = "#{arg}##{val.class}"
395
- val_str = nil
396
- if (val.is_a?(String))
397
- if (val.length > 20)
398
- val_str = (val[0..20]+'...').inspect
399
- else
400
- val_str = val.inspect
401
- end
402
- elsif (val.is_a?(Symbol) || val.is_a?(Fixnum) || val.is_a?(Float) || val.is_a?(BigDecimal) || val.is_a?(Date) || val.is_a?(Time))
397
+
398
+ # if (frame_self == dest)
399
+ # info = "#{dest_str}"
400
+ # else
401
+ # info = "#{self_str}: #{dest_str}"
402
+ # end
403
+ info = "#{self_str}: #{dest_str}"
404
+ info += ".#{ex_method}("
405
+ info += args.map{ |arg|
406
+ val = locals[arg]
407
+ arg_str = "#{arg}##{val.class}"
408
+ val_str = nil
409
+ if (val.is_a?(String))
410
+ if (val.length > 20)
411
+ val_str = (val[0..20]+'...').inspect
412
+ else
403
413
  val_str = val.inspect
404
414
  end
405
- arg_str += "=#{val_str}" if val_str
406
- arg_str
407
- }.join(', ')
408
- info += ")"
409
- end
410
- if (Spider.conf.get('devel.trace.show_instance_variables'))
415
+ elsif (val.is_a?(Symbol) || val.is_a?(Fixnum) || val.is_a?(Float) || val.is_a?(BigDecimal) || val.is_a?(Date) || val.is_a?(Time))
416
+ val_str = val.inspect
417
+ end
418
+ arg_str += "=#{val_str}" if val_str
419
+ arg_str
420
+ }.join(', ')
421
+ info += ")"
422
+
423
+ iv = nil
424
+ if !seen_obj[frame_self.object_id] && Spider.conf.get('devel.trace.show_instance_variables')
411
425
  iv = {}
412
426
  frame_self.instance_variables.each{ |var| iv[var] = frame_self.instance_variable_get(var) }
413
427
  iv.reject{ |k, v| v.nil? }
@@ -416,8 +430,11 @@ module Spider; module ControllerMixins
416
430
  bt << {
417
431
  :text => str, :info => info,
418
432
  :path => File.expand_path(file), :line => line, :method => method, :klass => klass, :locals => locals,
419
- :instance_variables => iv
433
+ :self => frame_self.object_id,
434
+ :instance_variables => iv,
435
+ :first_seen => !seen_obj[frame_self.object_id]
420
436
  }
437
+ seen_obj[frame_self.object_id] = true
421
438
  rescue => exc2
422
439
  end
423
440
  end
@@ -493,7 +510,7 @@ module Spider; module ControllerMixins
493
510
  return nil if check_action(action, check)
494
511
  end
495
512
  end
496
- action = (action && !action.empty?) ? action.to_sym : self.default_action
513
+ action = (action && !action.empty?) ? action.to_s.split('/').first.to_sym : self.default_action
497
514
  layouts.each do |name|
498
515
  params = @layout_params[name]
499
516
  if (params[:for])
data/lib/spiderfw/home.rb CHANGED
@@ -30,6 +30,14 @@ module Spider
30
30
  @apps_path ||= File.join(@path, 'apps')
31
31
  end
32
32
 
33
+ def pub_path
34
+ controller.pub_path
35
+ end
36
+
37
+ def pub_url
38
+ controller.pub_url
39
+ end
40
+
33
41
  def list_apps
34
42
  apps_dir = Pathname.new(self.apps_path)
35
43
  paths = Spider.find_all_apps(self.apps_path)
@@ -14,6 +14,7 @@ module Spider; module I18n
14
14
  end
15
15
 
16
16
  def localize_date_time(object, format = 'medium', options={})
17
+ raise "Localize format is nil" unless format
17
18
  options[:calendar] ||= 'gregorian'
18
19
  format = 'medium' if format == :default
19
20
 
@@ -1602,7 +1602,7 @@ module Spider; module Model
1602
1602
  element = self.class.elements[name]
1603
1603
  element.type.check(val) if (element.type.respond_to?(:check))
1604
1604
  if (checks = element.attributes[:check])
1605
- checks = {("'%s' is not in the correct format") => checks} unless checks.is_a?(Hash)
1605
+ checks = {_("'%s' is not in the correct format") => checks} unless checks.is_a?(Hash)
1606
1606
  checks.each do |msg, check|
1607
1607
  test = case check
1608
1608
  when Regexp
@@ -2154,7 +2154,7 @@ module Spider; module Model
2154
2154
 
2155
2155
  def after_save
2156
2156
  reset_modified_elements
2157
- autoload(@_saving[:prev_autoload]) if @_saving
2157
+ self.autoload = @_saving[:prev_autoload] if @_saving
2158
2158
  @_saving = nil
2159
2159
  end
2160
2160
 
@@ -363,6 +363,7 @@ module Spider; module Model; module Mappers
363
363
  next if !element || !element.type || element.integrated?
364
364
  if !element.model?
365
365
  field = schema.field(el)
366
+ raise "Element #{el} in #{@model} does not have a schema field" unless field
366
367
  primary_keys << field if model_pks.include?(el)
367
368
  unless seen_fields[field.name]
368
369
  keys << field
@@ -73,7 +73,7 @@ module Spider; module Model
73
73
  obj = task.object
74
74
  if task.action == :save
75
75
  next unless obj.mapper && obj.mapper.class.write?
76
- next if !obj.modified? && obj.primary_keys_set?
76
+ next if task.params[:force] != :insert && !obj.modified? && obj.primary_keys_set?
77
77
  end
78
78
  #Spider::Logger.debug("Executing task #{task.inspect}")
79
79
  task.execute()
@@ -130,7 +130,7 @@ module Spider; module Model
130
130
  end
131
131
  curr = @actions[obj.object_id]
132
132
  if curr && (curr_act = curr.select{ |c| c[0] == action }).length > 0
133
- curr_act.each{ |c| c[1] = params}
133
+ curr_act.each{ |c| c[1].merge!(params)}
134
134
  return
135
135
  end
136
136
  if action == :delete # FIXME: abstract
@@ -31,4 +31,5 @@ require 'spiderfw/model/model'
31
31
  require 'spiderfw/home'
32
32
  require 'spiderfw/site'
33
33
  require 'spiderfw/resource'
34
+ require 'spiderfw/controller/request'
34
35
  require 'rational'
@@ -222,7 +222,9 @@ module Spider
222
222
  puts "\n\n"
223
223
  @done_tasks.each do |app, tasks|
224
224
  next unless tasks
225
- task.print_release_notes
225
+ tasks.each do |task|
226
+ task.print_release_notes
227
+ end
226
228
  end
227
229
  end
228
230
  if options[:clear_cache]
@@ -336,13 +338,19 @@ module Spider
336
338
  Spider.output _("Updating %s from %s") % [spec.app_id, spec.git_repo]
337
339
  options[:branch] ||= 'master'
338
340
  Dir.chdir(app_path) do
339
- app_repo.fetch
340
- if app_repo.is_branch?(options[:branch])
341
- app_repo.checkout(options[:branch])
342
- else
343
- app_repo.checkout("origin/#{options[:branch]}", :new_branch => options[:branch])
344
- end
345
- app_repo.merge("origin/#{options[:branch]}")
341
+ app_repo.branch('master').checkout
342
+ end
343
+ response = err = nil
344
+ Dir.chdir(app_path) do
345
+ response = `git --git-dir='#{app_path}/.git' pull origin master`
346
+ end
347
+ if response =~ /Aborting/
348
+ Spider.output err, :ERROR
349
+ raise "Unable to update"
350
+ end
351
+ Dir.chdir(app_path) do
352
+ app_repo.reset('HEAD', :hard => true)
353
+ app_repo.branch('master').checkout
346
354
  end
347
355
  # response = err = nil
348
356
  # Dir.chdir(app_path) do
@@ -643,8 +643,6 @@ module Spider
643
643
 
644
644
  search_paths ||= []
645
645
  owner_classes.each do |owner_class| # FIXME: refactor
646
- next if owner_class.is_a?(Spider::Home) # home is already checked for other owner_classes
647
- # FIXME: maybe it shouldn't get here?
648
646
  owner_class = nil if owner_class == NilClass
649
647
  resource_config = @resource_types[resource_type]
650
648
  raise "Unknown resource type #{resource_type}" unless resource_config
@@ -677,6 +675,8 @@ module Spider
677
675
  end
678
676
  end
679
677
  app = path_app
678
+ elsif owner_class.is_a?(Spider::Home)
679
+ app = owner_class
680
680
  elsif owner_class <= Spider::App || owner_class == Spider
681
681
  app = owner_class
682
682
  else
@@ -45,6 +45,7 @@ module Spider
45
45
  next if ass[:src].blank? && !ass[:runtime]
46
46
  next if seen[seen_check]
47
47
  seen[seen_check] = true
48
+ ass[:app] = Spider.home if ass[:app] == :home
48
49
 
49
50
  ass = compile_asset(ass)
50
51
 
@@ -190,7 +191,8 @@ module Spider
190
191
  end
191
192
 
192
193
  def all_assets
193
- assets = @template.assets + self.assets
194
+ tpl_assets = @template.is_a?(Layout) ? @template.all_assets : @template.assets
195
+ assets = tpl_assets + self.assets
194
196
  if @only_asset_profiles
195
197
  assets = assets.select{ |ass| ass[:profiles] && !(ass[:profiles] & @only_asset_profiles).empty? }
196
198
  end
@@ -253,13 +255,13 @@ module Spider
253
255
  FileUtils.mkdir_p(destdir)
254
256
  dest = File.join(destdir, newname)
255
257
  if Spider.conf.get('css.compile')
256
- compiler_class = if ass_type == :sass
257
- require 'spiderfw/templates/resources/sass'
258
- Spider::SassCompiler
259
- elsif ass_type == :less
260
- Spider::LessCompiler
261
- end
262
258
  begin
259
+ compiler_class = if ass_type == :sass
260
+ require 'spiderfw/templates/resources/sass'
261
+ Spider::SassCompiler
262
+ elsif ass_type == :less
263
+ Spider::LessCompiler
264
+ end
263
265
  compiler = compiler_class.new(ass[:app].pub_path)
264
266
  compiler.compile(ass[:path], dest)
265
267
  rescue Exception
@@ -368,7 +370,8 @@ module Spider
368
370
 
369
371
  src.scan(/url\([\s"']*([^\)"'\s]*)[\s"']*\)/m).uniq.collect do |url|
370
372
  url = url.first
371
- next if url =~ %r{^/} || url =~ %r{^[a-z]+://}
373
+ next if url =~ %r{^/} || url =~ %r{^[a-z]+://}
374
+ url, cb = url.split('?', 2)
372
375
  path = ""
373
376
  url_src = File.expand_path(File.join(src_dir, url))
374
377
  src_pathname = Pathname.new(url_src)
@@ -409,7 +412,11 @@ module Spider
409
412
  else
410
413
  Spider.logger.error("CSS referenced file not found: #{url_src}")
411
414
  end
412
- src.gsub!(/\([\s"']*#{url}[\s"']*\)/m, "(#{new_url})")
415
+ if cb
416
+ url += "?#{cb}"
417
+ new_url += "?#{cb}"
418
+ end
419
+ src.gsub!(/\([\s"']*#{Regexp.quote(url)}[\s"']*\)/m, "(#{new_url})")
413
420
  end
414
421
  f.write(src+"\n")
415
422
  end