webroar 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (402) hide show
  1. data/CHANGELOG +7 -0
  2. data/README +1 -1
  3. data/doc/user-guide.html +125 -85
  4. data/doc/user-guide.txt +2 -2
  5. data/lib/constant.rb +23 -16
  6. data/lib/db_connect.rb +2 -3
  7. data/lib/installer.rb +17 -10
  8. data/lib/user_interaction.rb +21 -10
  9. data/lib/webroar_command.rb +21 -23
  10. data/src/admin_panel/Gemfile +8 -0
  11. data/src/admin_panel/Rakefile +2 -5
  12. data/src/admin_panel/app/controllers/application_controller.rb +1 -1
  13. data/src/admin_panel/app/controllers/exceptions_controller.rb +25 -26
  14. data/src/admin_panel/app/controllers/graph_controller.rb +2 -1
  15. data/src/admin_panel/app/helpers/admin_helper.rb +1 -1
  16. data/src/admin_panel/app/{models → mailers}/mailer.rb +5 -8
  17. data/src/admin_panel/app/models/app.rb +1 -1
  18. data/src/admin_panel/app/models/app_exception.rb +15 -11
  19. data/src/admin_panel/app/models/app_time_sample.rb +40 -10
  20. data/src/admin_panel/app/models/application_specification.rb +71 -41
  21. data/src/admin_panel/app/models/resource_usage.rb +76 -55
  22. data/src/admin_panel/app/models/url_breakup_time_sample.rb +6 -11
  23. data/src/admin_panel/app/models/url_time_sample.rb +57 -13
  24. data/src/admin_panel/app/views/admin/_application_table.html.erb +5 -5
  25. data/src/admin_panel/app/views/admin/_feedback_partial.html.erb +4 -4
  26. data/src/admin_panel/app/views/admin/_report_bug_partial.html.erb +5 -5
  27. data/src/admin_panel/app/views/admin/change_password_form.html.erb +3 -3
  28. data/src/admin_panel/app/views/admin/configuration.html.erb +6 -6
  29. data/src/admin_panel/app/views/admin/home.html.erb +4 -4
  30. data/src/admin_panel/app/views/admin/index.html.erb +5 -5
  31. data/src/admin_panel/app/views/application_specification/_application_specification_form.html.erb +15 -6
  32. data/src/admin_panel/app/views/exceptions/_add_and_list_exception_classes.html.erb +7 -6
  33. data/src/admin_panel/app/views/exceptions/_exception_backtrace_partial.html.erb +1 -1
  34. data/src/admin_panel/app/views/exceptions/_exception_environment_partial.html.erb +30 -30
  35. data/src/admin_panel/app/views/exceptions/_exception_list_partial.html.erb +11 -11
  36. data/src/admin_panel/app/views/exceptions/_show.html.erb +8 -8
  37. data/src/admin_panel/app/views/exceptions/index.html.erb +0 -1
  38. data/src/admin_panel/app/views/graph/_get_database_data.html.erb +1 -1
  39. data/src/admin_panel/app/views/graph/_get_resource_usage_data_app.html.erb +2 -2
  40. data/src/admin_panel/app/views/graph/_get_resource_usage_data_server.html.erb +2 -2
  41. data/src/admin_panel/app/views/graph/_get_throughput_data.html.erb +2 -2
  42. data/src/admin_panel/app/views/graph/_get_url_data.html.erb +4 -4
  43. data/src/admin_panel/app/views/graph/_pie.html.erb +2 -2
  44. data/src/admin_panel/app/views/graph/_query_date.html.erb +1 -1
  45. data/src/admin_panel/app/views/graph/_query_period.html.erb +1 -1
  46. data/src/admin_panel/app/views/graph/_slider_partial.html.erb +5 -4
  47. data/src/admin_panel/app/views/graph/index.html.erb +0 -1
  48. data/src/admin_panel/app/views/headers/_add_expires_text_box.html.erb +5 -5
  49. data/src/admin_panel/app/views/headers/_expires_by_type_form.html.erb +1 -1
  50. data/src/admin_panel/app/views/headers/_headers_table.html.erb +12 -12
  51. data/src/admin_panel/app/views/layouts/application.html.erb +71 -51
  52. data/src/admin_panel/app/views/mail_specification/_current_spec.html.erb +4 -4
  53. data/src/admin_panel/app/views/mail_specification/_sendmail_form.html.erb +3 -3
  54. data/src/admin_panel/app/views/mail_specification/_smtp_form.html.erb +3 -3
  55. data/src/admin_panel/app/views/server_specification/_add_div.html.erb +4 -4
  56. data/src/admin_panel/app/views/server_specification/_ssl_support_form.html.erb +3 -2
  57. data/src/admin_panel/config.ru +4 -0
  58. data/src/admin_panel/config/application.rb +46 -0
  59. data/src/admin_panel/config/boot.rb +4 -112
  60. data/src/admin_panel/config/environment.rb +4 -85
  61. data/src/admin_panel/config/environments/development.rb +20 -13
  62. data/src/admin_panel/config/environments/production.rb +44 -17
  63. data/src/admin_panel/config/environments/test.rb +31 -18
  64. data/src/admin_panel/config/initializers/application_constants.rb +13 -11
  65. data/src/admin_panel/config/initializers/secret_token.rb +7 -0
  66. data/src/admin_panel/config/initializers/session_store.rb +8 -0
  67. data/src/admin_panel/config/initializers/ssl.rb +6 -2
  68. data/src/admin_panel/config/routes.rb +15 -57
  69. data/src/admin_panel/doc/README_FOR_APP +1 -1
  70. data/src/admin_panel/doc/app/ActionView.html +229 -0
  71. data/src/admin_panel/doc/app/ActionView/Helpers.html +229 -0
  72. data/src/admin_panel/doc/app/ActionView/Helpers/AssetTagHelper.html +277 -0
  73. data/src/admin_panel/doc/app/AdminController.html +814 -0
  74. data/src/admin_panel/doc/app/AdminHelper.html +495 -0
  75. data/src/admin_panel/doc/app/Analytics.html +272 -0
  76. data/src/admin_panel/doc/app/Analytics/Database.html +401 -0
  77. data/src/admin_panel/doc/app/Analytics/ResourceUsage.html +683 -0
  78. data/src/admin_panel/doc/app/Analytics/Throughput.html +488 -0
  79. data/src/admin_panel/doc/app/Analytics/Url.html +484 -0
  80. data/src/admin_panel/doc/app/Analytics/UrlBreakup.html +537 -0
  81. data/src/admin_panel/doc/app/App.html +489 -0
  82. data/src/admin_panel/doc/app/AppException.html +710 -0
  83. data/src/admin_panel/doc/app/AppTimeSample.html +620 -0
  84. data/src/admin_panel/doc/app/ApplicationController.html +239 -0
  85. data/src/admin_panel/doc/app/ApplicationHelper.html +296 -0
  86. data/src/admin_panel/doc/app/ApplicationSpecification.html +876 -0
  87. data/src/admin_panel/doc/app/ApplicationSpecificationController.html +552 -0
  88. data/src/admin_panel/doc/app/ApplicationSpecificationHelper.html +219 -0
  89. data/src/admin_panel/doc/app/Control.html +431 -0
  90. data/src/admin_panel/doc/app/ExceptionDetail.html +227 -0
  91. data/src/admin_panel/doc/app/ExceptionsController.html +754 -0
  92. data/src/admin_panel/doc/app/ExceptionsHelper.html +219 -0
  93. data/src/admin_panel/doc/app/GraphController.html +1101 -0
  94. data/src/admin_panel/doc/app/GraphHelper.html +285 -0
  95. data/src/admin_panel/doc/app/Headers.html +549 -0
  96. data/src/admin_panel/doc/app/HeadersController.html +507 -0
  97. data/src/admin_panel/doc/app/HeadersHelper.html +219 -0
  98. data/src/admin_panel/doc/app/MailSpecification.html +685 -0
  99. data/src/admin_panel/doc/app/MailSpecificationController.html +541 -0
  100. data/src/admin_panel/doc/app/MailSpecificationHelper.html +219 -0
  101. data/src/admin_panel/doc/app/Mailer.html +589 -0
  102. data/src/admin_panel/doc/app/Object.html +240 -0
  103. data/src/admin_panel/doc/app/PseudoModel.html +354 -0
  104. data/src/admin_panel/doc/app/ResourceUsage.html +656 -0
  105. data/src/admin_panel/doc/app/SCGI.html +674 -0
  106. data/src/admin_panel/doc/app/ServerSpecification.html +479 -0
  107. data/src/admin_panel/doc/app/ServerSpecificationController.html +500 -0
  108. data/src/admin_panel/doc/app/ServerSpecificationHelper.html +219 -0
  109. data/src/admin_panel/doc/app/SignalHelper.html +287 -0
  110. data/src/admin_panel/doc/app/UrlBreakupTimeSample.html +287 -0
  111. data/src/admin_panel/doc/app/UrlTimeSample.html +986 -0
  112. data/src/admin_panel/doc/app/User.html +290 -0
  113. data/src/admin_panel/doc/app/YAMLConfig.html +247 -0
  114. data/src/admin_panel/doc/app/YAMLWriter.html +284 -0
  115. data/src/admin_panel/doc/app/app/controllers/admin_controller_rb.html +52 -0
  116. data/src/admin_panel/doc/app/app/controllers/application_controller_rb.html +54 -0
  117. data/src/admin_panel/doc/app/app/controllers/application_specification_controller_rb.html +52 -0
  118. data/src/admin_panel/doc/app/app/controllers/exceptions_controller_rb.html +52 -0
  119. data/src/admin_panel/doc/app/app/controllers/graph_controller_rb.html +52 -0
  120. data/src/admin_panel/doc/app/app/controllers/headers_controller_rb.html +52 -0
  121. data/src/admin_panel/doc/app/app/controllers/mail_specification_controller_rb.html +52 -0
  122. data/src/admin_panel/doc/app/app/controllers/server_specification_controller_rb.html +52 -0
  123. data/src/admin_panel/doc/app/app/helpers/admin_helper_rb.html +52 -0
  124. data/src/admin_panel/doc/app/app/helpers/application_helper_rb.html +52 -0
  125. data/src/admin_panel/doc/app/app/helpers/application_specification_helper_rb.html +52 -0
  126. data/src/admin_panel/doc/app/app/helpers/exceptions_helper_rb.html +52 -0
  127. data/src/admin_panel/doc/app/app/helpers/graph_helper_rb.html +52 -0
  128. data/src/admin_panel/doc/app/app/helpers/headers_helper_rb.html +52 -0
  129. data/src/admin_panel/doc/app/app/helpers/mail_specification_helper_rb.html +52 -0
  130. data/src/admin_panel/doc/app/app/helpers/server_specification_helper_rb.html +52 -0
  131. data/src/admin_panel/doc/app/app/mailers/mailer_rb.html +56 -0
  132. data/src/admin_panel/doc/app/app/models/app_exception_rb.html +52 -0
  133. data/src/admin_panel/doc/app/app/models/app_rb.html +54 -0
  134. data/src/admin_panel/doc/app/app/models/app_time_sample_rb.html +52 -0
  135. data/src/admin_panel/doc/app/app/models/application_specification_rb.html +52 -0
  136. data/src/admin_panel/doc/app/app/models/exception_detail_rb.html +52 -0
  137. data/src/admin_panel/doc/app/app/models/headers_rb.html +52 -0
  138. data/src/admin_panel/doc/app/app/models/mail_specification_rb.html +52 -0
  139. data/src/admin_panel/doc/app/app/models/pseudo_model_rb.html +52 -0
  140. data/src/admin_panel/doc/app/app/models/resource_usage_rb.html +52 -0
  141. data/src/admin_panel/doc/app/app/models/server_specification_rb.html +52 -0
  142. data/src/admin_panel/doc/app/app/models/url_breakup_time_sample_rb.html +52 -0
  143. data/src/admin_panel/doc/app/app/models/url_time_sample_rb.html +52 -0
  144. data/src/admin_panel/doc/app/app/models/user_rb.html +52 -0
  145. data/src/admin_panel/doc/app/created.rid +42 -1
  146. data/src/admin_panel/doc/app/doc/README_FOR_APP.html +172 -0
  147. data/src/admin_panel/doc/app/images/brick.png +0 -0
  148. data/src/admin_panel/doc/app/images/brick_link.png +0 -0
  149. data/src/admin_panel/doc/app/images/bug.png +0 -0
  150. data/src/admin_panel/doc/app/images/bullet_black.png +0 -0
  151. data/src/admin_panel/doc/app/images/bullet_toggle_minus.png +0 -0
  152. data/src/admin_panel/doc/app/images/bullet_toggle_plus.png +0 -0
  153. data/src/admin_panel/doc/app/images/date.png +0 -0
  154. data/src/admin_panel/doc/app/images/find.png +0 -0
  155. data/src/admin_panel/doc/app/images/loadingAnimation.gif +0 -0
  156. data/src/admin_panel/doc/app/images/macFFBgHack.png +0 -0
  157. data/src/admin_panel/doc/app/images/package.png +0 -0
  158. data/src/admin_panel/doc/app/images/page_green.png +0 -0
  159. data/src/admin_panel/doc/app/images/page_white_text.png +0 -0
  160. data/src/admin_panel/doc/app/images/page_white_width.png +0 -0
  161. data/src/admin_panel/doc/app/images/plugin.png +0 -0
  162. data/src/admin_panel/doc/app/images/ruby.png +0 -0
  163. data/src/admin_panel/doc/app/images/tag_green.png +0 -0
  164. data/src/admin_panel/doc/app/images/wrench.png +0 -0
  165. data/src/admin_panel/doc/app/images/wrench_orange.png +0 -0
  166. data/src/admin_panel/doc/app/images/zoom.png +0 -0
  167. data/src/admin_panel/doc/app/index.html +564 -20
  168. data/src/admin_panel/doc/app/js/darkfish.js +116 -0
  169. data/src/admin_panel/doc/app/js/jquery.js +32 -0
  170. data/src/admin_panel/doc/app/js/quicksearch.js +114 -0
  171. data/src/admin_panel/doc/app/js/thickbox-compressed.js +10 -0
  172. data/src/admin_panel/doc/app/lib/asset_tag_helper_ext_rb.html +52 -0
  173. data/src/admin_panel/doc/app/lib/control_rb.html +58 -0
  174. data/src/admin_panel/doc/app/lib/graph_controller_extensions/database_analytics_rb.html +52 -0
  175. data/src/admin_panel/doc/app/lib/graph_controller_extensions/resource_usage_analytics_rb.html +52 -0
  176. data/src/admin_panel/doc/app/lib/graph_controller_extensions/throughput_analytics_rb.html +52 -0
  177. data/src/admin_panel/doc/app/lib/graph_controller_extensions/url_analytics_rb.html +52 -0
  178. data/src/admin_panel/doc/app/lib/graph_controller_extensions/url_breakup_analytics_rb.html +52 -0
  179. data/src/admin_panel/doc/app/lib/helper_rb.html +52 -0
  180. data/src/admin_panel/doc/app/lib/scgi_rb.html +54 -0
  181. data/src/admin_panel/doc/app/lib/yaml_writer_rb.html +52 -0
  182. data/src/admin_panel/doc/app/rdoc.css +763 -0
  183. data/src/admin_panel/lib/helper.rb +6 -2
  184. data/src/admin_panel/public/stylesheets/other/login.css +8 -4
  185. data/src/admin_panel/public/stylesheets/other/style.css +21 -17
  186. data/src/admin_panel/script/rails +6 -0
  187. data/src/admin_panel/test/test_helper.rb +2 -2
  188. data/src/admin_panel/vendor/plugins/calendar_date_select/History.txt +281 -0
  189. data/src/admin_panel/vendor/plugins/calendar_date_select/MIT-LICENSE +20 -0
  190. data/src/admin_panel/vendor/plugins/calendar_date_select/Manifest.txt +42 -0
  191. data/src/admin_panel/vendor/plugins/calendar_date_select/README.txt +17 -0
  192. data/src/admin_panel/vendor/plugins/calendar_date_select/Rakefile +37 -0
  193. data/src/admin_panel/vendor/plugins/calendar_date_select/VERSION +1 -0
  194. data/src/admin_panel/vendor/plugins/calendar_date_select/calendar_date_select.gemspec +95 -0
  195. data/src/admin_panel/vendor/plugins/calendar_date_select/init.rb +1 -0
  196. data/src/admin_panel/vendor/plugins/calendar_date_select/js_test/functional/cds_test.html +376 -0
  197. data/src/admin_panel/vendor/plugins/calendar_date_select/js_test/functional/format_iso_date_test.html +52 -0
  198. data/src/admin_panel/vendor/plugins/calendar_date_select/js_test/prototype.js +4184 -0
  199. data/src/admin_panel/vendor/plugins/calendar_date_select/js_test/test.css +40 -0
  200. data/src/admin_panel/vendor/plugins/calendar_date_select/js_test/unit/cds_helper_methods.html +46 -0
  201. data/src/admin_panel/vendor/plugins/calendar_date_select/js_test/unittest.js +564 -0
  202. data/src/admin_panel/vendor/plugins/calendar_date_select/lib/calendar_date_select.rb +33 -0
  203. data/src/admin_panel/vendor/plugins/calendar_date_select/lib/calendar_date_select/calendar_date_select.rb +122 -0
  204. data/src/admin_panel/vendor/plugins/calendar_date_select/lib/calendar_date_select/form_helpers.rb +237 -0
  205. data/src/admin_panel/vendor/plugins/calendar_date_select/lib/calendar_date_select/includes_helper.rb +29 -0
  206. data/src/admin_panel/vendor/plugins/calendar_date_select/public/blank_iframe.html +2 -0
  207. data/src/admin_panel/vendor/plugins/calendar_date_select/public/images/calendar_date_select/calendar.gif +0 -0
  208. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/calendar_date_select.js +459 -0
  209. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_american.js +35 -0
  210. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_danish.js +31 -0
  211. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_db.js +27 -0
  212. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
  213. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_euro_24hr_ymd.js +7 -0
  214. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_finnish.js +32 -0
  215. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_hyphen_ampm.js +37 -0
  216. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_iso_date.js +29 -0
  217. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_italian.js +24 -0
  218. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/ar.js +10 -0
  219. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/cs.js +11 -0
  220. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/da.js +11 -0
  221. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/de.js +11 -0
  222. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/es.js +11 -0
  223. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/fi.js +10 -0
  224. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/fr.js +11 -0
  225. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/hu.js +11 -0
  226. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/it.js +9 -0
  227. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/ja.js +11 -0
  228. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/nl.js +11 -0
  229. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/pl.js +11 -0
  230. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/pt.js +11 -0
  231. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/ru.js +10 -0
  232. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/sl.js +11 -0
  233. data/src/admin_panel/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/sv.js +9 -0
  234. data/src/admin_panel/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/blue.css +130 -0
  235. data/src/admin_panel/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/default.css +135 -0
  236. data/src/admin_panel/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/green.css +142 -0
  237. data/src/admin_panel/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/plain.css +128 -0
  238. data/src/admin_panel/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/red.css +135 -0
  239. data/src/admin_panel/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/silver.css +133 -0
  240. data/src/admin_panel/vendor/plugins/calendar_date_select/spec/calendar_date_select/calendar_date_select_spec.rb +14 -0
  241. data/src/admin_panel/vendor/plugins/calendar_date_select/spec/calendar_date_select/form_helpers_spec.rb +189 -0
  242. data/src/admin_panel/vendor/plugins/calendar_date_select/spec/calendar_date_select/includes_helper_spec.rb +46 -0
  243. data/src/admin_panel/vendor/plugins/calendar_date_select/spec/spec_helper.rb +26 -0
  244. data/src/admin_panel/vendor/plugins/open_flash_chart_2_plugin/install.rb +2 -2
  245. data/src/admin_panel/vendor/plugins/open_flash_chart_2_plugin/uninstall.rb +2 -2
  246. data/src/admin_panel/vendor/plugins/prototype_legacy_helper/README.markdown +13 -0
  247. data/src/admin_panel/vendor/plugins/prototype_legacy_helper/init.rb +1 -0
  248. data/src/admin_panel/vendor/plugins/prototype_legacy_helper/lib/prototype_legacy_helper.rb +432 -0
  249. data/src/admin_panel/vendor/plugins/prototype_legacy_helper/test/test_prototype_helper.rb +297 -0
  250. data/src/helper/wr_config.c +1 -1
  251. data/src/ruby_lib/analyzer/message_analyzer.rb +1 -0
  252. data/src/ruby_lib/analyzer/webroar_analyzer.rb +2 -2
  253. data/src/ruby_lib/profiler/message_dispatcher.rb +1 -1
  254. data/src/ruby_lib/ruby_interface/version.rb +2 -2
  255. data/src/ruby_lib/webroar_app_loader.rb +1 -1
  256. data/tasks/gem.rake +5 -7
  257. data/tasks/test.rake +1 -0
  258. data/test/spec/analytics_spec.rb +25 -24
  259. data/test/spec/test_app/README +142 -129
  260. data/test/spec/test_app/Rakefile +2 -5
  261. data/test/spec/test_app/app/controllers/application_controller.rb +3 -8
  262. data/test/spec/test_app/app/controllers/test_controller.rb +3 -3
  263. data/test/spec/test_app/app/controllers/users_controller.rb +8 -8
  264. data/test/spec/test_app/app/helpers/application_helper.rb +2 -1
  265. data/test/spec/test_app/app/helpers/test_helper.rb +2 -0
  266. data/test/spec/test_app/app/helpers/users_helper.rb +2 -0
  267. data/test/spec/test_app/app/models/user.rb +2 -0
  268. data/test/spec/test_app/app/views/layouts/{users.html.erb → application.html.erb} +6 -9
  269. data/test/spec/test_app/app/views/test/post_data.html.erb +2 -2
  270. data/test/spec/test_app/app/views/test/upload_file.html.erb +1 -1
  271. data/test/spec/test_app/{db/migrate/20090602102438_create_users.rb → app/views/users/_form.html.erb} +22 -11
  272. data/test/spec/test_app/app/views/users/edit.html.erb +19 -28
  273. data/test/spec/test_app/app/views/users/index.html.erb +23 -19
  274. data/test/spec/test_app/app/views/users/new.html.erb +19 -28
  275. data/test/spec/test_app/app/views/users/show.html.erb +21 -18
  276. data/test/spec/test_app/config/application.rb +45 -0
  277. data/test/spec/test_app/config/boot.rb +4 -112
  278. data/test/spec/test_app/config/database.yml +1 -1
  279. data/test/spec/test_app/config/environment.rb +4 -41
  280. data/test/spec/test_app/config/environments/development.rb +22 -13
  281. data/test/spec/test_app/config/environments/production.rb +41 -20
  282. data/test/spec/test_app/config/environments/test.rb +35 -28
  283. data/test/spec/test_app/config/initializers/backtrace_silencers.rb +2 -2
  284. data/test/spec/test_app/config/initializers/inflections.rb +1 -1
  285. data/test/spec/test_app/config/initializers/secret_token.rb +7 -0
  286. data/test/spec/test_app/config/initializers/session_store.rb +3 -10
  287. data/test/spec/test_app/config/locales/en.yml +5 -0
  288. data/test/spec/test_app/config/routes.rb +37 -22
  289. data/test/spec/test_app/db/migrate/20110906113329_create_users.rb +13 -0
  290. data/test/spec/test_app/db/seeds.rb +7 -0
  291. data/test/spec/test_app/public/404.html +15 -19
  292. data/test/spec/test_app/public/422.html +15 -19
  293. data/test/spec/test_app/public/500.html +14 -18
  294. data/test/spec/test_app/public/index.html +41 -77
  295. data/test/spec/test_app/public/javascripts/controls.js +5 -3
  296. data/test/spec/test_app/public/javascripts/dragdrop.js +7 -6
  297. data/test/spec/test_app/public/javascripts/effects.js +8 -13
  298. data/test/spec/test_app/public/javascripts/prototype.js +3381 -1700
  299. data/test/spec/test_app/public/javascripts/rails.js +191 -0
  300. data/test/spec/test_app/public/stylesheets/scaffold.css +15 -13
  301. data/test/spec/test_app/script/rails +6 -0
  302. metadata +340 -163
  303. data/src/admin_panel/Gemfile.lock +0 -79
  304. data/src/admin_panel/doc/app/classes/ActionView.html +0 -111
  305. data/src/admin_panel/doc/app/classes/ActionView/Helpers.html +0 -111
  306. data/src/admin_panel/doc/app/classes/ActionView/Helpers/AssetTagHelper.html +0 -149
  307. data/src/admin_panel/doc/app/classes/AdminController.html +0 -628
  308. data/src/admin_panel/doc/app/classes/AdminHelper.html +0 -482
  309. data/src/admin_panel/doc/app/classes/Analytics.html +0 -138
  310. data/src/admin_panel/doc/app/classes/Analytics/Database.html +0 -245
  311. data/src/admin_panel/doc/app/classes/Analytics/ResourceUsage.html +0 -478
  312. data/src/admin_panel/doc/app/classes/Analytics/Throughput.html +0 -316
  313. data/src/admin_panel/doc/app/classes/Analytics/Url.html +0 -314
  314. data/src/admin_panel/doc/app/classes/Analytics/UrlBreakup.html +0 -372
  315. data/src/admin_panel/doc/app/classes/App.html +0 -298
  316. data/src/admin_panel/doc/app/classes/AppException.html +0 -330
  317. data/src/admin_panel/doc/app/classes/AppTimeSample.html +0 -427
  318. data/src/admin_panel/doc/app/classes/ApplicationController.html +0 -118
  319. data/src/admin_panel/doc/app/classes/ApplicationHelper.html +0 -172
  320. data/src/admin_panel/doc/app/classes/ApplicationSpecification.html +0 -641
  321. data/src/admin_panel/doc/app/classes/ApplicationSpecificationController.html +0 -354
  322. data/src/admin_panel/doc/app/classes/Control.html +0 -273
  323. data/src/admin_panel/doc/app/classes/ExceptionsController.html +0 -612
  324. data/src/admin_panel/doc/app/classes/ExceptionsHelper.html +0 -105
  325. data/src/admin_panel/doc/app/classes/GraphController.html +0 -804
  326. data/src/admin_panel/doc/app/classes/GraphHelper.html +0 -164
  327. data/src/admin_panel/doc/app/classes/MailSpecification.html +0 -357
  328. data/src/admin_panel/doc/app/classes/MailSpecificationController.html +0 -304
  329. data/src/admin_panel/doc/app/classes/PseudoModel.html +0 -206
  330. data/src/admin_panel/doc/app/classes/ResourceUsage.html +0 -425
  331. data/src/admin_panel/doc/app/classes/SCGI.html +0 -406
  332. data/src/admin_panel/doc/app/classes/ServerSpecification.html +0 -325
  333. data/src/admin_panel/doc/app/classes/ServerSpecificationController.html +0 -273
  334. data/src/admin_panel/doc/app/classes/UrlBreakupTimeSample.html +0 -169
  335. data/src/admin_panel/doc/app/classes/UrlTimeSample.html +0 -708
  336. data/src/admin_panel/doc/app/classes/User.html +0 -165
  337. data/src/admin_panel/doc/app/classes/YAMLWriter.html +0 -159
  338. data/src/admin_panel/doc/app/files/app/controllers/admin_controller_rb.html +0 -101
  339. data/src/admin_panel/doc/app/files/app/controllers/application_controller_rb.html +0 -108
  340. data/src/admin_panel/doc/app/files/app/controllers/application_specification_controller_rb.html +0 -101
  341. data/src/admin_panel/doc/app/files/app/controllers/exceptions_controller_rb.html +0 -101
  342. data/src/admin_panel/doc/app/files/app/controllers/graph_controller_rb.html +0 -101
  343. data/src/admin_panel/doc/app/files/app/controllers/mail_specification_controller_rb.html +0 -101
  344. data/src/admin_panel/doc/app/files/app/controllers/server_specification_controller_rb.html +0 -101
  345. data/src/admin_panel/doc/app/files/app/helpers/admin_helper_rb.html +0 -101
  346. data/src/admin_panel/doc/app/files/app/helpers/application_helper_rb.html +0 -101
  347. data/src/admin_panel/doc/app/files/app/helpers/exceptions_helper_rb.html +0 -101
  348. data/src/admin_panel/doc/app/files/app/helpers/graph_helper_rb.html +0 -101
  349. data/src/admin_panel/doc/app/files/app/models/app_exception_rb.html +0 -101
  350. data/src/admin_panel/doc/app/files/app/models/app_rb.html +0 -108
  351. data/src/admin_panel/doc/app/files/app/models/app_time_sample_rb.html +0 -101
  352. data/src/admin_panel/doc/app/files/app/models/application_specification_rb.html +0 -101
  353. data/src/admin_panel/doc/app/files/app/models/mail_specification_rb.html +0 -101
  354. data/src/admin_panel/doc/app/files/app/models/pseudo_model_rb.html +0 -101
  355. data/src/admin_panel/doc/app/files/app/models/resource_usage_rb.html +0 -101
  356. data/src/admin_panel/doc/app/files/app/models/server_specification_rb.html +0 -101
  357. data/src/admin_panel/doc/app/files/app/models/url_breakup_time_sample_rb.html +0 -101
  358. data/src/admin_panel/doc/app/files/app/models/url_time_sample_rb.html +0 -101
  359. data/src/admin_panel/doc/app/files/app/models/user_rb.html +0 -101
  360. data/src/admin_panel/doc/app/files/doc/README_FOR_APP.html +0 -109
  361. data/src/admin_panel/doc/app/files/lib/asset_tag_helper_ext_rb.html +0 -101
  362. data/src/admin_panel/doc/app/files/lib/control_rb.html +0 -110
  363. data/src/admin_panel/doc/app/files/lib/graph_controller_extensions/database_analytics_rb.html +0 -101
  364. data/src/admin_panel/doc/app/files/lib/graph_controller_extensions/resource_usage_analytics_rb.html +0 -101
  365. data/src/admin_panel/doc/app/files/lib/graph_controller_extensions/throughput_analytics_rb.html +0 -101
  366. data/src/admin_panel/doc/app/files/lib/graph_controller_extensions/url_analytics_rb.html +0 -101
  367. data/src/admin_panel/doc/app/files/lib/graph_controller_extensions/url_breakup_analytics_rb.html +0 -101
  368. data/src/admin_panel/doc/app/files/lib/scgi_rb.html +0 -101
  369. data/src/admin_panel/doc/app/files/lib/yaml_writer_rb.html +0 -101
  370. data/src/admin_panel/doc/app/fr_class_index.html +0 -60
  371. data/src/admin_panel/doc/app/fr_file_index.html +0 -58
  372. data/src/admin_panel/doc/app/fr_method_index.html +0 -206
  373. data/src/admin_panel/doc/app/rdoc-style.css +0 -208
  374. data/src/admin_panel/public/dispatch.cgi +0 -10
  375. data/src/admin_panel/public/dispatch.fcgi +0 -24
  376. data/src/admin_panel/public/dispatch.rb +0 -10
  377. data/src/admin_panel/script/about +0 -4
  378. data/src/admin_panel/script/console +0 -3
  379. data/src/admin_panel/script/dbconsole +0 -3
  380. data/src/admin_panel/script/destroy +0 -3
  381. data/src/admin_panel/script/generate +0 -3
  382. data/src/admin_panel/script/performance/benchmarker +0 -3
  383. data/src/admin_panel/script/performance/profiler +0 -3
  384. data/src/admin_panel/script/performance/request +0 -3
  385. data/src/admin_panel/script/plugin +0 -3
  386. data/src/admin_panel/script/process/inspector +0 -3
  387. data/src/admin_panel/script/process/reaper +0 -3
  388. data/src/admin_panel/script/process/spawner +0 -3
  389. data/src/admin_panel/script/runner +0 -3
  390. data/src/admin_panel/script/server +0 -3
  391. data/test/spec/test_app/config/initializers/new_rails_defaults.rb +0 -19
  392. data/test/spec/test_app/script/about +0 -4
  393. data/test/spec/test_app/script/console +0 -3
  394. data/test/spec/test_app/script/dbconsole +0 -3
  395. data/test/spec/test_app/script/destroy +0 -3
  396. data/test/spec/test_app/script/generate +0 -3
  397. data/test/spec/test_app/script/performance/benchmarker +0 -3
  398. data/test/spec/test_app/script/performance/profiler +0 -3
  399. data/test/spec/test_app/script/plugin +0 -3
  400. data/test/spec/test_app/script/runner +0 -3
  401. data/test/spec/test_app/script/server +0 -3
  402. data/test/spec/test_app/vendor/.placeholder +0 -0
