muck-friends 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. data/.gitignore +5 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +51 -0
  4. data/Rakefile +101 -0
  5. data/VERSION +1 -0
  6. data/app/controllers/muck/friends_controller.rb +70 -0
  7. data/app/helpers/muck_friends_helper.rb +93 -0
  8. data/app/models/friend_mailer.rb +25 -0
  9. data/app/views/activity_templates/follow.html.erb +1 -0
  10. data/app/views/activity_templates/friends_with.html.erb +1 -0
  11. data/app/views/friend_mailer/follow.text.html.erb +8 -0
  12. data/app/views/friend_mailer/follow.text.plain.erb +8 -0
  13. data/app/views/friend_mailer/friend_request.text.html.erb +8 -0
  14. data/app/views/friend_mailer/friend_request.text.plain.erb +8 -0
  15. data/app/views/friends/_friend_simple.html.erb +4 -0
  16. data/app/views/friends/_friends.html.erb +8 -0
  17. data/app/views/friends/_notifications.html.erb +32 -0
  18. data/app/views/friends/friend_or_follow_request.html.erb +8 -0
  19. data/app/views/friends/index.html.erb +1 -0
  20. data/config/muck_friends_routes.rb +4 -0
  21. data/db/migrate/20090608073052_create_friends.rb +16 -0
  22. data/install.rb +1 -0
  23. data/lib/active_record/acts/muck_friend.rb +141 -0
  24. data/lib/active_record/acts/muck_friend_user.rb +103 -0
  25. data/lib/muck_friends.rb +12 -0
  26. data/lib/muck_friends/initialize_routes.rb +8 -0
  27. data/lib/muck_friends/tasks.rb +27 -0
  28. data/locales/ar.yml +31 -0
  29. data/locales/bg.yml +31 -0
  30. data/locales/ca.yml +31 -0
  31. data/locales/cs.yml +31 -0
  32. data/locales/da.yml +31 -0
  33. data/locales/de.yml +31 -0
  34. data/locales/el.yml +31 -0
  35. data/locales/en.yml +31 -0
  36. data/locales/es.yml +31 -0
  37. data/locales/et.yml +31 -0
  38. data/locales/fa.yml +31 -0
  39. data/locales/fi.yml +31 -0
  40. data/locales/fr.yml +31 -0
  41. data/locales/gl.yml +31 -0
  42. data/locales/hi.yml +31 -0
  43. data/locales/hr.yml +31 -0
  44. data/locales/hu.yml +31 -0
  45. data/locales/id.yml +31 -0
  46. data/locales/it.yml +31 -0
  47. data/locales/iw.yml +31 -0
  48. data/locales/ja.yml +31 -0
  49. data/locales/ko.yml +31 -0
  50. data/locales/lt.yml +31 -0
  51. data/locales/lv.yml +31 -0
  52. data/locales/mt.yml +31 -0
  53. data/locales/nl.yml +31 -0
  54. data/locales/no.yml +32 -0
  55. data/locales/pl.yml +31 -0
  56. data/locales/pt-PT.yml +31 -0
  57. data/locales/pt.yml +6 -0
  58. data/locales/ro.yml +31 -0
  59. data/locales/ru.yml +31 -0
  60. data/locales/sk.yml +31 -0
  61. data/locales/sl.yml +31 -0
  62. data/locales/sq.yml +31 -0
  63. data/locales/sr.yml +31 -0
  64. data/locales/sv.yml +31 -0
  65. data/locales/th.yml +31 -0
  66. data/locales/tl.yml +31 -0
  67. data/locales/tr.yml +31 -0
  68. data/locales/uk.yml +31 -0
  69. data/locales/vi.yml +31 -0
  70. data/locales/zh-CN.yml +31 -0
  71. data/locales/zh-TW.yml +31 -0
  72. data/locales/zh.yml +31 -0
  73. data/muck-friends.gemspec +381 -0
  74. data/rails/init.rb +4 -0
  75. data/tasks/rails.rake +1 -0
  76. data/test/rails_root/.gitignore +8 -0
  77. data/test/rails_root/.rake_tasks +103 -0
  78. data/test/rails_root/Capfile +3 -0
  79. data/test/rails_root/Rakefile +15 -0
  80. data/test/rails_root/app/controllers/application_controller.rb +21 -0
  81. data/test/rails_root/app/controllers/default_controller.rb +7 -0
  82. data/test/rails_root/app/helpers/application_helper.rb +3 -0
  83. data/test/rails_root/app/models/.keep +0 -0
  84. data/test/rails_root/app/models/activity.rb +3 -0
  85. data/test/rails_root/app/models/friend.rb +4 -0
  86. data/test/rails_root/app/models/user.rb +8 -0
  87. data/test/rails_root/app/models/user_session.rb +2 -0
  88. data/test/rails_root/app/views/default/index.html.erb +1 -0
  89. data/test/rails_root/app/views/layouts/default.html.erb +26 -0
  90. data/test/rails_root/config/amazon_s3.yml +14 -0
  91. data/test/rails_root/config/boot.rb +109 -0
  92. data/test/rails_root/config/database.yml +14 -0
  93. data/test/rails_root/config/environment.rb +27 -0
  94. data/test/rails_root/config/environments/development.rb +19 -0
  95. data/test/rails_root/config/environments/production.rb +1 -0
  96. data/test/rails_root/config/environments/test.rb +34 -0
  97. data/test/rails_root/config/global_config.yml +72 -0
  98. data/test/rails_root/config/initializers/inflections.rb +10 -0
  99. data/test/rails_root/config/initializers/mime_types.rb +5 -0
  100. data/test/rails_root/config/initializers/requires.rb +13 -0
  101. data/test/rails_root/config/initializers/session_store.rb +8 -0
  102. data/test/rails_root/config/routes.rb +3 -0
  103. data/test/rails_root/db/.keep +0 -0
  104. data/test/rails_root/db/migrate/20090320174818_create_muck_permissions_and_roles.rb +16 -0
  105. data/test/rails_root/db/migrate/20090402033319_add_muck_activities.rb +36 -0
  106. data/test/rails_root/db/migrate/20090602041838_create_users.rb +39 -0
  107. data/test/rails_root/db/migrate/20090608073052_create_friends.rb +16 -0
  108. data/test/rails_root/features/step_definitions/webrat_steps.rb +99 -0
  109. data/test/rails_root/features/support/env.rb +14 -0
  110. data/test/rails_root/public/.htaccess +40 -0
  111. data/test/rails_root/public/404.html +30 -0
  112. data/test/rails_root/public/422.html +30 -0
  113. data/test/rails_root/public/500.html +30 -0
  114. data/test/rails_root/public/dispatch.rb +10 -0
  115. data/test/rails_root/public/favicon.ico +0 -0
  116. data/test/rails_root/public/images/arrow_left.gif +0 -0
  117. data/test/rails_root/public/images/arrow_right.gif +0 -0
  118. data/test/rails_root/public/images/blue/preview.gif +0 -0
  119. data/test/rails_root/public/images/icons/accept.png +0 -0
  120. data/test/rails_root/public/images/icons/add.png +0 -0
  121. data/test/rails_root/public/images/icons/delete.png +0 -0
  122. data/test/rails_root/public/images/icons/vote.png +0 -0
  123. data/test/rails_root/public/images/loading.gif +0 -0
  124. data/test/rails_root/public/images/profile_default.jpg +0 -0
  125. data/test/rails_root/public/images/rails.png +0 -0
  126. data/test/rails_root/public/images/red/preview.gif +0 -0
  127. data/test/rails_root/public/images/spinner.gif +0 -0
  128. data/test/rails_root/public/images/sprites.png +0 -0
  129. data/test/rails_root/public/javascripts/application.js +2 -0
  130. data/test/rails_root/public/javascripts/builder.js +136 -0
  131. data/test/rails_root/public/javascripts/controls.js +963 -0
  132. data/test/rails_root/public/javascripts/dragdrop.js +972 -0
  133. data/test/rails_root/public/javascripts/effects.js +1120 -0
  134. data/test/rails_root/public/javascripts/fancyzoom.min.js +1 -0
  135. data/test/rails_root/public/javascripts/jquery/jquery-ui.js +273 -0
  136. data/test/rails_root/public/javascripts/jquery/jquery.form.js +637 -0
  137. data/test/rails_root/public/javascripts/jquery/jquery.jgrowl.js +2 -0
  138. data/test/rails_root/public/javascripts/jquery/jquery.js +19 -0
  139. data/test/rails_root/public/javascripts/jquery/jquery.tips.js +69 -0
  140. data/test/rails_root/public/javascripts/muck.js +76 -0
  141. data/test/rails_root/public/javascripts/muck_activities.js +108 -0
  142. data/test/rails_root/public/javascripts/prototype.js +4225 -0
  143. data/test/rails_root/public/javascripts/scriptaculous.js +58 -0
  144. data/test/rails_root/public/javascripts/slider.js +277 -0
  145. data/test/rails_root/public/javascripts/sound.js +60 -0
  146. data/test/rails_root/public/robots.txt +1 -0
  147. data/test/rails_root/public/stylesheets/.keep +0 -0
  148. data/test/rails_root/public/stylesheets/admin.css +12 -0
  149. data/test/rails_root/public/stylesheets/blueprint/ie.css +26 -0
  150. data/test/rails_root/public/stylesheets/blueprint/liquid_screen.css +203 -0
  151. data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/cross.png +0 -0
  152. data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/key.png +0 -0
  153. data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/icons/tick.png +0 -0
  154. data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/readme.txt +32 -0
  155. data/test/rails_root/public/stylesheets/blueprint/plugins/buttons/screen.css +97 -0
  156. data/test/rails_root/public/stylesheets/blueprint/plugins/fancy-type/readme.txt +14 -0
  157. data/test/rails_root/public/stylesheets/blueprint/plugins/fancy-type/screen.css +71 -0
  158. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/doc.png +0 -0
  159. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/email.png +0 -0
  160. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/external.png +0 -0
  161. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/feed.png +0 -0
  162. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/im.png +0 -0
  163. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/pdf.png +0 -0
  164. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/visited.png +0 -0
  165. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/icons/xls.png +0 -0
  166. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/readme.txt +18 -0
  167. data/test/rails_root/public/stylesheets/blueprint/plugins/link-icons/screen.css +40 -0
  168. data/test/rails_root/public/stylesheets/blueprint/plugins/liquid/liquid.css +134 -0
  169. data/test/rails_root/public/stylesheets/blueprint/plugins/liquid/src/liquid.css +197 -0
  170. data/test/rails_root/public/stylesheets/blueprint/plugins/rtl/readme.txt +10 -0
  171. data/test/rails_root/public/stylesheets/blueprint/plugins/rtl/screen.css +109 -0
  172. data/test/rails_root/public/stylesheets/blueprint/print.css +30 -0
  173. data/test/rails_root/public/stylesheets/blueprint/screen.css +251 -0
  174. data/test/rails_root/public/stylesheets/blueprint/sprite.css +1 -0
  175. data/test/rails_root/public/stylesheets/blueprint/src/forms.css +49 -0
  176. data/test/rails_root/public/stylesheets/blueprint/src/grid.css +213 -0
  177. data/test/rails_root/public/stylesheets/blueprint/src/grid.png +0 -0
  178. data/test/rails_root/public/stylesheets/blueprint/src/ie.css +59 -0
  179. data/test/rails_root/public/stylesheets/blueprint/src/print.css +85 -0
  180. data/test/rails_root/public/stylesheets/blueprint/src/reset.css +38 -0
  181. data/test/rails_root/public/stylesheets/blueprint/src/typography.css +105 -0
  182. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png +0 -0
  183. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_diagonals-thick_15_444444_40x40.png +0 -0
  184. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_100_f0f0f0_1x400.png +0 -0
  185. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_50_99c2ff_1x400.png +0 -0
  186. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_55_fbf5d0_1x400.png +0 -0
  187. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_80_e6e6e6_1x400.png +0 -0
  188. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  189. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_highlight-hard_100_f9f9f9_1x100.png +0 -0
  190. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-bg_highlight-soft_100_e7eef3_1x100.png +0 -0
  191. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_222222_256x240.png +0 -0
  192. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
  193. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
  194. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
  195. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_888888_256x240.png +0 -0
  196. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_cd0a0a_256x240.png +0 -0
  197. data/test/rails_root/public/stylesheets/jquery/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
  198. data/test/rails_root/public/stylesheets/jquery/cupertino/jquery-ui-1.7.1.custom.css +404 -0
  199. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  200. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  201. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  202. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  203. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  204. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  205. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  206. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  207. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_217bc0_256x240.png +0 -0
  208. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
  209. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_469bdd_256x240.png +0 -0
  210. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
  211. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
  212. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
  213. data/test/rails_root/public/stylesheets/jquery/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
  214. data/test/rails_root/public/stylesheets/jquery/redmond/jquery-ui-1.7.1.custom.css +404 -0
  215. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  216. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  217. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  218. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  219. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  220. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  221. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  222. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  223. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_222222_256x240.png +0 -0
  224. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  225. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_454545_256x240.png +0 -0
  226. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_888888_256x240.png +0 -0
  227. data/test/rails_root/public/stylesheets/jquery/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  228. data/test/rails_root/public/stylesheets/jquery/smoothness/jquery-ui-1.7.1.custom.css +404 -0
  229. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  230. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  231. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  232. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  233. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  234. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  235. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  236. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  237. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  238. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
  239. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  240. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
  241. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
  242. data/test/rails_root/public/stylesheets/jquery/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  243. data/test/rails_root/public/stylesheets/jquery/ui-lightness/jquery-ui-1.7.1.custom.css +404 -0
  244. data/test/rails_root/public/stylesheets/reset.css +0 -0
  245. data/test/rails_root/public/stylesheets/styles.css +79 -0
  246. data/test/rails_root/public/stylesheets/themes/blue/styles.css +1 -0
  247. data/test/rails_root/public/stylesheets/themes/red/styles.css +1 -0
  248. data/test/rails_root/script/about +3 -0
  249. data/test/rails_root/script/breakpointer +3 -0
  250. data/test/rails_root/script/console +3 -0
  251. data/test/rails_root/script/create_project.rb +52 -0
  252. data/test/rails_root/script/cucumber +7 -0
  253. data/test/rails_root/script/dbconsole +3 -0
  254. data/test/rails_root/script/destroy +3 -0
  255. data/test/rails_root/script/generate +3 -0
  256. data/test/rails_root/script/performance/benchmarker +3 -0
  257. data/test/rails_root/script/performance/profiler +3 -0
  258. data/test/rails_root/script/performance/request +3 -0
  259. data/test/rails_root/script/plugin +3 -0
  260. data/test/rails_root/script/process/inspector +3 -0
  261. data/test/rails_root/script/process/reaper +3 -0
  262. data/test/rails_root/script/process/spawner +3 -0
  263. data/test/rails_root/script/runner +3 -0
  264. data/test/rails_root/script/server +3 -0
  265. data/test/rails_root/test/factories.rb +50 -0
  266. data/test/rails_root/test/functional/.keep +0 -0
  267. data/test/rails_root/test/functional/friends_controller_test.rb +171 -0
  268. data/test/rails_root/test/integration/.keep +0 -0
  269. data/test/rails_root/test/mocks/development/.keep +0 -0
  270. data/test/rails_root/test/mocks/test/.keep +0 -0
  271. data/test/rails_root/test/shoulda_macros/controller.rb +45 -0
  272. data/test/rails_root/test/shoulda_macros/forms.rb +32 -0
  273. data/test/rails_root/test/shoulda_macros/models.rb +50 -0
  274. data/test/rails_root/test/shoulda_macros/pagination.rb +53 -0
  275. data/test/rails_root/test/shoulda_macros/plugins.rb +34 -0
  276. data/test/rails_root/test/test_helper.rb +38 -0
  277. data/test/rails_root/test/unit/.keep +0 -0
  278. data/test/rails_root/test/unit/friend_mailer_test.rb +37 -0
  279. data/test/rails_root/test/unit/friend_test.rb +186 -0
  280. data/test/rails_root/test/unit/user_test.rb +170 -0
  281. data/test/rails_root/vendor/plugins/ssl_requirement/README +43 -0
  282. data/test/rails_root/vendor/plugins/ssl_requirement/lib/ssl_requirement.rb +62 -0
  283. data/test/rails_root/vendor/plugins/ssl_requirement/test/ssl_requirement_test.rb +132 -0
  284. data/test/rails_root/vendor/plugins/validation_reflection/CHANGELOG +24 -0
  285. data/test/rails_root/vendor/plugins/validation_reflection/LICENSE +20 -0
  286. data/test/rails_root/vendor/plugins/validation_reflection/README +64 -0
  287. data/test/rails_root/vendor/plugins/validation_reflection/Rakefile +22 -0
  288. data/test/rails_root/vendor/plugins/validation_reflection/about.yml +7 -0
  289. data/test/rails_root/vendor/plugins/validation_reflection/init.rb +8 -0
  290. data/test/rails_root/vendor/plugins/validation_reflection/lib/boiler_plate/validation_reflection.rb +129 -0
  291. data/test/rails_root/vendor/plugins/validation_reflection/test/test_helper.rb +36 -0
  292. data/test/rails_root/vendor/plugins/validation_reflection/test/validation_reflection_test.rb +126 -0
  293. data/uninstall.rb +1 -0
  294. metadata +416 -0
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,51 @@
1
+ = MuckFriends
2
+
3
+ == Installation
4
+
5
+ The muck friends engine is part of the muck framework and relies upon the muck_engine as well as the muck-users gem. Both gems should be installed automatically when you install the muck-friends gem. Refer
6
+ to the documentation for muck-users for muck-users configuration.
7
+
8
+ sudo gem install muck-friends
9
+
10
+ Add this to environment.rb:
11
+
12
+ config.gem 'muck-friends', :lib => 'muck_friends'
13
+
14
+
15
+ Inside of global_config.yml add the following, changing the emails to match your application:
16
+
17
+ default: &DEFAULT
18
+
19
+ # Sent in emails to users
20
+ application_name: 'Name of my application'
21
+ from_email: 'support@example.com'
22
+ support_email: 'support@example.com'
23
+ admin_email: 'admin@example.com'
24
+
25
+ # Friend configuration
26
+ allow_following: true # If true then users can 'follow' each other. If false then only friend requests will be used.
27
+ enable_friend_activity: true # If true then friend related activity will show up in the activity feed. Requires muck-activity gem
28
+
29
+ == Usage
30
+
31
+ You will need a friend model that 'acts_as_muck_friend' and a user model that 'acts_as_muck_friend_user'
32
+
33
+ == Example
34
+ After installing the gem just create a friend model thus:
35
+
36
+ class Friend < ActiveRecord::Base
37
+ acts_as_muck_friend
38
+ # install muck-activities and uncomment the following to have friend notifications show up in each user's activity feed.
39
+ # has_activities
40
+ # after_create :add_activity
41
+ end
42
+
43
+ and a user model thus:
44
+
45
+ class User < ActiveRecord::Base
46
+ acts_as_muck_user
47
+ acts_as_muck_friend_user
48
+ end
49
+
50
+
51
+ Copyright (c) 2009 Justin Ball, released under the MIT license
@@ -0,0 +1,101 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Translate this gem'
9
+ task :translate do
10
+ file = File.join(File.dirname(__FILE__), 'locales', 'en.yml')
11
+ system("babelphish -o -y #{file}")
12
+ end
13
+
14
+ desc 'Test the muck_friends plugin.'
15
+ Rake::TestTask.new(:test) do |t|
16
+ t.libs << 'lib'
17
+ t.libs << 'test/rails_root/test'
18
+ t.pattern = 'test/rails_root/test/**/*_test.rb'
19
+ t.verbose = true
20
+ end
21
+
22
+ begin
23
+ require 'rcov/rcovtask'
24
+ Rcov::RcovTask.new do |t|
25
+ #t.libs << 'lib'
26
+ t.libs << 'test/rails_root/lib'
27
+ t.pattern = 'test/rails_root/test/**/*_test.rb'
28
+ t.verbose = true
29
+ t.output_dir = 'coverage'
30
+ t.rcov_opts << '--exclude "gems/*"'
31
+ end
32
+ rescue LoadError
33
+ task :rcov do
34
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
35
+ end
36
+ end
37
+
38
+
39
+ desc 'Generate documentation for the muck_friends plugin.'
40
+ Rake::RDocTask.new(:rdoc) do |rdoc|
41
+ rdoc.rdoc_dir = 'rdoc'
42
+ rdoc.title = 'MuckFriends'
43
+ rdoc.options << '--line-numbers' << '--inline-source'
44
+ rdoc.rdoc_files.include('README*')
45
+ rdoc.rdoc_files.include('lib/**/*.rb')
46
+ end
47
+
48
+ begin
49
+ require 'jeweler'
50
+ Jeweler::Tasks.new do |gemspec|
51
+ gemspec.name = "muck-friends"
52
+ gemspec.summary = "Friends engine for the muck system"
53
+ gemspec.email = "justinball@gmail.com"
54
+ gemspec.homepage = "http://github.com/jbasdf/muck_friends"
55
+ gemspec.description = "Friend engine for the muck system."
56
+ gemspec.authors = ["Justin Ball"]
57
+ gemspec.rubyforge_project = 'muck-friends'
58
+ gemspec.add_dependency "muck-engine"
59
+ gemspec.add_dependency "muck-users"
60
+ gemspec.add_dependency "muck-profiles"
61
+ # gemspec.files.include %w(
62
+ # tasks/*
63
+ # db/migrate/*.rb
64
+ # app/**/**/**/*
65
+ # config/*
66
+ # locales/*
67
+ # rails/*
68
+ # test/*
69
+ # lib/**/*
70
+ # public/**/* )
71
+ end
72
+ rescue LoadError
73
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
74
+ end
75
+
76
+ # rubyforge tasks
77
+ begin
78
+ require 'rake/contrib/sshpublisher'
79
+ namespace :rubyforge do
80
+
81
+ desc "Release gem and RDoc documentation to RubyForge"
82
+ task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
83
+
84
+ namespace :release do
85
+ desc "Publish RDoc to RubyForge."
86
+ task :docs => [:rdoc] do
87
+ config = YAML.load(
88
+ File.read(File.expand_path('~/.rubyforge/user-config.yml'))
89
+ )
90
+
91
+ host = "#{config['username']}@rubyforge.org"
92
+ remote_dir = "/var/www/gforge-projects/muck-friends/"
93
+ local_dir = 'rdoc'
94
+
95
+ Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
96
+ end
97
+ end
98
+ end
99
+ rescue LoadError
100
+ puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
101
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,70 @@
1
+ class Muck::FriendsController < ApplicationController
2
+ unloadable
3
+
4
+ before_filter :login_required, :except => [:index]
5
+ before_filter :get_user_and_target, :except => [:index]
6
+
7
+ def index
8
+ @user = User.find(params[:user_id]) rescue current_user
9
+ respond_to do |format|
10
+ format.html { render :template => 'friends/index' }
11
+ end
12
+ end
13
+
14
+ def create
15
+ respond_to do |format|
16
+ if Friend.make_friends(@user, @target)
17
+ friend = current_user.reload.friend_of? @target
18
+ format.html do
19
+ if GlobalConfig.allow_following
20
+ flash[:notice] = t('muck.friends.you_are_now_following', :user => @target.login)
21
+ else
22
+ flash[:notice] = t('muck.friends.friend_request_sent')
23
+ end
24
+ redirect_to profile_path(@target)
25
+ end
26
+ format.js { render( :update ) {|page| page.replace make_id(@user, @target), get_friend_link(@user, @target)}}
27
+ else
28
+ if GlobalConfig.allow_following
29
+ message = t('muck.friends.problem_adding_follow', :user => @target.login)
30
+ else
31
+ message = t('muck.friends.problem_sending_friend_request', :user => @target.login)
32
+ end
33
+ format.html do
34
+ flash[:notice] = message
35
+ redirect_to profile_path(@target)
36
+ end
37
+ format.js {render( :update ){|page| page.alert message}}
38
+ end
39
+ end
40
+ end
41
+
42
+ def destroy
43
+ @user.drop_friend(@target)
44
+ respond_to do |format|
45
+ format.html do
46
+ flash[:notice] = t('muck.friends.removed_friendship')
47
+ redirect_to profile_path(@target)
48
+ end
49
+ format.js do
50
+ render( :update ){|page| page.replace make_id(@user, @target), get_friend_link(@user, @target)}
51
+ end
52
+ end
53
+ end
54
+
55
+ protected
56
+
57
+ def make_id(user, target)
58
+ user.dom_id(target.dom_id + '_friendship_')
59
+ end
60
+
61
+ def get_user_and_target
62
+ if admin? && params[:user_id]
63
+ @user = User.find(params[:user_id]) rescue current_user
64
+ else
65
+ @user = current_user
66
+ end
67
+ @target = User.find(params[:id])
68
+ end
69
+
70
+ end
@@ -0,0 +1,93 @@
1
+ module MuckFriendsHelper
2
+
3
+ def follow_or_friend_requests
4
+ # TODO
5
+ end
6
+
7
+ def follow_or_friend_request
8
+ render :partial => 'friends/friend_or_follow_request', :locals => { :user => user }
9
+ end
10
+
11
+ def all_friends(user)
12
+ render :partial => 'friends/friends', :locals => { :user => user }
13
+ end
14
+
15
+ def friends(user)
16
+ return '' if user.nil?
17
+ users = user.friends.find(:all, :limit => size, :order => 'RAND()') rescue []
18
+ if users
19
+ render :partial => 'friends/friend_simple', :collection => users, :locals => { :user => user }
20
+ else
21
+ "<p>#{t('muck.friends.no_friends')}</p>"
22
+ end
23
+ end
24
+
25
+ def followers(user)
26
+ return '' if user.nil?
27
+ users = user.followers.find(:all, :limit => size, :order => 'RAND()') rescue []
28
+ if users
29
+ render :partial => 'friends/friend_simple', :collection => users, :locals => { :user => user }
30
+ else
31
+ "<p>#{t('muck.friends.no_followers')}</p>"
32
+ end
33
+ end
34
+
35
+ def followings(user)
36
+ return '' if user.nil?
37
+ users = user.followings.find(:all, :limit => size, :order => 'RAND()') rescue []
38
+ if users
39
+ render :partial => 'friends/friend_simple', :collection => users, :locals => { :user => user }
40
+ else
41
+ "<p>#{t('muck.friends.not_following_anyone')}</p>"
42
+ end
43
+ end
44
+
45
+ # TODO review this code
46
+ def get_friend_link(user, target)
47
+
48
+ return wrap_get_friend_link(link_to( I18n.t('muck.friends.muck.friends.sign_up_to_follow'), signup_path)) if user.blank?
49
+ return '' unless user != :false && target
50
+
51
+ dom_id = make_id(user, target)
52
+
53
+ return wrap_get_friend_link('') if user == target
54
+ return wrap_get_friend_link(link_to_remote( I18n.t('muck.friends.stop_being_friends'), :url => user_friend_path(user, target), :method => :delete), dom_id) if user.friend_of? target
55
+
56
+ if GlobalConfig.allow_following
57
+ return wrap_get_friend_link(link_to_remote( I18n.t('muck.friends.stop_following'), :url => user_friend_path(user, target), :method => :delete), dom_id) if user.following? target
58
+ else
59
+ if user.following? target
60
+ return wrap_get_friend_link( I18n.t('muck.friends.friend_request_pending', :link => link_to_remote(I18n.t('muck.friends.delete'), :url => user_friend_path(user, target), :method => :delete)), dom_id)
61
+ end
62
+ end
63
+
64
+ return wrap_get_friend_link(link_to_remote( I18n.t('muck.friends.acccept_friend_request'), :url => user_friends_path(user, :id => target), :method => :post), dom_id) if user.followed_by? target
65
+
66
+ if GlobalConfig.allow_following
67
+ wrap_get_friend_link(link_to_remote( I18n.t('muck.friends.start_following'), :url => user_friends_path(user, :id => target), :method => :post), dom_id)
68
+ else
69
+ wrap_get_friend_link(link_to_remote( I18n.t('muck.friends.friend_request'), :url => user_friends_path(user, :id => target), :method => :post), dom_id)
70
+ end
71
+
72
+ end
73
+
74
+ def accept_follower_link user, target
75
+ dom_id = make_id(user, target)
76
+ wrap_get_friend_link(link_to_remote( I18n.t('muck.friends.accept'), { :url => user_friends_path(user, :id => target), :method => :post}, {:id => "accept-#{target.id}", :class => 'notification-link'}), dom_id)
77
+ end
78
+
79
+ def ignore_friend_request_link user, target
80
+ dom_id = make_id(user, target)
81
+ wrap_get_friend_link(link_to_remote( I18n.t('muck.friends.ignore'), { :url => user_friend_path(user, target), :method => :delete }, {:id => "ignore-#{target.id}", :class => 'notification-link'}), dom_id)
82
+ end
83
+
84
+ protected
85
+ def wrap_get_friend_link str, dom_id = ''
86
+ content_tag :span, str, :id => dom_id, :class => 'friendship-description'
87
+ end
88
+
89
+ def make_id user, target
90
+ user.dom_id(target.dom_id + '_friendship_')
91
+ end
92
+
93
+ end
@@ -0,0 +1,25 @@
1
+ class FriendMailer < ActionMailer::Base
2
+ unloadable
3
+ layout 'email_default'
4
+ default_url_options[:host] = GlobalConfig.application_url
5
+
6
+ def follow(inviter, invited)
7
+ setup_email(invited.email)
8
+ subject I18n.t('muck.friends.following_you', :name => inviter.login, :application_name => GlobalConfig.application_name)
9
+ body :inviter => inviter, :invited => invited
10
+ end
11
+
12
+ def friend_request(inviter, invited)
13
+ setup_email(invited.email)
14
+ subject I18n.t('muck.friends.friend_request', :name => inviter.login, :application_name => GlobalConfig.application_name)
15
+ body :inviter => inviter, :invited => invited
16
+ end
17
+
18
+ protected
19
+ def setup_email(email)
20
+ recipients email
21
+ from "#{GlobalConfig.from_email_name} <#{GlobalConfig.from_email}>"
22
+ sent_on Time.now
23
+ end
24
+
25
+ end
@@ -0,0 +1 @@
1
+ <%= render :partial => 'activity_templates/generic', :locals => { :activity => activity, :activity_css_class => 'activity-follow' } %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'activity_templates/generic', :locals => { :activity => activity, :activity_css_class => 'activity-friends-with' } %>
@@ -0,0 +1,8 @@
1
+ <p>Hi <%= h(@invited.login) %></p>
2
+
3
+ <p><%= h(@inviter.login) %> is now following your updates on <%= GlobalConfig.application_name %>.</p>
4
+
5
+ <p>You may find more information about <%= h(@inviter.login) %> on their profile <%= profile_url(@inviter) %></p>
6
+
7
+ <p>Thanks, <br />
8
+ The <%= GlobalConfig.application_name %> Team</p>
@@ -0,0 +1,8 @@
1
+ Hi <%= h(invited.login) %>
2
+
3
+ <%= h(inviter.login) %> is now following your updates on <%= GlobalConfig.application_name %>.
4
+
5
+ You may find more information about <%= h(inviter.login) %> on their profile <%= profile_url(inviter) %>
6
+
7
+ Thanks,
8
+ The <%= GlobalConfig.application_name %> Team
@@ -0,0 +1,8 @@
1
+ <p>Hi <%= h(@invited.login) %></p>
2
+
3
+ <p><%= h(@inviter.login) %> has sent you a friend request on <%= GlobalConfig.application_name %>.</p>
4
+
5
+ <p>You may find more information about <%= h(@inviter.login) %> on their profile <%= profile_url(@inviter) %></p>
6
+
7
+ <p>Thanks, <br />
8
+ The <%= GlobalConfig.application_name %> Team</p>
@@ -0,0 +1,8 @@
1
+ Hi <%= h(invited.login) %>
2
+
3
+ <%= h(inviter.login) %> has sent you a friend request on <%= GlobalConfig.application_name %>.
4
+
5
+ You may find more information about <%= h(inviter.login) %> on their profile <%= profile_url(inviter) %>
6
+
7
+ Thanks,
8
+ The <%= GlobalConfig.application_name %> Team
@@ -0,0 +1,4 @@
1
+ <div class="friend">
2
+ <%= icon friend %>
3
+ <%= link_to h(friend.display_name), profile_path(friend) %>
4
+ </div>
@@ -0,0 +1,8 @@
1
+ <h2>Friends</h2>
2
+ <%= friends(user) %>
3
+ <% if GlobalConfig.allow_following -%>
4
+ <h2>Followers</h2>
5
+ <%= followers(user) %>
6
+ <h2>Following</h2>
7
+ <%= followings(user) %>
8
+ <% end -%>
@@ -0,0 +1,32 @@
1
+ <div id="decline_request_to_join" class="hidden">
2
+ <%= render :partial => 'messages/decline', :locals => {:hide_header => true} %>
3
+ </div>
4
+ <% if !(@user.followers.empty? && @user.unread_messages.empty? && @user.pledge_requests.empty?) %>
5
+ <div id="notifications" class="activity_box">
6
+ <h2><%= _('Notifications') %></h2>
7
+ <ul>
8
+ <% if !GlobalConfig.allow_following -%>
9
+ <% @user.followers.each do |follower| %>
10
+ <li>
11
+ <%= _("%{profile} requests to be your Friend %{accept} %{ignore}") % {:profile => link_to(h(follower.full_name), profile_path(follower)),
12
+ :accept => accept_follower_link(current_user, follower),
13
+ :ignore => ignore_friend_request_link(current_user, follower) } -%></li>
14
+ <% end %>
15
+ <% end %>
16
+ <% @user.pledge_requests.each do |pledge| %>
17
+ <li><%= _("%{profile} requests to join %{group_link} group %{admin_links}") % {
18
+ :profile => link_to(h(pledge.full_name), profile_path(pledge)),
19
+ :group_link => link_to(h(pledge.group_name), group_path(pledge.url_key)),
20
+ :admin_links => pledge_admin_links(pledge) } -%>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
25
+ <% end %>
26
+ <script type="text/javascript" language="JavaScript">
27
+ jQuery(document).ready(function(){
28
+ jQuery(".notification-link").click(function(){
29
+ jQuery(this).parent().parent().fadeOut();
30
+ });
31
+ });
32
+ </script>