serum-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +6 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +3 -0
  5. data/Gemfile.lock +42 -0
  6. data/LICENSE +22 -0
  7. data/README.md +40 -0
  8. data/bin/serum-rails +13 -0
  9. data/lib/serum/rails/app.rb +50 -0
  10. data/lib/serum/rails/code_scanner.rb +49 -0
  11. data/lib/serum/rails/metrics.rb +118 -0
  12. data/lib/serum/rails/type_selection.rb +31 -0
  13. data/lib/serum/rails/version.rb +7 -0
  14. data/lib/serum-rails.rb +5 -0
  15. data/serum-rails.gemspec +23 -0
  16. data/spec/serum/rails/metrics_spec.rb +87 -0
  17. data/spec/spec_helper.rb +80 -0
  18. data/spec/test_app/Capfile +4 -0
  19. data/spec/test_app/Gemfile +54 -0
  20. data/spec/test_app/Gemfile.lock +163 -0
  21. data/spec/test_app/Rakefile +11 -0
  22. data/spec/test_app/app/controllers/admin/categories_controller.rb +17 -0
  23. data/spec/test_app/app/controllers/admin/users_controller.rb +30 -0
  24. data/spec/test_app/app/controllers/application_controller/i18n_trait.rb +24 -0
  25. data/spec/test_app/app/controllers/application_controller/navigation_trait.rb +19 -0
  26. data/spec/test_app/app/controllers/application_controller/security_trait/disabled_clearance_accounts_trait.rb +41 -0
  27. data/spec/test_app/app/controllers/application_controller/security_trait.rb +65 -0
  28. data/spec/test_app/app/controllers/application_controller.rb +13 -0
  29. data/spec/test_app/app/controllers/conferences_controller.rb +67 -0
  30. data/spec/test_app/app/controllers/friendship_requests_controller.rb +31 -0
  31. data/spec/test_app/app/controllers/invitations_controller.rb +39 -0
  32. data/spec/test_app/app/controllers/members_controller.rb +21 -0
  33. data/spec/test_app/app/controllers/passwords_controller.rb +33 -0
  34. data/spec/test_app/app/controllers/sessions_controller.rb +17 -0
  35. data/spec/test_app/app/controllers/shared/boring_controller_trait/deletable_trait.rb +23 -0
  36. data/spec/test_app/app/controllers/shared/boring_controller_trait/flash_trait.rb +23 -0
  37. data/spec/test_app/app/controllers/shared/boring_controller_trait/helpers_trait.rb +35 -0
  38. data/spec/test_app/app/controllers/shared/boring_controller_trait/index_trait.rb +39 -0
  39. data/spec/test_app/app/controllers/shared/boring_controller_trait/log_changes_trait.rb +18 -0
  40. data/spec/test_app/app/controllers/shared/boring_controller_trait.rb +16 -0
  41. data/spec/test_app/app/controllers/users_controller.rb +49 -0
  42. data/spec/test_app/app/controllers/ws/api_controller/formatters_trait.rb +91 -0
  43. data/spec/test_app/app/controllers/ws/api_controller/parsers_trait.rb +59 -0
  44. data/spec/test_app/app/controllers/ws/api_controller.rb +70 -0
  45. data/spec/test_app/app/controllers/ws/attendees_controller.rb +43 -0
  46. data/spec/test_app/app/controllers/ws/categories_controller.rb +30 -0
  47. data/spec/test_app/app/controllers/ws/conferences_controller.rb +62 -0
  48. data/spec/test_app/app/controllers/ws/contacts_controller.rb +41 -0
  49. data/spec/test_app/app/controllers/ws/factory_controller.rb +45 -0
  50. data/spec/test_app/app/controllers/ws/members_controller.rb +34 -0
  51. data/spec/test_app/app/controllers/ws/series_controller.rb +19 -0
  52. data/spec/test_app/app/controllers/ws/tests_controller.rb +23 -0
  53. data/spec/test_app/app/helpers/application_helper.rb +180 -0
  54. data/spec/test_app/app/helpers/mail_helper.rb +9 -0
  55. data/spec/test_app/app/helpers/tags_helper.rb +16 -0
  56. data/spec/test_app/app/helpers/user_helper.rb +23 -0
  57. data/spec/test_app/app/models/attendance.rb +11 -0
  58. data/spec/test_app/app/models/category/ancestry_trait.rb +23 -0
  59. data/spec/test_app/app/models/category.rb +25 -0
  60. data/spec/test_app/app/models/conference/attendance_trait.rb +23 -0
  61. data/spec/test_app/app/models/conference/categories_trait.rb +26 -0
  62. data/spec/test_app/app/models/conference/icalendar_trait.rb +36 -0
  63. data/spec/test_app/app/models/conference/search_trait.rb +44 -0
  64. data/spec/test_app/app/models/conference.rb +24 -0
  65. data/spec/test_app/app/models/conference_category.rb +6 -0
  66. data/spec/test_app/app/models/conference_search.rb +51 -0
  67. data/spec/test_app/app/models/error.rb +25 -0
  68. data/spec/test_app/app/models/friendship.rb +14 -0
  69. data/spec/test_app/app/models/friendship_request.rb +19 -0
  70. data/spec/test_app/app/models/invitation.rb +38 -0
  71. data/spec/test_app/app/models/member_search.rb +18 -0
  72. data/spec/test_app/app/models/navigation.rb +38 -0
  73. data/spec/test_app/app/models/patterns.rb +14 -0
  74. data/spec/test_app/app/models/permissions.rb +106 -0
  75. data/spec/test_app/app/models/shared/afterlife_trait.rb +18 -0
  76. data/spec/test_app/app/models/shared/choice_trait.rb +37 -0
  77. data/spec/test_app/app/models/shared/deletable_trait.rb +8 -0
  78. data/spec/test_app/app/models/shared/flag_trait.rb +30 -0
  79. data/spec/test_app/app/models/shared/indestructible_trait.rb +19 -0
  80. data/spec/test_app/app/models/shared/list_field_trait.rb +70 -0
  81. data/spec/test_app/app/models/shared/person_name_trait.rb +25 -0
  82. data/spec/test_app/app/models/shared/searchable_trait.rb +71 -0
  83. data/spec/test_app/app/models/shared/sortable_trait.rb +24 -0
  84. data/spec/test_app/app/models/user/authentication_trait.rb +33 -0
  85. data/spec/test_app/app/models/user/authorization_trait.rb +17 -0
  86. data/spec/test_app/app/models/user/friends_trait.rb +42 -0
  87. data/spec/test_app/app/models/user/search_trait.rb +43 -0
  88. data/spec/test_app/app/models/user.rb +61 -0
  89. data/spec/test_app/app/models/util.rb +19 -0
  90. data/spec/test_app/app/views/admin/categories/_form.html.haml +18 -0
  91. data/spec/test_app/app/views/admin/categories/_list.html.haml +17 -0
  92. data/spec/test_app/app/views/admin/categories/edit.html.haml +6 -0
  93. data/spec/test_app/app/views/admin/categories/index.html.haml +6 -0
  94. data/spec/test_app/app/views/admin/categories/new.html.haml +6 -0
  95. data/spec/test_app/app/views/admin/categories/show.html.haml +27 -0
  96. data/spec/test_app/app/views/admin/users/_form.html.haml +49 -0
  97. data/spec/test_app/app/views/admin/users/_head.html.haml +5 -0
  98. data/spec/test_app/app/views/admin/users/_list.html.haml +20 -0
  99. data/spec/test_app/app/views/admin/users/_search.html.haml +9 -0
  100. data/spec/test_app/app/views/admin/users/deleted.html.haml +5 -0
  101. data/spec/test_app/app/views/admin/users/edit.html.haml +5 -0
  102. data/spec/test_app/app/views/admin/users/index.html.haml +7 -0
  103. data/spec/test_app/app/views/admin/users/new.html.haml +6 -0
  104. data/spec/test_app/app/views/clearance_mailer/change_password.erb +9 -0
  105. data/spec/test_app/app/views/conferences/_categories_list.html.haml +8 -0
  106. data/spec/test_app/app/views/conferences/_form.html.haml +32 -0
  107. data/spec/test_app/app/views/conferences/_head.html.haml +4 -0
  108. data/spec/test_app/app/views/conferences/_list.html.haml +22 -0
  109. data/spec/test_app/app/views/conferences/_search.html.haml +24 -0
  110. data/spec/test_app/app/views/conferences/edit.html.haml +8 -0
  111. data/spec/test_app/app/views/conferences/index.html.haml +22 -0
  112. data/spec/test_app/app/views/conferences/new.html.haml +9 -0
  113. data/spec/test_app/app/views/conferences/search.html.haml +7 -0
  114. data/spec/test_app/app/views/conferences/show.html.haml +78 -0
  115. data/spec/test_app/app/views/invitations/index.html.haml +26 -0
  116. data/spec/test_app/app/views/invitations/new.html.haml +22 -0
  117. data/spec/test_app/app/views/layouts/_flashes.html.haml +13 -0
  118. data/spec/test_app/app/views/layouts/_javascript_requirement.html.haml +8 -0
  119. data/spec/test_app/app/views/layouts/_javascripts.html.haml +4 -0
  120. data/spec/test_app/app/views/layouts/_notifications.html.haml +11 -0
  121. data/spec/test_app/app/views/layouts/_session_navigation.html.haml +12 -0
  122. data/spec/test_app/app/views/layouts/_stylesheets.html.haml +6 -0
  123. data/spec/test_app/app/views/layouts/screen.html.haml +30 -0
  124. data/spec/test_app/app/views/members/index.html.haml +40 -0
  125. data/spec/test_app/app/views/passwords/edit.html.haml +21 -0
  126. data/spec/test_app/app/views/passwords/new.html.haml +14 -0
  127. data/spec/test_app/app/views/sessions/new.html.haml +19 -0
  128. data/spec/test_app/app/views/users/_form.html.haml +45 -0
  129. data/spec/test_app/app/views/users/_head.html.haml +3 -0
  130. data/spec/test_app/app/views/users/edit.html.haml +5 -0
  131. data/spec/test_app/app/views/users/new.html.haml +6 -0
  132. data/spec/test_app/app/views/users/show.html.haml +49 -0
  133. data/spec/test_app/assets/data.json +981 -0
  134. data/spec/test_app/config/boot.rb +125 -0
  135. data/spec/test_app/config/cucumber.yml +8 -0
  136. data/spec/test_app/config/database.sample.yml +24 -0
  137. data/spec/test_app/config/deploy/production.rb +9 -0
  138. data/spec/test_app/config/deploy.rb +100 -0
  139. data/spec/test_app/config/environment.rb +27 -0
  140. data/spec/test_app/config/environments/cucumber.rb +28 -0
  141. data/spec/test_app/config/environments/development.rb +22 -0
  142. data/spec/test_app/config/environments/production.rb +35 -0
  143. data/spec/test_app/config/environments/test.rb +30 -0
  144. data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
  145. data/spec/test_app/config/initializers/clearance.rb +5 -0
  146. data/spec/test_app/config/initializers/collect_hash.rb +23 -0
  147. data/spec/test_app/config/initializers/collection_path_with_params.rb +18 -0
  148. data/spec/test_app/config/initializers/cookie_verification_secret.rb +10 -0
  149. data/spec/test_app/config/initializers/form_builder.rb +166 -0
  150. data/spec/test_app/config/initializers/inflections.rb +10 -0
  151. data/spec/test_app/config/initializers/invert_ordered_hash.rb +12 -0
  152. data/spec/test_app/config/initializers/localize_textfield_input_for_numbers.rb +30 -0
  153. data/spec/test_app/config/initializers/mime_types.rb +7 -0
  154. data/spec/test_app/config/initializers/new_rails_defaults.rb +21 -0
  155. data/spec/test_app/config/initializers/preload_associations.rb +7 -0
  156. data/spec/test_app/config/initializers/query_diet.rb +6 -0
  157. data/spec/test_app/config/initializers/saner_field_with_errors.rb +5 -0
  158. data/spec/test_app/config/initializers/session_store.rb +18 -0
  159. data/spec/test_app/config/locales/en.yml +231 -0
  160. data/spec/test_app/config/preinitializer.rb +22 -0
  161. data/spec/test_app/config/routes.rb +47 -0
  162. data/spec/test_app/db/migrate/20110114164517_initial_tables.rb +52 -0
  163. data/spec/test_app/db/migrate/20110118090858_add_profile_fields_to_user.rb +15 -0
  164. data/spec/test_app/db/migrate/20110118092741_create_conference.rb +20 -0
  165. data/spec/test_app/db/migrate/20110118093503_create_category.rb +17 -0
  166. data/spec/test_app/db/migrate/20110118104438_create_conference_category.rb +16 -0
  167. data/spec/test_app/db/migrate/20110118105959_create_attendance.rb +17 -0
  168. data/spec/test_app/db/migrate/20110118122324_create_friendship_requests.rb +15 -0
  169. data/spec/test_app/db/migrate/20110118162436_create_invitation.rb +16 -0
  170. data/spec/test_app/db/migrate/20110118170347_create_friendships.rb +15 -0
  171. data/spec/test_app/db/migrate/20110118193528_add_timestamps_to_conference.rb +12 -0
  172. data/spec/test_app/db/migrate/20110119075012_set_unique_index_on_username_for_user.rb +11 -0
  173. data/spec/test_app/db/migrate/20110119093458_remove_first_and_last_name_from_user.rb +12 -0
  174. data/spec/test_app/db/migrate/20110119110857_add_missing_indexes.rb +23 -0
  175. data/spec/test_app/db/migrate/20110119115751_add_uniqueness_of_name_to_category.rb +9 -0
  176. data/spec/test_app/db/seeds.rb +5 -0
  177. data/spec/test_app/lib/scripts/create_many_users_sql.rb +14 -0
  178. data/spec/test_app/lib/tasks/cucumber.rake +53 -0
  179. data/spec/test_app/lib/tasks/pending_migrations.rake +24 -0
  180. data/spec/test_app/lib/tasks/rcov.rake +42 -0
  181. data/spec/test_app/lib/tasks/rspec.rake +144 -0
  182. data/spec/test_app/public/404.html +30 -0
  183. data/spec/test_app/public/422.html +30 -0
  184. data/spec/test_app/public/500.html +30 -0
  185. data/spec/test_app/public/favicon.ico +0 -0
  186. data/spec/test_app/public/images/ajax-loader.gif +0 -0
  187. data/spec/test_app/public/images/icons/balloon-quotation.png +0 -0
  188. data/spec/test_app/public/images/icons/balloon-sound.png +0 -0
  189. data/spec/test_app/public/images/icons/balloon.png +0 -0
  190. data/spec/test_app/public/images/icons/bell.png +0 -0
  191. data/spec/test_app/public/images/icons/bin.png +0 -0
  192. data/spec/test_app/public/images/icons/bookmark.png +0 -0
  193. data/spec/test_app/public/images/icons/cake.png +0 -0
  194. data/spec/test_app/public/images/icons/calendar-blue.png +0 -0
  195. data/spec/test_app/public/images/icons/calendar-month.png +0 -0
  196. data/spec/test_app/public/images/icons/calendar-month_light.png +0 -0
  197. data/spec/test_app/public/images/icons/calendar-select.png +0 -0
  198. data/spec/test_app/public/images/icons/card-address.png +0 -0
  199. data/spec/test_app/public/images/icons/cards-address.png +0 -0
  200. data/spec/test_app/public/images/icons/cross-script.png +0 -0
  201. data/spec/test_app/public/images/icons/cross-small.png +0 -0
  202. data/spec/test_app/public/images/icons/cross.png +0 -0
  203. data/spec/test_app/public/images/icons/crown-silver.png +0 -0
  204. data/spec/test_app/public/images/icons/crown.png +0 -0
  205. data/spec/test_app/public/images/icons/dashboard.png +0 -0
  206. data/spec/test_app/public/images/icons/document-list.png +0 -0
  207. data/spec/test_app/public/images/icons/document-node.png +0 -0
  208. data/spec/test_app/public/images/icons/document-number.png +0 -0
  209. data/spec/test_app/public/images/icons/document-stamp.png +0 -0
  210. data/spec/test_app/public/images/icons/document-task.png +0 -0
  211. data/spec/test_app/public/images/icons/document-text.png +0 -0
  212. data/spec/test_app/public/images/icons/fire.png +0 -0
  213. data/spec/test_app/public/images/icons/folder-medium.png +0 -0
  214. data/spec/test_app/public/images/icons/folder.png +0 -0
  215. data/spec/test_app/public/images/icons/gear.png +0 -0
  216. data/spec/test_app/public/images/icons/globe-green.png +0 -0
  217. data/spec/test_app/public/images/icons/globe-green_light.png +0 -0
  218. data/spec/test_app/public/images/icons/globe-medium-green.png +0 -0
  219. data/spec/test_app/public/images/icons/heart-break.png +0 -0
  220. data/spec/test_app/public/images/icons/heart.png +0 -0
  221. data/spec/test_app/public/images/icons/images-flickr.png +0 -0
  222. data/spec/test_app/public/images/icons/information-balloon.png +0 -0
  223. data/spec/test_app/public/images/icons/key.png +0 -0
  224. data/spec/test_app/public/images/icons/light-bulb.png +0 -0
  225. data/spec/test_app/public/images/icons/lock--exclamation.png +0 -0
  226. data/spec/test_app/public/images/icons/lock.png +0 -0
  227. data/spec/test_app/public/images/icons/magnifier-medium.png +0 -0
  228. data/spec/test_app/public/images/icons/magnifier.png +0 -0
  229. data/spec/test_app/public/images/icons/mail.png +0 -0
  230. data/spec/test_app/public/images/icons/paper-clip-small.png +0 -0
  231. data/spec/test_app/public/images/icons/paper-clip.png +0 -0
  232. data/spec/test_app/public/images/icons/pencil.png +0 -0
  233. data/spec/test_app/public/images/icons/plus-circle.png +0 -0
  234. data/spec/test_app/public/images/icons/plus-small.png +0 -0
  235. data/spec/test_app/public/images/icons/plus.png +0 -0
  236. data/spec/test_app/public/images/icons/printer.png +0 -0
  237. data/spec/test_app/public/images/icons/question-balloon.png +0 -0
  238. data/spec/test_app/public/images/icons/question-white.png +0 -0
  239. data/spec/test_app/public/images/icons/question.png +0 -0
  240. data/spec/test_app/public/images/icons/quill.png +0 -0
  241. data/spec/test_app/public/images/icons/robot.png +0 -0
  242. data/spec/test_app/public/images/icons/ruby_16.png +0 -0
  243. data/spec/test_app/public/images/icons/ruby_2_16.png +0 -0
  244. data/spec/test_app/public/images/icons/ruby_32.png +0 -0
  245. data/spec/test_app/public/images/icons/show.png +0 -0
  246. data/spec/test_app/public/images/icons/star.png +0 -0
  247. data/spec/test_app/public/images/icons/sticky-note-text.png +0 -0
  248. data/spec/test_app/public/images/icons/telephone-fax.png +0 -0
  249. data/spec/test_app/public/images/icons/telephone-fax_light.png +0 -0
  250. data/spec/test_app/public/images/icons/telephone.png +0 -0
  251. data/spec/test_app/public/images/icons/telephone_light.png +0 -0
  252. data/spec/test_app/public/images/icons/thumb-up.png +0 -0
  253. data/spec/test_app/public/images/icons/thumb.png +0 -0
  254. data/spec/test_app/public/images/icons/tick.png +0 -0
  255. data/spec/test_app/public/images/icons/trophy-silver.png +0 -0
  256. data/spec/test_app/public/images/icons/trophy.png +0 -0
  257. data/spec/test_app/public/images/icons/user-gray.png +0 -0
  258. data/spec/test_app/public/images/icons/user-gray_gray.png +0 -0
  259. data/spec/test_app/public/images/icons/user-medium.png +0 -0
  260. data/spec/test_app/public/images/icons/user-red.png +0 -0
  261. data/spec/test_app/public/images/icons/users.png +0 -0
  262. data/spec/test_app/public/images/icons/users_gray.png +0 -0
  263. data/spec/test_app/public/images/icons/xfn.png +0 -0
  264. data/spec/test_app/public/images/legend_bg.png +0 -0
  265. data/spec/test_app/public/images/poshytip/tip-deepgray.png +0 -0
  266. data/spec/test_app/public/images/poshytip/tip-deepgray_arrows.png +0 -0
  267. data/spec/test_app/public/images/stripes_bottom_dark.png +0 -0
  268. data/spec/test_app/public/images/stripes_top_dark.png +0 -0
  269. data/spec/test_app/public/images/ui/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  270. data/spec/test_app/public/images/ui/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  271. data/spec/test_app/public/images/ui/ui-bg_flat_10_000000_40x100.png +0 -0
  272. data/spec/test_app/public/images/ui/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  273. data/spec/test_app/public/images/ui/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  274. data/spec/test_app/public/images/ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  275. data/spec/test_app/public/images/ui/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  276. data/spec/test_app/public/images/ui/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  277. data/spec/test_app/public/images/ui/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  278. data/spec/test_app/public/images/ui/ui-icons_222222_256x240.png +0 -0
  279. data/spec/test_app/public/images/ui/ui-icons_228ef1_256x240.png +0 -0
  280. data/spec/test_app/public/images/ui/ui-icons_ef8c08_256x240.png +0 -0
  281. data/spec/test_app/public/images/ui/ui-icons_ffd27a_256x240.png +0 -0
  282. data/spec/test_app/public/images/ui/ui-icons_ffffff_256x240.png +0 -0
  283. data/spec/test_app/public/javascripts/application.js +175 -0
  284. data/spec/test_app/public/javascripts/lib/jquery-1.4.2.min.js +154 -0
  285. data/spec/test_app/public/javascripts/lib/jquery-ui-1.8.5.custom.min.js +249 -0
  286. data/spec/test_app/public/javascripts/lib/jquery-ui-1.8.5.custom.min.txt +9 -0
  287. data/spec/test_app/public/javascripts/lib/jquery-ui-timepicker-addon.js +682 -0
  288. data/spec/test_app/public/javascripts/lib/jquery-ui-timepicker-addon.min.js +22 -0
  289. data/spec/test_app/public/javascripts/lib/jquery.elastic.js +6 -0
  290. data/spec/test_app/public/javascripts/lib/jquery.elastic.performance.js +128 -0
  291. data/spec/test_app/public/javascripts/lib/jquery.elastic.source.js +117 -0
  292. data/spec/test_app/public/javascripts/lib/jquery.poshytip.js +414 -0
  293. data/spec/test_app/public/javascripts/lib/jquery.poshytip.min.js +7 -0
  294. data/spec/test_app/public/javascripts/lib/jquery.ui.datepicker-de.js +23 -0
  295. data/spec/test_app/public/javascripts/lib/jrails.js +1 -0
  296. data/spec/test_app/public/javascripts/lib/multiple-autocomplete.js +39 -0
  297. data/spec/test_app/public/javascripts/lib/underscore-min.js +17 -0
  298. data/spec/test_app/public/javascripts/lib/underscore.js +704 -0
  299. data/spec/test_app/public/robots.txt +5 -0
  300. data/spec/test_app/public/stylesheets/lib/PIE.htc +77 -0
  301. data/spec/test_app/public/stylesheets/lib/PIE_uncompressed.htc +3064 -0
  302. data/spec/test_app/public/stylesheets/lib/jquery-ui-timepicker-addon.css +11 -0
  303. data/spec/test_app/public/stylesheets/lib/poshytip/tip-darkgray/tip-darkgray.css +62 -0
  304. data/spec/test_app/public/stylesheets/lib/poshytip/tip-darkgray/tip-darkgray.png +0 -0
  305. data/spec/test_app/public/stylesheets/lib/poshytip/tip-darkgray/tip-darkgray_arrows.png +0 -0
  306. data/spec/test_app/public/stylesheets/lib/poshytip/tip-deepgray/tip-deepgray.css +64 -0
  307. data/spec/test_app/public/stylesheets/lib/poshytip/tip-green/tip-green.css +57 -0
  308. data/spec/test_app/public/stylesheets/lib/poshytip/tip-green/tip-green_arrows.gif +0 -0
  309. data/spec/test_app/public/stylesheets/lib/poshytip/tip-skyblue/tip-skyblue.css +58 -0
  310. data/spec/test_app/public/stylesheets/lib/poshytip/tip-skyblue/tip-skyblue.png +0 -0
  311. data/spec/test_app/public/stylesheets/lib/poshytip/tip-skyblue/tip-skyblue_arrows.png +0 -0
  312. data/spec/test_app/public/stylesheets/lib/poshytip/tip-twitter/tip-twitter.css +59 -0
  313. data/spec/test_app/public/stylesheets/lib/poshytip/tip-twitter/tip-twitter_arrows.gif +0 -0
  314. data/spec/test_app/public/stylesheets/lib/poshytip/tip-violet/tip-violet.css +60 -0
  315. data/spec/test_app/public/stylesheets/lib/poshytip/tip-violet/tip-violet.png +0 -0
  316. data/spec/test_app/public/stylesheets/lib/poshytip/tip-violet/tip-violet_arrows.png +0 -0
  317. data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellow/tip-yellow.css +60 -0
  318. data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellow/tip-yellow.png +0 -0
  319. data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellow/tip-yellow_arrows.png +0 -0
  320. data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellowsimple/tip-yellowsimple.css +60 -0
  321. data/spec/test_app/public/stylesheets/lib/poshytip/tip-yellowsimple/tip-yellowsimple_arrows.gif +0 -0
  322. data/spec/test_app/public/stylesheets/lib/ui-lightness/jquery-ui-1.8.5.custom.css +459 -0
  323. data/spec/test_app/public/stylesheets/sass/_mixins.sass +79 -0
  324. data/spec/test_app/public/stylesheets/sass/_reset.sass +40 -0
  325. data/spec/test_app/public/stylesheets/sass/print.sass +22 -0
  326. data/spec/test_app/public/stylesheets/sass/screen.sass +866 -0
  327. data/spec/test_app/script/about +4 -0
  328. data/spec/test_app/script/autospec +6 -0
  329. data/spec/test_app/script/console +3 -0
  330. data/spec/test_app/script/cucumber +10 -0
  331. data/spec/test_app/script/dbconsole +3 -0
  332. data/spec/test_app/script/destroy +3 -0
  333. data/spec/test_app/script/generate +3 -0
  334. data/spec/test_app/script/performance/benchmarker +3 -0
  335. data/spec/test_app/script/performance/profiler +3 -0
  336. data/spec/test_app/script/plugin +3 -0
  337. data/spec/test_app/script/runner +3 -0
  338. data/spec/test_app/script/server +3 -0
  339. data/spec/test_app/script/spec +10 -0
  340. metadata +748 -0