@@ -19,7 +19,7 @@
19
19
  #++
20
20
 
21
21
  unless defined?ActionMailer
22
- gem 'actionmailer', '2.3.9'
22
+ gem 'actionmailer', '3.0.9'
23
23
  require 'action_mailer'
24
24
  require 'uri'
25
25
  end
@@ -68,10 +68,7 @@ class Mailer < ActionMailer::Base
68
68
 
69
69
  # This method is to deliver the email to recipients
70
70
  def send_email(subject,body,from,recipients)
71
- @subject = subject
72
- @from = from
73
- @recipients = recipients
74
- @body = body
71
+ mail(:to => recipients,:from => from,:subject => subject,:body => body)
75
72
  end
76
73
 
77
74
  # This method is used to send exception notification to the recipients
@@ -89,7 +86,7 @@ class Mailer < ActionMailer::Base
89
86
  body << "#{key.to_s.upcase} : #{value}\n"
90
87
  end
91
88
  begin
92
- deliver_send_email(subject,body,from,recipients)
89
+ send_email(subject,body,from,recipients).deliver
93
90
  rescue Exception => e
94
91
  e
95
92
  end
@@ -137,7 +134,7 @@ class Mailer < ActionMailer::Base
137
134
  body = "#{report_bug[:description]}\n\n"
