spiderfw 0.5.19 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. data/CHANGELOG +7 -0
  2. data/VERSION +1 -1
  3. data/apps/core/auth/lib/rbac.rb +7 -2
  4. data/apps/core/auth/models/mixins/rbac_provider.rb +66 -4
  5. data/apps/core/components/assets.rb +63 -33
  6. data/apps/core/components/public/js/jquery/{jquery-1.4.3.js → jquery-1.5.2.js} +2617 -1126
  7. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/overlay/overlay.apple.js +155 -0
  8. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/overlay/overlay.js +293 -0
  9. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/scrollable/scrollable.js +335 -0
  10. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tabs/tabs.css +59 -0
  11. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tabs/tabs.js +283 -0
  12. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/toolbox/toolbox.expose.js +224 -0
  13. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tooltip/tooltip.dynamic.js +150 -0
  14. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tooltip/tooltip.js +343 -0
  15. data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tooltip/tooltip.slide.js +78 -0
  16. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/button_bg.png +0 -0
  17. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/datepicker.gif +0 -0
  18. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/icon_sprite.png +0 -0
  19. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/progress_bar.gif +0 -0
  20. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/slider_h_bg.gif +0 -0
  21. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/slider_handles.png +0 -0
  22. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/slider_v_bg.gif +0 -0
  23. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/tab_bg.gif +0 -0
  24. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/the_gradient.gif +0 -0
  25. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-anim_basic_16x16.gif +0 -0
  26. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  27. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  28. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_flat_10_000000_40x100.png +0 -0
  29. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  30. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  31. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  32. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  33. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  34. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  35. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_222222_256x240.png +0 -0
  36. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_228ef1_256x240.png +0 -0
  37. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_ef8c08_256x240.png +0 -0
  38. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_ffd27a_256x240.png +0 -0
  39. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_ffffff_256x240.png +0 -0
  40. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/jquery-ui.custom.css +0 -0
  41. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-af.js +0 -0
  42. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
  43. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ar.js +7 -8
  44. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-az.js +0 -0
  45. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-bg.js +0 -0
  46. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-bs.js +0 -0
  47. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ca.js +0 -0
  48. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-cs.js +0 -0
  49. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-da.js +0 -0
  50. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-de.js +0 -0
  51. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-el.js +0 -0
  52. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-en-AU.js +23 -0
  53. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-en-GB.js +0 -0
  54. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
  55. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-eo.js +0 -0
  56. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-es.js +0 -0
  57. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-et.js +0 -0
  58. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-eu.js +0 -0
  59. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fa.js +0 -0
  60. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fi.js +0 -0
  61. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fo.js +0 -0
  62. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fr-CH.js +0 -0
  63. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fr.js +12 -10
  64. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-gl.js +23 -0
  65. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-he.js +0 -0
  66. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-hr.js +0 -0
  67. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-hu.js +1 -1
  68. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-hy.js +0 -0
  69. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-id.js +0 -0
  70. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-is.js +0 -0
  71. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-it.js +0 -0
  72. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ja.js +0 -0
  73. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ko.js +0 -0
  74. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-kz.js +23 -0
  75. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-lt.js +0 -0
  76. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-lv.js +0 -0
  77. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-ml.js +23 -0
  78. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ms.js +0 -0
  79. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-nl.js +0 -0
  80. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-no.js +23 -0
  81. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-pl.js +0 -0
  82. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-pt-BR.js +0 -0
  83. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-pt.js +22 -0
  84. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-rm.js +21 -0
  85. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ro.js +0 -0
  86. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ru.js +1 -1
  87. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sk.js +0 -0
  88. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sl.js +0 -0
  89. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sq.js +0 -0
  90. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sr-SR.js +0 -0
  91. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sr.js +0 -0
  92. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sv.js +0 -0
  93. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ta.js +0 -0
  94. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-th.js +1 -1
  95. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-tj.js +23 -0
  96. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-tr.js +0 -0
  97. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-uk.js +0 -0
  98. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-vi.js +0 -0
  99. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-zh-CN.js +0 -0
  100. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-zh-HK.js +0 -0
  101. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-zh-TW.js +0 -0
  102. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.blind.js +3 -3
  103. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.bounce.js +3 -3
  104. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.clip.js +3 -3
  105. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.core.js +48 -15
  106. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.drop.js +3 -3
  107. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.explode.js +2 -2
  108. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/jquery.effects.fade.js +32 -0
  109. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.fold.js +3 -3
  110. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.highlight.js +2 -2
  111. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.pulsate.js +2 -2
  112. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.scale.js +4 -4
  113. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.shake.js +3 -3
  114. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.slide.js +4 -4
  115. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.transfer.js +2 -2
  116. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.accordion.js +33 -20
  117. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.autocomplete.js +104 -42
  118. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.button.js +35 -13
  119. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.core.js +111 -84
  120. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.datepicker.js +87 -46
  121. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.dialog.js +105 -75
  122. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.draggable.js +17 -15
  123. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.droppable.js +5 -5
  124. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.mouse.js +16 -11
  125. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.position.js +51 -32
  126. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.progressbar.js +24 -10
  127. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.resizable.js +7 -7
  128. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.selectable.js +3 -3
  129. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.slider.js +9 -7
  130. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.sortable.js +22 -20
  131. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.tabs.js +15 -14
  132. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.widget.js +50 -25
  133. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → plugins/bsmselect}/GPL-LICENSE.txt +1 -1
  134. data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → plugins/bsmselect}/MIT-LICENSE.txt +3 -7
  135. data/apps/core/components/public/js/jquery/plugins/bsmselect/README.md +185 -0
  136. data/apps/core/components/public/js/jquery/plugins/bsmselect/css/jquery.bsmselect.css +64 -0
  137. data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.compatibility.js +60 -0
  138. data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.js +381 -0
  139. data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.sortable.js +49 -0
  140. data/apps/core/components/public/js/plugins/sortable.js +16 -7
  141. data/apps/core/components/public/js/spider.js +60 -41
  142. data/apps/core/components/widgets/admin/admin.shtml +1 -1
  143. data/apps/core/components/widgets/list/list.shtml +2 -2
  144. data/apps/core/components/widgets/month_calendar/month_calendar.shtml +23 -20
  145. data/apps/core/components/widgets/switcher/switcher.rb +77 -21
  146. data/apps/core/components/widgets/switcher/templates/default.shtml +8 -0
  147. data/apps/core/components/widgets/switcher/templates/table.shtml +15 -0
  148. data/apps/core/components/widgets/table/table.rb +4 -1
  149. data/apps/core/components/widgets/table/table.shtml +10 -8
  150. data/apps/core/forms/public/css/form.css +9 -1
  151. data/apps/core/forms/public/date_time.js +14 -2
  152. data/apps/core/forms/public/input.js +1 -1
  153. data/apps/core/forms/public/select.js +4 -3
  154. data/apps/core/forms/tags/element_row.erb +11 -2
  155. data/apps/core/forms/widgets/inputs/date_time/date_time.rb +9 -0
  156. data/apps/core/forms/widgets/inputs/date_time/date_time.shtml +1 -1
  157. data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +2 -2
  158. data/apps/core/forms/widgets/inputs/input/input.rb +0 -3
  159. data/apps/core/forms/widgets/inputs/select/select.shtml +2 -2
  160. data/apps/messenger/backends/email/sendmail.rb +20 -0
  161. data/apps/messenger/backends/email/smtp.rb +12 -14
  162. data/apps/messenger/backends/email/test.rb +20 -0
  163. data/apps/messenger/config/options.rb +9 -9
  164. data/apps/messenger/config/test.config.yml +2 -0
  165. data/apps/messenger/controllers/mixins/messenger_helper.rb +41 -15
  166. data/apps/messenger/lib/email_backend.rb +10 -0
  167. data/apps/messenger/messenger.rb +45 -26
  168. data/apps/messenger/test/features/attachments.feature +26 -0
  169. data/apps/messenger/test/features/messenger_helper.feature +31 -0
  170. data/apps/messenger/test/features/sending_email.feature +10 -0
  171. data/apps/messenger/test/features/step_definitions/common_steps.rb +11 -0
  172. data/apps/messenger/test/features/step_definitions/email_steps.rb +98 -0
  173. data/apps/messenger/test/features/support/env.rb +11 -0
  174. data/apps/messenger/test/files/test_file1.txt +1 -0
  175. data/apps/messenger/test/lib/controllers/mail_test_controller.rb +34 -0
  176. data/apps/messenger/test/templates/email/multipart.html.erb +1 -0
  177. data/apps/messenger/test/templates/email/multipart.txt.erb +1 -0
  178. data/apps/messenger/test/templates/email/simple.erb +1 -0
  179. data/apps/messenger/test/templates/email/vars.erb +1 -0
  180. data/lib/spiderfw/cmd/cmd.rb +4 -0
  181. data/lib/spiderfw/cmd/commands/webserver.rb +12 -59
  182. data/lib/spiderfw/config/configuration.rb +4 -0
  183. data/lib/spiderfw/config/options/spider.rb +25 -8
  184. data/lib/spiderfw/controller/controller.rb +10 -4
  185. data/lib/spiderfw/controller/first_responder.rb +6 -20
  186. data/lib/spiderfw/controller/http_controller.rb +2 -1
  187. data/lib/spiderfw/controller/mixins/http_mixin.rb +12 -1
  188. data/lib/spiderfw/controller/mixins/visual.rb +3 -16
  189. data/lib/spiderfw/env.rb +1 -1
  190. data/lib/spiderfw/http/server.rb +178 -2
  191. data/lib/spiderfw/model/base_model.rb +142 -111
  192. data/lib/spiderfw/model/data_type.rb +15 -0
  193. data/lib/spiderfw/model/datatypes/decimal.rb +8 -0
  194. data/lib/spiderfw/model/datatypes/pk.rb +29 -0
  195. data/lib/spiderfw/model/datatypes.rb +1 -0
  196. data/lib/spiderfw/model/element.rb +5 -1
  197. data/lib/spiderfw/model/extended_models/managed.rb +1 -1
  198. data/lib/spiderfw/model/junction.rb +23 -0
  199. data/lib/spiderfw/model/mappers/db_mapper.rb +96 -80
  200. data/lib/spiderfw/model/mappers/document_mapper.rb +315 -0
  201. data/lib/spiderfw/model/mappers/mapper.rb +164 -75
  202. data/lib/spiderfw/model/mixins/list.rb +1 -0
  203. data/lib/spiderfw/model/mixins/versioned.rb +63 -27
  204. data/lib/spiderfw/model/model.rb +36 -9
  205. data/lib/spiderfw/model/query_funcs.rb +3 -0
  206. data/lib/spiderfw/model/query_set.rb +21 -1
  207. data/lib/spiderfw/model/storage/base_storage.rb +259 -6
  208. data/lib/spiderfw/model/storage/{db/db_connection_pool.rb → connection_pool.rb} +25 -21
  209. data/lib/spiderfw/model/storage/db/adapters/mysql.rb +25 -5
  210. data/lib/spiderfw/model/storage/db/adapters/oracle.rb +1 -1
  211. data/lib/spiderfw/model/storage/db/connectors/jdbc_oracle.rb +2 -2
  212. data/lib/spiderfw/model/storage/db/connectors/oci8.rb +3 -4
  213. data/lib/spiderfw/model/storage/db/db_storage.rb +18 -219
  214. data/lib/spiderfw/model/storage/document/adapters/mongodb.rb +307 -0
  215. data/lib/spiderfw/model/storage/document/document.rb +7 -0
  216. data/lib/spiderfw/model/storage/document/document_storage.rb +34 -0
  217. data/lib/spiderfw/model/storage.rb +23 -11
  218. data/lib/spiderfw/model/unit_of_work.rb +45 -22
  219. data/lib/spiderfw/spider.rb +660 -0
  220. data/lib/spiderfw/templates/blocks/html.rb +4 -2
  221. data/lib/spiderfw/templates/blocks/run.rb +1 -1
  222. data/lib/spiderfw/templates/blocks/tag_if.rb +1 -1
  223. data/lib/spiderfw/templates/blocks/widget.rb +1 -1
  224. data/lib/spiderfw/templates/layout.rb +29 -5
  225. data/lib/spiderfw/templates/template.rb +72 -7
  226. data/lib/spiderfw/templates/template_blocks.rb +1 -1
  227. data/lib/spiderfw/test/capybara.rb +7 -0
  228. data/lib/spiderfw/test/cucumber.rb +12 -0
  229. data/lib/spiderfw/test/page_object.rb +29 -0
  230. data/lib/spiderfw/test/spec.rb +20 -0
  231. data/lib/spiderfw/test/stubs/mapper_stub.rb +18 -0
  232. data/lib/spiderfw/test/stubs/storage_stub.rb +23 -0
  233. data/lib/spiderfw/test/unit.rb +23 -0
  234. data/lib/spiderfw/test.rb +89 -0
  235. data/lib/spiderfw/utils/json.rb +6 -0
  236. data/lib/spiderfw/utils/logger.rb +17 -4
  237. data/lib/spiderfw/utils/loggers/apache_commons_logger.rb +61 -0
  238. data/lib/spiderfw/utils/monkey/date_time.rb +2 -2
  239. data/lib/spiderfw/utils/monkey/module.rb +3 -1
  240. data/lib/spiderfw/utils/profiling.rb +2 -2
  241. data/lib/spiderfw/widget/widget.rb +31 -13
  242. data/lib/spiderfw.rb +1 -597
  243. data/spider.gemspec +9 -10
  244. metadata +193 -132
  245. data/apps/admin/_init.rb +0 -9
  246. data/apps/admin/controllers/admin_controller.rb +0 -12
  247. data/apps/admin/widgets/dashboard_widget/dashboard_widget.rb +0 -8
  248. data/apps/core/components/public/js/jquery/jquery-ui-1.8.4/development-bundle/AUTHORS.txt +0 -30
  249. data/apps/core/components/public/js/jquery/jquery-ui-1.8.4/development-bundle/ui/i18n/jquery-ui-i18n.js +0 -1176
  250. data/apps/core/components/public/js/jquery/jquery-ui-1.8.4/development-bundle/ui/i18n/jquery.ui.datepicker-no.js +0 -23
  251. data/apps/core/components/public/js/jquery/jquery-ui-1.8.4/development-bundle/version.txt +0 -1
  252. data/apps/core/components/public/js/jquery/plugins/asmselect/jquery.asmselect.css +0 -64
  253. data/apps/core/components/public/js/jquery/plugins/asmselect/jquery.asmselect.js +0 -407
  254. data/apps/core/components/widgets/switcher/switcher.shtml +0 -17
  255. data/apps/master/po/master.pot +0 -400
