rules_engine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +17 -0
  3. data/VERSION +1 -0
  4. data/init.rb +1 -0
  5. data/lib/rules_engine/cache.rb +26 -0
  6. data/lib/rules_engine/discovery.rb +51 -0
  7. data/lib/rules_engine/job_runner.rb +115 -0
  8. data/lib/rules_engine/rule.rb +60 -0
  9. data/lib/rules_engine/rule_outcome.rb +13 -0
  10. data/lib/rules_engine.rb +6 -0
  11. data/rails_generators/USAGE +68 -0
  12. data/rails_generators/blacklist_word.yml +6 -0
  13. data/rails_generators/blacklist_word_manifest.rb +26 -0
  14. data/rails_generators/generator.yml +58 -0
  15. data/rails_generators/generator_manifest.rb +282 -0
  16. data/rails_generators/rules_engine_generator.rb +35 -0
  17. data/rails_generators/simple.yml +6 -0
  18. data/rails_generators/simple_manifest.rb +21 -0
  19. data/rails_generators/template_manifest.rb +13 -0
  20. data/rails_generators/templates/app/controllers/re_jobs_controller.rb +18 -0
  21. data/rails_generators/templates/app/controllers/re_pipeline_jobs_controller.rb +17 -0
  22. data/rails_generators/templates/app/controllers/re_pipelines_controller.rb +143 -0
  23. data/rails_generators/templates/app/controllers/re_rules_controller.rb +140 -0
  24. data/rails_generators/templates/app/helpers/re_pipeline_helper.rb +29 -0
  25. data/rails_generators/templates/app/models/re_job.rb +123 -0
  26. data/rails_generators/templates/app/models/re_job_audit.rb +21 -0
  27. data/rails_generators/templates/app/models/re_pipeline.rb +69 -0
  28. data/rails_generators/templates/app/models/re_pipeline_activated.rb +26 -0
  29. data/rails_generators/templates/app/models/re_pipeline_activated_observer.rb +11 -0
  30. data/rails_generators/templates/app/models/re_pipeline_base.rb +68 -0
  31. data/rails_generators/templates/app/models/re_rule.rb +78 -0
  32. data/rails_generators/templates/app/models/re_rule_outcome.rb +40 -0
  33. data/rails_generators/templates/app/rules/blacklist_word.rb +89 -0
  34. data/rails_generators/templates/app/rules/simple.rb +44 -0
  35. data/rails_generators/templates/app/rules/template.rb +51 -0
  36. data/rails_generators/templates/app/views/layouts/_blockUI.html.erb +3 -0
  37. data/rails_generators/templates/app/views/re_jobs/_empty.html.erb +11 -0
  38. data/rails_generators/templates/app/views/re_jobs/_index.html.erb +66 -0
  39. data/rails_generators/templates/app/views/re_jobs/_show.html.erb +43 -0
  40. data/rails_generators/templates/app/views/re_jobs/index.html.erb +21 -0
  41. data/rails_generators/templates/app/views/re_jobs/index.js.erb +9 -0
  42. data/rails_generators/templates/app/views/re_jobs/show.html.erb +12 -0
  43. data/rails_generators/templates/app/views/re_jobs/show.js.erb +1 -0
  44. data/rails_generators/templates/app/views/re_pipeline_jobs/_empty.html.erb +11 -0
  45. data/rails_generators/templates/app/views/re_pipeline_jobs/_index.html.erb +41 -0
  46. data/rails_generators/templates/app/views/re_pipeline_jobs/index.html.erb +21 -0
  47. data/rails_generators/templates/app/views/re_pipeline_jobs/index.js.erb +10 -0
  48. data/rails_generators/templates/app/views/re_pipelines/_change.html.erb +46 -0
  49. data/rails_generators/templates/app/views/re_pipelines/_change_actions.html.erb +34 -0
  50. data/rails_generators/templates/app/views/re_pipelines/_confirm.html.erb +40 -0
  51. data/rails_generators/templates/app/views/re_pipelines/_edit.html.erb +21 -0
  52. data/rails_generators/templates/app/views/re_pipelines/_empty.html.erb +13 -0
  53. data/rails_generators/templates/app/views/re_pipelines/_index.html.erb +58 -0
  54. data/rails_generators/templates/app/views/re_pipelines/_new.html.erb +18 -0
  55. data/rails_generators/templates/app/views/re_pipelines/_show.html.erb +32 -0
  56. data/rails_generators/templates/app/views/re_pipelines/_show_actions.html.erb +3 -0
  57. data/rails_generators/templates/app/views/re_pipelines/change.html.erb +37 -0
  58. data/rails_generators/templates/app/views/re_pipelines/create.js.erb +8 -0
  59. data/rails_generators/templates/app/views/re_pipelines/edit.html.erb +11 -0
  60. data/rails_generators/templates/app/views/re_pipelines/edit.js.erb +5 -0
  61. data/rails_generators/templates/app/views/re_pipelines/index.html.erb +14 -0
  62. data/rails_generators/templates/app/views/re_pipelines/new.html.erb +9 -0
  63. data/rails_generators/templates/app/views/re_pipelines/new.js.erb +5 -0
  64. data/rails_generators/templates/app/views/re_pipelines/show.html.erb +41 -0
  65. data/rails_generators/templates/app/views/re_pipelines/update.js.erb +13 -0
  66. data/rails_generators/templates/app/views/re_rule_definitions/blacklist_word/_edit.html.erb +7 -0
  67. data/rails_generators/templates/app/views/re_rule_definitions/blacklist_word/_help.html.erb +2 -0
  68. data/rails_generators/templates/app/views/re_rule_definitions/blacklist_word/_new.html.erb +7 -0
  69. data/rails_generators/templates/app/views/re_rule_definitions/blacklist_word/_pipeline.html.erb +18 -0
  70. data/rails_generators/templates/app/views/re_rule_definitions/blacklist_word/_script.html.erb +26 -0
  71. data/rails_generators/templates/app/views/re_rule_definitions/blacklist_word/_title.html.erb +6 -0
  72. data/rails_generators/templates/app/views/re_rule_definitions/blacklist_word/_word.html.erb +12 -0
  73. data/rails_generators/templates/app/views/re_rule_definitions/blacklist_word/_words.html.erb +16 -0
  74. data/rails_generators/templates/app/views/re_rule_definitions/simple/_edit.html.erb +6 -0
  75. data/rails_generators/templates/app/views/re_rule_definitions/simple/_help.html.erb +2 -0
  76. data/rails_generators/templates/app/views/re_rule_definitions/simple/_new.html.erb +6 -0
  77. data/rails_generators/templates/app/views/re_rule_definitions/template/_edit.html.erb +6 -0
  78. data/rails_generators/templates/app/views/re_rule_definitions/template/_help.html.erb +2 -0
  79. data/rails_generators/templates/app/views/re_rule_definitions/template/_new.html.erb +6 -0
  80. data/rails_generators/templates/app/views/re_rules/_change.html.erb +57 -0
  81. data/rails_generators/templates/app/views/re_rules/_edit.html.erb +25 -0
  82. data/rails_generators/templates/app/views/re_rules/_empty.html.erb +12 -0
  83. data/rails_generators/templates/app/views/re_rules/_empty.js.erb +7 -0
  84. data/rails_generators/templates/app/views/re_rules/_error.html.erb +3 -0
  85. data/rails_generators/templates/app/views/re_rules/_help.html.erb +13 -0
  86. data/rails_generators/templates/app/views/re_rules/_index.html.erb +38 -0
  87. data/rails_generators/templates/app/views/re_rules/_menu.html.erb +41 -0
  88. data/rails_generators/templates/app/views/re_rules/_new.html.erb +26 -0
  89. data/rails_generators/templates/app/views/re_rules/_show.html.erb +43 -0
  90. data/rails_generators/templates/app/views/re_rules/destroy.js.erb +13 -0
  91. data/rails_generators/templates/app/views/re_rules/edit.html.erb +11 -0
  92. data/rails_generators/templates/app/views/re_rules/edit.js.erb +5 -0
  93. data/rails_generators/templates/app/views/re_rules/error.html.erb +11 -0
  94. data/rails_generators/templates/app/views/re_rules/error.js.erb +3 -0
  95. data/rails_generators/templates/app/views/re_rules/help.html.erb +11 -0
  96. data/rails_generators/templates/app/views/re_rules/help.js.erb +2 -0
  97. data/rails_generators/templates/app/views/re_rules/new.html.erb +11 -0
  98. data/rails_generators/templates/app/views/re_rules/new.js.erb +5 -0
  99. data/rails_generators/templates/app/views/re_rules/update.js.erb +20 -0
  100. data/rails_generators/templates/db/migrate/20100308225008_create_re_pipelines.rb +74 -0
  101. data/rails_generators/templates/lib/tasks/re_runner.rake +12 -0
  102. data/rails_generators/templates/public/images/re_job/error-14.png +0 -0
  103. data/rails_generators/templates/public/images/re_job/error-18.png +0 -0
  104. data/rails_generators/templates/public/images/re_job/error-25.png +0 -0
  105. data/rails_generators/templates/public/images/re_job/error-48.png +0 -0
  106. data/rails_generators/templates/public/images/re_job/goto-16.png +0 -0
  107. data/rails_generators/templates/public/images/re_job/info-14.png +0 -0
  108. data/rails_generators/templates/public/images/re_job/info-18.png +0 -0
  109. data/rails_generators/templates/public/images/re_job/info-25.png +0 -0
  110. data/rails_generators/templates/public/images/re_job/info-48.png +0 -0
  111. data/rails_generators/templates/public/images/re_job/list-14.png +0 -0
  112. data/rails_generators/templates/public/images/re_job/list-18.png +0 -0
  113. data/rails_generators/templates/public/images/re_job/list-25.png +0 -0
  114. data/rails_generators/templates/public/images/re_job/list-48.png +0 -0
  115. data/rails_generators/templates/public/images/re_job/loadingAnimation.gif +0 -0
  116. data/rails_generators/templates/public/images/re_job/next-disabled-14.png +0 -0
  117. data/rails_generators/templates/public/images/re_job/next-disabled-18.png +0 -0
  118. data/rails_generators/templates/public/images/re_job/next-disabled-25.png +0 -0
  119. data/rails_generators/templates/public/images/re_job/next-disabled-48.png +0 -0
  120. data/rails_generators/templates/public/images/re_job/next-enabled-14.png +0 -0
  121. data/rails_generators/templates/public/images/re_job/next-enabled-18.png +0 -0
  122. data/rails_generators/templates/public/images/re_job/next-enabled-25.png +0 -0
  123. data/rails_generators/templates/public/images/re_job/next-enabled-48.png +0 -0
  124. data/rails_generators/templates/public/images/re_job/prev-disabled-14.png +0 -0
  125. data/rails_generators/templates/public/images/re_job/prev-disabled-18.png +0 -0
  126. data/rails_generators/templates/public/images/re_job/prev-disabled-25.png +0 -0
  127. data/rails_generators/templates/public/images/re_job/prev-disabled-48.png +0 -0
  128. data/rails_generators/templates/public/images/re_job/prev-enabled-14.png +0 -0
  129. data/rails_generators/templates/public/images/re_job/prev-enabled-18.png +0 -0
  130. data/rails_generators/templates/public/images/re_job/prev-enabled-25.png +0 -0
  131. data/rails_generators/templates/public/images/re_job/prev-enabled-48.png +0 -0
  132. data/rails_generators/templates/public/images/re_job/success-14.png +0 -0
  133. data/rails_generators/templates/public/images/re_job/success-18.png +0 -0
  134. data/rails_generators/templates/public/images/re_job/success-25.png +0 -0
  135. data/rails_generators/templates/public/images/re_job/success-48.png +0 -0
  136. data/rails_generators/templates/public/images/re_pipeline/__destroy-14.png +0 -0
  137. data/rails_generators/templates/public/images/re_pipeline/__destroy-18.png +0 -0
  138. data/rails_generators/templates/public/images/re_pipeline/__destroy-25.png +0 -0
  139. data/rails_generators/templates/public/images/re_pipeline/__destroy-48.png +0 -0
  140. data/rails_generators/templates/public/images/re_pipeline/activate-14.png +0 -0
  141. data/rails_generators/templates/public/images/re_pipeline/activate-18.png +0 -0
  142. data/rails_generators/templates/public/images/re_pipeline/activate-25.png +0 -0
  143. data/rails_generators/templates/public/images/re_pipeline/activate-48.png +0 -0
  144. data/rails_generators/templates/public/images/re_pipeline/alert-14.png +0 -0
  145. data/rails_generators/templates/public/images/re_pipeline/alert-18.png +0 -0
  146. data/rails_generators/templates/public/images/re_pipeline/alert-25.png +0 -0
  147. data/rails_generators/templates/public/images/re_pipeline/alert-48.png +0 -0
  148. data/rails_generators/templates/public/images/re_pipeline/change-14.png +0 -0
  149. data/rails_generators/templates/public/images/re_pipeline/change-18.png +0 -0
  150. data/rails_generators/templates/public/images/re_pipeline/change-25.png +0 -0
  151. data/rails_generators/templates/public/images/re_pipeline/change-48.png +0 -0
  152. data/rails_generators/templates/public/images/re_pipeline/changed-14.png +0 -0
  153. data/rails_generators/templates/public/images/re_pipeline/changed-18.png +0 -0
  154. data/rails_generators/templates/public/images/re_pipeline/changed-25.png +0 -0
  155. data/rails_generators/templates/public/images/re_pipeline/changed-48.png +0 -0
  156. data/rails_generators/templates/public/images/re_pipeline/current-14.png +0 -0
  157. data/rails_generators/templates/public/images/re_pipeline/current-18.png +0 -0
  158. data/rails_generators/templates/public/images/re_pipeline/current-25.png +0 -0
  159. data/rails_generators/templates/public/images/re_pipeline/current-48.png +0 -0
  160. data/rails_generators/templates/public/images/re_pipeline/deactivate-14.png +0 -0
  161. data/rails_generators/templates/public/images/re_pipeline/deactivate-18.png +0 -0
  162. data/rails_generators/templates/public/images/re_pipeline/deactivate-25.png +0 -0
  163. data/rails_generators/templates/public/images/re_pipeline/deactivate-48.png +0 -0
  164. data/rails_generators/templates/public/images/re_pipeline/destroy-14.png +0 -0
  165. data/rails_generators/templates/public/images/re_pipeline/destroy-18.png +0 -0
  166. data/rails_generators/templates/public/images/re_pipeline/destroy-25.png +0 -0
  167. data/rails_generators/templates/public/images/re_pipeline/destroy-48.png +0 -0
  168. data/rails_generators/templates/public/images/re_pipeline/draft-14.png +0 -0
  169. data/rails_generators/templates/public/images/re_pipeline/draft-18.png +0 -0
  170. data/rails_generators/templates/public/images/re_pipeline/draft-25.png +0 -0
  171. data/rails_generators/templates/public/images/re_pipeline/draft-48.png +0 -0
  172. data/rails_generators/templates/public/images/re_pipeline/edit-14.png +0 -0
  173. data/rails_generators/templates/public/images/re_pipeline/edit-18.png +0 -0
  174. data/rails_generators/templates/public/images/re_pipeline/edit-25.png +0 -0
  175. data/rails_generators/templates/public/images/re_pipeline/edit-48.png +0 -0
  176. data/rails_generators/templates/public/images/re_pipeline/list-14.png +0 -0
  177. data/rails_generators/templates/public/images/re_pipeline/list-18.png +0 -0
  178. data/rails_generators/templates/public/images/re_pipeline/list-25.png +0 -0
  179. data/rails_generators/templates/public/images/re_pipeline/list-48.png +0 -0
  180. data/rails_generators/templates/public/images/re_pipeline/list-down.png +0 -0
  181. data/rails_generators/templates/public/images/re_pipeline/list-right.png +0 -0
  182. data/rails_generators/templates/public/images/re_pipeline/new-14.png +0 -0
  183. data/rails_generators/templates/public/images/re_pipeline/new-18.png +0 -0
  184. data/rails_generators/templates/public/images/re_pipeline/new-25.png +0 -0
  185. data/rails_generators/templates/public/images/re_pipeline/new-48.png +0 -0
  186. data/rails_generators/templates/public/images/re_pipeline/revert-14.png +0 -0
  187. data/rails_generators/templates/public/images/re_pipeline/revert-18.png +0 -0
  188. data/rails_generators/templates/public/images/re_pipeline/revert-25.png +0 -0
  189. data/rails_generators/templates/public/images/re_pipeline/revert-48.png +0 -0
  190. data/rails_generators/templates/public/images/re_pipeline/show-14.png +0 -0
  191. data/rails_generators/templates/public/images/re_pipeline/show-18.png +0 -0
  192. data/rails_generators/templates/public/images/re_pipeline/show-25.png +0 -0
  193. data/rails_generators/templates/public/images/re_pipeline/show-48.png +0 -0
  194. data/rails_generators/templates/public/images/re_pipeline/verify-14.png +0 -0
  195. data/rails_generators/templates/public/images/re_pipeline/verify-18.png +0 -0
  196. data/rails_generators/templates/public/images/re_pipeline/verify-25.png +0 -0
  197. data/rails_generators/templates/public/images/re_pipeline/verify-48.png +0 -0
  198. data/rails_generators/templates/public/images/re_rule/__destroy-14.png +0 -0
  199. data/rails_generators/templates/public/images/re_rule/__destroy-18.png +0 -0
  200. data/rails_generators/templates/public/images/re_rule/__destroy-25.png +0 -0
  201. data/rails_generators/templates/public/images/re_rule/__destroy-48.png +0 -0
  202. data/rails_generators/templates/public/images/re_rule/destroy-14.png +0 -0
  203. data/rails_generators/templates/public/images/re_rule/destroy-18.png +0 -0
  204. data/rails_generators/templates/public/images/re_rule/destroy-25.png +0 -0
  205. data/rails_generators/templates/public/images/re_rule/destroy-48.png +0 -0
  206. data/rails_generators/templates/public/images/re_rule/edit-14.png +0 -0
  207. data/rails_generators/templates/public/images/re_rule/edit-18.png +0 -0
  208. data/rails_generators/templates/public/images/re_rule/edit-25.png +0 -0
  209. data/rails_generators/templates/public/images/re_rule/edit-48.png +0 -0
  210. data/rails_generators/templates/public/images/re_rule/goto-pipeline-14.png +0 -0
  211. data/rails_generators/templates/public/images/re_rule/goto-pipeline-18.png +0 -0
  212. data/rails_generators/templates/public/images/re_rule/move-down-14.png +0 -0
  213. data/rails_generators/templates/public/images/re_rule/move-down-18.png +0 -0
  214. data/rails_generators/templates/public/images/re_rule/move-down-25.png +0 -0
  215. data/rails_generators/templates/public/images/re_rule/move-down-48.png +0 -0
  216. data/rails_generators/templates/public/images/re_rule/move-down-off-14.png +0 -0
  217. data/rails_generators/templates/public/images/re_rule/move-down-off-18.png +0 -0
  218. data/rails_generators/templates/public/images/re_rule/move-down-off-25.png +0 -0
  219. data/rails_generators/templates/public/images/re_rule/move-down-off-48.png +0 -0
  220. data/rails_generators/templates/public/images/re_rule/move-up-14.png +0 -0
  221. data/rails_generators/templates/public/images/re_rule/move-up-18.png +0 -0
  222. data/rails_generators/templates/public/images/re_rule/move-up-25.png +0 -0
  223. data/rails_generators/templates/public/images/re_rule/move-up-48.png +0 -0
  224. data/rails_generators/templates/public/images/re_rule/move-up-off-14.png +0 -0
  225. data/rails_generators/templates/public/images/re_rule/move-up-off-18.png +0 -0
  226. data/rails_generators/templates/public/images/re_rule/move-up-off-25.png +0 -0
  227. data/rails_generators/templates/public/images/re_rule/move-up-off-48.png +0 -0
  228. data/rails_generators/templates/public/images/re_rule/next-change-14.png +0 -0
  229. data/rails_generators/templates/public/images/re_rule/next-change-18.png +0 -0
  230. data/rails_generators/templates/public/images/re_rule/next-change-25.png +0 -0
  231. data/rails_generators/templates/public/images/re_rule/next-change-48.png +0 -0
  232. data/rails_generators/templates/public/images/re_rule/next-show-14.png +0 -0
  233. data/rails_generators/templates/public/images/re_rule/next-show-18.png +0 -0
  234. data/rails_generators/templates/public/images/re_rule/next-show-25.png +0 -0
  235. data/rails_generators/templates/public/images/re_rule/next-show-48.png +0 -0
  236. data/rails_generators/templates/public/images/re_rule/stop-failure-14.png +0 -0
  237. data/rails_generators/templates/public/images/re_rule/stop-failure-18.png +0 -0
  238. data/rails_generators/templates/public/images/re_rule/stop-failure-25.png +0 -0
  239. data/rails_generators/templates/public/images/re_rule/stop-failure-48.png +0 -0
  240. data/rails_generators/templates/public/images/re_rule/stop-success-14.png +0 -0
  241. data/rails_generators/templates/public/images/re_rule/stop-success-18.png +0 -0
  242. data/rails_generators/templates/public/images/re_rule/stop-success-25.png +0 -0
  243. data/rails_generators/templates/public/images/re_rule/stop-success-48.png +0 -0
  244. data/rails_generators/templates/public/images/re_rule/valid-14.png +0 -0
  245. data/rails_generators/templates/public/images/re_rule/valid-18.png +0 -0
  246. data/rails_generators/templates/public/images/re_rule/valid-25.png +0 -0
  247. data/rails_generators/templates/public/images/re_rule/valid-48.png +0 -0
  248. data/rails_generators/templates/public/images/re_rule/verify-14.png +0 -0
  249. data/rails_generators/templates/public/images/re_rule/verify-18.png +0 -0
  250. data/rails_generators/templates/public/images/re_rule/verify-25.png +0 -0
  251. data/rails_generators/templates/public/images/re_rule/verify-48.png +0 -0
  252. data/rails_generators/templates/public/images/re_rule_class/add-14.png +0 -0
  253. data/rails_generators/templates/public/images/re_rule_class/add-18.png +0 -0
  254. data/rails_generators/templates/public/images/re_rule_class/add-25.png +0 -0
  255. data/rails_generators/templates/public/images/re_rule_class/add-48.png +0 -0
  256. data/rails_generators/templates/public/images/re_rule_class/help-14.png +0 -0
  257. data/rails_generators/templates/public/images/re_rule_class/help-18.png +0 -0
  258. data/rails_generators/templates/public/images/re_rule_class/help-25.png +0 -0
  259. data/rails_generators/templates/public/images/re_rule_class/help-48.png +0 -0
  260. data/rails_generators/templates/public/images/re_rule_class/list-down.png +0 -0
  261. data/rails_generators/templates/public/images/re_rule_class/list-right.png +0 -0
  262. data/rails_generators/templates/public/images/re_rule_class/new-14.png +0 -0
  263. data/rails_generators/templates/public/images/re_rule_class/new-18.png +0 -0
  264. data/rails_generators/templates/public/images/re_rule_class/new-25.png +0 -0
  265. data/rails_generators/templates/public/images/re_rule_class/new-48.png +0 -0
  266. data/rails_generators/templates/public/javascripts/re_jobs.js +59 -0
  267. data/rails_generators/templates/public/javascripts/re_pipeline.js +54 -0
  268. data/rails_generators/templates/public/javascripts/re_pipeline_change.js +205 -0
  269. data/rails_generators/templates/public/javascripts/re_pipeline_index.js +24 -0
  270. data/rails_generators/templates/public/javascripts/re_pipeline_jobs.js +61 -0
  271. data/rails_generators/templates/public/javascripts/re_pipeline_new.js +34 -0
  272. data/rails_generators/templates/public/stylesheets/re_pipeline/accept.png +0 -0
  273. data/rails_generators/templates/public/stylesheets/re_pipeline/exclamation.png +0 -0
  274. data/rails_generators/templates/public/stylesheets/re_pipeline.css +509 -0
  275. data/rails_generators/templates/spec/controllers/re_pipelines_controller_spec.rb +111 -0
  276. data/rails_generators/templates/spec/models/re_job_audit_spec.rb +24 -0
  277. data/rails_generators/templates/spec/models/re_job_spec.rb +18 -0
  278. data/rails_generators/templates/spec/models/re_pipeline_activated_spec.rb +6 -0
  279. data/rails_generators/templates/spec/models/re_pipeline_base_spec.rb +157 -0
  280. data/rails_generators/templates/spec/models/re_pipeline_spec.rb +166 -0
  281. data/rails_generators/templates/spec/models/re_rule_outcome_spec.rb +97 -0
  282. data/rails_generators/templates/spec/models/re_rule_spec.rb +171 -0
  283. data/rails_generators/templates/spec/support/blueprint_re_pipelines.rb +11 -0
  284. data/spec/rules_engine_spec.rb +7 -0
  285. data/spec/spec.opts +1 -0
  286. data/spec/spec_helper.rb +9 -0
  287. data/tasks/rspec.rake +18 -0
  288. metadata +363 -0