138
135
  body << "Name : #{report_bug[:name]}\nEmail Address : #{report_bug[:email]}\n"
139
136
  begin
140
- deliver_send_email(subject,body,from,"support@webroar.in")
137
+ send_email(subject,body,from,"support@webroar.in").deliver
141
138
  "<span style='color:green;'>Thank You for reporting the issue, We'll contact you shortly.</span>"
142
139
  rescue Exception => exception
143
140
  return self.parse_exception(exception),''
@@ -152,7 +149,7 @@ class Mailer < ActionMailer::Base
152
149
  body = "#{feedback[:message]}\n\n"
153
150
  body << "User Name : #{feedback[:name]}\nEmail Address : #{feedback[:email]}\n"
154
151
  begin
155
- deliver_send_email(subject,body,from,"support@webroar.in")
152
+ send_email(subject,body,from,"support@webroar.in").deliver
156
153
  "<span style='color:green;'>Thank you for your valuable feedback!</span>"
157
154
  rescue Exception => exception
158
155
  return self.parse_exception(exception),''
@@ -32,7 +32,7 @@ class App < ActiveRecord::Base
32
32
  #This method is used to get the application data.
33
33
  #It needs name of the application as an input.
34
34
  def get_application_data(name)
35
- app = find(:first, :conditions => ['name = ?', name])
35
+ app = where(:name => name).first
36
36
  return app