@@ -13,7 +13,7 @@ module Spider; module TemplateBlocks
13
13
  c += html.get_start(options)
14
14
  c += "end\n"
15
15
  c, init = html.compile_content(c, init, options)
16
- tag_end = html.get_end
16
+ tag_end = html.get_end(options)
17
17
  if (tag_end)
18
18
  c += "if (#{cond})\n"
19
19
  c += " $out << '#{tag_end}'\n"
@@ -75,7 +75,7 @@ module Spider; module TemplateBlocks
75
75
 
76
76
  init_params = self.class.attributes_to_init_params(@el.attributes.to_hash)
77
77
 
78
- init += "add_widget('#{id}', #{klass}.new(@request, @response), {#{init_params.join(', ')}}, '#{html}', #{t_param})\n"
78
+ init += "add_widget('#{id}', #{klass}.new(@request, @response), {#{init_params.join(', ')}}, '#{runtime_content}', #{t_param})\n"
79
79
  c = "yield :\"#{id}\"\n"
80
80
  return CompiledBlock.new(init, c)
81
81
  end
@@ -40,7 +40,7 @@ module Spider
40
40
  pub_dest = nil
41
41
  all_assets.each do |ass|
42
42
  seen_check = ass[:runtime] || ass[:src]
43
- next if !ass[:src] || ass[:src].empty?
43
+ next if ass[:src].blank? && !ass[:runtime]
44
44
  next if seen[seen_check]
