tournament 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. data/History.txt +15 -0
  2. data/Manifest.txt +241 -2
  3. data/README.txt +152 -12
  4. data/Rakefile +9 -6
  5. data/bin/benchmark_pool +0 -0
  6. data/bin/gui.rb +3 -1
  7. data/bin/picker +0 -0
  8. data/bin/pool +139 -15
  9. data/lib/tournament/bracket.rb +33 -50
  10. data/lib/tournament/entry.rb +3 -0
  11. data/lib/tournament/pool.rb +144 -93
  12. data/lib/tournament/scoring_strategy.rb +69 -0
  13. data/lib/tournament/webgui_installer.rb +109 -0
  14. data/tasks/ann.rake +19 -14
  15. data/tasks/bones.rake +6 -25
  16. data/tasks/gem.rake +46 -36
  17. data/tasks/git.rake +41 -0
  18. data/tasks/jamis.rb +589 -0
  19. data/tasks/notes.rake +28 -0
  20. data/tasks/post_load.rake +18 -11
  21. data/tasks/{doc.rake → rdoc.rake} +12 -9
  22. data/tasks/rubyforge.rake +12 -12
  23. data/tasks/setup.rb +121 -80
  24. data/tasks/spec.rake +12 -13
  25. data/tasks/svn.rake +15 -11
  26. data/tasks/test.rake +6 -6
  27. data/test/test_tournament.rb +8 -0
  28. data/test/test_webgui_installer.rb +64 -0
  29. data/webgui/README +256 -0
  30. data/webgui/Rakefile +10 -0
  31. data/webgui/app/controllers/admin_controller.rb +61 -0
  32. data/webgui/app/controllers/application.rb +25 -0
  33. data/webgui/app/controllers/entry_controller.rb +97 -0
  34. data/webgui/app/controllers/pool_controller.rb +4 -0
  35. data/webgui/app/controllers/reports_controller.rb +7 -0
  36. data/webgui/app/controllers/sessions_controller.rb +43 -0
  37. data/webgui/app/controllers/teams_controller.rb +75 -0
  38. data/webgui/app/controllers/users_controller.rb +57 -0
  39. data/webgui/app/helpers/admin_helper.rb +2 -0
  40. data/webgui/app/helpers/application_helper.rb +3 -0
  41. data/webgui/app/helpers/entry_helper.rb +2 -0
  42. data/webgui/app/helpers/pool_helper.rb +2 -0
  43. data/webgui/app/helpers/reports_helper.rb +2 -0
  44. data/webgui/app/helpers/sessions_helper.rb +2 -0
  45. data/webgui/app/helpers/teams_helper.rb +2 -0
  46. data/webgui/app/helpers/users_helper.rb +93 -0
  47. data/webgui/app/models/entry.rb +42 -0
  48. data/webgui/app/models/pool.rb +141 -0
  49. data/webgui/app/models/region.rb +3 -0
  50. data/webgui/app/models/role.rb +4 -0
  51. data/webgui/app/models/seeding.rb +4 -0
  52. data/webgui/app/models/team.rb +6 -0
  53. data/webgui/app/models/user.rb +98 -0
  54. data/webgui/app/models/user_mailer.rb +25 -0
  55. data/webgui/app/views/admin/bracket.html.erb +3 -0
  56. data/webgui/app/views/admin/entries.html.erb +25 -0
  57. data/webgui/app/views/admin/index.html.erb +17 -0
  58. data/webgui/app/views/admin/pool.html.erb +53 -0
  59. data/webgui/app/views/entry/index.html.erb +16 -0
  60. data/webgui/app/views/entry/print.erb +1 -0
  61. data/webgui/app/views/entry/print.html.erb +1 -0
  62. data/webgui/app/views/entry/show.html.erb +1 -0
  63. data/webgui/app/views/layouts/bracket.html.erb +37 -0
  64. data/webgui/app/views/layouts/default.html.erb +62 -0
  65. data/webgui/app/views/layouts/print.html.erb +12 -0
  66. data/webgui/app/views/layouts/report.html.erb +38 -0
  67. data/webgui/app/views/pool/index.html.erb +36 -0
  68. data/webgui/app/views/reports/_report.html.erb +11 -0
  69. data/webgui/app/views/reports/show.html.erb +12 -0
  70. data/webgui/app/views/sessions/new.html.erb +21 -0
  71. data/webgui/app/views/shared/_admins.html.erb +8 -0
  72. data/webgui/app/views/shared/_bracket.html.erb +1296 -0
  73. data/webgui/app/views/teams/choose.html.erb +57 -0
  74. data/webgui/app/views/user_mailer/activation.erb +3 -0
  75. data/webgui/app/views/user_mailer/signup_notification.erb +8 -0
  76. data/webgui/app/views/users/_user_bar.html.erb +8 -0
  77. data/webgui/app/views/users/new.html.erb +19 -0
  78. data/webgui/config/boot.rb +109 -0
  79. data/webgui/config/database.yml +22 -0
  80. data/webgui/config/environment.rb +78 -0
  81. data/webgui/config/environments/development.rb +29 -0
  82. data/webgui/config/environments/production.rb +24 -0
  83. data/webgui/config/environments/test.rb +22 -0
  84. data/webgui/config/initializers/inflections.rb +10 -0
  85. data/webgui/config/initializers/mime_types.rb +5 -0
  86. data/webgui/config/initializers/new_rails_defaults.rb +17 -0
  87. data/webgui/config/initializers/pool.rb +33 -0
  88. data/webgui/config/initializers/site_keys.rb +38 -0
  89. data/webgui/config/locales/en.yml +5 -0
  90. data/webgui/config/routes.rb +56 -0
  91. data/webgui/db/development.sqlite3 +0 -0
  92. data/webgui/db/migrate/20090216015836_create_entries.rb +13 -0
  93. data/webgui/db/migrate/20090217001611_add_tie_break_to_entry.rb +9 -0
  94. data/webgui/db/migrate/20090217004039_create_users.rb +23 -0
  95. data/webgui/db/migrate/20090217014940_relate_entry_and_user.rb +10 -0
  96. data/webgui/db/migrate/20090218024350_create_roles.rb +17 -0
  97. data/webgui/db/migrate/20090218024657_add_postition_to_roles.rb +9 -0
  98. data/webgui/db/migrate/20090218025240_add_admin_role.rb +10 -0
  99. data/webgui/db/migrate/20090225022928_create_pools.rb +16 -0
  100. data/webgui/db/migrate/20090225030346_associate_pool_and_entry.rb +9 -0
  101. data/webgui/db/migrate/20090225072358_change_pool_data_column.rb +9 -0
  102. data/webgui/db/migrate/20090225072849_add_completed_to_entries.rb +9 -0
  103. data/webgui/db/migrate/20090225074149_add_pool_id_index_to_entries.rb +9 -0
  104. data/webgui/db/migrate/20090225084414_add_user_id_to_pool.rb +9 -0
  105. data/webgui/db/migrate/20090226021913_add_active_to_pools.rb +9 -0
  106. data/webgui/db/migrate/20090226142240_rename_bracket_column_to_data.rb +9 -0
  107. data/webgui/db/migrate/20090301014710_create_teams.rb +84 -0
  108. data/webgui/db/migrate/20090301025902_add_more_teams.rb +16 -0
  109. data/webgui/db/migrate/20090301041526_create_seedings.rb +16 -0
  110. data/webgui/db/migrate/20090301090511_create_regions.rb +14 -0
  111. data/webgui/db/migrate/teams.txt +347 -0
  112. data/webgui/db/pool.yml +408 -0
  113. data/webgui/db/schema.rb +91 -0
  114. data/webgui/db/test.sqlite3 +0 -0
  115. data/webgui/doc/README_FOR_APP +5 -0
  116. data/webgui/lib/authenticated_system.rb +189 -0
  117. data/webgui/lib/authenticated_test_helper.rb +11 -0
  118. data/webgui/lib/form_object.rb +70 -0
  119. data/webgui/lib/pdf_helper.rb +47 -0
  120. data/webgui/lib/prince.rb +74 -0
  121. data/webgui/lib/saves_picks.rb +23 -0
  122. data/webgui/lib/tasks/admin.rake +10 -0
  123. data/webgui/public/404.html +30 -0
  124. data/webgui/public/422.html +30 -0
  125. data/webgui/public/500.html +33 -0
  126. data/webgui/public/dispatch.cgi +10 -0
  127. data/webgui/public/dispatch.fcgi +24 -0
  128. data/webgui/public/dispatch.rb +10 -0
  129. data/webgui/public/favicon.ico +0 -0
  130. data/webgui/public/images/2009FinalFour.png +0 -0
  131. data/webgui/public/images/rails.png +0 -0
  132. data/webgui/public/javascripts/application.js +2 -0
  133. data/webgui/public/javascripts/bracket.js +73 -0
  134. data/webgui/public/javascripts/controls.js +963 -0
  135. data/webgui/public/javascripts/dragdrop.js +973 -0
  136. data/webgui/public/javascripts/effects.js +1128 -0
  137. data/webgui/public/javascripts/prototype.js +4320 -0
  138. data/webgui/public/robots.txt +5 -0
  139. data/webgui/public/stylesheets/bracket-print.css +39 -0
  140. data/webgui/public/stylesheets/bracket.css +125 -0
  141. data/webgui/public/stylesheets/main.css +144 -0
  142. data/webgui/public/stylesheets/prince.css +6 -0
  143. data/webgui/public/stylesheets/prince_landscape.css +1 -0
  144. data/webgui/script/about +4 -0
  145. data/webgui/script/console +3 -0
  146. data/webgui/script/dbconsole +3 -0
  147. data/webgui/script/destroy +3 -0
  148. data/webgui/script/generate +3 -0
  149. data/webgui/script/performance/benchmarker +3 -0
  150. data/webgui/script/performance/profiler +3 -0
  151. data/webgui/script/performance/request +3 -0
  152. data/webgui/script/plugin +3 -0
  153. data/webgui/script/process/inspector +3 -0
  154. data/webgui/script/process/reaper +3 -0
  155. data/webgui/script/process/spawner +3 -0
  156. data/webgui/script/runner +3 -0
  157. data/webgui/script/server +3 -0
  158. data/webgui/test/fixtures/entries.yml +10 -0
  159. data/webgui/test/fixtures/pools.yml +14 -0
  160. data/webgui/test/fixtures/regions.yml +11 -0
  161. data/webgui/test/fixtures/roles.yml +11 -0
  162. data/webgui/test/fixtures/roles_users.yml +3 -0
  163. data/webgui/test/fixtures/seedings.yml +12 -0
  164. data/webgui/test/fixtures/teams.yml +3051 -0
  165. data/webgui/test/fixtures/users.yml +44 -0
  166. data/webgui/test/functional/admin_controller_test.rb +8 -0
  167. data/webgui/test/functional/entry_controller_test.rb +27 -0
  168. data/webgui/test/functional/pool_controller_test.rb +8 -0
  169. data/webgui/test/functional/reports_controller_test.rb +8 -0
  170. data/webgui/test/functional/sessions_controller_test.rb +82 -0
  171. data/webgui/test/functional/teams_controller_test.rb +216 -0
  172. data/webgui/test/functional/users_controller_test.rb +88 -0
  173. data/webgui/test/performance/browsing_test.rb +9 -0
  174. data/webgui/test/test_helper.rb +38 -0
  175. data/webgui/test/unit/entry_test.rb +8 -0
  176. data/webgui/test/unit/pool_test.rb +8 -0
  177. data/webgui/test/unit/region_test.rb +8 -0
  178. data/webgui/test/unit/role_test.rb +8 -0
  179. data/webgui/test/unit/seeding_test.rb +8 -0
  180. data/webgui/test/unit/team_test.rb +10 -0
  181. data/webgui/test/unit/user_mailer_test.rb +31 -0
  182. data/webgui/test/unit/user_test.rb +109 -0
  183. data/webgui/vendor/plugins/auto_complete/README +23 -0
  184. data/webgui/vendor/plugins/auto_complete/Rakefile +22 -0
  185. data/webgui/vendor/plugins/auto_complete/init.rb +2 -0
  186. data/webgui/vendor/plugins/auto_complete/lib/auto_complete.rb +47 -0
  187. data/webgui/vendor/plugins/auto_complete/lib/auto_complete_macros_helper.rb +143 -0
  188. data/webgui/vendor/plugins/auto_complete/test/auto_complete_test.rb +67 -0
  189. data/webgui/vendor/plugins/enumerations_mixin/ATTENTION +15 -0
  190. data/webgui/vendor/plugins/enumerations_mixin/LICENSE +20 -0
  191. data/webgui/vendor/plugins/enumerations_mixin/README_ENUMERATIONS +163 -0
  192. data/webgui/vendor/plugins/enumerations_mixin/init.rb +21 -0
  193. data/webgui/vendor/plugins/enumerations_mixin/lib/active_record/acts/enumerated.rb +177 -0
  194. data/webgui/vendor/plugins/enumerations_mixin/lib/active_record/aggregations/has_enumerated.rb +60 -0
  195. data/webgui/vendor/plugins/enumerations_mixin/lib/active_record/virtual_enumerations.rb +68 -0
  196. data/webgui/vendor/plugins/enumerations_mixin/virtual_enumerations_sample.rb +76 -0
  197. data/webgui/vendor/plugins/restful_authentication/.gitignore +21 -0
  198. data/webgui/vendor/plugins/restful_authentication/CHANGELOG +68 -0
  199. data/webgui/vendor/plugins/restful_authentication/README.textile +224 -0
  200. data/webgui/vendor/plugins/restful_authentication/Rakefile +32 -0
  201. data/webgui/vendor/plugins/restful_authentication/TODO +15 -0
  202. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/USAGE +1 -0
  203. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/authenticated_generator.rb +478 -0
  204. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/lib/insert_routes.rb +54 -0
  205. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/_model_partial.html.erb +8 -0
  206. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/activation.erb +3 -0
  207. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/authenticated_system.rb +189 -0
  208. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/authenticated_test_helper.rb +22 -0
  209. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/controller.rb +43 -0
  210. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/helper.rb +2 -0
  211. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/login.html.erb +16 -0
  212. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/mailer.rb +25 -0
  213. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/migration.rb +26 -0
  214. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/model.rb +83 -0
  215. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/model_controller.rb +85 -0
  216. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/model_helper.rb +93 -0
  217. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/model_helper_spec.rb +158 -0
  218. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/observer.rb +11 -0
  219. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/signup.html.erb +19 -0
  220. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/signup_notification.erb +8 -0
  221. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/site_keys.rb +38 -0
  222. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/controllers/access_control_spec.rb +90 -0
  223. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/controllers/authenticated_system_spec.rb +102 -0
  224. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/controllers/sessions_controller_spec.rb +139 -0
  225. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/controllers/users_controller_spec.rb +198 -0
  226. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/fixtures/users.yml +60 -0
  227. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/helpers/users_helper_spec.rb +141 -0
  228. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/spec/models/user_spec.rb +290 -0
  229. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/rest_auth_stories.rb +22 -0
  230. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/rest_auth_stories_helper.rb +81 -0
  231. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/steps/ra_navigation_steps.rb +49 -0
  232. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/steps/ra_resource_steps.rb +179 -0
  233. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/steps/ra_response_steps.rb +171 -0
  234. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/steps/user_steps.rb +153 -0
  235. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/users/accounts.story +186 -0
  236. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/stories/users/sessions.story +134 -0
  237. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/test/functional_test.rb +82 -0
  238. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/test/mailer_test.rb +31 -0
  239. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/test/model_functional_test.rb +93 -0
  240. data/webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/test/unit_test.rb +164 -0
  241. data/webgui/vendor/plugins/restful_authentication/init.rb +1 -0
  242. data/webgui/vendor/plugins/restful_authentication/install.rb +1 -0
  243. data/webgui/vendor/plugins/restful_authentication/lib/authentication/by_cookie_token.rb +82 -0
  244. data/webgui/vendor/plugins/restful_authentication/lib/authentication/by_password.rb +64 -0
  245. data/webgui/vendor/plugins/restful_authentication/lib/authentication.rb +40 -0
  246. data/webgui/vendor/plugins/restful_authentication/lib/authorization/aasm_roles.rb +63 -0
  247. data/webgui/vendor/plugins/restful_authentication/lib/authorization/stateful_roles.rb +62 -0
  248. data/webgui/vendor/plugins/restful_authentication/lib/authorization.rb +14 -0
  249. data/webgui/vendor/plugins/restful_authentication/lib/trustification/email_validation.rb +20 -0
  250. data/webgui/vendor/plugins/restful_authentication/lib/trustification.rb +14 -0
  251. data/webgui/vendor/plugins/restful_authentication/notes/AccessControl.txt +2 -0
  252. data/webgui/vendor/plugins/restful_authentication/notes/Authentication.txt +5 -0
  253. data/webgui/vendor/plugins/restful_authentication/notes/Authorization.txt +154 -0
  254. data/webgui/vendor/plugins/restful_authentication/notes/RailsPlugins.txt +78 -0
  255. data/webgui/vendor/plugins/restful_authentication/notes/SecurityFramework.graffle +0 -0
  256. data/webgui/vendor/plugins/restful_authentication/notes/SecurityFramework.png +0 -0
  257. data/webgui/vendor/plugins/restful_authentication/notes/SecurityPatterns.txt +163 -0
  258. data/webgui/vendor/plugins/restful_authentication/notes/Tradeoffs.txt +126 -0
  259. data/webgui/vendor/plugins/restful_authentication/notes/Trustification.txt +49 -0
  260. data/webgui/vendor/plugins/restful_authentication/rails/init.rb +3 -0
  261. data/webgui/vendor/plugins/restful_authentication/restful-authentication.gemspec +33 -0
  262. data/webgui/vendor/plugins/restful_authentication/tasks/auth.rake +33 -0
  263. metadata +288 -8
  264. data/tasks/annotations.rake +0 -22