37
37
  end
38
38
 
@@ -27,24 +27,25 @@ class AppException < ActiveRecord::Base
27
27
  class << self
28
28
  #Gives the array of the five (open|closed|ignored) exceptions starting from the value of varriable 'start' for an application.
29
29
  def get_all(exception_status, app_id, page = 1, per_page = 5)
30
- paginate(:conditions => ['app_id = ? and exception_status = ?', app_id, exception_status],
31
- # :include => [:latest_detail], # found bug with eager loading, its fetching all the associated records
32
- :page => page, :per_page => per_page)
30
+ where(:app_id => app_id,
31
+ :exception_status => exception_status
32
+ ).paginate(:page => page,
33
+ :per_page => per_page)
33
34
  end
34
35
 
35
36
  # Take App.id as argument and returns count of distinct open exceptions for an Application
36
37
  def count_open(app_id)
37
- count(:exception_message, :conditions => {:app_id => app_id, :exception_status => OPEN_EXCEPTION})
38
+ where(:app_id => app_id, :exception_status => OPEN_EXCEPTION).count
38
39
  end
39
40
 
40
41
  # Take App.id as argument and returns count of distinct closed exceptions for an Application
41
42
  def count_closed(app_id)
42
- count(:exception_message, :conditions => {:app_id => app_id, :exception_status => CLOSED_EXCEPTION})
43
+ where(:app_id => app_id, :exception_status => CLOSED_EXCEPTION).count
43
44
  end