45
45
  seen[seen_check] = true
46
46
  type = ass[:type].to_sym
@@ -55,7 +55,7 @@ module Spider
55
55
 
56
56
  if no_compress
57
57
  if ass[:runtime]
58
- assets[type] << Spider::Template.runtime_assets[ass[:runtime]].call(@request, @response, @scene)
58
+ assets[type] << {:src => Spider::Template.runtime_assets[ass[:runtime]].call(@request, @response, @scene)}
59
59
  else
60
60
  assets[type] << ass
61
61
  end
@@ -66,10 +66,34 @@ module Spider
66
66
  end
67
67
  if comp = ass[:compressed_path]
68
68
  name = File.basename(comp)
69
- unless File.exist?(File.join(pub_dest, name))
70
- File.cp(comp, pub_dest)
69
+ if ass[:compressed_rel_path]
70
+ dir = File.dirname(ass[:compressed_rel_path])
71
+ if ass[:copy_dir]
72
+ start = dir
73
+ if ass[:copy_dir].is_a?(Fixnum)
74
+ ass[:copy_dir].downto(0) do |i|
75
+ start = File.dirname(start)
76
+ end
77
+ end
78
+ dst_dir = File.join(pub_dest, start)
79
+ unless File.dirname(start) == '.' || File.directory?(File.dirname(dst_dir))
80
+ FileUtils.mkdir_p(File.join(pub_dest, File.dirname(dst_dir)))
81
+ end
82
+ unless File.directory?(dst_dir)
83
+ FileUtils.cp_r(File.join(ass[:app].pub_path, start), dst_dir)
84
+ end
85
+ else
86
+ FileUtils.mkdir_p(File.join(pub_dest, dir))
87
+ File.cp(comp, File.join(pub_dest, dir)) unless File.exist?(File.join(pub_dest, dir))
88
+ end
89
+ src = dir+'/'+name
90
+ else
91
+ unless File.exist?(File.join(pub_dest, name))
92
+ File.cp(comp, pub_dest)
93
+ end
94
+ src = name
71
95
  end