@@ -0,0 +1,408 @@
1
+ --- !ruby/object:Tournament::Pool
2
+ bracket: !ruby/object:Tournament::Bracket
3
+ rounds: 6
4
+ scoring_strategy: !ruby/object:Tournament::Bracket::JoshPatashnikStrategy {}
5
+
6
+ teams: &id001
7
+ - &id002 !ruby/object:Tournament::Team
8
+ name: North Carolina
9
+ seed: 1
10
+ short_name: UNC
11
+ - &id003 !ruby/object:Tournament::Team
12
+ name: Mt. St. Mary's
13
+ seed: 16
14
+ short_name: MSM
15
+ - &id004 !ruby/object:Tournament::Team
16
+ name: Indiana
17
+ seed: 8
18
+ short_name: Ind
19
+ - &id005 !ruby/object:Tournament::Team
20
+ name: Arkansas
21
+ seed: 9
22
+ short_name: Ark
23
+ - &id006 !ruby/object:Tournament::Team
24
+ name: Notre Dame
25
+ seed: 5
26
+ short_name: ND
27
+ - &id007 !ruby/object:Tournament::Team
28
+ name: George Mason
29
+ seed: 12
30
+ short_name: GM
31
+ - &id008 !ruby/object:Tournament::Team
32
+ name: Washington St.
33
+ seed: 4
34
+ short_name: WSt
35
+ - &id009 !ruby/object:Tournament::Team
36
+ name: Winthrop
37
+ seed: 13
38
+ short_name: Win
39
+ - &id010 !ruby/object:Tournament::Team
40
+ name: Oklahoma
41
+ seed: 6
42
+ short_name: Okl
43
+ - &id011 !ruby/object:Tournament::Team
44
+ name: St. Joseph's
45
+ seed: 11
46
+ short_name: StJ
47
+ - &id012 !ruby/object:Tournament::Team
48
+ name: Louisville
49
+ seed: 3
50
+ short_name: Lou
51
+ - &id013 !ruby/object:Tournament::Team
52
+ name: Boise St.
53
+ seed: 14
54
+ short_name: BSt
55
+ - &id014 !ruby/object:Tournament::Team
56
+ name: Butler
57
+ seed: 7
58
+ short_name: But
59
+ - &id015 !ruby/object:Tournament::Team
60
+ name: South Alabama
61
+ seed: 10
62
+ short_name: SAl
63
+ - &id016 !ruby/object:Tournament::Team
64
+ name: Tennessee
65
+ seed: 2
66
+ short_name: Ten
67
+ - &id017 !ruby/object:Tournament::Team
68
+ name: American
69
+ seed: 15
70
+ short_name: Am
71
+ - &id018 !ruby/object:Tournament::Team
72
+ name: Kansas
73
+ seed: 1
74
+ short_name: Kan
75
+ - &id019 !ruby/object:Tournament::Team
76
+ name: Portland St.
77
+ seed: 16
78
+ short_name: PSt
79
+ - &id020 !ruby/object:Tournament::Team
80
+ name: UNLV
81
+ seed: 8
82
+ short_name: ULV
83
+ - &id021 !ruby/object:Tournament::Team
84
+ name: Kent St.
85
+ seed: 9
86
+ short_name: KSt
87
+ - &id022 !ruby/object:Tournament::Team
88
+ name: Clemson
89
+ seed: 5
90
+ short_name: Clm
91
+ - &id023 !ruby/object:Tournament::Team
92
+ name: Villanova
93
+ seed: 12
94
+ short_name: Vil
95
+ - &id024 !ruby/object:Tournament::Team
96
+ name: Vanderbilt
97
+ seed: 4
98
+ short_name: Van
99
+ - &id025 !ruby/object:Tournament::Team
100
+ name: Siena
101
+ seed: 13
102
+ short_name: Sie
103
+ - &id026 !ruby/object:Tournament::Team
104
+ name: USC
105
+ seed: 6
106
+ short_name: USC
107
+ - &id027 !ruby/object:Tournament::Team
108
+ name: Kansas St.
109
+ seed: 11
110
+ short_name: KSU
111
+ - &id028 !ruby/object:Tournament::Team
112
+ name: Wisconsin
113
+ seed: 3
114
+ short_name: Wis
115
+ - &id029 !ruby/object:Tournament::Team
116
+ name: CSU Fullerton
117
+ seed: 14
118
+ short_name: CSF
119
+ - &id030 !ruby/object:Tournament::Team
120
+ name: Gonzaga
121
+ seed: 7
122
+ short_name: Gon
123
+ - &id031 !ruby/object:Tournament::Team
124
+ name: Davidson
125
+ seed: 10
126
+ short_name: Dav
127
+ - &id032 !ruby/object:Tournament::Team
128
+ name: Georgetown
129
+ seed: 2
130
+ short_name: GT
131
+ - &id033 !ruby/object:Tournament::Team
132
+ name: UMBC
133
+ seed: 15
134
+ short_name: UBC
135
+ - &id034 !ruby/object:Tournament::Team
136
+ name: Memphis
137
+ seed: 1
138
+ short_name: Mem
139
+ - &id035 !ruby/object:Tournament::Team
140
+ name: TX Arlington
141
+ seed: 16
142
+ short_name: TxA
143
+ - &id036 !ruby/object:Tournament::Team
144
+ name: Mississippi St.
145
+ seed: 8
146
+ short_name: MiS
147
+ - &id037 !ruby/object:Tournament::Team
148
+ name: Oregon
149
+ seed: 9
150
+ short_name: Ore
151
+ - &id038 !ruby/object:Tournament::Team
152
+ name: Michigan St.
153
+ seed: 5
154
+ short_name: MSU
155
+ - &id039 !ruby/object:Tournament::Team
156
+ name: Temple
157
+ seed: 12
158
+ short_name: Tem
159
+ - &id040 !ruby/object:Tournament::Team
160
+ name: Pittsburgh
161
+ seed: 4
162
+ short_name: Pit
163
+ - &id041 !ruby/object:Tournament::Team
164
+ name: Oral Roberts
165
+ seed: 13
166
+ short_name: ORo
167
+ - &id042 !ruby/object:Tournament::Team
168
+ name: Marquette
169
+ seed: 6
170
+ short_name: Mar
171
+ - &id043 !ruby/object:Tournament::Team
172
+ name: Kentucky
173
+ seed: 11
174
+ short_name: Ken
175
+ - &id044 !ruby/object:Tournament::Team
176
+ name: Stanford
177
+ seed: 3
178
+ short_name: Sta
179
+ - &id045 !ruby/object:Tournament::Team
180
+ name: Cornell
181
+ seed: 14
182
+ short_name: Cor
183
+ - &id046 !ruby/object:Tournament::Team
184
+ name: Miami (FL)
185
+ seed: 7
186
+ short_name: Mia
187
+ - &id047 !ruby/object:Tournament::Team
188
+ name: St. Mary's
189
+ seed: 10
190
+ short_name: StM
191
+ - &id048 !ruby/object:Tournament::Team
192
+ name: Texas
193
+ seed: 2
194
+ short_name: Tex
195
+ - &id049 !ruby/object:Tournament::Team
196
+ name: Austin Peay
197
+ seed: 15
198
+ short_name: APe
199
+ - &id050 !ruby/object:Tournament::Team
200
+ name: UCLA
201
+ seed: 1
202
+ short_name: ULA
203
+ - &id051 !ruby/object:Tournament::Team
204
+ name: Mis. Valley St
205
+ seed: 16
206
+ short_name: MVS
207
+ - &id052 !ruby/object:Tournament::Team
208
+ name: BYU
209
+ seed: 8
210
+ short_name: BYU
211
+ - &id053 !ruby/object:Tournament::Team
212
+ name: Texas A&M
213
+ seed: 9
214
+ short_name: A&M
215
+ - &id054 !ruby/object:Tournament::Team
216
+ name: Drake
217
+ seed: 5
218
+ short_name: Dra
219
+ - &id055 !ruby/object:Tournament::Team
220
+ name: W. Kentucky
221
+ seed: 12
222
+ short_name: WKy
223
+ - &id056 !ruby/object:Tournament::Team
224
+ name: Connecticut
225
+ seed: 4
226
+ short_name: Con
227
+ - &id057 !ruby/object:Tournament::Team
228
+ name: San Diego
229
+ seed: 13
230
+ short_name: SD
231
+ - &id058 !ruby/object:Tournament::Team
232
+ name: Purdue
233
+ seed: 6
234
+ short_name: Pur
235
+ - &id059 !ruby/object:Tournament::Team
236
+ name: Baylor
237
+ seed: 11
238
+ short_name: Bay
239
+ - &id060 !ruby/object:Tournament::Team
240
+ name: Xavier
241
+ seed: 3
242
+ short_name: Xav
243
+ - &id061 !ruby/object:Tournament::Team
244
+ name: Georgia
245
+ seed: 14
246
+ short_name: UG
247
+ - &id062 !ruby/object:Tournament::Team
248
+ name: West Virginia
249
+ seed: 7
250
+ short_name: WVa
251
+ - &id063 !ruby/object:Tournament::Team
252
+ name: Arizona
253
+ seed: 10
254
+ short_name: UA
255
+ - &id064 !ruby/object:Tournament::Team
256
+ name: Duke
257
+ seed: 2
258
+ short_name: Duk
259
+ - &id065 !ruby/object:Tournament::Team
260
+ name: Belmont
261
+ seed: 15
262
+ short_name: Bel
263
+ winners:
264
+ - *id001
265
+ - - :unk
266
+ - :unk
267
+ - :unk
268
+ - :unk
269
+ - :unk
270
+ - :unk
271
+ - :unk
272
+ - :unk
273
+ - :unk
274
+ - :unk
275
+ - :unk
276
+ - :unk
277
+ - :unk
278
+ - :unk
279
+ - :unk
280
+ - :unk
281
+ - :unk
282
+ - :unk
283
+ - :unk
284
+ - :unk
285
+ - :unk
286
+ - :unk
287
+ - :unk
288
+ - :unk
289
+ - :unk
290
+ - :unk
291
+ - :unk
292
+ - :unk
293
+ - :unk
294
+ - :unk
295
+ - :unk
296
+ - :unk
297
+ - - :unk
298
+ - :unk
299
+ - :unk
300
+ - :unk
301
+ - :unk
302
+ - :unk
303
+ - :unk
304
+ - :unk
305
+ - :unk
306
+ - :unk
307
+ - :unk
308
+ - :unk
309
+ - :unk
310
+ - :unk
311
+ - :unk
312
+ - :unk
313
+ - - :unk
314
+ - :unk
315
+ - :unk
316
+ - :unk
317
+ - :unk
318
+ - :unk
319
+ - :unk
320
+ - :unk
321
+ - - :unk
322
+ - :unk
323
+ - :unk
324
+ - :unk
325
+ - - :unk
326
+ - :unk
327
+ - - :unk
328
+ entries: []
329
+
330
+ entry_fee: "5"
331
+ payouts:
332
+ 1: 75
333
+ 2: 15
334
+ :last: -5
335
+ 3: 5
336
+ regions:
337
+ - :teams:
338
+ - *id002
339
+ - *id003
340
+ - *id004
341
+ - *id005
342
+ - *id006
343
+ - *id007
344
+ - *id008
345
+ - *id009
346
+ - *id010
347
+ - *id011
348
+ - *id012
349
+ - *id013
350
+ - *id014
351
+ - *id015
352
+ - *id016
353
+ - *id017
354
+ :name: East
355
+ - :teams:
356
+ - *id018
357
+ - *id019
358
+ - *id020
359
+ - *id021
360
+ - *id022
361
+ - *id023
362
+ - *id024
363
+ - *id025
364
+ - *id026
365
+ - *id027
366
+ - *id028
367
+ - *id029
368
+ - *id030
369
+ - *id031
370
+ - *id032
371
+ - *id033
372
+ :name: Midwest
373
+ - :teams:
374
+ - *id034
375
+ - *id035
376
+ - *id036
377
+ - *id037
378
+ - *id038
379
+ - *id039
380
+ - *id040
381
+ - *id041
382
+ - *id042
383
+ - *id043
384
+ - *id044
385
+ - *id045
386
+ - *id046
387
+ - *id047
388
+ - *id048
389
+ - *id049
390
+ :name: South
391
+ - :teams:
392
+ - *id050
393
+ - *id051
394
+ - *id052
395
+ - *id053
396
+ - *id054
397
+ - *id055
398
+ - *id056
399
+ - *id057
400
+ - *id058
401
+ - *id059
402
+ - *id060
403
+ - *id061
404
+ - *id062
405
+ - *id063
406
+ - *id064
407
+ - *id065
408
+ :name: West
@@ -0,0 +1,91 @@
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
+ # please use the migrations feature of Active Record to incrementally modify your database, and
3
+ # then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
+ # to create the application database on another system, you should be using db:schema:load, not running
7
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
9
+ #
10
+ # It's strongly recommended to check this file into your version control system.
11
+
12
+ ActiveRecord::Schema.define(:version => 20090301090511) do
13
+
14
+ create_table "entries", :force => true do |t|
15
+ t.string "name", :limit => 64, :null => false
16
+ t.binary "data"
17
+ t.datetime "created_at"
18
+ t.datetime "updated_at"
19
+ t.integer "tie_break"
20
+ t.integer "user_id", :default => 1, :null => false
21
+ t.integer "pool_id"
22
+ t.boolean "completed", :default => false, :null => false
23
+ end
24
+
25
+ add_index "entries", ["pool_id"], :name => "index_entries_on_pool_id"
26
+ add_index "entries", ["user_id"], :name => "index_entries_on_user_id"
27
+
28
+ create_table "pools", :force => true do |t|
29
+ t.string "name", :null => false
30
+ t.binary "data"
31
+ t.boolean "started", :default => false, :null => false
32
+ t.datetime "starts_at"
33
+ t.datetime "created_at"
34
+ t.datetime "updated_at"
35
+ t.integer "user_id"
36
+ t.boolean "active", :default => false, :null => false
37
+ end
38
+
39
+ create_table "regions", :force => true do |t|
40
+ t.integer "pool_id"
41
+ t.string "name"
42
+ t.integer "position"
43
+ t.datetime "created_at"
44
+ t.datetime "updated_at"
45
+ end
46
+
47
+ create_table "roles", :force => true do |t|
48
+ t.string "name", :limit => 32
49
+ t.datetime "created_at"
50
+ t.datetime "updated_at"
51
+ t.integer "position", :default => 0, :null => false
52
+ end
53
+
54
+ create_table "roles_users", :id => false, :force => true do |t|
55
+ t.integer "role_id"
56
+ t.integer "user_id"
57
+ end
58
+
59
+ create_table "seedings", :force => true do |t|
60
+ t.integer "pool_id"
61
+ t.integer "team_id"
62
+ t.string "region"
63
+ t.integer "seed"
64
+ t.datetime "created_at"
65
+ t.datetime "updated_at"
66
+ end
67
+
68
+ create_table "teams", :force => true do |t|
69
+ t.string "name"
70
+ t.string "short_name"
71
+ t.datetime "created_at"
72
+ t.datetime "updated_at"
73
+ end
74
+
75
+ create_table "users", :force => true do |t|
76
+ t.string "login", :limit => 40
77
+ t.string "name", :limit => 100, :default => ""
78
+ t.string "email", :limit => 100
79
+ t.string "crypted_password", :limit => 40
80
+ t.string "salt", :limit => 40
81
+ t.datetime "created_at"
82
+ t.datetime "updated_at"
83
+ t.string "remember_token", :limit => 40
84
+ t.datetime "remember_token_expires_at"
85
+ t.string "activation_code", :limit => 40
86
+ t.datetime "activated_at"
87
+ end
88
+
89
+ add_index "users", ["login"], :name => "index_users_on_login", :unique => true
90
+
91
+ end
Binary file
@@ -0,0 +1,5 @@
1
+ To build the guides:
2
+
3
+ * Install source-highlighter (http://www.gnu.org/software/src-highlite/source-highlight.html)
4
+ * Install the mizuho gem (http://github.com/FooBarWidget/mizuho/tree/master)
5
+ * Run `rake guides` from the railties directory
@@ -0,0 +1,189 @@
1
+ module AuthenticatedSystem
2
+ protected
3
+ # Returns true or false if the user is logged in.
4
+ # Preloads @current_user with the user model if they're logged in.
5
+ def logged_in?
6
+ !!current_user
7
+ end
8
+
9
+ # Accesses the current user from the session.
10
+ # Future calls avoid the database because nil is not equal to false.
11
+ def current_user
12
+ @current_user ||= (login_from_session || login_from_basic_auth || login_from_cookie) unless @current_user == false
13
+ end
14
+
15
+ # Store the given user id in the session.
16
+ def current_user=(new_user)
17
+ session[:user_id] = new_user ? new_user.id : nil
18
+ @current_user = new_user || false
19
+ end
20
+
21
+ # Check if the user is authorized
22
+ #
23
+ # Override this method in your controllers if you want to restrict access
24
+ # to only a few actions or if you want to check if the user
25
+ # has the correct rights.
26
+ #
27
+ # Example:
28
+ #
29
+ # # only allow nonbobs
30
+ # def authorized?
31
+ # current_user.login != "bob"
32
+ # end
33
+ #
34
+ def authorized?(action = action_name, resource = nil)
35
+ logged_in?
36
+ end
37
+
38
+ # Filter method to enforce a login requirement.
39
+ #
40
+ # To require logins for all actions, use this in your controllers:
41
+ #
42
+ # before_filter :login_required
43
+ #
44
+ # To require logins for specific actions, use this in your controllers:
45
+ #
46
+ # before_filter :login_required, :only => [ :edit, :update ]
47
+ #
48
+ # To skip this in a subclassed controller:
49
+ #
50
+ # skip_before_filter :login_required
51
+ #
52
+ def login_required
53
+ authorized? || access_denied
54
+ end
55
+
56
+ # Redirect as appropriate when an access request fails.
57
+ #
58
+ # The default action is to redirect to the login screen.
59
+ #
60
+ # Override this method in your controllers if you want to have special
61
+ # behavior in case the user is not authorized
62
+ # to access the requested action. For example, a popup window might
63
+ # simply close itself.
64
+ def access_denied
65
+ respond_to do |format|
66
+ format.html do
67
+ store_location
68
+ redirect_to new_session_path
69
+ end
70
+ # format.any doesn't work in rails version < http://dev.rubyonrails.org/changeset/8987
71
+ # Add any other API formats here. (Some browsers, notably IE6, send Accept: */* and trigger
72
+ # the 'format.any' block incorrectly. See http://bit.ly/ie6_borken or http://bit.ly/ie6_borken2
73
+ # for a workaround.)
74
+ format.any(:json, :xml) do
75
+ request_http_basic_authentication 'Web Password'
76
+ end
77
+ end
78
+ end
79
+
80
+ # Store the URI of the current request in the session.
81
+ #
82
+ # We can return to this location by calling #redirect_back_or_default.
83
+ def store_location
84
+ session[:return_to] = request.request_uri
85
+ end
86
+
87
+ # Redirect to the URI stored by the most recent store_location call or
88
+ # to the passed default. Set an appropriately modified
89
+ # after_filter :store_location, :only => [:index, :new, :show, :edit]
90
+ # for any controller you want to be bounce-backable.
91
+ def redirect_back_or_default(default)
92
+ redirect_to(session[:return_to] || default)
93
+ session[:return_to] = nil
94
+ end
95
+
96
+ # Inclusion hook to make #current_user and #logged_in?
97
+ # available as ActionView helper methods.
98
+ def self.included(base)
99
+ base.send :helper_method, :current_user, :logged_in?, :authorized? if base.respond_to? :helper_method
100
+ end
101
+
102
+ #
103
+ # Login
104
+ #
105
+
106
+ # Called from #current_user. First attempt to login by the user id stored in the session.
107
+ def login_from_session
108
+ self.current_user = User.find_by_id(session[:user_id]) if session[:user_id]
109
+ end
110
+
111
+ # Called from #current_user. Now, attempt to login by basic authentication information.
112
+ def login_from_basic_auth
113
+ authenticate_with_http_basic do |login, password|
114
+ self.current_user = User.authenticate(login, password)
115
+ end
116
+ end
117
+
118
+ #
119
+ # Logout
120
+ #
121
+
122
+ # Called from #current_user. Finaly, attempt to login by an expiring token in the cookie.
123
+ # for the paranoid: we _should_ be storing user_token = hash(cookie_token, request IP)
124
+ def login_from_cookie
125
+ user = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token])
126
+ if user && user.remember_token?
127
+ self.current_user = user
128
+ handle_remember_cookie! false # freshen cookie token (keeping date)
129
+ self.current_user
130
+ end
131
+ end
132
+
133
+ # This is ususally what you want; resetting the session willy-nilly wreaks
134
+ # havoc with forgery protection, and is only strictly necessary on login.
135
+ # However, **all session state variables should be unset here**.
136
+ def logout_keeping_session!
137
+ # Kill server-side auth cookie
138
+ @current_user.forget_me if @current_user.is_a? User
139
+ @current_user = false # not logged in, and don't do it for me
140
+ kill_remember_cookie! # Kill client-side auth cookie
141
+ session[:user_id] = nil # keeps the session but kill our variable
142
+ # explicitly kill any other session variables you set
143
+ end
144
+
145
+ # The session should only be reset at the tail end of a form POST --
146
+ # otherwise the request forgery protection fails. It's only really necessary
147
+ # when you cross quarantine (logged-out to logged-in).
148
+ def logout_killing_session!
149
+ logout_keeping_session!
150
+ reset_session
151
+ end
152
+
153
+ #
154
+ # Remember_me Tokens
155
+ #
156
+ # Cookies shouldn't be allowed to persist past their freshness date,
157
+ # and they should be changed at each login
158
+
159
+ # Cookies shouldn't be allowed to persist past their freshness date,
160
+ # and they should be changed at each login
161
+
162
+ def valid_remember_cookie?
163
+ return nil unless @current_user
164
+ (@current_user.remember_token?) &&
165
+ (cookies[:auth_token] == @current_user.remember_token)
166
+ end
167
+
168
+ # Refresh the cookie auth token if it exists, create it otherwise
169
+ def handle_remember_cookie!(new_cookie_flag)
170
+ return unless @current_user
171
+ case
172
+ when valid_remember_cookie? then @current_user.refresh_token # keeping same expiry date
173
+ when new_cookie_flag then @current_user.remember_me
174
+ else @current_user.forget_me
175
+ end
176
+ send_remember_cookie!
177
+ end
178
+
179
+ def kill_remember_cookie!
180
+ cookies.delete :auth_token
181
+ end
182
+
183
+ def send_remember_cookie!
184
+ cookies[:auth_token] = {
185
+ :value => @current_user.remember_token,
186
+ :expires => @current_user.remember_token_expires_at }
187
+ end
188
+
189
+ end
@@ -0,0 +1,11 @@
1
+ module AuthenticatedTestHelper
2
+ # Sets the current user in the session from the user fixtures.
3
+ def login_as(user)
4
+ @request.session[:user_id] = user ? users(user).id : nil
5
+ end
6
+
7
+ def authorize_as(user)
8
+ @request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentication::Basic.encode_credentials(users(user).login, 'monkey') : nil
9
+ end
10
+
11
+ end