44
45
 
45
46
  # Take App.id as argument and returns count of distinct ignored exceptions for an Application
46
47
  def count_ignored(app_id)
47
- count(:exception_message, :conditions => {:app_id => app_id, :exception_status => IGNORED_EXCEPTION})
48
+ where(:app_id => app_id, :exception_status => IGNORED_EXCEPTION).count
48
49
  end
49
50
 
50
51
  # Update all exceptions status for given exceptions id array
@@ -99,7 +100,7 @@ class AppException < ActiveRecord::Base
99
100
 
100
101
  # TODO Change function to fetch all exception records if we require all exception fields instead of id only
101
102
  def get_exceptions_by_class(app_id,exception_class)
102
- find(:all,:select => :id,:conditions=>["app_id = ? and exception_class = ?",app_id, exception_class])
103
+ where(:app_id => app_id, :exception_class => exception_class).select(:id)
103
104
  end
104
105
 
105
106
  # This method is used to change status of exceptions by searching the exception with exception_class
@@ -112,10 +113,13 @@ class AppException < ActiveRecord::Base
112
113
 
113
114
  # This function is used to fetch the first exception record for the given exception_message pattern ,
114
115
  # exception_class, exception_details.controller , exception_details.method and app_id
115
- def get_exception_for_analyzer(exception_hash,app_id)
116
- AppException.find(:first,:conditions => ["exception_message like ? and exception_class = ? and controller = ? and method = ? and app_id = ?" ,
117
- exception_hash[:exception_message].split(EXCEPTION_MESSAGE_SPLITER)[0] + "%",exception_hash[:exception_class],
118
- exception_hash[:controller],exception_hash[:method],app_id])
116
+ def get_exception_for_analyzer(exception_hash, app_id)
117
+ where("exception_message like ? and exception_class = ? and controller = ? and method = ? and app_id = ?",
118
+ exception_hash[:exception_message].split(EXCEPTION_MESSAGE_SPLITER)[0] + '%',
119
+ exception_hash[:exception_class],
120
+ exception_hash[:controller],
121
+ exception_hash[:method],
122
+ app_id).first
119
123
  end