72
- ass[:src] = Spider::HomeController.pub_url+'/'+COMPILED_FOLDER+'/'+name
96
+ ass[:src] = Spider::HomeController.pub_url+'/'+COMPILED_FOLDER+'/'+src
73
97
  assets[type] << ass
74
98
  else
75
99
  name = ass[:compress] || cname
@@ -33,7 +33,6 @@ module Spider
33
33
  @@registered = {}
34
34
  @@widget_plugins = {}
35
35
  @@namespaces = {}
36
- @@cache = TemplateCache.new(Spider.paths[:var]+'/cache/templates')
37
36
  @@overrides = ['content', 'override', 'override-content', 'override-attr', 'append-attr',
38
37
  'append', 'prepend', 'delete', 'before', 'after']
39
38
 
@@ -47,7 +46,7 @@ module Spider
47
46
 
48
47
  # Returns the class TemplateCache instance
49
48
  def cache
50
- @@cache
49
+ @@cache ||= TemplateCache.new(Spider.paths[:var]+'/cache/templates')
51
50
  end
52
51
 
53
52
  # Sets allowed blocks
@@ -245,6 +244,7 @@ module Spider
245
244
  # Loads the compiled template (from cache if available).
246
245
  def load(path=nil)
247
246
  @path = real_path(path) if path