@@ -0,0 +1,39 @@
1
+ # Provides an index action with includes, an order, find-as-you-type search, pagination and an option to see deletable records.
2
+ # origin: RM
3
+ module BoringControllerTrait::IndexTrait
4
+ as_trait do |options|
5
+
6
+ afterlife = options.delete(:afterlife) || :deleted
7
+ show_afterlife = "show_#{afterlife}"
8
+ with_afterlife = "with_#{afterlife}"
9
+
10
+ index.wants.html do
11
+ render :partial => "list" if request.xhr?
12
+ end
13
+
14
+ private
15
+
16
+ define_method :collection do
17
+ list = collection_scope
18
+ list = list.scoped(:include => options[:include]) if options[:include]
19
+ list = list.scoped(:order => options[:order]) if options[:order]
20
+ list = list.send(with_afterlife, params[show_afterlife] == '1') if list.respond_to?(with_afterlife)
21
+ list = list.search(*search_args) if list.respond_to?(:search) && params[:query].present?
22
+ list = paginate(list)
23
+ list
24
+ end
25
+
26
+ define_method :collection_scope do
27
+ end_of_association_chain
28
+ end
29
+
30
+ define_method :paginate do |scope|
31
+ scope.paginate(:page => params[:page], :per_page => PAGE_SIZE)
32
+ end
33
+
34
+ define_method :search_args do
35
+ params[:query]
36
+ end
37
+
38
+ end
39
+ end
@@ -0,0 +1,18 @@
1
+ # Configures a resource_controller to automatically set a user performing a record change.
2
+ # origin: RM
3
+ module BoringControllerTrait::LogChangesTrait
4
+ as_trait do
5
+
6
+ [:object, :build_object].each do |method|
7
+ define_method method do |*args|
8
+ super.tap do |record|
9
+ if record.present? && record.respond_to?(:changing_user=)
10
+ record.changing_user = current_user
11
+ # the actual logging takes place in the object model after saving
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ # Provides a resource_controller preconfigured with options you want 99% of the time. Used by most controllers that do CRUD.
2
+ # origin: RM
3
+ module BoringControllerTrait
4
+ as_trait do |*options|
5
+
6
+ options = options.first || {}
7
+
8
+ options[:singleton] ? resource_controller(:singleton) : resource_controller
9
+
10
+ does 'boring_controller_trait/flash'
11
+ does 'boring_controller_trait/deletable' unless options[:destroy_is_permanent]
12
+ does 'boring_controller_trait/index', options unless options[:singleton]
13
+ does 'boring_controller_trait/helpers', options
14
+
15
+ end
16
+ end
@@ -0,0 +1,49 @@
1
+ # Provides user sign up, the user status pages and sends friendship requests to individual users.
2
+ # origin: RM
3
+ class UsersController < ApplicationController
4
+
5
+ public_controller :only => [:new, :create]
6
+
7
+ does 'boring_controller'
8
+
9
+ permissions :users
10
+ in_sections :members
11
+
12
+ new_action do
13
+ before { set_sections_for_sign_up }
14
+ end
15
+
16
+ update do
17
+ flash 'Profile updated'
18
+ end
19
+
20
+ create do
21
+ before { set_sections_for_sign_up }
22
+ flash 'Welcome!'
23
+ wants.html do
24
+ sign_in(object)
25
+ redirect_to root_path
26
+ end
27
+ end
28
+
29
+ show.before do
30
+ in_sections :profile if object == current_user
31
+ end
32
+
33
+ def request_friendship
34
+ object.friendship_requests.create! :requesting_user => current_user if current_user.can_become_friends_with? object
35
+ flash[:notice] = 'Contact requests sent'
36
+ redirect_to object_path
37
+ end
38
+
39
+ private
40
+
41
+ def set_sections_for_sign_up
42
+ in_sections :sign_up, :exclusive => true
43
+ end
44
+
45
+ def object_params
46
+ (super || {}).slice(:username, :email, :password, :password_confirmation, :full_name, :town, :country)
47
+ end
48
+
49
+ end
@@ -0,0 +1,91 @@
1
+ # Trait to format CaP objects as json.
2
+ # origin: M
3
+ module Ws::ApiController::FormattersTrait
4
+ as_trait do
5
+
6
+ def format_date(date)
7
+ date.strftime('%Y%m%d')
8
+ end
9
+
10
+ def format_version(time)
11
+ time.to_i.to_s
12
+ end
13
+
14
+ def format_conference(conference, options = {})
15
+ result = {
16
+ 'version' => format_version(conference.updated_at),
17
+ 'id' => conference.id,
18
+ 'name' => conference.name,
19
+ 'creator' => format_user(conference.user, :stub => true),
20
+ 'startdate' => format_date(conference.start_date),
21
+ 'enddate' => format_date(conference.end_date),
22
+ 'categories' => format_categories(conference.categories),
23
+ 'description' => conference.description,
24
+ 'location' => conference.address
25
+ }
26
+ if options[:stub]
27
+ result.slice!('name', 'startdate', 'enddate', 'categories')
28
+ result.merge!('details' => ws_conference_url(conference))
29
+ end
30
+ result
31
+ end
32
+
33
+ def format_conferences(conferences)
34
+ conferences.collect do |conference|
35
+ format_conference conference, :stub => true
36
+ end
37
+ end
38
+
39
+ def format_users(users)
40
+ users.collect do |user|
41
+ format_user(user, :stub => true)
42
+ end
43
+ end
44
+
45
+ def format_user(user, options = {})
46
+ result = {
47
+ 'version' => format_version(user.updated_at),
48
+ 'id' => user.id,
49
+ 'username' => user.username,
50
+ 'fullname' => user.full_name,
51
+ 'email' => user.email,
52
+ 'town' => user.town,
53
+ 'country' => user.country,
54
+ 'status' => (api_user ? api_user.status_towards(user) : 'no_contact')
55
+ }
56
+ if options[:stub]
57
+ result.slice!('username')
58
+ result.merge!('details' => ws_member_url(user.username))
59
+ end
60
+ unless options[:full_details]
61
+ result.delete('email')
62
+ result.delete('fullname')
63
+ end
64
+ result
65
+ end
66
+
67
+ def format_category(category, options = {})
68
+ { 'name' => category.name }.tap do |result|
69
+ if options[:stub]
70
+ result.merge! 'details' => ws_category_url(category)
71
+ else
72
+ mother = category.parent
73
+ children = category.children
74
+ result.merge!({
75
+ 'version' => format_version(category.updated_at),
76
+ 'id' => category.id,
77
+ 'parent' => mother.present? ? format_category(mother, :stub => true) : {},
78
+ 'subcategories' => children.collect{ |child| format_category(child, :stub => true) }
79
+ })
80
+ end
81
+ end
82
+ end
83
+
84
+ def format_categories(categories)
85
+ categories.collect do |category|
86
+ format_category category, :stub => true
87
+ end
88
+ end
89
+
90
+ end
91
+ end
@@ -0,0 +1,59 @@
1
+ # Trait to parse incoming json objects
2
+ # origin: M
3
+ module Ws::ApiController::ParsersTrait
4
+ as_trait do
5
+
6
+ def find_user(user)
7
+ if user
8
+ User.find_by_username(user['username'])
9
+ end
10
+ end
11
+
12
+ def find_categories(categories)
13
+ if categories
14
+ Category.find_all_by_name(categories.collect { |category| category['name'] }).collect(&:id)
15
+ else
16
+ []
17
+ end
18
+ end
19
+
20
+ def find_category(name)
21
+ Category.find_by_name(name) if name
22
+ end
23
+
24
+ def compact_hash!(hash)
25
+ hash.delete_if { |key, value| value.nil? }
26
+ end
27
+
28
+ def parse_conference(conference)
29
+ compact_hash!(
30
+ :name => conference['name'],
31
+ :user => find_user(conference['creator']),
32
+ :start_date => conference['startdate'],
33
+ :end_date => conference['enddate'],
34
+ :category_list => find_categories(conference['categories']),
35
+ :description => conference['description'],
36
+ :address => conference['location']
37
+ )
38
+ end
39
+
40
+ def parse_category(category)
41
+ {
42
+ :name => category['name'],
43
+ :parent => find_category(category['parent'].andand['name'])
44
+ }
45
+ end
46
+
47
+ def parse_user(user)
48
+ compact_hash!(
49
+ :username => user['username'],
50
+ :password => user['password'],
51
+ :password_confirmation => user['password'],
52
+ :full_name => user['fullname'],
53
+ :email => user['email'],
54
+ :town => user['town'],
55
+ :country => user['country']
56
+ )
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,70 @@
1
+ # Base class for all webservice controllers; defines common functionality like authorization.
2
+ # origin: M
3
+ class Ws::ApiController < ActionController::Base
4
+
5
+ does 'ws/api_controller/parsers'
6
+ does 'ws/api_controller/formatters'
7
+
8
+ before_filter :authenticate
9
+ before_filter :deny_guest
10
+ around_filter :rescue_exceptions
11
+
12
+ attr_reader :api_user
13
+
14
+ def json_params
15
+ unless @json_params
16
+ @json_params = params.dup
17
+ @json_params.delete(:controller)
18
+ @json_params.delete(:action)
19
+ @json_params
20
+ end
21
+ @json_params
22
+ end
23
+
24
+ def validate_version!(record, version)
25
+ unless record.updated_at.to_i.to_s == version
26
+ raise ActiveRecord::StaleObjectError
27
+ end
28
+ end
29
+
30
+ def self.public_actions(*actions)
31
+ skip_before_filter :deny_guest, :only => actions
32
+ end
33
+
34
+ def render_no_content
35
+ render :status => 204, :text => ''
36
+ end
37
+
38
+ def render_not_implemented
39
+ render :status => 501, :text => ''
40
+ end
41
+
42
+ private
43
+
44
+ def rescue_exceptions
45
+ yield
46
+ rescue Aegis::AccessDenied
47
+ render :status => '403', :text => ''
48
+ rescue ActiveRecord::RecordNotFound
49
+ render :status => '404', :text => ''
50
+ rescue ActiveRecord::StaleObjectError
51
+ render :status => '409', :text => ''
52
+ rescue => exception
53
+ render :status => '400', :text => ''
54
+ end
55
+
56
+ def authenticate
57
+ authenticate_with_http_basic do |username, password|
58
+ @api_user = api_user_from_credentials(username, password)
59
+ end
60
+ true
61
+ end
62
+
63
+ def deny_guest
64
+ request_http_basic_authentication('CaP Webservice') unless api_user
65
+ end
66
+
67
+ def api_user_from_credentials(username, password)
68
+ User.authenticate(username, password)
69
+ end
70
+ end
@@ -0,0 +1,43 @@
1
+ # Controller for /ws/conference/{id}/attendees
2
+ # origin: M
3
+ class Ws::AttendeesController < Ws::ApiController
4
+
5
+ public_actions :index
6
+
7
+ def index
8
+ conference = Conference.find(params[:conference_id])
9
+ attendees = conference.attendees
10
+ if attendees.any?
11
+ render :json => format_users(conference.attendees)
12
+ else
13
+ render_no_content
14
+ end
15
+ end
16
+
17
+ def create
18
+ conference = Conference.find(params[:conference_id])
19
+ api_user.may_attend_conference!(conference)
20
+ username = json_params['username']
21
+ if username != api_user.username
22
+ raise Aegis::AccessDenied
23
+ end
24
+
25
+ conference.attend!(api_user)
26
+
27
+ render_no_content
28
+ end
29
+
30
+ def destroy
31
+ conference = Conference.find(params[:conference_id])
32
+ api_user.may_cancel_attendance_conference!(conference)
33
+ username = params[:id]
34
+ if username != api_user.username
35
+ raise Aegis::AccessDenied
36
+ end
37
+
38
+ conference.cancel_attendance!(api_user)
39
+
40
+ render_no_content
41
+ end
42
+
43
+ end
@@ -0,0 +1,30 @@
1
+ # Controller for /ws/categories
2
+ # origin: M
3
+ class Ws::CategoriesController < Ws::ApiController
4
+
5
+ public_actions :index, :show
6
+
7
+ def index
8
+ root_categories = Category.roots
9
+ if root_categories.any?
10
+ render :json => format_categories(root_categories)
11
+ else
12
+ render_no_content
13
+ end
14
+ end
15
+
16
+ def create
17
+ api_user.may_create_category!
18
+
19
+ category = Category.new(parse_category(json_params))
20
+
21
+ category.save!
22
+ render :json => format_category(category)
23
+ end
24
+
25
+ def show
26
+ category = Category.find(params[:id])
27
+ render :json => format_category(category)
28
+ end
29
+
30
+ end
@@ -0,0 +1,62 @@
1
+ # Controller for /ws/conferences
2
+ # origin: M
3
+ class Ws::ConferencesController < Ws::ApiController
4
+
5
+ public_actions :show, :by_category, :search
6
+
7
+ def show
8
+ conference = Conference.find(params[:id])
9
+ render :json => format_conference(conference)
10
+ end
11
+
12
+ def create
13
+ api_user.may_create_conference!
14
+
15
+ conference = Conference.new(parse_conference(json_params))
16
+ set_conference_fields(conference)
17
+
18
+ conference.save!
19
+ render :json => format_conference(conference)
20
+ end
21
+
22
+ def update
23
+ conference = Conference.find(params[:conference_id])
24
+ api_user.may_update_conference!(conference)
25
+
26
+ conference.attributes = parse_conference(json_params)
27
+ set_conference_fields(conference)
28
+
29
+ validate_version!(conference, json_params['version'])
30
+
31
+ conference.save!
32
+ render :json => format_conference(conference)
33
+ end
34
+
35
+ def by_category
36
+ category = Category.find params[:category_id]
37
+ if category.conferences.any?
38
+ render :json => format_conferences(category.conferences)
39
+ else
40
+ render_no_content
41
+ end
42
+ end
43
+
44
+ def search
45
+ conferences = ConferenceSearch.new(params.slice(:query) || {}).find
46
+ if conferences.any?
47
+ render :json => format_conferences(conferences)
48
+ else
49
+ render_no_content
50
+ end
51
+ end
52
+
53
+ private
54
+
55
+ def set_conference_fields(conference)
56
+ conference.user ||= api_user
57
+ if conference.user != api_user
58
+ raise Aegis::AccessDenied
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,41 @@
1
+ # Controller for /ws/contacts
2
+ # origin: M
3
+ class Ws::ContactsController < Ws::ApiController
4
+
5
+ public_actions :index
6
+
7
+ def index
8
+ user = User.find_by_username!(params[:member_id])
9
+ if user == api_user
10
+ contacts = user.contacts
11
+ else
12
+ contacts = user.friends
13
+ end
14
+
15
+ if contacts.any?
16
+ render :json => format_users(contacts)
17
+ else
18
+ render_no_content
19
+ end
20
+ end
21
+
22
+ def create
23
+ user = User.find_by_username!(params[:member_id])
24
+ positive = !!(json_params['positive'] or json_params['positive'] == 'true')
25
+ case api_user.status_towards(user)
26
+ when 'RCD_received'
27
+ request = api_user.friendship_requests.find(:first, :conditions => {:requesting_user_id => user.id})
28
+ if positive
29
+ request.accept
30
+ else
31
+ request.deny
32
+ end
33
+ when 'no_contact'
34
+ if positive
35
+ api_user.sent_friendship_requests.create!(:user_id => user.id)
36
+ end
37
+ end
38
+ render_no_content
39
+ end
40
+
41
+ end
@@ -0,0 +1,45 @@
1
+ # Controller for /ws/reset and /ws/factorydefaults
2
+ # origin: M
3
+ class Ws::FactoryController < Ws::ApiController
4
+
5
+ def reset
6
+ api_user.may_reset_application_state!
7
+
8
+ clean_and_create_admin!
9
+
10
+ render_no_content
11
+ end
12
+
13
+ def factorydefaults
14
+ api_user.may_reset_application_state!
15
+
16
+ clean_and_create_admin!
17
+
18
+ users, categories, series, conferences = JSON.parse(File.read("#{Rails.root}/assets/data.json"))
19
+
20
+ users.each do |user|
21
+ User.create(parse_user(user))
22
+ end
23
+
24
+ categories.each do |category|
25
+ Category.create(parse_category(category))
26
+ end
27
+
28
+ conferences.each do |conference|
29
+ Conference.create(parse_conference(conference))
30
+ end
31
+
32
+ render_no_content
33
+ end
34
+
35
+ private
36
+
37
+ def clean_and_create_admin!
38
+ [Attendance, Category, ConferenceCategory, Conference, FriendshipRequest, Friendship, Invitation, User].each do |model|
39
+ model.delete_all
40
+ end
41
+
42
+ User.create_admin!
43
+ end
44
+
45
+ end
@@ -0,0 +1,34 @@
1
+ # Controller for /ws/members
2
+ # origin: M
3
+ class Ws::MembersController < Ws::ApiController
4
+
5
+ public_actions :create
6
+
7
+ def create
8
+ user = User.new(parse_user(json_params))
9
+
10
+ user.save!
11
+ render :json => format_user(user, :full_details => true)
12
+ end
13
+
14
+ def show
15
+ user = User.find_by_username!(params[:id])
16
+
17
+ render :json => format_user(user, :full_details => api_user.sees_details_of?(user))
18
+ end
19
+
20
+ def update
21
+ user = User.find_by_username!(params[:user_id])
22
+ unless user == api_user
23
+ raise Aegis::AccessDenied
24
+ end
25
+
26
+ user.attributes = parse_user(json_params)
27
+
28
+ validate_version!(user, json_params['version'])
29
+
30
+ user.save!
31
+ render :json => format_user(user, :full_details => true)
32
+ end
33
+
34
+ end
@@ -0,0 +1,19 @@
1
+ # Controller for /ws/series
2
+ # origin: M
3
+ class Ws::SeriesController < Ws::ApiController
4
+
5
+ public_actions :index, :show, :create
6
+
7
+ def index
8
+ render_not_implemented
9
+ end
10
+
11
+ def create
12
+ render_not_implemented
13
+ end
14
+
15
+ def show
16
+ render_not_implemented
17
+ end
18
+
19
+ end
@@ -0,0 +1,23 @@
1
+ # Dummy controller to test some common webservice functionality; only used in specs
2
+ # origin: M
3
+ class Ws::TestsController < Ws::ApiController
4
+
5
+ def index
6
+ render :json => {'foo' => 'bar'}
7
+ end
8
+
9
+ def no_access
10
+ raise Aegis::AccessDenied
11
+ end
12
+
13
+ def error
14
+ raise "foo"
15
+ end
16
+
17
+ public_actions :public
18
+
19
+ def public
20
+ render :json => {'foo' => 'bar'}
21
+ end
22
+
23
+ end