120
124
  end
121
125
  end
@@ -34,23 +34,43 @@ class AppTimeSample < ActiveRecord::Base
34
34
  interval = ((end_time-start_time) / 60).to_i
35
35
  final_data = Array.new(interval)
36
36
  wall_time = Array.new(interval)
37
- application_samples = find(:all, :select => 'wall_time, sum(db_time) as db_time,sum(total_time_in_request) as total_time_in_request, sum(number_of_requests) as number_of_requests , avg(avg_response_time) as avg_avg_response_time, avg(peak_requests_served) as avg_peak_requests_served', :conditions => ['app_id = ? and wall_time >= ? and wall_time < ?', app_id, start_time, end_time], :group => 'wall_time')
38
- application_samples.each do |application_sample|
39
- current_time = Time.local(application_sample.wall_time.year, application_sample.wall_time.month, application_sample.wall_time.day, application_sample.wall_time.hour, application_sample.wall_time.min, '0')
37
+ application_samples = select('wall_time,
38
+ sum(db_time) as db_time,
39
+ sum(total_time_in_request) as total_time_in_request,
40
+ sum(number_of_requests) as number_of_requests ,
41
+ avg(avg_response_time) as avg_avg_response_time,
42
+ avg(peak_requests_served) as avg_peak_requests_served'
43
+ ).where('app_id = ? and
44
+ wall_time >= ? and
45
+ wall_time < ?',
46
+ app_id,
47
+ start_time.strftime('%Y-%m-%d %H:%M:%S'),
48
+ end_time.strftime('%Y-%m-%d %H:%M:%S')
49
+ ).group(:wall_time)
50
+
51
+ application_samples.each do |application_sample|
52
+ current_time = Time.local(application_sample.wall_time.year,
53
+ application_sample.wall_time.month,
54
+ application_sample.wall_time.day,
55
+ application_sample.wall_time.hour,
56
+ application_sample.wall_time.min,
57
+ '0')
40
58
  db_time_data = 0
41
59
  total_time_in_request = 0
42
60
  total_requests = 0
43
61
  total_data = 0
44
62
  index = (current_time-start_time) / 60
45
63
  total_time_in_request = application_sample.total_time_in_request.to_f
46
- if type == "db"
64
+ case type
65
+ when 'db'
47
66
  db_time_data = application_sample.db_time.to_f
48
67
  total_data = (db_time_data.to_f * 100 / total_time_in_request.to_f).to_f
49
- elsif type == "averageresponsetime"
68
+ when 'averageresponsetime'
50
69
  total_data = application_sample.avg_avg_response_time.to_f
51
- elsif type == "throughput"
70
+ when 'throughput'
52
71
  total_data = application_sample.avg_peak_requests_served.to_f
53
72
  end
73
+
54
74
  if max < total_data
55
75
  max = total_data.to_i
56
76
  end
@@ -97,7 +117,15 @@ class AppTimeSample < ActiveRecord::Base
97
117
  end
98
118
  # puts 'creating'
99
119
  with_exception_handling("Application sample creation for application #{app_id}, wall_time #{wall_time}") do
100
- create({:app_id => app_id, :total_time_in_request => sample[0], :db_time => sample[1], :rendering_time => sample[2], :number_of_requests => sample[3], :wall_time => wall_time, :sampling_rate => sampling_rate, :avg_response_time => art, :peak_requests_served => prs})
120
+ create({:app_id => app_id,
121
+ :total_time_in_request => sample[0],
122
+ :db_time => sample[1],
123
+ :rendering_time => sample[2],
124
+ :number_of_requests => sample[3],
125
+ :wall_time => wall_time,
126
+ :sampling_rate => sampling_rate,
127
+ :avg_response_time => art,
128
+ :peak_requests_served => prs})
101
129
  end
102
130
  end
103
131
  # application_samples contains at the most one sample and that is for current sampling period.
@@ -118,18 +146,20 @@ class AppTimeSample < ActiveRecord::Base
118
146
  sample[4][wall_time.sec] = (sample[4][wall_time.sec] || 0 ) + 1
119
147
  message_analyzer.application_samples[app_id][1] = sample
120
148
  elsif wall_time < message_analyzer.application_samples[app_id].first
121
- db_sample = find(:first, :conditions => ["app_id = ? and wall_time >= ? and wall_time <= ?",app_id, wall_time, wall_time + message_analyzer.sampling_rate])
149
+ db_sample = where('app_id = ? and
150
+ wall_time >= ? and wall_time <= ?',
151
+ app_id,
152
+ wall_time, wall_time + message_analyzer.sampling_rate
153
+ ).first
122
154
  if db_sample
123
155
  db_sample.total_time_in_request += total_spent_time
124
156
  db_sample.db_time += db_time
125
157
  db_sample.rendering_time += rendering_time
126
158
  db_sample.number_of_requests += 1
127
- #db_sample.avg_response_time += (total_spent_time / resource_analyzer.worker_count(app_id))
128
159
  db_sample.save! rescue nil
129
160
  else
130
161
  wall_time += message_analyzer.sampling_rate
131
162
  create_sample(app_id, [total_spent_time, db_time, rendering_time, 1, [1]], message_analyzer.sampling_rate, wall_time)
132
- #create({:app_id => app_id, :total_time_in_request => total_spent_time, :db_time => db_time, :rendering_time => rendering_time, :number_of_requests => 1, :wall_time => wall_time, :sampling_rate => message_analyzer.sampling_rate, :avg_response_time => 1000, :peak_requests_served => 1 })
133
163
  end
134
164
  elsif wall_time > message_analyzer.application_samples[app_id].first + message_analyzer.sampling_rate
135
165
  o_wall_time = message_analyzer.application_samples[app_id].first + message_analyzer.sampling_rate
@@ -17,8 +17,7 @@
17
17
  # You should have received a copy of the GNU General Public License
18
18
  # along with WebROaR. If not, see <http://www.gnu.org/licenses/>.
19
19
  #++
20
-
21
- require File.join(RAILS_ROOT, "lib", "helper.rb")
20
+ require File.join(File.expand_path('../../../' ,__FILE__), 'lib', 'helper')
22
21
 
23
22
  class ApplicationSpecification < PseudoModel
24
23
  column :app_id, :string
@@ -31,17 +30,39 @@ class ApplicationSpecification < PseudoModel
31
30
  column :type1, :string