247
+ @path = File.expand_path(@path)
248
248
  # debug("TEMPLATE LOADING #{@path}")
249
249
  cache_path = @path.sub(Spider.paths[:root], 'ROOT').sub(Spider.paths[:spider], 'SPIDER')
250
250
  unless @runtime_overrides.empty?
@@ -269,7 +269,7 @@ module Spider
269
269
  doc = open(@path){ |f| Hpricot.XML(f) }
270
270
  root = get_el(doc)
271
271
  el = process_tags(root)
272
- @overrides.each{ |o| apply_override(root, o) } if (@overrides)
272
+ @overrides.each{ |o| apply_override(root, o) } if @overrides
273
273
  root.search('tpl:placeholder').remove # remove empty placeholders
274
274
  owner_class = @owner ? @owner.class : @owner_class
275
275
  @assets += owner_class.assets if owner_class
@@ -316,6 +316,9 @@ module Spider
316
316
  root_block = TemplateBlocks.parse_element(root, self.class.allowed_blocks, self)
317
317
  if doc.children && doc.children[0].is_a?(Hpricot::DocType)
318
318
  root_block.doctype = doc.children[0]
319
+ options[:doctype] = DocType.new(root_block.doctype)
320
+ else
321
+ options[:doctype] ||= DocType.new(Spider.conf.get('template.default_doctype'))
319
322
  end
320
323
  options[:root] = true
321
324
  options[:owner] = @owner
@@ -406,6 +409,7 @@ module Spider
406
409
  else
407
410
  base_url = ''
408
411
  end
412
+ ass[:rel_path] = src
409
413
  ass[:src] = base_url + src
410
414
  ass_info = self.class.asset_types[type]
411
415
  if (ass_info && ass_info[:processor])
@@ -415,6 +419,7 @@ module Spider
415
419
  if cpr = attributes[:compressed]
416
420
  if cpr == "true"
417
421
  ass[:compressed_path] = ass[:path]
422
+ ass[:compressed_rel_path] = ass[:rel_path]
418
423
  ass[:compressed] = base_url + File.basename(ass[:path])
419
424
  else
420
425
  compressed_res = Spider.find_resource(type.to_sym, cpr, @path, [owner_class, @definer_class])
@@ -422,6 +427,8 @@ module Spider
422
427
  ass[:compressed] = base_url+cpr
423
428
  end
424
429
  end
430
+ ass[:copy_dir] = attributes[:copy_dir]
431
+ ass[:copy_dir] = ass[:copy_dir] =~ /\d+/ ? ass[:copy_dir].to_i : true
425
432
  [:gettext, :media, :if_ie_lte, :cdn].each do |key|
426
433
  ass[key] = attributes[key] if attributes.key?(key)
427
434
  end
@@ -471,6 +478,9 @@ module Spider
471
478
  elsif ext_app
472
479
  ext_app = Spider.apps_by_path[ext_app]
473
480
  ext_owner = ext_app
481
+ else
482
+ ext_owner = @owner.class
483
+ ext_app = ext_owner.app
474
484
  end
475
485
  ext_search_paths = nil
476
486
  if (ext_owner && ext_owner.respond_to?(:template_paths))
@@ -754,15 +764,30 @@ module Spider
754
764
  found.remove
755
765
  else
756
766
  found.each do |f|
767
+ o_doc = nil
757
768
  if (override.name == 'tpl:override-content')
758
769
  overridden = f.innerHTML
759
770
  f.innerHTML = override.innerHTML
760
- f.search('tpl:overridden').each{ |o| o.swap(overridden) }
771
+ f.search('tpl:overridden').each do |o|
772
+ ovr = overridden
773
+ if o_search = o.get_attribute('search')
774
+ o_doc ||= Hpricot("<o>#{overridden}</o>")
775
+ ovr = o_doc.root.search(o_search).to_html
776
+ end
777
+ o.swap(ovr)
778
+ end
761
779
  elsif (override.name == 'tpl:override' || override.name == 'tpl:content')
762
780
  overridden = f.to_html
763
781
  parent = f.parent
764
782
  f.swap(override.innerHTML)
765
- parent.search('tpl:overridden').each{ |o| o.swap(overridden) }
783
+ parent.search('tpl:overridden').each do |o|
784
+ ovr = overridden
785
+ if o_search = o.get_attribute('search')
786
+ o_doc ||= Hpricot("<o>#{overridden}</o>")
787
+ ovr = o_doc.root.search(o_search).to_html
788
+ end
789
+ o.swap(ovr)
790
+ end
766
791
  elsif (override.name == 'tpl:override-attr')
