ensnare 0.1beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (341) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +10 -0
  3. data/README.md +77 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/javascripts/application.js +10 -0
  6. data/app/assets/javascripts/ensnare/ZeroClipboard.js +474 -0
  7. data/app/assets/javascripts/ensnare/ZeroClipboard.min.js +9 -0
  8. data/app/assets/javascripts/ensnare/ZeroClipboard.swf +0 -0
  9. data/app/assets/javascripts/ensnare/application.js +20 -0
  10. data/app/assets/javascripts/ensnare/bootstrap-switch.js +382 -0
  11. data/app/assets/javascripts/ensnare/bootstrap_and_overrides.js +4 -0
  12. data/app/assets/javascripts/ensnare/clippy.js +18 -0
  13. data/app/assets/javascripts/ensnare/config_switch.js +19 -0
  14. data/app/assets/javascripts/ensnare/on_handler.js +9 -0
  15. data/app/assets/stylesheets/application.css +7 -0
  16. data/app/assets/stylesheets/bootstrap_and_overrides.css.less +30 -0
  17. data/app/assets/stylesheets/ensnare/application.css +13 -0
  18. data/app/assets/stylesheets/ensnare/bootstrap-switch.css +408 -0
  19. data/app/assets/stylesheets/ensnare/bootstrap_and_overrides.css +7 -0
  20. data/app/assets/stylesheets/ensnare/dashboard.css +4 -0
  21. data/app/assets/stylesheets/ensnare/toggle-switch.css +310 -0
  22. data/app/assets/stylesheets/ensnare/violation.css +4 -0
  23. data/app/controllers/ensnare/application_controller.rb +22 -0
  24. data/app/controllers/ensnare/configuration_controller.rb +15 -0
  25. data/app/controllers/ensnare/dashboard_controller.rb +32 -0
  26. data/app/controllers/ensnare/violations_controller.rb +36 -0
  27. data/app/helpers/ensnare/application_helper.rb +4 -0
  28. data/app/helpers/ensnare/dashboard_helper.rb +6 -0
  29. data/app/helpers/ensnare/violation_helper.rb +4 -0
  30. data/app/models/ensnare/violation.rb +6 -0
  31. data/app/views/ensnare/dashboard/configs.html.erb +1191 -0
  32. data/app/views/ensnare/dashboard/edit.html.erb +2 -0
  33. data/app/views/ensnare/dashboard/metrics.html.erb +38 -0
  34. data/app/views/ensnare/dashboard/metrics/_table.html.erb +17 -0
  35. data/app/views/ensnare/dashboard/mode.html.erb +75 -0
  36. data/app/views/ensnare/dashboard/violations.html.erb +32 -0
  37. data/app/views/ensnare/violations/captcha.html.erb +11 -0
  38. data/app/views/ensnare/violations/redirect.html.erb +2 -0
  39. data/app/views/ensnare/violations/show.html.erb +2 -0
  40. data/app/views/layouts/ensnare/application.html.erb +77 -0
  41. data/app/views/layouts/ensnare/captcha.html.erb +51 -0
  42. data/config/locales/en.bootstrap.yml +18 -0
  43. data/config/routes.rb +14 -0
  44. data/db/migrate/20131007205246_create_ensnare_violations.rb +10 -0
  45. data/db/migrate/20131007210137_rename_violation_type_field.rb +6 -0
  46. data/db/migrate/20131029010445_add_fields_to_violation.rb +8 -0
  47. data/db/migrate/20131031001835_add_name_to_ensnare_violation.rb +5 -0
  48. data/db/migrate/20131121163305_add_weight_to_violations.rb +5 -0
  49. data/lib/ensnare.rb +306 -0
  50. data/lib/ensnare/controllers/helpers.rb +143 -0
  51. data/lib/ensnare/engine.rb +30 -0
  52. data/lib/ensnare/form_tag_helper.rb +116 -0
  53. data/lib/ensnare/responses/block.rb +8 -0
  54. data/lib/ensnare/responses/captcha.rb +20 -0
  55. data/lib/ensnare/responses/flash_error.rb +11 -0
  56. data/lib/ensnare/responses/none.rb +10 -0
  57. data/lib/ensnare/responses/not_found.rb +9 -0
  58. data/lib/ensnare/responses/random_content.rb +11 -0
  59. data/lib/ensnare/responses/redirect.rb +8 -0
  60. data/lib/ensnare/responses/redirect_loop.rb +10 -0
  61. data/lib/ensnare/responses/response.rb +19 -0
  62. data/lib/ensnare/responses/server_error.rb +8 -0
  63. data/lib/ensnare/responses/throttle.rb +8 -0
  64. data/lib/ensnare/traps/cookie.rb +98 -0
  65. data/lib/ensnare/traps/parameter.rb +88 -0
  66. data/lib/ensnare/traps/reg_ex.rb +26 -0
  67. data/lib/ensnare/traps/routing_error.rb +25 -0
  68. data/lib/ensnare/traps/trap.rb +36 -0
  69. data/lib/ensnare/version.rb +3 -0
  70. data/lib/generators/ensnare/install_generator.rb +12 -0
  71. data/lib/generators/templates/ensnare.rb +44 -0
  72. data/lib/tasks/ensnare_tasks.rb +4 -0
  73. data/test/dummy/Gemfile +46 -0
  74. data/test/dummy/Gemfile.lock +149 -0
  75. data/test/dummy/README.rdoc +261 -0
  76. data/test/dummy/Rakefile +7 -0
  77. data/test/dummy/app/assets/images/rails.png +0 -0
  78. data/test/dummy/app/assets/javascripts/application.js +16 -0
  79. data/test/dummy/app/assets/javascripts/bootstrap.js +4 -0
  80. data/test/dummy/app/assets/javascripts/bootstrap.js.coffee +3 -0
  81. data/test/dummy/app/assets/javascripts/widgets.js.coffee +3 -0
  82. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  83. data/test/dummy/app/assets/stylesheets/bootstrap_and_overrides.css +7 -0
  84. data/test/dummy/app/assets/stylesheets/scaffolds.css.scss +69 -0
  85. data/test/dummy/app/assets/stylesheets/widgets.css.scss +3 -0
  86. data/test/dummy/app/controllers/application_controller.rb +12 -0
  87. data/test/dummy/app/controllers/widgets_controller.rb +94 -0
  88. data/test/dummy/app/helpers/application_helper.rb +2 -0
  89. data/test/dummy/app/helpers/widgets_helper.rb +2 -0
  90. data/test/dummy/app/models/user.rb +15 -0
  91. data/test/dummy/app/models/widget.rb +4 -0
  92. data/test/dummy/app/views/layouts/application.html.erb +108 -0
  93. data/test/dummy/app/views/widgets/_form.html.erb +25 -0
  94. data/test/dummy/app/views/widgets/edit.html.erb +6 -0
  95. data/test/dummy/app/views/widgets/index.html.erb +25 -0
  96. data/test/dummy/app/views/widgets/new.html.erb +5 -0
  97. data/test/dummy/app/views/widgets/show.html.erb +15 -0
  98. data/test/dummy/config.ru +4 -0
  99. data/test/dummy/config/application.rb +65 -0
  100. data/test/dummy/config/boot.rb +6 -0
  101. data/test/dummy/config/database.yml +25 -0
  102. data/test/dummy/config/environment.rb +5 -0
  103. data/test/dummy/config/environments/development.rb +41 -0
  104. data/test/dummy/config/environments/production.rb +67 -0
  105. data/test/dummy/config/environments/test.rb +37 -0
  106. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  107. data/test/dummy/config/initializers/captcha.rb +5 -0
  108. data/test/dummy/config/initializers/devise.rb +258 -0
  109. data/test/dummy/config/initializers/ensnare.rb +272 -0
  110. data/test/dummy/config/initializers/ensnare.sample +323 -0
  111. data/test/dummy/config/initializers/examples.example +323 -0
  112. data/test/dummy/config/initializers/inflections.rb +15 -0
  113. data/test/dummy/config/initializers/mime_types.rb +5 -0
  114. data/test/dummy/config/initializers/quiet_assets.rb +13 -0
  115. data/test/dummy/config/initializers/secret_token.rb +7 -0
  116. data/test/dummy/config/initializers/session_store.rb +8 -0
  117. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  118. data/test/dummy/config/locales/devise.en.yml +60 -0
  119. data/test/dummy/config/locales/en.bootstrap.yml +18 -0
  120. data/test/dummy/config/locales/en.yml +5 -0
  121. data/test/dummy/config/routes.rb +68 -0
  122. data/test/dummy/db/development.sqlite3 +0 -0
  123. data/test/dummy/db/migrate/20131007193540_create_widgets.rb +10 -0
  124. data/test/dummy/db/migrate/20131031153254_devise_create_users.rb +42 -0
  125. data/test/dummy/db/migrate/20140405051634_create_ensnare_violations.ensnare.rb +11 -0
  126. data/test/dummy/db/migrate/20140405051635_rename_violation_type_field.ensnare.rb +7 -0
  127. data/test/dummy/db/migrate/20140405051636_add_fields_to_violation.ensnare.rb +9 -0
  128. data/test/dummy/db/migrate/20140405051637_add_name_to_ensnare_violation.ensnare.rb +6 -0
  129. data/test/dummy/db/migrate/20140405051638_add_weight_to_violations.ensnare.rb +6 -0
  130. data/test/dummy/db/schema.rb +54 -0
  131. data/test/dummy/db/seeds.rb +7 -0
  132. data/test/dummy/db/test.sqlite3 +0 -0
  133. data/test/dummy/doc/README_FOR_APP +2 -0
  134. data/test/dummy/lib/ensnare/responses/custom.rb_sample +11 -0
  135. data/test/dummy/lib/ensnare/traps/custom.rb_sample +26 -0
  136. data/test/dummy/log/development.log +92903 -0
  137. data/test/dummy/log/production.log +158 -0
  138. data/test/dummy/public/404.html +26 -0
  139. data/test/dummy/public/422.html +26 -0
  140. data/test/dummy/public/500.html +25 -0
  141. data/test/dummy/public/favicon.ico +0 -0
  142. data/test/dummy/public/robots.txt +5 -0
  143. data/test/dummy/script/rails +6 -0
  144. data/test/dummy/test/fixtures/users.yml +11 -0
  145. data/test/dummy/test/fixtures/widgets.yml +9 -0
  146. data/test/dummy/test/functional/widgets_controller_test.rb +49 -0
  147. data/test/dummy/test/performance/browsing_test.rb +12 -0
  148. data/test/dummy/test/test_helper.rb +13 -0
  149. data/test/dummy/test/unit/helpers/widgets_helper_test.rb +4 -0
  150. data/test/dummy/test/unit/user_test.rb +7 -0
  151. data/test/dummy/test/unit/widget_test.rb +7 -0
  152. data/test/dummy/tmp/cache/assets/C10/FA0/sprockets%2F269fa26485a91206814a45af06210315 +0 -0
  153. data/test/dummy/tmp/cache/assets/C23/310/sprockets%2Fc79437284218b38e613366d14284ac07 +0 -0
  154. data/test/dummy/tmp/cache/assets/C40/710/sprockets%2F545779172fbf9cf79082774a07841659 +0 -0
  155. data/test/dummy/tmp/cache/assets/C48/0D0/sprockets%2F75b535a43e06025546821f95d011d85b +0 -0
  156. data/test/dummy/tmp/cache/assets/C4E/110/sprockets%2Fb806449c86337e3e06070c462280e90b +0 -0
  157. data/test/dummy/tmp/cache/assets/C57/BD0/sprockets%2Facd987410b744152d157762609194e8c +0 -0
  158. data/test/dummy/tmp/cache/assets/C5D/9E0/sprockets%2F0d79b66115628050357f99d36aa4876d +0 -0
  159. data/test/dummy/tmp/cache/assets/C80/840/sprockets%2F562c2d168da585f80579347d10790a0a +0 -0
  160. data/test/dummy/tmp/cache/assets/C84/DD0/sprockets%2F3e508585142de6585818df6a2290bf11 +0 -0
  161. data/test/dummy/tmp/cache/assets/C85/E00/sprockets%2Fcbe2d565923657893e41f9160d30e540 +0 -0
  162. data/test/dummy/tmp/cache/assets/C88/BC0/sprockets%2F341dd4748a8a73570a59264e9f9540b2 +0 -0
  163. data/test/dummy/tmp/cache/assets/C8D/F80/sprockets%2F81e191073a2f74b9eca460537339789f +0 -0
  164. data/test/dummy/tmp/cache/assets/C98/B10/sprockets%2F94976d41a9fc1279e0cd996c78087410 +0 -0
  165. data/test/dummy/tmp/cache/assets/C9F/190/sprockets%2Fb8f3f499dc494543381d55292e346e99 +0 -0
  166. data/test/dummy/tmp/cache/assets/CA4/1A0/sprockets%2F629131c0f22f0d55ed1725737a343bd7 +0 -0
  167. data/test/dummy/tmp/cache/assets/CAD/EB0/sprockets%2F481955f78ac093b746e0512b4a9c1b24 +0 -0
  168. data/test/dummy/tmp/cache/assets/CB0/8D0/sprockets%2Fba6342b6172d4ee18e951f667e237313 +0 -0
  169. data/test/dummy/tmp/cache/assets/CB4/DC0/sprockets%2F48af5bbf36e6f2720f4144f928129612 +0 -0
  170. data/test/dummy/tmp/cache/assets/CB7/5B0/sprockets%2F67a1cdb0edc3998371d944050583e358 +0 -0
  171. data/test/dummy/tmp/cache/assets/CB8/F00/sprockets%2F089f52a057d7a14247c7f93e8b59143b +0 -0
  172. data/test/dummy/tmp/cache/assets/CBD/0E0/sprockets%2F662f42b5efa6584377436f1d94318cd4 +0 -0
  173. data/test/dummy/tmp/cache/assets/CBF/4D0/sprockets%2F1462d4ee75c877880447a02b2f58e6b9 +0 -0
  174. data/test/dummy/tmp/cache/assets/CC3/220/sprockets%2F218c30380a6f2bae6b7402068da50f01 +0 -0
  175. data/test/dummy/tmp/cache/assets/CC7/200/sprockets%2F5366d8fff996ca22271713d1ca987379 +0 -0
  176. data/test/dummy/tmp/cache/assets/CCE/810/sprockets%2F90453c5b48e1f0a4f1a6836135c1c4b1 +0 -0
  177. data/test/dummy/tmp/cache/assets/CD4/E90/sprockets%2F5464e430cbb52421e1f9c23947fe31c1 +0 -0
  178. data/test/dummy/tmp/cache/assets/CD5/2C0/sprockets%2F166c056119ebdfb8b7104c97b424b423 +0 -0
  179. data/test/dummy/tmp/cache/assets/CD7/6F0/sprockets%2Fbd3936370d0f952ada5774e2230046ed +0 -0
  180. data/test/dummy/tmp/cache/assets/CD7/C90/sprockets%2F5382f60c349e1511eefc83803fa450c1 +0 -0
  181. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  182. data/test/dummy/tmp/cache/assets/CDC/5C0/sprockets%2F9767868b3b77f9164f290797f1d8fe5c +0 -0
  183. data/test/dummy/tmp/cache/assets/CDE/570/sprockets%2F0e30065c6148a1ef8d5e42439e148f4d +0 -0
  184. data/test/dummy/tmp/cache/assets/CE0/CC0/sprockets%2F2b38c3fb549036de5c4666637a0c80c6 +0 -0
  185. data/test/dummy/tmp/cache/assets/CE0/F80/sprockets%2F487624acd392c0310f0c7434e88d48bf +0 -0
  186. data/test/dummy/tmp/cache/assets/CE4/570/sprockets%2F306a61edb38d739bb2f81b448b376818 +0 -0
  187. data/test/dummy/tmp/cache/assets/CE5/C70/sprockets%2F681ae890ae2f44aee1099119d04a7938 +0 -0
  188. data/test/dummy/tmp/cache/assets/CE5/CE0/sprockets%2F9d186abc5f6a106511502d60d98ff939 +0 -0
  189. data/test/dummy/tmp/cache/assets/CE6/B90/sprockets%2F5997a940521ec92b2ea92eb63c49a562 +0 -0
  190. data/test/dummy/tmp/cache/assets/CE6/DE0/sprockets%2F9889a2fbf25b223583561299dfca004e +0 -0
  191. data/test/dummy/tmp/cache/assets/CE7/6F0/sprockets%2F6ac42c22840f7d853b6184b6f94a65c8 +0 -0
  192. data/test/dummy/tmp/cache/assets/CE7/E70/sprockets%2F704fcbd6f72c99767550538053a0bc7d +0 -0
  193. data/test/dummy/tmp/cache/assets/CE8/6E0/sprockets%2F51f80f23e41678e790edd8710c6d75c0 +0 -0
  194. data/test/dummy/tmp/cache/assets/CE9/510/sprockets%2F0c8887733a9e311fd348f21029d6bef6 +0 -0
  195. data/test/dummy/tmp/cache/assets/CEA/BA0/sprockets%2F98e291b46a924814292e2daf17ad8c84 +0 -0
  196. data/test/dummy/tmp/cache/assets/CF4/140/sprockets%2F22a3157d204c1f8e417a25f01a2dbe45 +0 -0
  197. data/test/dummy/tmp/cache/assets/CF6/EE0/sprockets%2F9e92e631fb88a8e23180da66c77859f0 +0 -0
  198. data/test/dummy/tmp/cache/assets/CF7/8B0/sprockets%2F0f091833381aa52e100fb74924fdc1aa +0 -0
  199. data/test/dummy/tmp/cache/assets/CF9/AF0/sprockets%2Fe6cf7ff483a7c68902418a2f4b374889 +0 -0
  200. data/test/dummy/tmp/cache/assets/CFF/C60/sprockets%2F0889d12d44383c7e7a859966f686badf +0 -0
  201. data/test/dummy/tmp/cache/assets/D04/D90/sprockets%2F617b1ad4f3ced27a38b689309c3240a2 +0 -0
  202. data/test/dummy/tmp/cache/assets/D06/D60/sprockets%2Fa09118ec6cd7033eb762b64a1ae58274 +0 -0
  203. data/test/dummy/tmp/cache/assets/D07/8B0/sprockets%2Ff123328eedad10b6f547eba992560504 +0 -0
  204. data/test/dummy/tmp/cache/assets/D09/740/sprockets%2Fb4177155aa0b2a846458b4da378dbe56 +0 -0
  205. data/test/dummy/tmp/cache/assets/D0A/6F0/sprockets%2Fa394b21853c45302cad3b17f7de2489e +0 -0
  206. data/test/dummy/tmp/cache/assets/D0B/E00/sprockets%2Fce33d32f3235ad54031338e689a8bdc7 +0 -0
  207. data/test/dummy/tmp/cache/assets/D0C/3B0/sprockets%2Ff34ef114cb808f84780a11082ade91d7 +0 -0
  208. data/test/dummy/tmp/cache/assets/D0F/3E0/sprockets%2F6654975eaa53a225d976278fcb6baa00 +0 -0
  209. data/test/dummy/tmp/cache/assets/D0F/550/sprockets%2F9927550095e029ace0d4d5add6901ce5 +0 -0
  210. data/test/dummy/tmp/cache/assets/D10/790/sprockets%2F31d2271940e9d19a9a5fb42fc70f26d7 +0 -0
  211. data/test/dummy/tmp/cache/assets/D12/1F0/sprockets%2Fce0c803f16e21317768892d42f1a8efc +0 -0
  212. data/test/dummy/tmp/cache/assets/D12/8E0/sprockets%2F93656a1c9a1db15ff824a84f3867c3b0 +0 -0
  213. data/test/dummy/tmp/cache/assets/D14/380/sprockets%2F7d5975b3efc5ace265c437a91539101f +0 -0
  214. data/test/dummy/tmp/cache/assets/D14/890/sprockets%2F2cb018dd1879c96fa83d4909b04f21e5 +0 -0
  215. data/test/dummy/tmp/cache/assets/D16/1F0/sprockets%2Fb19e1a25f43ad7167231aee857288f6f +0 -0
  216. data/test/dummy/tmp/cache/assets/D18/150/sprockets%2F524feca5ed7674507bd2e517943f45c4 +0 -0
  217. data/test/dummy/tmp/cache/assets/D19/6F0/sprockets%2Fc63725cd8e7d8f30818f7a82a75cc331 +0 -0
  218. data/test/dummy/tmp/cache/assets/D1A/600/sprockets%2F56bf56fa14222faef68241a4866f9e28 +0 -0
  219. data/test/dummy/tmp/cache/assets/D1E/AF0/sprockets%2F38fb02a7c41a3f3956e1f8b783885af8 +0 -0
  220. data/test/dummy/tmp/cache/assets/D21/2A0/sprockets%2F1fa2a4758d368a4ed74af19d94958d53 +0 -0
  221. data/test/dummy/tmp/cache/assets/D23/C30/sprockets%2F30a075c86c0057f03ed03a1a6c1ac74f +0 -0
  222. data/test/dummy/tmp/cache/assets/D2C/3A0/sprockets%2F5fb3206e15e73cbac0463d4e0633b9c1 +0 -0
  223. data/test/dummy/tmp/cache/assets/D2D/B40/sprockets%2F214ba38cd9bae5351510b85c60b1cf66 +0 -0
  224. data/test/dummy/tmp/cache/assets/D31/410/sprockets%2F1fb41a8351cfe74b19081d3a0a8cd186 +0 -0
  225. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  226. data/test/dummy/tmp/cache/assets/D34/3C0/sprockets%2Fd6f33bf9ea577a425537e31a1b1436aa +0 -0
  227. data/test/dummy/tmp/cache/assets/D36/A50/sprockets%2F4c5a2303a78ff5007cba199ec980b41d +0 -0
  228. data/test/dummy/tmp/cache/assets/D38/300/sprockets%2F231189114e3e16c0af8cbbfb922a7c89 +0 -0
  229. data/test/dummy/tmp/cache/assets/D3A/320/sprockets%2Fb4e466a4108157e7bbdf8a80530e76ab +0 -0
  230. data/test/dummy/tmp/cache/assets/D3C/430/sprockets%2Fc1850205179d6bc0315cf87db4edd7a8 +0 -0
  231. data/test/dummy/tmp/cache/assets/D3C/600/sprockets%2F6cb9fa003e4ae915755dbc429d54b255 +0 -0
  232. data/test/dummy/tmp/cache/assets/D3D/970/sprockets%2F9e70fe2b22f4504ee45029b9d04ce46c +0 -0
  233. data/test/dummy/tmp/cache/assets/D3F/4A0/sprockets%2F9d1d25fb38006ddc0e6fcf42190d8583 +0 -0
  234. data/test/dummy/tmp/cache/assets/D3F/D70/sprockets%2Fa7d40ead3d8014db7e90ec643e323969 +0 -0
  235. data/test/dummy/tmp/cache/assets/D43/7F0/sprockets%2F05ba12f3e980c9658d979415aca6a3ce +0 -0
  236. data/test/dummy/tmp/cache/assets/D45/7E0/sprockets%2Fc24e2e08818f34b11af78c7b4467fb5f +0 -0
  237. data/test/dummy/tmp/cache/assets/D45/970/sprockets%2Ff0e7b8648d5a2519256c1eeb2d9f08d2 +0 -0
  238. data/test/dummy/tmp/cache/assets/D45/F90/sprockets%2F6b6e959a5f0990831a196b6bddb05f3b +0 -0
  239. data/test/dummy/tmp/cache/assets/D47/E90/sprockets%2Fa578fc0e68c5d167fc5c365e2c09a616 +0 -0
  240. data/test/dummy/tmp/cache/assets/D48/090/sprockets%2F7a07a493490b7ac1cc0466a9eed8e589 +0 -0
  241. data/test/dummy/tmp/cache/assets/D4A/820/sprockets%2Feb00ebb7f262bff8638844571e1a859f +0 -0
  242. data/test/dummy/tmp/cache/assets/D4B/160/sprockets%2F78835ac7e39b080e262f9a4b76cbd65d +0 -0
  243. data/test/dummy/tmp/cache/assets/D4B/320/sprockets%2F4a570986eef4f2707130eb8c9c36d9ad +0 -0
  244. data/test/dummy/tmp/cache/assets/D4C/7F0/sprockets%2F5c0e220ac801d18f4bd1bd65e043d20a +0 -0
  245. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  246. data/test/dummy/tmp/cache/assets/D4F/E20/sprockets%2F2da45938fca5e6979baa57c61b43b689 +0 -0
  247. data/test/dummy/tmp/cache/assets/D51/C40/sprockets%2F9c881f9a0edd974bf6ff0f83a4308192 +0 -0
  248. data/test/dummy/tmp/cache/assets/D52/6A0/sprockets%2F8b5de085dffa4897817e72a1b75348cd +0 -0
  249. data/test/dummy/tmp/cache/assets/D54/210/sprockets%2F8d24b46f6838cc66ddb9c7b07d32e939 +0 -0
  250. data/test/dummy/tmp/cache/assets/D56/C20/sprockets%2F4ce9229c7c971ce590189cfea1e74d95 +0 -0
  251. data/test/dummy/tmp/cache/assets/D5A/310/sprockets%2F7f968e95238c9866f6ebd76a16b2aab6 +0 -0
  252. data/test/dummy/tmp/cache/assets/D5A/7B0/sprockets%2Fda913ea979b742f1f7418f488e32fe8f +0 -0
  253. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  254. data/test/dummy/tmp/cache/assets/D5C/1F0/sprockets%2Fed34fbbec82818204a214b5114d3dce5 +0 -0
  255. data/test/dummy/tmp/cache/assets/D64/700/sprockets%2F76c71d55a65dae34d0f60d62ee3a63b0 +0 -0
  256. data/test/dummy/tmp/cache/assets/D64/DE0/sprockets%2F655e1ca6a735ac75093c0e01febce293 +0 -0
  257. data/test/dummy/tmp/cache/assets/D72/4B0/sprockets%2F34ba5dd43adc2c826b79ce9a944f8620 +0 -0
  258. data/test/dummy/tmp/cache/assets/D76/710/sprockets%2F6740efeff28c623e091100f28f7c9eaf +0 -0
  259. data/test/dummy/tmp/cache/assets/D77/3D0/sprockets%2F76515b80ab945bb46f93cdace3993c4e +0 -0
  260. data/test/dummy/tmp/cache/assets/D78/C60/sprockets%2F3ed4e68ec22d09a66c1ea96e6b733d66 +0 -0
  261. data/test/dummy/tmp/cache/assets/D92/5E0/sprockets%2F17d03aff61dbd220217eb7f159bb8df2 +0 -0
  262. data/test/dummy/tmp/cache/assets/D96/CE0/sprockets%2Fff431fe62bbb5f0e9d63c43c4010fd56 +0 -0
  263. data/test/dummy/tmp/cache/assets/D9C/CF0/sprockets%2Fde9afe6f38620c4144b5a5fd1dc36f23 +0 -0
  264. data/test/dummy/tmp/cache/assets/D9C/EA0/sprockets%2Ff1cdf6c71079c7b373b1b842bf4e9a3a +0 -0
  265. data/test/dummy/tmp/cache/assets/D9D/590/sprockets%2F93ee64febc21345494bfbd0a8aad6446 +0 -0
  266. data/test/dummy/tmp/cache/assets/D9E/490/sprockets%2Fe231e8b6ec488aecaf61d84bb542e029 +0 -0
  267. data/test/dummy/tmp/cache/assets/D9E/6A0/sprockets%2F0a9e2c29287a00d9b9cc94cd9b3af63a +0 -0
  268. data/test/dummy/tmp/cache/assets/DA0/110/sprockets%2F29a7ddee7ded49b2613bb26f5d0980a3 +0 -0
  269. data/test/dummy/tmp/cache/assets/DA2/580/sprockets%2F35d3674fac89e6235b3fa6b251fbc3ff +0 -0
  270. data/test/dummy/tmp/cache/assets/DA2/780/sprockets%2F83886a2d2dba19d6cf5a2ea7fe7213d7 +0 -0
  271. data/test/dummy/tmp/cache/assets/DA3/9C0/sprockets%2F7f2d6495f1f675acc353e0a37adc94ae +0 -0
  272. data/test/dummy/tmp/cache/assets/DA6/B80/sprockets%2F60bbf1fc573c8bc35c8da9082888cb6c +0 -0
  273. data/test/dummy/tmp/cache/assets/DA6/EB0/sprockets%2F83015053ed9a581994cafcbbf9e7e6ab +0 -0
  274. data/test/dummy/tmp/cache/assets/DA7/0C0/sprockets%2Fc9194b0b488f53a9afc0540ced96ad9e +0 -0
  275. data/test/dummy/tmp/cache/assets/DA7/6D0/sprockets%2F28ce714e9b9d6aa16c4604bc9b5afd79 +0 -0
  276. data/test/dummy/tmp/cache/assets/DA9/490/sprockets%2F9815ad0a7dab6fbdfb2856654298acf7 +0 -0
  277. data/test/dummy/tmp/cache/assets/DAC/E40/sprockets%2Fec3c6d68d0e246ed889fe31471dc44fc +0 -0
  278. data/test/dummy/tmp/cache/assets/DAE/050/sprockets%2F6a3d58d879f5afbf0ad526425fe76a5f +0 -0
  279. data/test/dummy/tmp/cache/assets/DB8/040/sprockets%2F218aaca004d507da6f207ce9de821bea +0 -0
  280. data/test/dummy/tmp/cache/assets/DBB/E80/sprockets%2Fa01bf17ca00dc2b43f749abe69cad680 +0 -0
  281. data/test/dummy/tmp/cache/assets/DBD/170/sprockets%2Fc229df8cfb1c041769d0bb3c8eb310ac +0 -0
  282. data/test/dummy/tmp/cache/assets/DBF/770/sprockets%2F89c90a5f9259fc5b1b6ed69efe7c88d2 +0 -0
  283. data/test/dummy/tmp/cache/assets/DBF/850/sprockets%2Fb37d146f03d1ab72bd81afa3b7c295bf +0 -0
  284. data/test/dummy/tmp/cache/assets/DC3/E90/sprockets%2F63fce83ccf6fed1a634c00ec9623ba30 +0 -0
  285. data/test/dummy/tmp/cache/assets/DC4/1B0/sprockets%2Fedae9235cb5ca2fc97c2d335ba27a660 +0 -0
  286. data/test/dummy/tmp/cache/assets/DC7/2B0/sprockets%2Fda49c151b0b2be5bf6e8e135bd6f80d6 +0 -0
  287. data/test/dummy/tmp/cache/assets/DC9/C70/sprockets%2Fba5f2321c2ee8c42d0ff498a12e5bf7e +0 -0
  288. data/test/dummy/tmp/cache/assets/DCA/DC0/sprockets%2F7ed2addf814bfd28c3bad7790e005d53 +0 -0
  289. data/test/dummy/tmp/cache/assets/DCB/320/sprockets%2F672cc04c39b0a37cbe89cecbf3580ad7 +0 -0
  290. data/test/dummy/tmp/cache/assets/DCB/AE0/sprockets%2Fd14638ac9aaefa36ca75c1d66cb727e3 +0 -0
  291. data/test/dummy/tmp/cache/assets/DCC/1D0/sprockets%2Ff6defe1375c5acb57e141263b70fe5eb +0 -0
  292. data/test/dummy/tmp/cache/assets/DD1/DB0/sprockets%2Fc7a35f025c7fb33a2d9ce83ce4bd4f86 +0 -0
  293. data/test/dummy/tmp/cache/assets/DD2/5B0/sprockets%2F91c620bad817c7ffa64d5ea8b446db6f +0 -0
  294. data/test/dummy/tmp/cache/assets/DD2/D60/sprockets%2Fcc373f8a8e1d94ed2154dc37ca0f3ff6 +0 -0
  295. data/test/dummy/tmp/cache/assets/DD5/8E0/sprockets%2F0dde6f938e5addbdab55f6e7037e1482 +0 -0
  296. data/test/dummy/tmp/cache/assets/DD5/B80/sprockets%2Fdd3beb4c76fbf877171fd66192ebc4b2 +0 -0
  297. data/test/dummy/tmp/cache/assets/DD7/F30/sprockets%2Fe5fedf2dc39b7a678447c63ee2601ebc +0 -0
  298. data/test/dummy/tmp/cache/assets/DDB/200/sprockets%2F9dd434d9f9a3f7f4b35d90a0ddd6fb19 +0 -0
  299. data/test/dummy/tmp/cache/assets/DDC/1F0/sprockets%2F7533abdaee852b1c7bb05cabe3b2040a +0 -0
  300. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  301. data/test/dummy/tmp/cache/assets/DDD/190/sprockets%2F85d9f2c43cee7e82bdf893e0d35ac66a +0 -0
  302. data/test/dummy/tmp/cache/assets/DDD/1E0/sprockets%2F951cfc59ce1918fcb37c28fa20e9ebf7 +0 -0
  303. data/test/dummy/tmp/cache/assets/DDE/590/sprockets%2F2e7b6f67b665649ced381dfe37ce2abe +0 -0
  304. data/test/dummy/tmp/cache/assets/DDE/660/sprockets%2Ff64ad0798dfc7f6da9fcd83b53c8c250 +0 -0
  305. data/test/dummy/tmp/cache/assets/DE8/2A0/sprockets%2F37ceb226c01db0bd317e3f3fcfcf1c51 +0 -0
  306. data/test/dummy/tmp/cache/assets/DE8/440/sprockets%2F5559ecfd0ee508d816e4dc889cd8fe3b +0 -0
  307. data/test/dummy/tmp/cache/assets/DEE/730/sprockets%2F8121bbae4961aeba50bdb2cbd939c09f +0 -0
  308. data/test/dummy/tmp/cache/assets/DEF/AB0/sprockets%2Ff8c08dc2009dc1c91a4da29cc852badb +0 -0
  309. data/test/dummy/tmp/cache/assets/DF1/9C0/sprockets%2F7bbd18d10dc4ea3f5d6b137a5b0c9e7b +0 -0
  310. data/test/dummy/tmp/cache/assets/DF8/6B0/sprockets%2F3b2dfa4e62529eeedd6de03ab7b26b19 +0 -0
  311. data/test/dummy/tmp/cache/assets/DFA/CE0/sprockets%2F11f1769f11ddfe50ae1ec399fafa1cf3 +0 -0
  312. data/test/dummy/tmp/cache/assets/DFE/C50/sprockets%2F0af9ec26a81ea5fa1e72f6de4f7a8e03 +0 -0
  313. data/test/dummy/tmp/cache/assets/DFF/900/sprockets%2Fd6d6cf5ff58edce3840dc45621fb1a1d +0 -0
  314. data/test/dummy/tmp/cache/assets/E02/C30/sprockets%2Fecc53a781b3bf1fbcc94fc77c951c5c5 +0 -0
  315. data/test/dummy/tmp/cache/assets/E04/440/sprockets%2F28fe8df46cdf880c8aa0cced70bb7570 +0 -0
  316. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  317. data/test/dummy/tmp/cache/assets/E08/200/sprockets%2Fed91cd00ed3e395eef48f19c62de6e1d +0 -0
  318. data/test/dummy/tmp/cache/assets/E10/340/sprockets%2F7ebd866bfd5a89bfdbf6d928b1d7341d +0 -0
  319. data/test/dummy/tmp/cache/assets/E19/2A0/sprockets%2F10fcfbe6ebae11a40c8eac41939a1b9a +0 -0
  320. data/test/dummy/tmp/cache/assets/E23/A10/sprockets%2F03c4303cddb0cfd8cc9e67aa76c70aee +0 -0
  321. data/test/dummy/tmp/cache/assets/E24/670/sprockets%2Fb857c29efff63c768fbb48ef8e79aae7 +0 -0
  322. data/test/dummy/tmp/cache/assets/E2E/550/sprockets%2Ffb7d8bb50347f4edae6b56ca4bdf07b7 +0 -0
  323. data/test/dummy/tmp/cache/assets/E3B/080/sprockets%2F09e2a090befacdae0db10cafb1893a0a +0 -0
  324. data/test/dummy/tmp/cache/assets/E3E/DE0/sprockets%2Fa977ff5dc4e348f89fe35af4bd2aae3c +0 -0
  325. data/test/dummy/tmp/cache/assets/E45/C30/sprockets%2F69ccc9abc9b338aeee9ee4f1958fb64c +0 -0
  326. data/test/dummy/tmp/cache/assets/E83/1F0/sprockets%2F936cdaaa3e9ff0aafac3bc95ea45a3c6 +0 -0
  327. data/test/dummy/tmp/cache/assets/E85/370/sprockets%2Fca34a37aca7a3f4fe4b2d9ad46ecccc9 +0 -0
  328. data/test/dummy/tmp/cache/assets/E89/CE0/sprockets%2F86a2fd89bf33cbbacf438bb6ef0f3aca +0 -0
  329. data/test/dummy/tmp/cache/assets/F45/590/sprockets%2Fedcf9d1288bc0cfabaccf35fa6ecceca +0 -0
  330. data/test/dummy/tmp/cache/sass/867224f66ea2bfec241b4cee6d1fd9626cb72b7e/scaffolds.css.scssc +0 -0
  331. data/test/dummy/tmp/cache/sass/867224f66ea2bfec241b4cee6d1fd9626cb72b7e/widgets.css.scssc +0 -0
  332. data/test/ensnare_test.rb +7 -0
  333. data/test/fixtures/ensnare/violations.yml +9 -0
  334. data/test/functional/ensnare/dashboard_controller_test.rb +16 -0
  335. data/test/functional/ensnare/violation_controller_test.rb +11 -0
  336. data/test/integration/navigation_test.rb +10 -0
  337. data/test/test_helper.rb +15 -0
  338. data/test/unit/ensnare/violation_test.rb +9 -0
  339. data/test/unit/helpers/ensnare/dashboard_helper_test.rb +6 -0
  340. data/test/unit/helpers/ensnare/violation_helper_test.rb +6 -0
  341. metadata +692 -0
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | | |-- images
161
+ | | |-- javascripts
162
+ | | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | |-- assets
177
+ | `-- tasks
178
+ |-- log
179
+ |-- public
180
+ |-- script
181
+ |-- test
182
+ | |-- fixtures
183
+ | |-- functional
184
+ | |-- integration
185
+ | |-- performance
186
+ | `-- unit
187
+ |-- tmp
188
+ | `-- cache
189
+ | `-- assets
190
+ `-- vendor
191
+ |-- assets
192
+ | |-- javascripts
193
+ | `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ EnsnareTestApp::Application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require twitter/bootstrap
16
+ //= require_tree .
@@ -0,0 +1,4 @@
1
+ jQuery(function() {
2
+ $("a[rel~=popover], .has-popover").popover();
3
+ $("a[rel~=tooltip], .has-tooltip").tooltip();
4
+ });
@@ -0,0 +1,3 @@
1
+ jQuery ->
2
+ $("a[rel~=popover], .has-popover").popover()
3
+ $("a[rel~=tooltip], .has-tooltip").tooltip()
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,7 @@
1
+ /*
2
+ =require twitter-bootstrap-static/bootstrap
3
+
4
+ Use Font Awesome icons (default)
5
+ To use Glyphicons sprites instead of Font Awesome, replace with "require twitter-bootstrap-static/sprites"
6
+ =require twitter-bootstrap-static/fontawesome
7
+ */
@@ -0,0 +1,69 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ p, ol, ul, td {
10
+ font-family: verdana, arial, helvetica, sans-serif;
11
+ font-size: 13px;
12
+ line-height: 18px;
13
+ }
14
+
15
+ pre {
16
+ background-color: #eee;
17
+ padding: 10px;
18
+ font-size: 11px;
19
+ }
20
+
21
+ a {
22
+ color: #000;
23
+ &:visited {
24
+ color: #666;
25
+ }
26
+ &:hover {
27
+ color: #fff;
28
+ background-color: #000;
29
+ }
30
+ }
31
+
32
+ div {
33
+ &.field, &.actions {
34
+ margin-bottom: 10px;
35
+ }
36
+ }
37
+
38
+ #notice {
39
+ color: green;
40
+ }
41
+
42
+ .field_with_errors {
43
+ padding: 2px;
44
+ background-color: red;
45
+ display: table;
46
+ }
47
+
48
+ #error_explanation {
49
+ width: 450px;
50
+ border: 2px solid red;
51
+ padding: 7px;
52
+ padding-bottom: 0;
53
+ margin-bottom: 20px;
54
+ background-color: #f0f0f0;
55
+ h2 {
56
+ text-align: left;
57
+ font-weight: bold;
58
+ padding: 5px 5px 5px 15px;
59
+ font-size: 12px;
60
+ margin: -7px;
61
+ margin-bottom: 0px;
62
+ background-color: #c00;
63
+ color: #fff;
64
+ }
65
+ ul li {
66
+ font-size: 12px;
67
+ list-style: square;
68
+ }
69
+ }
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Widgets controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,12 @@
1
+ class ApplicationController < ActionController::Base
2
+
3
+
4
+ before_filter :ensnare
5
+ protect_from_forgery
6
+
7
+
8
+ private
9
+
10
+
11
+
12
+ end
@@ -0,0 +1,94 @@
1
+ class WidgetsController < ApplicationController
2
+
3
+ before_filter :authenticate_user!, :only=>[:edit, :update, :destroy]
4
+
5
+ # GET /widgets
6
+ # GET /widgets.json
7
+ def index
8
+ @widgets = Widget.all
9
+
10
+ respond_to do |format|
11
+ format.html # index.html.erb
12
+ format.json { render json: @widgets }
13
+ end
14
+ end
15
+
16
+ # GET /widgets/1
17
+ # GET /widgets/1.json
18
+ def show
19
+ @widget = Widget.find(params[:id])
20
+
21
+ respond_to do |format|
22
+ format.html # show.html.erb
23
+ format.json { render json: @widget }
24
+ end
25
+ end
26
+
27
+ # GET /widgets/new
28
+ # GET /widgets/new.json
29
+ def new
30
+ @widget = Widget.new
31
+
32
+ respond_to do |format|
33
+ format.html # new.html.erb
34
+ format.json { render json: @widget }
35
+ end
36
+ end
37
+
38
+ # GET /widgets/1/edit
39
+ def edit
40
+ @widget = Widget.find(params[:id])
41
+ end
42
+
43
+ # POST /widgets
44
+ # POST /widgets.json
45
+ def create
46
+ @widget = Widget.new(params[:widget])
47
+
48
+ respond_to do |format|
49
+ if @widget.save
50
+ format.html { redirect_to @widget, notice: 'Widget was successfully created.' }
51
+ format.json { render json: @widget, status: :created, location: @widget }
52
+ else
53
+ format.html { render action: "new" }
54
+ format.json { render json: @widget.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # PUT /widgets/1
60
+ # PUT /widgets/1.json
61
+ def update
62
+ @widget = Widget.find(params[:id])
63
+
64
+ respond_to do |format|
65
+ if @widget.update_attributes(params[:widget])
66
+ format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }
67
+ format.json { head :no_content }
68
+ else
69
+ format.html { render action: "edit" }
70
+ format.json { render json: @widget.errors, status: :unprocessable_entity }
71
+ end
72
+ end
73
+ end
74
+
75
+ # DELETE /widgets/1
76
+ # DELETE /widgets/1.json
77
+ def destroy
78
+
79
+ Ensnare::Violation.create(:ip_address=>request.remote_ip.to_s,
80
+ :violation_type=>"Delete Widget",
81
+ :session_id=>session.try(:[],"session_id").to_s,
82
+ :user_id=>current_user.id,
83
+ :expected=>"None",
84
+ :name=>params[:id].to_s,
85
+ :observed=>"Delete",
86
+ :weight=>5)
87
+
88
+ respond_to do |format|
89
+ format.html { redirect_to widgets_url, notice: 'You are not allowed to do that!' }
90
+ end
91
+
92
+
93
+ end
94
+ end