32
31
  column :analytics, :string
33
32
  column :environment, :string
34
- column :min_worker, :number
35
- column :max_worker, :number
36
- validates_presence_of :name, :resolver, :path, :run_as_user, :type1, :environment
37
- validates_numericality_of :min_worker, :max_worker, :greater_than_or_equal_to => 1, :less_than_or_equal_to => ALLOWED_MAX_WORKERS
38
- validates_format_of :name, :with => /^[A-Za-z0-9_\-]*$/i, :message => " must consist of A-Z, a-z, 0-9 , _ , - and /."
33
+ column :min_worker, :number
34
+ column :max_worker, :number
35
+
36
+ validates :name, :presence => true,
37
+ :format => { :with => /^[A-Za-z0-9_\-]*$/i, :message => " must consist of A-Z, a-z, 0-9 , _ , - and /."},
38
+ :length => { :maximum => 30 },
39
+ :allow_nil => true
40
+ validates :resolver, :presence => true
41
+ validates :path, :presence => true
42
+ validates :run_as_user, :presence => true,
43
+ :length => { :maximum => 30 },
44
+ :allow_nil => true
45
+ validates :type1, :presence => true
46
+ validates :environment, :presence => true,
47
+ :length => { :maximum => 30 },
48
+ :allow_nil => true
49
+ validates :min_worker, :numericality => true,
50
+ :inclusion => { :in => 0..ALLOWED_MAX_WORKERS }
51
+ validates :max_worker, :numericality => true,
52
+ :inclusion => { :in => 0..ALLOWED_MAX_WORKERS }
53
+
54
+ validate :ensure_validations
55
+
56
+ #validates_presence_of :name, :resolver, :path, :run_as_user, :type1, :environment
57
+ #validates_numericality_of :min_worker, :max_worker, :greater_than_or_equal_to => 1, :less_than_or_equal_to => ALLOWED_MAX_WORKERS
58
+ #validates_format_of :name, :with => /^[A-Za-z0-9_\-]*$/i, :message => " must consist of A-Z, a-z, 0-9 , _ , - and /."
39
59
  # validates_format_of :path, :with => /^\/.*$/i, :message => "entered is not the complete path for your web application root directory."
40
- validates_length_of :name, :maximum => 30, :allow_nil => true
60
+ #validates_length_of :name, :maximum => 30, :allow_nil => true
41
61
  #validates_length_of :path, :maximum => 256
42
- validates_length_of :run_as_user, :maximum => 30, :allow_nil => true
43
- validates_length_of :environment, :maximum => 30, :allow_nil => true
62
+ #validates_length_of :run_as_user, :maximum => 30, :allow_nil => true
63
+ #validates_length_of :environment, :maximum => 30, :allow_nil => true
44
64
  # validates_format_of :baseuri, :with => /^\/[A-Za-z0-9_\-\/]*$/i, :message => "must start with '/' and contains characters A-Z, a-z, 0-9 , _ , - and /."
65
+
45
66
  def write
46
67
 
47
68
  info = YAML::load_file(CONFIG_FILE_PATH) rescue nil
@@ -69,7 +90,7 @@ class ApplicationSpecification < PseudoModel
69
90
  info.delete('Application Specification') if info['Application Specification'].length == 0
70
91
  end
71
92
 
72
- app = App.find(:first, :conditions=>["name = ?", app_name])
93
+ app = App.where(:name => app_name).first
73
94
  app.destroy if app
74
95
  SignalHelper.send
75
96
 
@@ -82,9 +103,17 @@ class ApplicationSpecification < PseudoModel
82
103
 
83
104
  #Converting ApplicationSpecification obeject into a Hash.
84
105
  def obj_to_hash
85
- app = Hash["name" => name, "path" => path, "run_as_user" => run_as_user.downcase, "type" => type1.downcase, "analytics" => analytics.to_s.downcase, "environment" => environment.downcase, "min_worker" => min_worker.to_i, "max_worker" => max_worker.to_i]
86
- app["baseuri"] = baseuri.strip if baseuri
87
- app["host_names"] = host_names if host_names
106
+ app = {}
107
+ app['name'] = name
108
+ app['path'] = path
109
+ app['run_as_user'] = run_as_user.downcase unless run_as_user.nil?
110
+ app['type'] = type1.downcase unless type1.nil?
111
+ app['analytics'] = analytics.downcase unless analytics.nil?
112
+ app['environment'] = environment.downcase unless environment.nil?
113
+ app['min_worker'] = min_worker.to_i
114
+ app['max_worker'] = max_worker.to_i
115
+ app['baseuri'] = baseuri.strip if baseuri
116
+ app['host_names'] = host_names if host_names
88
117
  return app
89
118
  end
90
119
 
@@ -99,26 +128,27 @@ class ApplicationSpecification < PseudoModel
99
128
  end
100
129
 
101
130
  #this method is used to validate the various fields of the apps model.
102
- def validate
103
- # errors.add_to_base MIN_WORKERS_VALIDATION if min_worker.to_i > 20
131
+ #def validate
132
+ def ensure_validations
133
+ # errors.add(:base, MIN_WORKERS_VALIDATION) if min_worker.to_i > 20
104
134
  if max_worker.to_i < min_worker.to_i
105
- errors.add_to_base MAX_WORKERS_VALIDATION_1
135
+ errors.add(:base, MAX_WORKERS_VALIDATION_1)
106
136
  # elsif max_worker.to_i > 20
107
137
  # errors.add_to_base MAX_WORKERS_VALIDATION_2
108
138
  end
109
139
  #errors.add_to_base APPLICATION_PATH_EXISTANCE_VALIDATION if !File.directory?(path)
110
- errors.add_to_base ANALYTICS_VALIDATION if type1=="Rails" and !(analytics.downcase == "enabled" or analytics.downcase == "disabled")
140
+ errors.add(:base, ANALYTICS_VALIDATION) if type1 and type1=="Rails" and analytics and !(analytics.downcase == "enabled" or analytics.downcase == "disabled")
111
141
  #errors.add_to_base ENVIRONMENT_VALIDATION if !(environment.downcase == "production" or environment.downcase == "development" or environment.downcase == "test")
112
- errors.add_to_base TYPE_VALIDATION if !(type1.downcase == RAILS or type1.downcase == RACK)
142
+ errors.add(:base, TYPE_VALIDATION) if type1 and !(type1.downcase == RAILS or type1.downcase == RACK)
113
143
  if path and type1
114
144
  if type1.downcase == RAILS
115
145
  unless File.exists?(File.join(path, 'config', 'environment.rb'))
116
- errors.add_to_base "The entered application path is not a valid Rails application path."
146
+ errors.add(:base, "The entered application path is not a valid Rails application path.")
117
147
  end
118
148
  end
119
149
  if type1.downcase == RACK
120
150
  unless File.exists?(File.join(path, 'config.ru'))
121
- errors.add_to_base "The entered application path is not a valid Rack application path."
151
+ errors.add(:base, "The entered application path is not a valid Rack application path.")
122
152
  end
123
153
  end
124
154
  end
@@ -132,7 +162,7 @@ class ApplicationSpecification < PseudoModel
132
162
 
133
163
  if (tokens.size == 1 and tokens[0].start_with?('/'))
134
164
  write_attribute(:baseuri, resolver)
135
- errors.add_to_base "BaseURI must start with '/' and contains characters A-Z, a-z, 0-9 , _ , - and /." if !(baseuri.strip =~ /^\/[A-Za-z0-9_\-\/]*$/i)
165
+ errors.add(:base, "BaseURI must start with '/' and contains characters A-Z, a-z, 0-9 , _ , - and /.") if !(baseuri.strip =~ /^\/[A-Za-z0-9_\-\/]*$/i)
136
166
  else
