mongo_session_store-rails5 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (327) hide show
  1. checksums.yaml +7 -0
  2. data/.bundle/install.log +768 -0
  3. data/.gitignore +10 -0
  4. data/.rspec +1 -0
  5. data/.travis.yml +21 -0
  6. data/Gemfile +67 -0
  7. data/README.md +133 -0
  8. data/Rakefile +93 -0
  9. data/lib/mongo_session_store-rails3.rb +1 -0
  10. data/lib/mongo_session_store-rails4.rb +1 -0
  11. data/lib/mongo_session_store-rails5.rb +1 -0
  12. data/lib/mongo_session_store.rb +49 -0
  13. data/lib/mongo_session_store/mongo_mapper_store.rb +22 -0
  14. data/lib/mongo_session_store/mongo_store.rb +83 -0
  15. data/lib/mongo_session_store/mongo_store_base.rb +98 -0
  16. data/lib/mongo_session_store/mongoid_store.rb +57 -0
  17. data/lib/mongo_session_store/version.rb +3 -0
  18. data/mongo_session_store-rails3.gemspec +18 -0
  19. data/mongo_session_store-rails4.gemspec +18 -0
  20. data/mongo_session_store-rails5.gemspec +20 -0
  21. data/perf/benchmark.rb +92 -0
  22. data/release.sh +6 -0
  23. data/spec/integration_with_devise_spec.rb +89 -0
  24. data/spec/mongo_store_base_spec.rb +42 -0
  25. data/spec/rails_3.1_app/.gitignore +5 -0
  26. data/spec/rails_3.1_app/README +261 -0
  27. data/spec/rails_3.1_app/Rakefile +7 -0
  28. data/spec/rails_3.1_app/app/assets/javascripts/application.js +7 -0
  29. data/spec/rails_3.1_app/app/assets/stylesheets/application.css +7 -0
  30. data/spec/rails_3.1_app/app/controllers/application_controller.rb +3 -0
  31. data/spec/rails_3.1_app/app/controllers/home_controller.rb +4 -0
  32. data/spec/rails_3.1_app/app/helpers/application_helper.rb +2 -0
  33. data/spec/rails_3.1_app/app/mailers/.gitkeep +0 -0
  34. data/spec/rails_3.1_app/app/models/.gitkeep +0 -0
  35. data/spec/rails_3.1_app/app/models/user.rb +6 -0
  36. data/spec/rails_3.1_app/app/views/devise/confirmations/new.html.erb +12 -0
  37. data/spec/rails_3.1_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  38. data/spec/rails_3.1_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  39. data/spec/rails_3.1_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  40. data/spec/rails_3.1_app/app/views/devise/passwords/edit.html.erb +16 -0
  41. data/spec/rails_3.1_app/app/views/devise/passwords/new.html.erb +12 -0
  42. data/spec/rails_3.1_app/app/views/devise/registrations/edit.html.erb +25 -0
  43. data/spec/rails_3.1_app/app/views/devise/registrations/new.html.erb +18 -0
  44. data/spec/rails_3.1_app/app/views/devise/sessions/new.html.erb +17 -0
  45. data/spec/rails_3.1_app/app/views/devise/shared/_links.erb +25 -0
  46. data/spec/rails_3.1_app/app/views/devise/unlocks/new.html.erb +12 -0
  47. data/spec/rails_3.1_app/app/views/home/index.html.erb +10 -0
  48. data/spec/rails_3.1_app/app/views/layouts/application.html.erb +15 -0
  49. data/spec/rails_3.1_app/config.ru +4 -0
  50. data/spec/rails_3.1_app/config/application.rb +47 -0
  51. data/spec/rails_3.1_app/config/boot.rb +6 -0
  52. data/spec/rails_3.1_app/config/database.yml +11 -0
  53. data/spec/rails_3.1_app/config/environment.rb +5 -0
  54. data/spec/rails_3.1_app/config/environments/development.rb +27 -0
  55. data/spec/rails_3.1_app/config/environments/production.rb +54 -0
  56. data/spec/rails_3.1_app/config/environments/test.rb +39 -0
  57. data/spec/rails_3.1_app/config/initializers/backtrace_silencers.rb +7 -0
  58. data/spec/rails_3.1_app/config/initializers/devise.rb +201 -0
  59. data/spec/rails_3.1_app/config/initializers/inflections.rb +10 -0
  60. data/spec/rails_3.1_app/config/initializers/mime_types.rb +5 -0
  61. data/spec/rails_3.1_app/config/initializers/secret_token.rb +7 -0
  62. data/spec/rails_3.1_app/config/initializers/session_store.rb +9 -0
  63. data/spec/rails_3.1_app/config/initializers/wrap_parameters.rb +12 -0
  64. data/spec/rails_3.1_app/config/locales/devise.en.yml +55 -0
  65. data/spec/rails_3.1_app/config/locales/en.yml +5 -0
  66. data/spec/rails_3.1_app/config/mongo.yml +18 -0
  67. data/spec/rails_3.1_app/config/mongoid.yml +13 -0
  68. data/spec/rails_3.1_app/config/routes.rb +4 -0
  69. data/spec/rails_3.1_app/db/migrate/20120222195914_create_users_table.rb +12 -0
  70. data/spec/rails_3.1_app/db/schema.rb +20 -0
  71. data/spec/rails_3.1_app/lib/tasks/.gitkeep +0 -0
  72. data/spec/rails_3.1_app/log/.gitkeep +0 -0
  73. data/spec/rails_3.1_app/public/404.html +26 -0
  74. data/spec/rails_3.1_app/public/422.html +26 -0
  75. data/spec/rails_3.1_app/public/500.html +26 -0
  76. data/spec/rails_3.1_app/public/favicon.ico +0 -0
  77. data/spec/rails_3.1_app/public/robots.txt +5 -0
  78. data/spec/rails_3.1_app/script/rails +6 -0
  79. data/spec/rails_3.1_app/vendor/assets/stylesheets/.gitkeep +0 -0
  80. data/spec/rails_3.1_app/vendor/plugins/.gitkeep +0 -0
  81. data/spec/rails_3.2_app/.gitignore +5 -0
  82. data/spec/rails_3.2_app/README +261 -0
  83. data/spec/rails_3.2_app/Rakefile +7 -0
  84. data/spec/rails_3.2_app/app/assets/javascripts/application.js +7 -0
  85. data/spec/rails_3.2_app/app/assets/stylesheets/application.css +7 -0
  86. data/spec/rails_3.2_app/app/controllers/application_controller.rb +3 -0
  87. data/spec/rails_3.2_app/app/controllers/home_controller.rb +4 -0
  88. data/spec/rails_3.2_app/app/helpers/application_helper.rb +2 -0
  89. data/spec/rails_3.2_app/app/mailers/.gitkeep +0 -0
  90. data/spec/rails_3.2_app/app/models/.gitkeep +0 -0
  91. data/spec/rails_3.2_app/app/models/user.rb +6 -0
  92. data/spec/rails_3.2_app/app/views/devise/confirmations/new.html.erb +12 -0
  93. data/spec/rails_3.2_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  94. data/spec/rails_3.2_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  95. data/spec/rails_3.2_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  96. data/spec/rails_3.2_app/app/views/devise/passwords/edit.html.erb +16 -0
  97. data/spec/rails_3.2_app/app/views/devise/passwords/new.html.erb +12 -0
  98. data/spec/rails_3.2_app/app/views/devise/registrations/edit.html.erb +25 -0
  99. data/spec/rails_3.2_app/app/views/devise/registrations/new.html.erb +18 -0
  100. data/spec/rails_3.2_app/app/views/devise/sessions/new.html.erb +17 -0
  101. data/spec/rails_3.2_app/app/views/devise/shared/_links.erb +25 -0
  102. data/spec/rails_3.2_app/app/views/devise/unlocks/new.html.erb +12 -0
  103. data/spec/rails_3.2_app/app/views/home/index.html.erb +10 -0
  104. data/spec/rails_3.2_app/app/views/layouts/application.html.erb +15 -0
  105. data/spec/rails_3.2_app/config.ru +4 -0
  106. data/spec/rails_3.2_app/config/application.rb +47 -0
  107. data/spec/rails_3.2_app/config/boot.rb +6 -0
  108. data/spec/rails_3.2_app/config/database.yml +11 -0
  109. data/spec/rails_3.2_app/config/environment.rb +5 -0
  110. data/spec/rails_3.2_app/config/environments/development.rb +27 -0
  111. data/spec/rails_3.2_app/config/environments/production.rb +54 -0
  112. data/spec/rails_3.2_app/config/environments/test.rb +39 -0
  113. data/spec/rails_3.2_app/config/initializers/backtrace_silencers.rb +7 -0
  114. data/spec/rails_3.2_app/config/initializers/devise.rb +203 -0
  115. data/spec/rails_3.2_app/config/initializers/inflections.rb +10 -0
  116. data/spec/rails_3.2_app/config/initializers/mime_types.rb +5 -0
  117. data/spec/rails_3.2_app/config/initializers/secret_token.rb +7 -0
  118. data/spec/rails_3.2_app/config/initializers/session_store.rb +9 -0
  119. data/spec/rails_3.2_app/config/initializers/wrap_parameters.rb +12 -0
  120. data/spec/rails_3.2_app/config/locales/devise.en.yml +55 -0
  121. data/spec/rails_3.2_app/config/locales/en.yml +5 -0
  122. data/spec/rails_3.2_app/config/mongo.yml +18 -0
  123. data/spec/rails_3.2_app/config/mongoid.yml +13 -0
  124. data/spec/rails_3.2_app/config/routes.rb +4 -0
  125. data/spec/rails_3.2_app/db/migrate/20120222195914_create_users_table.rb +12 -0
  126. data/spec/rails_3.2_app/db/schema.rb +20 -0
  127. data/spec/rails_3.2_app/lib/tasks/.gitkeep +0 -0
  128. data/spec/rails_3.2_app/log/.gitkeep +0 -0
  129. data/spec/rails_3.2_app/public/404.html +26 -0
  130. data/spec/rails_3.2_app/public/422.html +26 -0
  131. data/spec/rails_3.2_app/public/500.html +26 -0
  132. data/spec/rails_3.2_app/public/favicon.ico +0 -0
  133. data/spec/rails_3.2_app/public/robots.txt +5 -0
  134. data/spec/rails_3.2_app/script/rails +6 -0
  135. data/spec/rails_3.2_app/vendor/assets/stylesheets/.gitkeep +0 -0
  136. data/spec/rails_3.2_app/vendor/plugins/.gitkeep +0 -0
  137. data/spec/rails_4.0_app/.gitignore +16 -0
  138. data/spec/rails_4.0_app/Rakefile +6 -0
  139. data/spec/rails_4.0_app/app/assets/images/.keep +0 -0
  140. data/spec/rails_4.0_app/app/assets/javascripts/application.js +13 -0
  141. data/spec/rails_4.0_app/app/assets/stylesheets/application.css +13 -0
  142. data/spec/rails_4.0_app/app/controllers/application_controller.rb +5 -0
  143. data/spec/rails_4.0_app/app/controllers/concerns/.keep +0 -0
  144. data/spec/rails_4.0_app/app/controllers/home_controller.rb +4 -0
  145. data/spec/rails_4.0_app/app/helpers/application_helper.rb +2 -0
  146. data/spec/rails_4.0_app/app/mailers/.keep +0 -0
  147. data/spec/rails_4.0_app/app/models/.keep +0 -0
  148. data/spec/rails_4.0_app/app/models/concerns/.keep +0 -0
  149. data/spec/rails_4.0_app/app/models/user.rb +5 -0
  150. data/spec/rails_4.0_app/app/views/devise/confirmations/new.html.erb +12 -0
  151. data/spec/rails_4.0_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  152. data/spec/rails_4.0_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  153. data/spec/rails_4.0_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  154. data/spec/rails_4.0_app/app/views/devise/passwords/edit.html.erb +16 -0
  155. data/spec/rails_4.0_app/app/views/devise/passwords/new.html.erb +12 -0
  156. data/spec/rails_4.0_app/app/views/devise/registrations/edit.html.erb +29 -0
  157. data/spec/rails_4.0_app/app/views/devise/registrations/new.html.erb +18 -0
  158. data/spec/rails_4.0_app/app/views/devise/sessions/new.html.erb +17 -0
  159. data/spec/rails_4.0_app/app/views/devise/shared/_links.erb +25 -0
  160. data/spec/rails_4.0_app/app/views/devise/unlocks/new.html.erb +12 -0
  161. data/spec/rails_4.0_app/app/views/home/index.html.erb +10 -0
  162. data/spec/rails_4.0_app/app/views/layouts/application.html.erb +17 -0
  163. data/spec/rails_4.0_app/bin/bundle +3 -0
  164. data/spec/rails_4.0_app/bin/rails +4 -0
  165. data/spec/rails_4.0_app/bin/rake +4 -0
  166. data/spec/rails_4.0_app/config.ru +4 -0
  167. data/spec/rails_4.0_app/config/application.rb +26 -0
  168. data/spec/rails_4.0_app/config/boot.rb +4 -0
  169. data/spec/rails_4.0_app/config/database.yml +11 -0
  170. data/spec/rails_4.0_app/config/environment.rb +5 -0
  171. data/spec/rails_4.0_app/config/environments/development.rb +29 -0
  172. data/spec/rails_4.0_app/config/environments/production.rb +80 -0
  173. data/spec/rails_4.0_app/config/environments/test.rb +36 -0
  174. data/spec/rails_4.0_app/config/initializers/backtrace_silencers.rb +7 -0
  175. data/spec/rails_4.0_app/config/initializers/devise.rb +254 -0
  176. data/spec/rails_4.0_app/config/initializers/filter_parameter_logging.rb +4 -0
  177. data/spec/rails_4.0_app/config/initializers/inflections.rb +16 -0
  178. data/spec/rails_4.0_app/config/initializers/mime_types.rb +5 -0
  179. data/spec/rails_4.0_app/config/initializers/secret_token.rb +12 -0
  180. data/spec/rails_4.0_app/config/initializers/session_store.rb +5 -0
  181. data/spec/rails_4.0_app/config/initializers/wrap_parameters.rb +14 -0
  182. data/spec/rails_4.0_app/config/locales/devise.en.yml +59 -0
  183. data/spec/rails_4.0_app/config/locales/en.yml +23 -0
  184. data/spec/rails_4.0_app/config/mongo.yml +11 -0
  185. data/spec/rails_4.0_app/config/mongoid.yml +13 -0
  186. data/spec/rails_4.0_app/config/routes.rb +4 -0
  187. data/spec/rails_4.0_app/db/migrate/20140301171212_add_devise_users.rb +11 -0
  188. data/spec/rails_4.0_app/db/schema.rb +25 -0
  189. data/spec/rails_4.0_app/db/seeds.rb +7 -0
  190. data/spec/rails_4.0_app/lib/assets/.keep +0 -0
  191. data/spec/rails_4.0_app/lib/tasks/.keep +0 -0
  192. data/spec/rails_4.0_app/log/.keep +0 -0
  193. data/spec/rails_4.0_app/public/404.html +58 -0
  194. data/spec/rails_4.0_app/public/422.html +58 -0
  195. data/spec/rails_4.0_app/public/500.html +57 -0
  196. data/spec/rails_4.0_app/public/favicon.ico +0 -0
  197. data/spec/rails_4.0_app/public/robots.txt +5 -0
  198. data/spec/rails_4.1_app/.gitignore +16 -0
  199. data/spec/rails_4.1_app/Rakefile +6 -0
  200. data/spec/rails_4.1_app/app/assets/images/.keep +0 -0
  201. data/spec/rails_4.1_app/app/assets/javascripts/application.js +13 -0
  202. data/spec/rails_4.1_app/app/assets/stylesheets/application.css +15 -0
  203. data/spec/rails_4.1_app/app/controllers/application_controller.rb +5 -0
  204. data/spec/rails_4.1_app/app/controllers/concerns/.keep +0 -0
  205. data/spec/rails_4.1_app/app/controllers/home_controller.rb +4 -0
  206. data/spec/rails_4.1_app/app/helpers/application_helper.rb +2 -0
  207. data/spec/rails_4.1_app/app/mailers/.keep +0 -0
  208. data/spec/rails_4.1_app/app/models/.keep +0 -0
  209. data/spec/rails_4.1_app/app/models/concerns/.keep +0 -0
  210. data/spec/rails_4.1_app/app/models/user.rb +5 -0
  211. data/spec/rails_4.1_app/app/views/devise/confirmations/new.html.erb +12 -0
  212. data/spec/rails_4.1_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  213. data/spec/rails_4.1_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  214. data/spec/rails_4.1_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  215. data/spec/rails_4.1_app/app/views/devise/passwords/edit.html.erb +16 -0
  216. data/spec/rails_4.1_app/app/views/devise/passwords/new.html.erb +12 -0
  217. data/spec/rails_4.1_app/app/views/devise/registrations/edit.html.erb +29 -0
  218. data/spec/rails_4.1_app/app/views/devise/registrations/new.html.erb +18 -0
  219. data/spec/rails_4.1_app/app/views/devise/sessions/new.html.erb +17 -0
  220. data/spec/rails_4.1_app/app/views/devise/shared/_links.erb +25 -0
  221. data/spec/rails_4.1_app/app/views/devise/unlocks/new.html.erb +12 -0
  222. data/spec/rails_4.1_app/app/views/home/index.html.erb +10 -0
  223. data/spec/rails_4.1_app/app/views/layouts/application.html.erb +17 -0
  224. data/spec/rails_4.1_app/bin/bundle +3 -0
  225. data/spec/rails_4.1_app/bin/rails +8 -0
  226. data/spec/rails_4.1_app/bin/rake +8 -0
  227. data/spec/rails_4.1_app/bin/spring +18 -0
  228. data/spec/rails_4.1_app/config.ru +4 -0
  229. data/spec/rails_4.1_app/config/application.rb +23 -0
  230. data/spec/rails_4.1_app/config/boot.rb +4 -0
  231. data/spec/rails_4.1_app/config/database.yml +11 -0
  232. data/spec/rails_4.1_app/config/environment.rb +5 -0
  233. data/spec/rails_4.1_app/config/environments/development.rb +37 -0
  234. data/spec/rails_4.1_app/config/environments/production.rb +83 -0
  235. data/spec/rails_4.1_app/config/environments/test.rb +39 -0
  236. data/spec/rails_4.1_app/config/initializers/backtrace_silencers.rb +7 -0
  237. data/spec/rails_4.1_app/config/initializers/cookies_serializer.rb +3 -0
  238. data/spec/rails_4.1_app/config/initializers/devise.rb +254 -0
  239. data/spec/rails_4.1_app/config/initializers/filter_parameter_logging.rb +4 -0
  240. data/spec/rails_4.1_app/config/initializers/inflections.rb +16 -0
  241. data/spec/rails_4.1_app/config/initializers/mime_types.rb +5 -0
  242. data/spec/rails_4.1_app/config/initializers/session_store.rb +5 -0
  243. data/spec/rails_4.1_app/config/initializers/wrap_parameters.rb +14 -0
  244. data/spec/rails_4.1_app/config/locales/devise.en.yml +59 -0
  245. data/spec/rails_4.1_app/config/locales/en.yml +23 -0
  246. data/spec/rails_4.1_app/config/mongo.yml +11 -0
  247. data/spec/rails_4.1_app/config/mongoid.yml +13 -0
  248. data/spec/rails_4.1_app/config/routes.rb +4 -0
  249. data/spec/rails_4.1_app/config/secrets.yml +22 -0
  250. data/spec/rails_4.1_app/db/migrate/20140301171212_add_devise_users.rb +11 -0
  251. data/spec/rails_4.1_app/db/schema.rb +25 -0
  252. data/spec/rails_4.1_app/db/seeds.rb +7 -0
  253. data/spec/rails_4.1_app/lib/assets/.keep +0 -0
  254. data/spec/rails_4.1_app/lib/tasks/.keep +0 -0
  255. data/spec/rails_4.1_app/log/.keep +0 -0
  256. data/spec/rails_4.1_app/public/404.html +67 -0
  257. data/spec/rails_4.1_app/public/422.html +67 -0
  258. data/spec/rails_4.1_app/public/500.html +66 -0
  259. data/spec/rails_4.1_app/public/favicon.ico +0 -0
  260. data/spec/rails_4.1_app/public/robots.txt +5 -0
  261. data/spec/rails_4.2_app/.gitignore +17 -0
  262. data/spec/rails_4.2_app/Rakefile +6 -0
  263. data/spec/rails_4.2_app/app/assets/images/.keep +0 -0
  264. data/spec/rails_4.2_app/app/assets/javascripts/application.js +13 -0
  265. data/spec/rails_4.2_app/app/assets/stylesheets/application.css +15 -0
  266. data/spec/rails_4.2_app/app/controllers/application_controller.rb +5 -0
  267. data/spec/rails_4.2_app/app/controllers/concerns/.keep +0 -0
  268. data/spec/rails_4.2_app/app/controllers/home_controller.rb +4 -0
  269. data/spec/rails_4.2_app/app/helpers/application_helper.rb +2 -0
  270. data/spec/rails_4.2_app/app/mailers/.keep +0 -0
  271. data/spec/rails_4.2_app/app/models/.keep +0 -0
  272. data/spec/rails_4.2_app/app/models/concerns/.keep +0 -0
  273. data/spec/rails_4.2_app/app/models/user.rb +5 -0
  274. data/spec/rails_4.2_app/app/views/devise/confirmations/new.html.erb +12 -0
  275. data/spec/rails_4.2_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  276. data/spec/rails_4.2_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  277. data/spec/rails_4.2_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  278. data/spec/rails_4.2_app/app/views/devise/passwords/edit.html.erb +16 -0
  279. data/spec/rails_4.2_app/app/views/devise/passwords/new.html.erb +12 -0
  280. data/spec/rails_4.2_app/app/views/devise/registrations/edit.html.erb +29 -0
  281. data/spec/rails_4.2_app/app/views/devise/registrations/new.html.erb +18 -0
  282. data/spec/rails_4.2_app/app/views/devise/sessions/new.html.erb +17 -0
  283. data/spec/rails_4.2_app/app/views/devise/shared/_links.erb +25 -0
  284. data/spec/rails_4.2_app/app/views/devise/unlocks/new.html.erb +12 -0
  285. data/spec/rails_4.2_app/app/views/home/index.html.erb +10 -0
  286. data/spec/rails_4.2_app/app/views/layouts/application.html.erb +17 -0
  287. data/spec/rails_4.2_app/bin/bundle +3 -0
  288. data/spec/rails_4.2_app/bin/rails +8 -0
  289. data/spec/rails_4.2_app/bin/rake +8 -0
  290. data/spec/rails_4.2_app/bin/setup +29 -0
  291. data/spec/rails_4.2_app/bin/spring +15 -0
  292. data/spec/rails_4.2_app/config.ru +4 -0
  293. data/spec/rails_4.2_app/config/application.rb +26 -0
  294. data/spec/rails_4.2_app/config/boot.rb +3 -0
  295. data/spec/rails_4.2_app/config/database.yml +11 -0
  296. data/spec/rails_4.2_app/config/environment.rb +5 -0
  297. data/spec/rails_4.2_app/config/environments/development.rb +41 -0
  298. data/spec/rails_4.2_app/config/environments/production.rb +79 -0
  299. data/spec/rails_4.2_app/config/environments/test.rb +42 -0
  300. data/spec/rails_4.2_app/config/initializers/assets.rb +11 -0
  301. data/spec/rails_4.2_app/config/initializers/backtrace_silencers.rb +7 -0
  302. data/spec/rails_4.2_app/config/initializers/cookies_serializer.rb +3 -0
  303. data/spec/rails_4.2_app/config/initializers/devise.rb +254 -0
  304. data/spec/rails_4.2_app/config/initializers/filter_parameter_logging.rb +4 -0
  305. data/spec/rails_4.2_app/config/initializers/inflections.rb +16 -0
  306. data/spec/rails_4.2_app/config/initializers/mime_types.rb +4 -0
  307. data/spec/rails_4.2_app/config/initializers/session_store.rb +5 -0
  308. data/spec/rails_4.2_app/config/initializers/wrap_parameters.rb +14 -0
  309. data/spec/rails_4.2_app/config/locales/en.yml +23 -0
  310. data/spec/rails_4.2_app/config/mongo.yml +11 -0
  311. data/spec/rails_4.2_app/config/mongoid.yml +13 -0
  312. data/spec/rails_4.2_app/config/routes.rb +4 -0
  313. data/spec/rails_4.2_app/config/secrets.yml +22 -0
  314. data/spec/rails_4.2_app/db/migrate/20140301171212_add_devise_users.rb +11 -0
  315. data/spec/rails_4.2_app/db/schema.rb +25 -0
  316. data/spec/rails_4.2_app/db/seeds.rb +7 -0
  317. data/spec/rails_4.2_app/lib/assets/.keep +0 -0
  318. data/spec/rails_4.2_app/lib/tasks/.keep +0 -0
  319. data/spec/rails_4.2_app/log/.keep +0 -0
  320. data/spec/rails_4.2_app/public/404.html +67 -0
  321. data/spec/rails_4.2_app/public/422.html +67 -0
  322. data/spec/rails_4.2_app/public/500.html +66 -0
  323. data/spec/rails_4.2_app/public/favicon.ico +0 -0
  324. data/spec/rails_4.2_app/public/robots.txt +5 -0
  325. data/spec/rails_helper.rb +47 -0
  326. data/spec/spec_helper.rb +5 -0
  327. metadata +409 -0
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ .DS_Store
2
+ /pkg
3
+ /doc
4
+ /coverage
5
+ Gemfile.lock
6
+ Gemfile_Rails_*.lock
7
+ *.gem
8
+ .rvmrc
9
+ *.swo
10
+ *.swp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,21 @@
1
+ language: ruby
2
+ script: "rake"
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.5
7
+ - "2.2"
8
+ - ruby-head
9
+ - jruby-19mode
10
+ - jruby-head
11
+ - rbx-2.2.9
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: jruby-head
15
+ - rvm: ruby-head
16
+ - rvm: rbx-2.2.9
17
+ before_script:
18
+ - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz -O /tmp/mongodb.tgz
19
+ - tar -xvf /tmp/mongodb.tgz
20
+ - mkdir /tmp/data
21
+ - ${PWD}/mongodb-linux-x86_64-3.0.1/bin/mongod --dbpath /tmp/data --bind_ip 127.0.0.1 &> /dev/null &
data/Gemfile ADDED
@@ -0,0 +1,67 @@
1
+ source 'https://rubygems.org'
2
+
3
+ RAILS_VERS = case ENV['RAILS_VERS']
4
+ when '3.1'
5
+ '~>3.1.12'
6
+ when '3.2'
7
+ '~>3.2.18'
8
+ when '4.0'
9
+ '~>4.0.5'
10
+ when '4.1'
11
+ '~>4.1.9'
12
+ when '4.2'
13
+ '~>4.2.0'
14
+ when '5.0'
15
+ '~>5.0.0'
16
+ when nil
17
+ nil
18
+ else
19
+ raise "Invalid RAILS_VERS. Available versions are 3.1, 3.2, 4.0, 4.1, and 4.2."
20
+ end
21
+
22
+ gemspec :name => 'mongo_session_store-rails5'
23
+
24
+ group :development, :test do
25
+ gem 'rake'
26
+
27
+ case ENV['MONGO_SESSION_STORE_ORM']
28
+ when 'mongo_mapper'
29
+ gem 'mongo_mapper', '>= 0.13.1'
30
+ when 'mongoid'
31
+ if ENV['RAILS_VERS'] =~ /^5\.\d/
32
+ gem 'mongoid', '>= 6.0.0'
33
+ elsif ENV['RAILS_VERS'] =~ /^4\.\d/
34
+ gem 'mongoid', '>= 4.0.2'
35
+ elsif ENV['RAILS_VERS'] =~ /^3\.2\d/
36
+ gem 'mongoid', '>= 3.1.0'
37
+ else
38
+ gem 'mongoid', '>= 3.0.0'
39
+ end
40
+ when 'mongo'
41
+ gem 'mongo'
42
+ else
43
+ gem 'mongo' # So rake test_all can wait for Mongo to start
44
+ end
45
+
46
+ gem 'pry'
47
+
48
+ if RUBY_PLATFORM == 'java'
49
+ gem 'jdbc-sqlite3'
50
+ gem 'activerecord-jdbc-adapter'
51
+ gem 'activerecord-jdbcsqlite3-adapter'
52
+ gem 'jruby-openssl'
53
+ gem 'jruby-rack'
54
+ else
55
+ gem 'sqlite3' # for devise User storage
56
+ end
57
+
58
+ if RAILS_VERS
59
+ gem 'rails', RAILS_VERS
60
+ else
61
+ gem 'rails'
62
+ end
63
+ gem 'test-unit'
64
+
65
+ gem 'rspec-rails', '2.12.0'
66
+ gem 'devise'
67
+ end
data/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # MongoSessionStore [![Build Status](https://travis-ci.org/brianhempel/mongo_session_store.png?branch=master)](https://travis-ci.org/brianhempel/mongo_session_store) [![Gem Version](https://badge.fury.io/rb/mongo_session_store-rails4.svg)](http://badge.fury.io/rb/mongo_session_store-rails4)
2
+
3
+ ## Description
4
+
5
+ MongoSessionStore is a collection of Rails-compatible session stores for MongoMapper and Mongoid, but also included is a generic Mongo store that works with any (or no!) Mongo ODM.
6
+
7
+ MongoSessionStore is tested [on Travis CI](https://travis-ci.org/brianhempel/mongo_session_store) against Ruby 1.9.3, 2.0.0, 2.1.5, 2.2.0, and JRuby with Rails 3.1 through 4.2.
8
+
9
+ Mongoid users: This gem is compatible with both Mongoid 3 and 4.
10
+
11
+ If this gem doesn't work for you, you might next try [mongo_sessions](https://github.com/biilmann/mongo_sessions).
12
+
13
+ See the [Changelog](#changelog) if you need support for an older version of Ruby, Rails, or Mongoid.
14
+
15
+ ## Usage
16
+
17
+ MongoSessionStore is compatible with Rails 3.1 through 4.2.
18
+
19
+ In your Gemfile:
20
+
21
+ ```ruby
22
+ gem "mongo_mapper"
23
+ # or gem "mongoid"
24
+ # or gem "mongo"
25
+ gem "mongo_session_store-rails5"
26
+ # or gem "mongo_session_store-rails4"
27
+ # or gem "mongo_session_store-rails3"
28
+ ```
29
+
30
+ In the session_store initializer (config/initializers/session_store.rb):
31
+
32
+ ```ruby
33
+ # MongoMapper
34
+ MyApp::Application.config.session_store :mongo_mapper_store
35
+
36
+ # Mongoid
37
+ MyApp::Application.config.session_store :mongoid_store
38
+
39
+ # anything else
40
+ MyApp::Application.config.session_store :mongo_store
41
+ MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: \"my_app_development\")
42
+ ```
43
+
44
+ By default, the sessions will be stored in the "sessions" collection in MongoDB. If you want to use a different collection, you can set that in the initializer:
45
+
46
+ ```ruby
47
+ MongoSessionStore.collection_name = "client_sessions"
48
+ ```
49
+
50
+ And if for some reason you want to query your sessions:
51
+
52
+ ```ruby
53
+ # MongoMapper
54
+ MongoMapperStore::Session.where(:updated_at.gt => 2.days.ago)
55
+
56
+ # Mongoid
57
+ MongoidStore::Session.where(:updated_at.gt => 2.days.ago)
58
+
59
+ # Plain old Mongo
60
+ MongoStore::Session.where('updated_at' => { '$gt' => 2.days.ago })
61
+ ```
62
+
63
+ ## Changelog
64
+
65
+ 7.0.0 supports Rails 5.0.
66
+
67
+ 6.0.0 supports the Mongo Ruby Driver 2.0 for the generic MongoStore. The other stores are unchanged. Tests added for Rails 4.2. Tests against MongoDB 3.0.1 on Travis CI.
68
+
69
+ 5.1.0 generates a new session ID when a session is not found. Previously, when a session ID is provided in the request but the session was not found (because for example, it was removed from Mongo by a sweeper job) a new session with the provided ID would be created. This would cause a write error if two simultaneous requests both create a session with the same ID and both try to insert a new document with that ID.
70
+
71
+ 5.0.1 suppresses a warning from Mongoid 4 when setting the _id field type to String.
72
+
73
+ 5.0.0 introduces Rails 4.0 and 4.1 support and Mongoid 4 support alongside the existing Rails 3.1, 3.2, and Mongoid 3 support. Ruby 1.8.7 support is dropped. The database is no longer set automatically for the MongoStore when MongoMapper or Mongoid is present. You have to set the database manually whenever you choose to use the vanilla MongoStore.
74
+
75
+ The last version to support Ruby 1.8.7 is [version 4.1.1](https://rubygems.org/gems/mongo_session_store-rails3/versions/4.1.1).
76
+
77
+ The last version to support Rails 3.0 or Mongoid 2 is [version 3.0.6](https://rubygems.org/gems/mongo_session_store-rails3/versions/3.0.6).
78
+
79
+ ## Development
80
+
81
+ To run all the tests:
82
+
83
+ rake
84
+
85
+ To run the tests for a specific store (examples):
86
+
87
+ rake test_31_mongo
88
+ rake test_32_mongoid
89
+ rake test_40_mongoid
90
+ rake test_41_mongo_mapper
91
+
92
+ To see a list of all options for running tests, run
93
+
94
+ rake -T
95
+
96
+ ## Previous contributors
97
+
98
+ MongoSessionStore started as a fork of the DataMapper session store, modified to work with MongoMapper and Mongoid. Much thanks to all the previous contributors:
99
+
100
+ * Nicolas Mérouze
101
+ * Chris Brickley
102
+ * Tony Pitale
103
+ * Nicola Racco
104
+ * Matt Powell
105
+ * Ryan Fitzgerald
106
+
107
+ ## License
108
+
109
+ Copyright (c) 2011-2014 Brian Hempel
110
+ Copyright (c) 2010 Nicolas Mérouze
111
+ Copyright (c) 2009 Chris Brickley
112
+ Copyright (c) 2009 Tony Pitale
113
+
114
+ Permission is hereby granted, free of charge, to any person
115
+ obtaining a copy of this software and associated documentation
116
+ files (the "Software"), to deal in the Software without
117
+ restriction, including without limitation the rights to use,
118
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
119
+ copies of the Software, and to permit persons to whom the
120
+ Software is furnished to do so, subject to the following
121
+ conditions:
122
+
123
+ The above copyright notice and this permission notice shall be
124
+ included in all copies or substantial portions of the Software.
125
+
126
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
127
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
128
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
129
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
130
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
131
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
132
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
133
+ OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,93 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks :name => 'mongo_session_store-rails5'
5
+
6
+ def run_with_output(command)
7
+ puts "Running: #{command}"
8
+ system(command)
9
+ end
10
+
11
+ def set_versions(rails_vers, orm)
12
+ success = true
13
+ unless File.exists?("Gemfile_Rails_#{rails_vers}_#{orm}_#{RUBY_VERSION}.lock")
14
+ success &&= run_with_output("export RAILS_VERS=#{rails_vers}; export MONGO_SESSION_STORE_ORM=#{orm}; bundle update")
15
+ success &&= run_with_output("cp Gemfile.lock Gemfile_Rails_#{rails_vers}_#{orm}_#{RUBY_VERSION}.lock")
16
+ else
17
+ success &&= run_with_output("rm Gemfile.lock")
18
+ success &&= run_with_output("cp Gemfile_Rails_#{rails_vers}_#{orm}_#{RUBY_VERSION}.lock Gemfile.lock")
19
+ end
20
+ success
21
+ end
22
+
23
+ @rails_versions = ['5.0']
24
+ @orms = ['mongo_mapper', 'mongoid', 'mongo']
25
+
26
+ task :default => :test_all
27
+
28
+ desc 'Test each session store against Rails 5.0'
29
+ task :test_all do
30
+ # inspired by http://pivotallabs.com/users/jdean/blog/articles/1728-testing-your-gem-against-multiple-rubies-and-rails-versions-with-rvm
31
+
32
+ # Wait for mongod to start on Travis.
33
+ # From the Mongo Ruby Driver gem.
34
+ if ENV['TRAVIS']
35
+ require 'mongo'
36
+ client = Mongo::Client.new(['127.0.0.1:27017'])
37
+ begin
38
+ puts "Waiting for MongoDB..."
39
+ client.command(Mongo::Server::Monitor::STATUS)
40
+ rescue Mongo::ServerSelector::NoServerAvailable => e
41
+ sleep(2)
42
+ # 1 Retry
43
+ puts "Waiting for MongoDB..."
44
+ client.cluster.scan!
45
+ client.command(Mongo::ServerSelector::NoServerAvailable)
46
+ end
47
+ end
48
+
49
+ @failed_suites = []
50
+
51
+ @rails_versions.each do |rails_version|
52
+ @orms.each do |orm|
53
+ success = set_versions(rails_version, orm)
54
+
55
+ unless success && run_with_output("export RAILS_VERS=#{rails_version}; export MONGO_SESSION_STORE_ORM=#{orm}; bundle exec rspec spec")
56
+ @failed_suites << "Rails #{rails_version} / #{orm}"
57
+ end
58
+ end
59
+ end
60
+
61
+ if @failed_suites.any?
62
+ puts "\033[0;31mFailed:"
63
+ puts @failed_suites.join("\n")
64
+ print "\033[0m"
65
+ exit(1)
66
+ else
67
+ print "\033[0;32mAll passed! Success! "
68
+ "Yahoooo!!!".chars.each { |c| sleep 0.4; print c; STDOUT.flush }
69
+ puts "\033[0m"
70
+ end
71
+ end
72
+
73
+ @rails_versions.each do |rails_version|
74
+ @orms.each do |orm|
75
+ desc "Set Gemfile.lock to #{rails_version} with #{orm}"
76
+ task :"use_#{rails_version.gsub('.', '')}_#{orm}" do
77
+ set_versions(rails_version, orm)
78
+ end
79
+
80
+ desc "Test against #{rails_version} with #{orm}"
81
+ task :"test_#{rails_version.gsub('.', '')}_#{orm}" do
82
+ set_versions(rails_version, orm)
83
+ success = run_with_output("export RAILS_VERS=#{rails_version}; export MONGO_SESSION_STORE_ORM=#{orm}; bundle exec rspec spec")
84
+ exit(1) unless success
85
+ end
86
+
87
+ desc "Rebundle for #{rails_version} with #{orm}"
88
+ task :"rebundle_#{rails_version.gsub('.', '')}_#{orm}" do
89
+ run_with_output "rm Gemfile_Rails_#{rails_version}_#{orm}_#{RUBY_VERSION}.lock Gemfile.lock"
90
+ set_versions(rails_version, orm)
91
+ end
92
+ end
93
+ end
@@ -0,0 +1 @@
1
+ require 'mongo_session_store'
@@ -0,0 +1 @@
1
+ require 'mongo_session_store'
@@ -0,0 +1 @@
1
+ require 'mongo_session_store'
@@ -0,0 +1,49 @@
1
+ require 'securerandom'
2
+
3
+ $:.unshift File.dirname(__FILE__)
4
+
5
+ module MongoSessionStore
6
+ autoload :VERSION, 'mongo_session_store/version'
7
+
8
+ def self.collection_name=(name)
9
+ @collection_name = name
10
+
11
+ if defined?(MongoStore::Session)
12
+ MongoStore::Session.reset_collection
13
+ end
14
+
15
+ if defined?(MongoMapperStore::Session)
16
+ MongoMapperStore::Session.set_collection_name(name)
17
+ end
18
+
19
+ if defined?(MongoidStore::Session)
20
+ MongoidStore::Session.store_in :collection => MongoSessionStore.collection_name
21
+ end
22
+
23
+ @collection_name
24
+ end
25
+
26
+ def self.collection_name
27
+ @collection_name
28
+ end
29
+
30
+ # default collection name for all the stores
31
+ self.collection_name = "sessions"
32
+ end
33
+
34
+ # we don't use autoloading because of thread concerns
35
+ # hence, this mess
36
+ load_errors = []
37
+
38
+ %w(mongo_mapper_store mongoid_store mongo_store).each do |store_name|
39
+ begin
40
+ require "mongo_session_store/#{store_name}"
41
+ rescue LoadError => e
42
+ load_errors << e
43
+ end
44
+ end
45
+
46
+ if load_errors.count == 3
47
+ message = "Could not load any session store!\n" + load_errors.map(&:message).join("\n")
48
+ raise LoadError, message
49
+ end
@@ -0,0 +1,22 @@
1
+ require 'mongo_mapper'
2
+ require 'mongo_session_store/mongo_store_base'
3
+
4
+ module ActionDispatch
5
+ module Session
6
+ class MongoMapperStore < MongoStoreBase
7
+
8
+ class Session
9
+ include MongoMapper::Document
10
+ set_collection_name MongoSessionStore.collection_name
11
+
12
+ key :_id, String
13
+ key :data, Binary, :default => Marshal.dump({})
14
+
15
+ timestamps!
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+
22
+ MongoMapperStore = ActionDispatch::Session::MongoMapperStore
@@ -0,0 +1,83 @@
1
+ require 'mongo'
2
+ require 'mongo_session_store/mongo_store_base'
3
+
4
+ module ActionDispatch
5
+ module Session
6
+ class MongoStore < MongoStoreBase
7
+ class Session
8
+ attr_accessor :_id, :data, :created_at, :updated_at
9
+
10
+ def initialize(options = {})
11
+ @_id = options[:_id]
12
+ @data = options[:data] || BSON::Binary.new(Marshal.dump({}), :generic)
13
+ @created_at = options[:created_at]
14
+ @updated_at = options[:updated_at]
15
+ end
16
+
17
+ def self.load(options = {})
18
+ options[:data] = options["data"] if options["data"]
19
+ new(options)
20
+ end
21
+
22
+ def scope
23
+ collection.find(:_id => _id)
24
+ end
25
+
26
+ def destroy
27
+ scope.delete_one
28
+ end
29
+
30
+ def save
31
+ @created_at ||= Time.now
32
+ @updated_at = Time.now
33
+
34
+ attributes = {
35
+ :data => BSON::Binary.new(@data, :generic),
36
+ :created_at => @created_at,
37
+ :updated_at => @updated_at
38
+ }
39
+
40
+ scope.replace_one(attributes, upsert: true)
41
+ end
42
+
43
+ def data=(stuff)
44
+ @data = stuff.to_s
45
+ end
46
+
47
+ def self.where(query = {})
48
+ collection.find(query).map { |doc| load(doc) }
49
+ end
50
+
51
+ def self.last
52
+ where.last
53
+ end
54
+
55
+ def self.database
56
+ if @database
57
+ @database
58
+ else
59
+ raise "MongoStore needs a database, e.g. MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: \"my_app_development\")"
60
+ end
61
+ end
62
+
63
+ def self.database=(database)
64
+ @database = database
65
+ end
66
+
67
+ def self.collection
68
+ @collection ||= database[MongoSessionStore.collection_name]
69
+ end
70
+
71
+ def self.reset_collection
72
+ @collection = nil
73
+ end
74
+
75
+ def collection
76
+ self.class.collection
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ MongoStore = ActionDispatch::Session::MongoStore