767
792
  f.set_attribute(override.get_attribute("name"), override.get_attribute("value"))
768
793
  elsif (override.name == 'tpl:append-attr')
@@ -810,7 +835,7 @@ module Spider
810
835
  SceneVarRegexp = /@(\w[\w\d_]+)/
811
836
 
812
837
  def self.scan_text(text)
813
- text = text.gsub(/\302\240/, ' ') # remove annoying fake space
838
+ text = text.gsub(/\302\240/u, ' ') # remove annoying fake space
814
839
  scanner = ::StringScanner.new(text)
815
840
  pos = 0
816
841
  c = ""
@@ -847,7 +872,7 @@ module Spider
847
872
  end
848
873
  yield :plain, scanner.rest
849
874
  end
850
-
875
+
851
876
  end
852
877
 
853
878
  # Class holding compiled template code.
@@ -881,4 +906,44 @@ module Spider
881
906
  class TemplateCompileError < RuntimeError
882
907
  end
883
908
 
909
+ class DocType
910
+ attr_reader :type, :variant
911
+
912
+ def initialize(type_or_str)
913
+ if type_or_str.is_a?(Symbol)
914
+ @type = type_or_str
915
+ else
916
+ @type = parse(type_or_str.to_s)
917
+ end
918
+ end
919
+
920
+ def parse(str)
921
+ if str =~ /DOCTYPE HTML PUBLIC.+\sHTML/i
922
+ @type = :html4
923
+ elsif str =~ /DOCTYPE HTML PUBLIC.+\sXHTML/i
924
+ @type = :xhtml
925
+ elsif str.downcase == '<!doctype html>'
926
+ @type = :html5
927
+ end
928
+ if str =~ /strict/i
929
+ @variant = :strict
930
+ elsif str =~ /transitional/i
931
+ @variant = :transitional
932
+ end
933
+ end
934
+
935
+ def html?
936
+ @type == :html4 || @type == :html5
937
+ end
938
+
939
+ def xhtml?
940
+ @type == :xhtml
941
+ end
942
+
943
+ def strict?
944
+ @variant == :strict
945
+ end
946
+
947
+ end
948
+
884
949
  end
@@ -135,7 +135,7 @@ module Spider
135
135
  when :plain
136
136
  res += escape_text(val)
137
137
  when :escaped_expr
138
- res += full
138
+ res += "{ #{val} }"
139
139
  when :expr
140
140
  res += "'+("+vars_to_scene(val)+").to_s+'"
141
141
  when :gettext