137
167
  write_attribute(:host_names, resolver)
138
168
  host_name_flag = 1
@@ -145,38 +175,38 @@ class ApplicationSpecification < PseudoModel
145
175
  len = token.size
146
176
  # Whole name can not exceed total length of 253
147
177
  if len > 253
148
- errors.add_to_base HOSTNAME_LENGTH_EXCEEDS
178
+ errors.add(:base , HOSTNAME_LENGTH_EXCEEDS)
149
179
  next
150
180
  end
151
181
  # Subdivision can go down to maximum 127 level.
152
182
  labels = token.split(/\./)
153
183
  if labels.size > 127
154
- errors.add_to_base SUBDIVISION_EXCEEDS_127
184
+ errors.add(:base, SUBDIVISION_EXCEEDS_127)
155
185
  next
156
186
  end
157
187
  # Start with '/' indicates BaseURI
158
188
  if token.start_with?('/')
159
- errors.add_to_base BASEURI_AND_HOSTNAMES_EXIST
189
+ errors.add(:base, BASEURI_AND_HOSTNAMES_EXIST)
160
190
  break
161
191
  end
162
192
  # If wildcard '*' presents, Hostname should prefix with '~'
163
193
  if token.include?("*") and !(token =~ /^~/)
164
- errors.add_to_base "#{token} - #{START_WTIH_TILD}"
194
+ errors.add(:base, "#{token} - #{START_WTIH_TILD}")
165
195
  next
166
196
  end
167
197
  # Wildcard '*' can come either at start or at end, not inbetween
168
198
  pos = token.index('*', 1)
169
199
  if pos and pos != 1 and pos != len-1
170
- errors.add_to_base "#{token} - #{WILDCARD_AT_START_OR_END}"
200
+ errors.add(:base, "#{token} - #{WILDCARD_AT_START_OR_END}")
171
201
  next
172
202
  end
173
203
  pos = token.index('*', 2)
174
204
  if pos and pos != len - 1
175
- errors.add_to_base "#{token} - #{WILDCARD_AT_START_OR_END}"
205
+ errors.add(:base, "#{token} - #{WILDCARD_AT_START_OR_END}")
176
206
  next
177
207
  end
178
208
  if token =~ /[.][.]/
179
- errors.add_to_base "#{token} - #{CONSECUTIVE_DOTS}"
209
+ errors.add(:base, "#{token} - #{CONSECUTIVE_DOTS}")
180
210
  next
181
211
  end
182
212
  # Check for Letters, Digits and Hyphen
@@ -187,14 +217,14 @@ class ApplicationSpecification < PseudoModel
187
217
  labels = labels[1..labels.size - 2]
188
218
  labels.each do |label|
189
219
  if label.size > 63
190
- errors.add_to_base LABEL_LENGTH_EXCEEDS
220
+ errors.add(:base, LABEL_LENGTH_EXCEEDS)
191
221
  next
192
222
  end
193
223
  label.each_char do |c|
194
224
  if (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '-'
195
225
  next
196
226
  else
197
- errors.add_to_base HOSTNAME_LDH
227
+ errors.add(:base, HOSTNAME_LDH)
198
228
  err_flag = 1
199
229
  break;
200
230
  end
@@ -210,7 +240,7 @@ class ApplicationSpecification < PseudoModel
210
240
  c = char_array[0]
211
241
  if (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '~'
212
242
  else
213
- errors.add_to_base HOSTNAME_LDH
243
+ errors.add(:base, HOSTNAME_LDH)
214
244
  err_flag = 1
215
245
  end
216
246
  end
@@ -219,7 +249,7 @@ class ApplicationSpecification < PseudoModel
219
249
  c = char_array[1]
220
250
  if (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '*'
221
251
  else
222
- errors.add_to_base HOSTNAME_LDH
252
+ errors.add(:base, HOSTNAME_LDH)
223
253
  err_flag = 1
224
254
  end
225
255
  end
@@ -230,7 +260,7 @@ class ApplicationSpecification < PseudoModel
230
260
  if (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '-'
231
261
  next
232
262
  else
233
- errors.add_to_base HOSTNAME_LDH
263
+ errors.add(:base, HOSTNAME_LDH)
234
264
  err_flag = 1
235
265
  break;
236
266
  end
@@ -245,7 +275,7 @@ class ApplicationSpecification < PseudoModel
245
275
  c = char_array[char_array.size - 1]
246
276
  if (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '*'
247
277
  else
248
- errors.add_to_base HOSTNAME_LDH
278
+ errors.add(:base, HOSTNAME_LDH)
249
279
  err_flag = 1
250
280
  end
251
281
  end
@@ -255,7 +285,7 @@ class ApplicationSpecification < PseudoModel
255
285
  char_array.each do |c|
256
286
  if (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '*'
257
287
  else
258
- errors.add_to_base HOSTNAME_LDH
288
+ errors.add(:base, HOSTNAME_LDH)
259
289
  err_flag = 1
260
290
  end
261
291
  end
@@ -267,7 +297,7 @@ class ApplicationSpecification < PseudoModel
267
297
  end
268
298
 
269
299
  #BaseURI can not be /admin-panel
270
- errors.add_to_base BASEURI_AS_ADMIN_PANEL_BASEURI_VALIDATION if baseuri and baseuri.strip == ADMIN_PANEL_BASE_URI
300
+ errors.add(:base, BASEURI_AS_ADMIN_PANEL_BASEURI_VALIDATION) if baseuri and baseuri.strip == ADMIN_PANEL_BASE_URI
271
301
  all_host_names = []
272
302
  curr_host_names_size = curr_host_names.size
273
303
 
@@ -278,8 +308,8 @@ class ApplicationSpecification < PseudoModel
278
308
  if info and info['Application Specification']
279
309
  i = 0
280
310
  info['Application Specification'].each do |app_info|
281
- errors.add_to_base "#{name} - #{APPLICATION_NAME_REPEATED}" if app_info['name'] == name and tmp_id != i
282
- errors.add_to_base BASEURI_EXISTANCE_VALIDATION if baseuri and baseuri.strip and app_info['baseuri'] == baseuri.strip and tmp_id != i
311
+ errors.add(:base, "#{name} - #{APPLICATION_NAME_REPEATED}") if app_info['name'] == name and tmp_id != i
312
+ errors.add(:base, BASEURI_EXISTANCE_VALIDATION) if baseuri and baseuri.strip and app_info['baseuri'] == baseuri.strip and tmp_id != i
283
313
  all_host_names << app_info['host_names'].split(/ /) if app_info['host_names'] and curr_host_names_size > 0 and tmp_id != i
284
314
  i += 1
285
315
  end
@@ -287,12 +317,12 @@ class ApplicationSpecification < PseudoModel
287
317
  all_host_names.flatten!
288
318
  # checking uniqueness of Hostnames
289
319
  if curr_host_names_size > 0
290
- errors.add_to_base HOSTNAME_REPEATED if curr_host_names_size != curr_host_names.uniq.size
320
+ errors.add(:base, HOSTNAME_REPEATED) if curr_host_names_size != curr_host_names.uniq.size
291
321
  if all_host_names.size > 0
292
322
  curr_host_names.each do |c_host_name|
293
323
  all_host_names.each do |host_name|
294
324
  if c_host_name.eql?(host_name)
295
- errors.add_to_base "#{c_host_name}-#{HOSTNAME_REPEATED }"
325
+ errors.add(:base, "#{c_host_name}-#{HOSTNAME_REPEATED }")
296
326
  break
297
327
  end
298
328
  end