@@ -0,0 +1,282 @@
1
+ class GeneratorManifest
2
+ def self.populate_record(m)
3
+
4
+ %w(
5
+ public/stylesheets
6
+ public/images/re_pipeline
7
+ app/views/re_pipeline_jobs
8
+ app/views/re_pipelines
9
+ public/images/re_rule
10
+ public/javascripts
11
+ app/helpers
12
+ app/models
13
+ public/images/re_job
14
+ spec/controllers
15
+ lib/tasks
16
+ db/migrate
17
+ app/views/re_jobs
18
+ app/views/re_rules
19
+ public/images/re_rule_class
20
+ app/views/layouts
21
+ spec/support
22
+ app/controllers
23
+ spec/models
24
+ public/stylesheets/re_pipeline
25
+ ).each do |dirname|
26
+ m.directory dirname
27
+ end
28
+
29
+ %w(
30
+ app/models/re_rule_outcome.rb
31
+ public/images/re_rule/move-down-48.png
32
+ spec/models/re_pipeline_spec.rb
33
+ public/images/re_pipeline/revert-14.png
34
+ public/images/re_job/next-enabled-48.png
35
+ public/images/re_pipeline/new-48.png
36
+ public/images/re_rule_class/help-48.png
37
+ public/images/re_job/prev-enabled-25.png
38
+ app/views/re_rules/_menu.html.erb
39
+ public/images/re_job/success-48.png
40
+ public/images/re_pipeline/__destroy-25.png
41
+ public/images/re_job/list-18.png
42
+ public/images/re_rule/move-down-14.png
43
+ public/images/re_pipeline/deactivate-25.png
44
+ app/views/re_pipelines/_empty.html.erb
45
+ app/views/re_rules/_empty.html.erb
46
+ public/images/re_rule_class/add-25.png
47
+ public/images/re_pipeline/changed-18.png
48
+ app/views/re_pipelines/edit.html.erb
49
+ public/images/re_pipeline/deactivate-18.png
50
+ public/images/re_rule_class/add-18.png
51
+ public/images/re_rule_class/new-48.png
52
+ public/images/re_pipeline/draft-25.png
53
+ app/models/re_pipeline.rb
54
+ public/images/re_pipeline/new-14.png
55
+ public/images/re_rule/move-up-off-25.png
56
+ public/images/re_rule/valid-18.png
57
+ public/images/re_job/next-disabled-48.png
58
+ app/views/re_rules/edit.html.erb
59
+ public/images/re_job/info-18.png
60
+ public/images/re_rule/goto-pipeline-18.png
61
+ app/views/re_pipelines/show.html.erb
62
+ public/images/re_pipeline/draft-18.png
63
+ app/views/re_jobs/_show.html.erb
64
+ app/views/re_pipeline_jobs/index.js.erb
65
+ app/views/re_jobs/_empty.html.erb
66
+ public/images/re_rule/move-up-48.png
67
+ public/images/re_rule/edit-18.png
68
+ public/images/re_job/error-25.png
69
+ app/views/re_rules/update.js.erb
70
+ public/images/re_job/next-disabled-14.png
71
+ app/views/re_jobs/show.html.erb
72
+ public/images/re_pipeline/change-48.png
73
+ public/images/re_pipeline/destroy-48.png
74
+ public/images/re_pipeline/activate-48.png
75
+ public/images/re_rule/stop-success-48.png
76
+ public/images/re_pipeline/list-18.png
77
+ app/views/re_pipeline_jobs/_index.html.erb
78
+ public/images/re_rule/next-change-25.png
79
+ public/images/re_rule/move-up-14.png
80
+ public/images/re_pipeline/change-14.png
81
+ public/images/re_pipeline/activate-14.png
82
+ public/images/re_rule/stop-success-14.png
83
+ app/views/re_pipelines/index.html.erb
84
+ app/views/re_pipelines/_edit.html.erb
85
+ public/images/re_rule/next-change-18.png
86
+ public/images/re_rule/next-show-48.png
87
+ public/images/re_pipeline/current-14.png
88
+ public/images/re_pipeline/edit-25.png
89
+ app/views/re_rules/_index.html.erb
90
+ public/images/re_rule/verify-25.png
91
+ public/images/re_rule/__destroy-25.png
92
+ spec/models/re_rule_outcome_spec.rb
93
+ app/views/re_pipelines/_show_actions.html.erb
94
+ app/views/re_pipeline_jobs/index.html.erb
95
+ app/views/re_pipelines/_change.html.erb
96
+ public/images/re_rule_class/list-down.png
97
+ public/images/re_pipeline/alert-18.png
98
+ public/images/re_rule/verify-18.png
99
+ public/images/re_rule/__destroy-18.png
100
+ public/images/re_pipeline/__destroy-14.png
101
+ public/images/re_pipeline/verify-25.png
102
+ public/images/re_pipeline/edit-18.png
103
+ public/javascripts/re_pipeline_index.js
104
+ public/images/re_rule/next-show-14.png
105
+ app/views/re_rules/new.js.erb
106
+ public/images/re_job/success-14.png
107
+ app/views/re_rules/_new.html.erb
108
+ public/images/re_job/prev-enabled-48.png
109
+ app/views/re_rules/_help.html.erb
110
+ public/images/re_pipeline/__destroy-48.png
111
+ public/images/re_job/prev-disabled-18.png
112
+ app/models/re_job.rb
113
+ public/images/re_pipeline/deactivate-48.png
114
+ public/images/re_rule_class/add-48.png
115
+ app/views/re_rules/_error.html.erb
116
+ public/images/re_rule/stop-failure-18.png
117
+ public/images/re_pipeline/changed-25.png
118
+ public/images/re_pipeline/draft-48.png
119
+ public/images/re_rule/destroy-18.png
120
+ public/images/re_rule/valid-48.png
121
+ app/views/re_pipelines/new.html.erb
122
+ public/stylesheets/re_pipeline.css
123
+ public/images/re_pipeline/new-25.png
124
+ app/controllers/re_rules_controller.rb
125
+ public/images/re_job/prev-enabled-14.png
126
+ public/images/re_rule/move-up-off-48.png
127
+ public/images/re_job/info-25.png
128
+ public/javascripts/re_pipeline_new.js
129
+ public/images/re_rule/move-up-off-14.png
130
+ public/images/re_rule_class/new-14.png
131
+ app/views/re_rules/destroy.js.erb
132
+ public/images/re_job/list-25.png
133
+ public/images/re_job/loadingAnimation.gif
134
+ public/images/re_job/error-48.png
135
+ public/stylesheets/re_pipeline/accept.png
136
+ public/images/re_job/next-disabled-25.png
137
+ public/images/re_pipeline/verify-14.png
138
+ public/images/re_rule/next-change-48.png
139
+ public/images/re_job/error-14.png
140
+ app/views/re_pipelines/_change_actions.html.erb
141
+ public/images/re_rule/move-down-off-14.png
142
+ public/images/re_rule/move-up-25.png
143
+ public/javascripts/re_pipeline_jobs.js
144
+ public/images/re_pipeline/alert-48.png
145
+ public/images/re_rule/verify-48.png
146
+ public/images/re_rule/__destroy-48.png
147
+ public/images/re_pipeline/show-18.png
148
+ public/images/re_pipeline/edit-48.png
149
+ public/images/re_rule_class/list-right.png
150
+ public/images/re_pipeline/verify-48.png
151
+ public/images/re_pipeline/current-18.png
152
+ public/images/re_rule/edit-25.png
153
+ app/views/re_pipelines/_show.html.erb
154
+ app/models/re_pipeline_activated_observer.rb
155
+ public/images/re_rule/next-show-25.png
156
+ public/images/re_pipeline/list-25.png
157
+ public/javascripts/re_pipeline.js
158
+ app/controllers/re_pipelines_controller.rb
159
+ spec/support/blueprint_re_pipelines.rb
160
+ app/models/re_pipeline_base.rb
161
+ public/images/re_job/success-18.png
162
+ app/models/re_job_audit.rb
163
+ public/images/re_rule/destroy-25.png
164
+ public/images/re_pipeline/changed-48.png
165
+ app/views/re_jobs/_index.html.erb
166
+ public/images/re_rule/stop-failure-25.png
167
+ public/images/re_pipeline/list-right.png
168
+ app/views/re_rules/error.js.erb
169
+ public/images/re_pipeline/revert-18.png
170
+ public/images/re_job/info-48.png
171
+ db/migrate/20100308225008_create_re_pipelines.rb
172
+ public/images/re_rule/move-down-18.png
173
+ public/images/re_job/next-enabled-14.png
174
+ public/images/re_pipeline/changed-14.png
175
+ public/images/re_pipeline/deactivate-14.png
176
+ public/images/re_rule_class/add-14.png
177
+ public/images/re_rule_class/help-14.png
178
+ spec/models/re_job_spec.rb
179
+ public/images/re_pipeline/draft-14.png
180
+ app/views/re_rules/_empty.js.erb
181
+ public/images/re_rule/valid-14.png
182
+ public/images/re_rule_class/help-18.png
183
+ public/images/re_job/prev-disabled-25.png
184
+ spec/models/re_job_audit_spec.rb
185
+ public/images/re_job/list-48.png
186
+ public/images/re_job/info-14.png
187
+ public/images/re_pipeline/new-18.png
188
+ public/images/re_rule/goto-pipeline-14.png
189
+ public/images/re_pipeline/list-down.png
190
+ app/views/re_rules/_change.html.erb
191
+ app/views/re_pipelines/update.js.erb
192
+ app/views/re_pipelines/create.js.erb
193
+ public/javascripts/re_jobs.js
194
+ lib/tasks/re_runner.rake
195
+ public/images/re_pipeline/show-25.png
196
+ app/views/re_rules/edit.js.erb
197
+ public/images/re_job/next-disabled-18.png
198
+ app/views/re_pipelines/_confirm.html.erb
199
+ app/controllers/re_jobs_controller.rb
200
+ public/images/re_rule/move-down-off-25.png
201
+ public/images/re_pipeline/list-14.png
202
+ app/controllers/re_pipeline_jobs_controller.rb
203
+ app/views/re_pipelines/change.html.erb
204
+ public/images/re_rule/edit-48.png
205
+ app/views/re_pipelines/edit.js.erb
206
+ public/images/re_rule/move-up-18.png
207
+ public/images/re_pipeline/destroy-14.png
208
+ public/images/re_rule/next-change-14.png
209
+ public/images/re_pipeline/list-48.png
210
+ public/images/re_pipeline/change-18.png
211
+ public/images/re_pipeline/activate-18.png
212
+ app/views/re_rules/help.html.erb
213
+ public/images/re_rule/stop-success-18.png
214
+ app/models/re_rule.rb
215
+ public/images/re_rule/verify-14.png
216
+ public/images/re_pipeline/edit-14.png
217
+ app/models/re_pipeline_activated.rb
218
+ public/images/re_pipeline/alert-14.png
219
+ public/images/re_pipeline/__destroy-18.png
220
+ app/views/re_pipelines/_new.html.erb
221
+ public/images/re_rule/stop-failure-48.png
222
+ public/images/re_rule/next-show-18.png
223
+ public/images/re_rule/destroy-48.png
224
+ app/helpers/re_pipeline_helper.rb
225
+ public/images/re_pipeline/current-25.png
226
+ public/images/re_pipeline/revert-25.png
227
+ public/images/re_job/prev-disabled-14.png
228
+ spec/models/re_pipeline_base_spec.rb
229
+ app/views/re_rules/help.js.erb
230
+ app/views/re_pipelines/new.js.erb
231
+ app/views/re_pipeline_jobs/_empty.html.erb
232
+ spec/models/re_rule_spec.rb
233
+ app/views/re_rules/new.html.erb
234
+ public/images/re_rule/destroy-14.png
235
+ public/images/re_rule/move-down-25.png
236
+ public/images/re_rule/stop-failure-14.png
237
+ public/images/re_rule_class/help-25.png
238
+ public/images/re_job/list-14.png
239
+ public/images/re_job/next-enabled-25.png
240
+ public/images/re_job/prev-disabled-48.png
241
+ public/images/re_job/next-enabled-18.png
242
+ public/images/re_rule/valid-25.png
243
+ public/images/re_job/success-25.png
244
+ public/images/re_job/prev-enabled-18.png
245
+ app/views/re_jobs/index.html.erb
246
+ app/views/re_jobs/show.js.erb
247
+ app/views/layouts/_blockUI.html.erb
248
+ public/images/re_rule_class/new-25.png
249
+ public/images/re_rule/move-up-off-18.png
250
+ public/images/re_rule_class/new-18.png
251
+ public/images/re_pipeline/show-48.png
252
+ public/images/re_job/goto-16.png
253
+ public/images/re_rule/edit-14.png
254
+ public/images/re_rule/move-down-off-48.png
255
+ public/images/re_pipeline/show-14.png
256
+ public/images/re_pipeline/verify-18.png
257
+ public/images/re_pipeline/destroy-25.png
258
+ public/images/re_pipeline/change-25.png
259
+ public/images/re_pipeline/activate-25.png
260
+ public/images/re_rule/stop-success-25.png
261
+ app/views/re_rules/_edit.html.erb
262
+ public/images/re_rule/move-down-off-18.png
263
+ public/images/re_job/error-18.png
264
+ app/views/re_rules/_show.html.erb
265
+ public/images/re_pipeline/destroy-18.png
266
+ spec/models/re_pipeline_activated_spec.rb
267
+ public/javascripts/re_pipeline_change.js
268
+ public/images/re_pipeline/alert-25.png
269
+ app/views/re_jobs/index.js.erb
270
+ app/views/re_pipelines/_index.html.erb
271
+ spec/controllers/re_pipelines_controller_spec.rb
272
+ public/images/re_rule/__destroy-14.png
273
+ app/views/re_rules/error.html.erb
274
+ public/stylesheets/re_pipeline/exclamation.png
275
+ public/images/re_pipeline/revert-48.png
276
+ public/images/re_pipeline/current-48.png
277
+ ).each do |filename|
278
+ m.file filename, filename
279
+ end
280
+
281
+ end
282
+ end
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/generator_manifest")
2
+ require File.expand_path(File.dirname(__FILE__) + "/template_manifest")
3
+ require File.expand_path(File.dirname(__FILE__) + "/blacklist_word_manifest")
4
+ require File.expand_path(File.dirname(__FILE__) + "/simple_manifest")
5
+
6
+ class RulesEngineGenerator < Rails::Generator::Base
7
+
8
+ attr_reader :rule_name, :rule_class
9
+
10
+ def initialize(runtime_args, runtime_options = {})
11
+ super
12
+ end
13
+
14
+ def after_generate
15
+ end
16
+
17
+ def manifest
18
+ @rule_name = args[0] || 'generator'
19
+ @rule_class = @rule_name.camelize
20
+
21
+ record do |m|
22
+ if (@rule_name == 'generator')
23
+ GeneratorManifest.populate_record(m)
24
+ m.readme './../USAGE'
25
+ elsif (@rule_name == 'blacklist_word')
26
+ BlacklistWordManifest.populate_record(m)
27
+ elsif (@rule_name == 'simple')
28
+ Simple.populate_record(m)
29
+ else
30
+ TemplateManifest.populate_record(m, @rule_name)
31
+ end
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,6 @@
1
+ directories :
2
+ - app/views/re_rule_definitions/simple
3
+
4
+
5
+ files :
6
+ - app/rules/simple.rb
@@ -0,0 +1,21 @@
1
+ class SimpleManifest
2
+ def self.populate_record(m)
3
+
4
+ %w(
5
+ app/rules
6
+ app/views/re_rule_definitions/simple
7
+ ).each do |dirname|
8
+ m.directory dirname
9
+ end
10
+
11
+ %w(
12
+ app/views/re_rule_definitions/simple/_new.html.erb
13
+ app/views/re_rule_definitions/simple/_edit.html.erb
14
+ app/rules/simple.rb
15
+ app/views/re_rule_definitions/simple/_help.html.erb
16
+ ).each do |filename|
17
+ m.file filename, filename
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ class TemplateManifest
2
+ def self.populate_record(m, rule_name)
3
+
4
+ m.directory "app/views/re_rule_definitions/#{rule_name}"
5
+
6
+ m.template "app/views/re_rule_definitions/template/_new.html.erb", "app/views/re_rule_definitions/#{rule_name}/_new.html.erb"
7
+ m.template "app/views/re_rule_definitions/template/_edit.html.erb", "app/views/re_rule_definitions/#{rule_name}/_edit.html.erb"
8
+ m.template "app/views/re_rule_definitions/template/_help.html.erb", "app/views/re_rule_definitions/#{rule_name}/_help.html.erb"
9
+
10
+ m.template "app/rules/template.rb", "app/rules/#{rule_name}.rb"
11
+
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ class ReJobsController < ApplicationController
2
+
3
+ before_filter :only => [:show] do |controller|
4
+ controller.load_model :re_job
5
+ end
6
+
7
+ # before_filter :login_required
8
+ before_filter :reader_access_required
9
+
10
+ def index
11
+ @re_jobs = ReJob.find_jobs(:page => params[:page], :per_page => 2)
12
+ end
13
+
14
+ def show
15
+ @re_job_audits = ReJobAudit.by_re_job_id(params[:id]).order_date('ASC').find(:all, :include => [:re_pipeline] )
16
+ end
17
+
18
+ end
@@ -0,0 +1,17 @@
1
+ class RePipelineJobsController < ApplicationController
2
+
3
+ before_filter do |controller|
4
+ controller.load_model :re_pipeline, {:param_id => :re_pipeline_id, :redirect_path => :re_pipelines_path}
5
+ end
6
+ before_filter :only => [:show] do |controller|
7
+ controller.load_model :re_job
8
+ end
9
+
10
+ # before_filter :login_required
11
+ before_filter :reader_access_required
12
+
13
+ def index
14
+ @re_jobs = ReJob.find_jobs_by_pipeline(@re_pipeline.id, :page => params[:page], :per_page => 20)
15
+ end
16
+
17
+ end
@@ -0,0 +1,143 @@
1
+ class RePipelinesController < ApplicationController
2
+
3
+ before_filter :only => [:show, :change, :edit, :update, :activate, :deactivate, :revert, :destroy] do |controller|
4
+ controller.load_model :re_pipeline
5
+ end
6
+
7
+ # before_filter :login_required
8
+ before_filter :editor_access_required, :only => [:new, :create, :change, :edit, :update, :activate, :deactivate, :revert, :destroy]
9
+ before_filter :reader_access_required, :only => [:lookup, :index, :show]
10
+
11
+ def lookup
12
+ klass = RePipeline
13
+ query = params[:q] || ''
14
+ if params[:t] == 'code'
15
+ if query.chomp.blank?
16
+ render :text => klass.find(:all, :order => "title", :limit => 10 ).map(&:title).join("\n")
17
+ else
18
+ render :text => klass.find(:all, :conditions => ["title LIKE ?", "#{params[:q]}%"], :order => "title", :limit => 10 ).map(&:title).join("\n")
19
+ end
20
+ else # params[:t] == 'title'
21
+ if query.chomp.blank?
22
+ render :text => klass.find(:all, :order => "code", :limit => 10 ).map(&:code).join("\n")
23
+ else
24
+ render :text => klass.find(:all, :conditions => ["code LIKE ?", "#{params[:q]}%"], :order => "code", :limit => 10 ).map(&:code).join("\n")
25
+ end
26
+ end
27
+ end
28
+
29
+
30
+ def index
31
+ klass = RePipeline
32
+ @re_pipelines = klass.find(:all)
33
+ end
34
+
35
+ def show
36
+ end
37
+
38
+ def new
39
+ @re_pipeline = RePipeline.new
40
+ end
41
+
42
+ def create
43
+ @re_pipeline = RePipeline.new(params[:re_pipeline])
44
+
45
+ if @re_pipeline.save
46
+ flash[:success] = 'Pipeline Created.'
47
+
48
+ respond_to do |format|
49
+ format.html do
50
+ redirect_to(change_re_pipeline_path(@re_pipeline))
51
+ end
52
+ format.js do
53
+ render :action => "create"
54
+ end
55
+ end
56
+ else
57
+ render :action => "new"
58
+ end
59
+
60
+ end
61
+
62
+ def change
63
+ end
64
+
65
+ def edit
66
+ end
67
+
68
+ def update
69
+ @re_pipeline.attributes = params[:re_pipeline].except(:code)
70
+ if @re_pipeline.save
71
+ flash[:success] = 'Pipeline Updated.'
72
+
73
+ respond_to do |format|
74
+ format.html do
75
+ redirect_to(change_re_pipeline_path(@re_pipeline))
76
+ end
77
+ format.js do
78
+ render :action => "update"
79
+ end
80
+ end
81
+ else
82
+ render :action => "edit"
83
+ end
84
+
85
+ end
86
+
87
+ def activate
88
+ @re_pipeline.activate!
89
+ flash[:success] = 'Pipeline Activated.'
90
+
91
+ respond_to do |format|
92
+ format.html do
93
+ redirect_to(change_re_pipeline_path(@re_pipeline))
94
+ end
95
+ format.js do
96
+ render :action => "update"
97
+ end
98
+ end
99
+ end
100
+
101
+ def deactivate
102
+ @re_pipeline.deactivate!
103
+ flash[:success] = 'Pipeline Deactivated.'
104
+
105
+ respond_to do |format|
106
+ format.html do
107
+ redirect_to(change_re_pipeline_path(@re_pipeline))
108
+ end
109
+ format.js do
110
+ render :action => "update"
111
+ end
112
+ end
113
+ end
114
+
115
+ def revert
116
+ @re_pipeline.revert!
117
+ flash[:success] = 'Pipeline Changes Removed.'
118
+
119
+ respond_to do |format|
120
+ format.html do
121
+ redirect_to(change_re_pipeline_path(@re_pipeline))
122
+ end
123
+ format.js do
124
+ render :action => "update"
125
+ end
126
+ end
127
+ end
128
+
129
+ def destroy
130
+ @re_pipeline.destroy
131
+ flash[:success] = 'Pipeline Removed.'
132
+
133
+ respond_to do |format|
134
+ format.html do
135
+ redirect_to(re_pipelines_path)
136
+ end
137
+ format.js do
138
+ render :inline => "window.location.href = '#{re_pipelines_path}';"
139
+ end
140
+ end
141
+ end
142
+
143
+ end
@@ -0,0 +1,140 @@
1
+ class ReRulesController < ApplicationController
2
+
3
+ before_filter do |controller|
4
+ controller.load_model :re_pipeline, {:param_id => :re_pipeline_id, :redirect_path => :re_pipelines_path}
5
+ end
6
+ before_filter :only => [:edit, :update, :destroy, :move_up, :move_down] do |controller|
7
+ controller.load_model :re_rule, {:param_id => :id, :parents => [:re_pipeline], :redirect_path => :re_pipeline_path}
8
+ end
9
+ before_filter :load_rule_class_from_rule_class, :only => [:help, :new, :create]
10
+ before_filter :load_rule_class_from_model, :only => [:edit, :update, :move_up, :move_down]
11
+
12
+ # before_filter :login_required
13
+ before_filter :editor_access_required, :except => [:error, :help]
14
+
15
+ def error
16
+ end
17
+
18
+ def help
19
+ end
20
+
21
+ def new
22
+ @re_rule = ReRule.new(:re_pipeline_id => @re_pipeline.id)
23
+ end
24
+
25
+ def create
26
+ @re_rule = ReRule.new(:re_pipeline_id => @re_pipeline.id)
27
+ @rule.attributes = params
28
+ if @rule.valid? && @rule.save(@re_rule) && @re_rule.save
29
+ flash[:success] = 'Rule Created.'
30
+ @rule.after_create(@re_rule)
31
+
32
+ respond_to do |format|
33
+ format.html do
34
+ redirect_to(change_re_pipeline_path(@re_pipeline))
35
+ end
36
+ format.js do
37
+ render :action => "update"
38
+ end
39
+ end
40
+ else
41
+ render :action => "new"
42
+ end
43
+ end
44
+
45
+ def edit
46
+ end
47
+
48
+ def update
49
+ @rule.attributes = params
50
+ if @rule.valid? && @rule.save(@re_rule) && @re_rule.save
51
+ @re_pipeline.changed
52
+ flash[:success] = 'Rule Updated.'
53
+ @rule.after_update(@re_rule)
54
+
55
+ respond_to do |format|
56
+ format.html do
57
+ redirect_to(change_re_pipeline_path(@re_pipeline))
58
+ end
59
+ format.js do
60
+ render :action => "update"
61
+ end
62
+ end
63
+ else
64
+ render :action => "new"
65
+ end
66
+ end
67
+
68
+ def destroy
69
+ @rule_class = RulesEngine::Discovery.rule_class(@re_rule.rule_class)
70
+ if (@rule_class)
71
+ @rule = @rule_class.new
72
+ @rule.before_destroy(@re_rule)
73
+ end
74
+ @re_rule.destroy
75
+ @re_pipeline.changed
76
+ flash[:success] = 'Rule Deleted.'
77
+
78
+ respond_to do |format|
79
+ format.html do
80
+ redirect_to(change_re_pipeline_path(@re_pipeline))
81
+ end
82
+ format.js do
83
+ render :action => "destroy"
84
+ end
85
+ end
86
+
87
+ end
88
+
89
+ def move_up
90
+ @re_rule.move_higher
91
+ @re_pipeline.changed
92
+ flash[:success] = 'Rule Moved Up.'
93
+
94
+ respond_to do |format|
95
+ format.html do
96
+ redirect_to(change_re_pipeline_path(@re_pipeline))
97
+ end
98
+ format.js do
99
+ render :action => "update"
100
+ end
101
+ end
102
+ end
103
+
104
+ def move_down
105
+ @re_rule.move_lower
106
+ @re_pipeline.changed
107
+ flash[:success] = 'Rule Moved Down.'
108
+
109
+ respond_to do |format|
110
+ format.html do
111
+ redirect_to(change_re_pipeline_path(@re_pipeline))
112
+ end
113
+ format.js do
114
+ render :action => "update"
115
+ end
116
+ end
117
+ end
118
+
119
+ protected
120
+ def load_rule_class_from_rule_class
121
+ @rule_class = RulesEngine::Discovery.rule_class(params[:rule_class])
122
+ if @rule_class.nil?
123
+ flash[:error] = "#{params[:rule_class]} : class not found."
124
+ render :action => :error
125
+ else
126
+ @rule = @rule_class.new
127
+ end
128
+ end
129
+
130
+ def load_rule_class_from_model
131
+ @rule_class = RulesEngine::Discovery.rule_class(@re_rule.rule_class)
132
+ if @rule_class.nil?
133
+ flash[:error] = "#{@re_rule.rule_class} : class not found."
134
+ render :action => :error
135
+ else
136
+ @rule = @rule_class.new
137
+ render :action => :error unless @rule.load(@re_rule)
138
+ end
139
+ end
140
+ end