@@ -0,0 +1,7 @@
1
+ require 'spiderfw/http/adapters/rack'
2
+ require 'capybara'
3
+ require 'capybara/cucumber'
4
+ require 'culerity'
5
+
6
+ Capybara.app = Spider::HTTP::RackApplication.new
7
+ Capybara.default_host = 'localhost'
@@ -0,0 +1,12 @@
1
+ require 'cucumber/rspec/doubles'
2
+ require 'spiderfw/spider'
3
+ require 'spiderfw/test'
4
+ require 'fileutils'
5
+
6
+ Before do
7
+ Spider::Test.before
8
+ end
9
+
10
+ After do
11
+ Spider::Test.after
12
+ end
@@ -0,0 +1,29 @@
1
+ module Spider; module Test
2
+
3
+ class PageObject
4
+ attr_reader :browser
5
+
6
+ def initialize(browser=nil)
7
+ unless browser
8
+ if Object.const_defined?(:Capybara) && Capybara.current_session
9
+ browser = Capybara.current_session
10
+ end
11
+ end
12
+ @browser = browser
13
+ end
14
+
15
+ def go(url)
16
+ if url =~ /^https?:\/\/([^\/])(\/.+)$/
17
+ url = $1
18
+ end
19
+ @browser.visit(url)
20
+ end
21
+
22
+ def method_missing(method, *args)
23
+ @browser.send(method, *args)
24
+ end
25
+
26
+
27
+ end
28
+
29
+ end; end
@@ -0,0 +1,20 @@
1
+ $SPIDER_RUNMODE = 'test'
2
+ require 'rspec'
3
+ require 'rr'
4
+ require 'spiderfw/spider'
5
+ require 'spiderfw/test'
6
+ $:.unshift($SPIDER_PATH) unless $:.include?($SPIDER_PATH)
7
+ $:.unshift(File.join($SPIDER_PATH, 'test'))
8
+ Spider::Controller # autoload
9
+ Spider.start_loggers
10
+ require 'ruby-debug' rescue LoadError
11
+
12
+ RSpec.configure do |config|
13
+ config.mock_with :rr
14
+ config.before(:each) do
15
+ Spider::Test.before
16
+ end
17
+ config.after(:each) do
18
+ Spider::Test.after
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ module Spider; module Test
2
+
3
+ class MapperStub < Spider::Model::Mapper
4
+
5
+ def fetch(query)
6
+ Spider::Model::QuerySet.static(@model)
7
+ end
8
+
9
+ def have_references?(element)
10
+ false
11
+ end
12
+
13
+ def do_insert(obj)
14
+ end
15
+
16
+ end
17
+
18
+ end; end
@@ -0,0 +1,23 @@
1
+ require 'spiderfw/model/storage/base_storage'
2
+ require 'spiderfw/test/stubs/mapper_stub'
3
+
4
+ module Spider; module Test
5
+
6
+ class StorageStub < Spider::Model::Storage::BaseStorage
7
+
8
+ def get_mapper(model)
9
+ mapper = Spider::Test::MapperStub.new(model, self)
10
+ end
11
+
12
+ def parse_url(url)
13
+ end
14
+
15
+ def method_missing(method, *args)
16
+ end
17
+
18
+ def do_insert
19
+ end
20
+
21
+ end
22
+
23
+ end; end
@@ -0,0 +1,23 @@
1
+ $SPIDER_RUNMODE = 'test'
2
+ require 'spiderfw/test'
3
+ require "test/unit"
4
+
5
+ module Spider
6
+
7
+ class TestCase < ::Test::Unit::TestCase
8
+
9
+ def setup
10
+ Spider::Test.before
11
+ end
12
+
13
+ def teardown
14
+ Spider::Test.after
15
+ end
16
+
17
+ def default_test
18
+ return super unless self.class == Spider::TestCase
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,89 @@
1
+ require 'spiderfw/test/page_object'
2
+
3
+ module Spider; module Test
4
+
5
+ def self.env
6
+ @env ||= {}
7
+ end
8
+
9
+ def self.before
10
+ if Spider.init_done?
11
+ Spider.config.get('storages').keys.each do |k|
12
+ Spider::Model::BaseModel.get_storage(k).start_transaction
13
+ end
14
+ unless Spider.runmode == 'production'
15
+ FileUtils.rm_rf(Spider.paths[:var])
16
+ FileUtils.mkdir_p(Spider.paths[:var])
17
+ end
18
+ end
19
+ begin
20
+ Mail::TestMailer.deliveries.clear
21
+ rescue
22
+ end
23
+ Spider::Request.reset_current
24
+ Spider.apps.each do |name, mod|
25
+ mod.before_test if mod.respond_to?(:before_test)
26
+ end
27
+ end
28
+
29
+ def self.after
30
+ if Spider.init_done?
31
+ Spider.config.get('storages').keys.each do |k|
32
+ storage = Spider::Model::BaseModel.get_storage(k)
33
+ storage.rollback! if storage.supports_transactions?
34
+ end
35
+ end
36
+ begin
37
+ Mail::TestMailer.deliveries.clear
38
+ rescue
39
+ end
40
+ Spider.apps.each do |name, mod|
41
+ mod.before_test if mod.respond_to?(:after_test)
42
+ end
43
+ end
44
+
45
+ def self.load_fixtures!(app)
46
+ load_fixtures(app, true)
47
+ end
48
+
49
+ def self.load_fixtures(app, truncate=false)
50
+ path = File.join(app.path, 'test', 'fixtures')
51
+ Dir.glob(File.join(path, '*.yml')).each do |yml|
52
+ Spider::Model.load_fixtures(yml, truncate)
53
+ end
54
+ end
55
+
56
+ def self.load_fixtures_file(app, file, truncate=false)
57
+ path = File.join(app.path, 'test', 'fixtures')
58
+ Spider::Model.load_fixtures(File.join(path, file)+'.yml', truncate)
59
+ end
60
+
61
+ def self.load_fixtures_file!(app, file)
62
+ load_fixtures_file(app, file, true)
63
+ end
64
+
65
+ def self.restart_transactions
66
+ Spider.config.get('storages').keys.each do |k|
67
+ storage = Spider::Model::BaseModel.get_storage(k)
68
+ storage.rollback!
69
+ storage.start_transaction
70
+ end
71
+ end
72
+
73
+ def self.use_storage_stub_for(app_or_model)
74
+ require 'spiderfw/test/stubs/storage_stub'
75
+ Spider::Test.env[:storage_stub] ||= StorageStub.new('dummy')
76
+ models = []
77
+ if app_or_model < Spider::App
78
+ models = app_or_model.models
79
+ else
80
+ models = [app_or_model]
81
+ end
82
+ models.each do |m|
83
+ m.use_storage 'stub://stub'
84
+ end
85
+ end
86
+
87
+
88
+ end; end
89
+
@@ -37,3 +37,9 @@ class Integer
37
37
  to_s
38
38
  end
39
39
  end
40
+
41
+ def BigDecimal
42
+ def to_json(options = nil) #:nodoc:
43
+ to_f.to_json
44
+ end
45
+ end
@@ -14,13 +14,22 @@ module Spider
14
14
  # @@loggers ||= {}
15
15
  # @@loggers[dest]
16
16
  # end
17
+
18
+ @loggers = {}
17
19
 
18
20
  # Open a new logger.
19
21
  def open(dest, level= :WARN)
20
- @loggers ||= {}
21
- logger = Spider::Logger::Logger.new(dest, Spider.conf.get('log.rotate.age'), Spider.conf.get('log.rotate.size'))
22
- logger.formatter = Spider::Logger::Formatter.new
23
- logger.level = ::Logger.const_get(level)
22
+ begin
23
+ logger = Spider::Logger::Logger.new(dest, Spider.conf.get('log.rotate.age'), Spider.conf.get('log.rotate.size'))
24
+ logger.formatter = Spider::Logger::Formatter.new
25
+ logger.level = ::Logger.const_get(level)
26
+ add(dest, logger)
27
+ rescue => exc
28
+ STDERR << "Can't open logging to #{dest}: #{exc}\n"
29
+ end
30
+ end
31
+
32
+ def add(dest, logger, levels={})
24
33
  @loggers[dest] = logger
25
34
  end
26
35
 
@@ -115,6 +124,10 @@ module Spider
115
124
  def unknown(*args, &proc)
116
125
  send_to_loggers(:unknown, *args, &proc)
117
126
  end
127
+
128
+ def method_missing(method, *args, &proc)
129
+ send_to_loggers(method, *args, &proc)
130
+ end
118
131
 
119
132
  end
120
133
 
@@ -0,0 +1,61 @@
1
+ module Spider; module Loggers
2
+
3
+ class ApacheCommonsLogger
4
+
5
+ def initialize(klass='spider')
6
+ @logger = org.apache.commons.logging.LogFactory.getLog(klass)
7
+ end
8
+
9
+ def do_log(level, message=nil, &proc)
10
+ if block_given?
11
+ return unless send("#{level}?")
12
+ message = yield
13
+ end
14
+ @logger.send(level, message)
15
+ end
16
+
17
+ def fatal(message, &proc)
18
+ do_log(:fatal, message, &proc)
19
+ end
20
+
21
+ def error(message, &proc)
22
+ do_log(:error, message, &proc)
23
+ end
24
+
25
+ def warn(message, &proc)
26
+ do_log(:warn, message, &proc)
27
+ end
28
+
29
+ def info(message, &proc)
30
+ do_log(:info, message, &proc)
31
+ end
32
+
33
+ def debug(message, &proc)
34
+ do_log(:info, message, &proc)
35
+ end
36
+
37
+ def fatal?
38
+ @logger.isFatalEnabled
39
+ end
40
+
41
+ def error?
42
+ @logger.isErrorEnabled
43
+ end
44
+
45
+ def warn?
46
+ @logger.isWarnEnabled
47
+ end
48
+
49
+ def info?
50
+ @logger.isInfoEnabled
51
+ end
52
+
53
+ def debug?
54
+ @logger.isDebugEnabled
55
+ end
56
+
57
+
58
+
59
+ end
60
+
61
+ end; end
@@ -10,7 +10,7 @@ class Date
10
10
 
11
11
  # Converts to a Time object in the local timezone.
12
12
  def to_local_time
13
- to_time(new_offset(DateTime.now.offset), :local)
13
+ conv_to_time(new_offset(DateTime.now.offset), :local)
14
14
  end
15
15
 
16
16
  def to_date
@@ -38,7 +38,7 @@ class Date
38
38
  end
39
39
 
40
40
  private
41
- def to_time(dest, method)
41
+ def conv_to_time(dest, method)
42
42
  #Convert a fraction of a day to a number of microseconds
43
43
  usec = (dest.send(:sec_fraction) * 60 * 60 * 24 * (10**6)).to_i
44
44
  if dest.respond_to?(:hour)
@@ -6,7 +6,9 @@ class Module #:nodoc:
6
6
  end
7
7
 
8
8
  def parent_module(n=1)
9
- return const_get_full(self.to_s.reverse.split('::', n+1)[n].reverse)
9
+ part = self.to_s.reverse.split('::', n+1)[n]
10
+ return nil if part.blank?
11
+ return const_get_full(part.reverse)
10
12
  end
11
13
 
12
14
  def last_name
@@ -15,8 +15,6 @@ module Spider
15
15
  end
16
16
 
17
17
  def self.stop
18
- Spider.request_mutex.unlock
19
- Spider.request_mutex = nil
20
18
  result = RubyProf.stop
21
19
  @profiling_started = false
22
20
  printer = ::RubyProf::GraphHtmlPrinter.new(result)
@@ -25,6 +23,8 @@ module Spider
25
23
  printer.print(f, :min_percent => 0)
26
24
  end
27
25
  Spider.logger.info("Written profiling info in #{file_name}")
26
+ Spider.request_mutex.unlock
27
+ Spider.request_mutex = nil
28
28
  end
29
29
 
30
30
  def self.started?