writefully 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (328) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +31 -0
  4. data/Rakefile +22 -0
  5. data/app/assets/javascripts/writefully/authorships.js +2 -0
  6. data/app/assets/javascripts/writefully/sessions.js +2 -0
  7. data/app/assets/javascripts/writefully/writefully/initializers/boot.coffee +6 -0
  8. data/app/assets/javascripts/writefully/writefully/initializers/manifest.coffee +28 -0
  9. data/app/assets/javascripts/writefully/writefully/initializers/setup.coffee +4 -0
  10. data/app/assets/javascripts/writefully/writefully/loader.coffee +6 -0
  11. data/app/assets/javascripts/writefully/writefully.coffee +8 -0
  12. data/app/assets/stylesheets/writefully/base.sass +23 -0
  13. data/app/assets/stylesheets/writefully/sessions.sass +9 -0
  14. data/app/assets/stylesheets/writefully/sites.sass +33 -0
  15. data/app/assets/stylesheets/writefully/writefully.sass +4 -0
  16. data/app/controllers/writefully/application_controller.rb +28 -0
  17. data/app/controllers/writefully/authorships_controller.rb +8 -0
  18. data/app/controllers/writefully/hooks_controller.rb +51 -0
  19. data/app/controllers/writefully/posts_controller.rb +21 -0
  20. data/app/controllers/writefully/sessions_controller.rb +47 -0
  21. data/app/controllers/writefully/sites_controller.rb +51 -0
  22. data/app/helpers/writefully/application_helper.rb +15 -0
  23. data/app/helpers/writefully/flash_helper.rb +31 -0
  24. data/app/helpers/writefully/posts_helper.rb +8 -0
  25. data/app/helpers/writefully/sites_helper.rb +21 -0
  26. data/app/models/writefully/authorship.rb +34 -0
  27. data/app/models/writefully/post.rb +23 -0
  28. data/app/models/writefully/site.rb +30 -0
  29. data/app/models/writefully/tag.rb +15 -0
  30. data/app/models/writefully/tagging.rb +6 -0
  31. data/app/views/layouts/writefully/application.html.erb +16 -0
  32. data/app/views/layouts/writefully/sessions.html.erb +16 -0
  33. data/app/views/writefully/application/_activeable_link_to.html.erb +5 -0
  34. data/app/views/writefully/application/_flash.html.erb +5 -0
  35. data/app/views/writefully/application/_navigation.html.erb +23 -0
  36. data/app/views/writefully/application/flash/_owner_exists.html.erb +0 -0
  37. data/app/views/writefully/application/flash/_signed_in.html.erb +0 -0
  38. data/app/views/writefully/application/flash/_signed_out.html.erb +0 -0
  39. data/app/views/writefully/posts/_not_published.html.erb +1 -0
  40. data/app/views/writefully/posts/_post.html.erb +14 -0
  41. data/app/views/writefully/posts/_published.html.erb +1 -0
  42. data/app/views/writefully/posts/index.html.erb +7 -0
  43. data/app/views/writefully/posts/show.html.erb +0 -0
  44. data/app/views/writefully/sessions/new.html.erb +7 -0
  45. data/app/views/writefully/sites/_empty.html.erb +0 -0
  46. data/app/views/writefully/sites/_form.html.erb +15 -0
  47. data/app/views/writefully/sites/_site.html.erb +16 -0
  48. data/app/views/writefully/sites/edit.html.erb +0 -0
  49. data/app/views/writefully/sites/flash/create/_error.html.erb +0 -0
  50. data/app/views/writefully/sites/flash/create/_success.html.erb +2 -0
  51. data/app/views/writefully/sites/healthy/_no.html.erb +3 -0
  52. data/app/views/writefully/sites/healthy/_yes.html.erb +3 -0
  53. data/app/views/writefully/sites/index.html.erb +14 -0
  54. data/app/views/writefully/sites/new.html.erb +7 -0
  55. data/app/views/writefully/sites/processing/_no.html.erb +3 -0
  56. data/app/views/writefully/sites/processing/_yes.html.erb +3 -0
  57. data/app/views/writefully/sites/show/_errors.html.erb +0 -0
  58. data/app/views/writefully/sites/show/_heading.html.erb +6 -0
  59. data/app/views/writefully/sites/show/_processing.html.erb +0 -0
  60. data/app/views/writefully/sites/show/_tabs.html.erb +5 -0
  61. data/app/views/writefully/sites/show.html.erb +3 -0
  62. data/bin/rails +12 -0
  63. data/bin/writefully +7 -0
  64. data/config/routes.rb +16 -0
  65. data/db/migrate/20140402091204_create_writefully_posts.rb +22 -0
  66. data/db/migrate/20140402091244_create_writefully_tags.rb +14 -0
  67. data/db/migrate/20140402091415_create_writefully_taggings.rb +10 -0
  68. data/db/migrate/20140402200330_create_writefully_authorships.rb +12 -0
  69. data/db/migrate/20140403181629_create_writefully_sites.rb +20 -0
  70. data/lib/sample/README.md +26 -0
  71. data/lib/sample/meta.yml +7 -0
  72. data/lib/sample/writefully.png +0 -0
  73. data/lib/tasks/writefully_tasks.rake +9 -0
  74. data/lib/writefully/asset.rb +33 -0
  75. data/lib/writefully/cli.rb +57 -0
  76. data/lib/writefully/content.rb +31 -0
  77. data/lib/writefully/engine.rb +25 -0
  78. data/lib/writefully/indices.rb +21 -0
  79. data/lib/writefully/news_agency.rb +8 -0
  80. data/lib/writefully/postable.rb +57 -0
  81. data/lib/writefully/process.rb +84 -0
  82. data/lib/writefully/source.rb +52 -0
  83. data/lib/writefully/storage.rb +33 -0
  84. data/lib/writefully/taxon.rb +28 -0
  85. data/lib/writefully/tools/dispatcher.rb +59 -0
  86. data/lib/writefully/tools/eraser.rb +0 -0
  87. data/lib/writefully/tools/hammer.rb +41 -0
  88. data/lib/writefully/tools/initializer.rb +38 -0
  89. data/lib/writefully/tools/pencil.rb +71 -0
  90. data/lib/writefully/tools/pigeon.rb +19 -0
  91. data/lib/writefully/tools/synchronizer.rb +24 -0
  92. data/lib/writefully/tools.rb +13 -0
  93. data/lib/writefully/version.rb +3 -0
  94. data/lib/writefully/workers/base_worker.rb +25 -0
  95. data/lib/writefully/workers/handyman.rb +44 -0
  96. data/lib/writefully/workers/helpers/handyman/builder.rb +17 -0
  97. data/lib/writefully/workers/helpers.rb +8 -0
  98. data/lib/writefully/workers/journalist.rb +23 -0
  99. data/lib/writefully/workers.rb +9 -0
  100. data/lib/writefully/workers_helpers.rb +7 -0
  101. data/lib/writefully.rb +77 -0
  102. data/scripts/initialize.sh +30 -0
  103. data/scripts/sync.sh +17 -0
  104. data/spec/controllers/writefully/hooks_controller_spec.rb +35 -0
  105. data/spec/controllers/writefully/posts_controller_spec.rb +46 -0
  106. data/spec/controllers/writefully/sites_controller_spec.rb +91 -0
  107. data/spec/dummy/Rakefile +8 -0
  108. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  109. data/spec/dummy/app/models/playlist.rb +3 -0
  110. data/spec/dummy/app/models/post.rb +3 -0
  111. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  112. data/spec/dummy/bin/bundle +3 -0
  113. data/spec/dummy/bin/rails +4 -0
  114. data/spec/dummy/bin/rake +4 -0
  115. data/spec/dummy/config/application.rb +22 -0
  116. data/spec/dummy/config/boot.rb +5 -0
  117. data/spec/dummy/config/database.yml +25 -0
  118. data/spec/dummy/config/environment.rb +5 -0
  119. data/spec/dummy/config/environments/development.rb +29 -0
  120. data/spec/dummy/config/environments/production.rb +80 -0
  121. data/spec/dummy/config/environments/test.rb +36 -0
  122. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  123. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  124. data/spec/dummy/config/initializers/inflections.rb +16 -0
  125. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  126. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  127. data/spec/dummy/config/initializers/session_store.rb +3 -0
  128. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  129. data/spec/dummy/config/locales/en.yml +23 -0
  130. data/spec/dummy/config/routes.rb +3 -0
  131. data/spec/dummy/config/writefully.yml +9 -0
  132. data/spec/dummy/config.ru +4 -0
  133. data/spec/dummy/content/codemy-net/posts/1-hash-selector-pattern/README.md +119 -0
  134. data/spec/dummy/content/codemy-net/posts/1-hash-selector-pattern/assets/hash-selector-cover.png +0 -0
  135. data/spec/dummy/content/codemy-net/posts/1-hash-selector-pattern/assets/hash-selector-icon.png +0 -0
  136. data/spec/dummy/content/codemy-net/posts/1-hash-selector-pattern/benchmark/selector.rb +77 -0
  137. data/spec/dummy/content/codemy-net/posts/1-hash-selector-pattern/meta.yml +7 -0
  138. data/spec/dummy/content/codemy-net/posts/2-rails-flash-partials/README.md +171 -0
  139. data/spec/dummy/content/codemy-net/posts/2-rails-flash-partials/assets/cover.png +0 -0
  140. data/spec/dummy/content/codemy-net/posts/2-rails-flash-partials/meta.yml +7 -0
  141. data/spec/dummy/db/schema.rb +89 -0
  142. data/spec/dummy/log/development.log +13946 -0
  143. data/spec/dummy/log/test.log +100164 -0
  144. data/spec/dummy/tmp/cache/assets/development/sass/77bc3b7f842c905df4dddb7e3ac7b7cf15d9035b/application.sassc +0 -0
  145. data/spec/dummy/tmp/cache/assets/development/sass/77bc3b7f842c905df4dddb7e3ac7b7cf15d9035b/bootstrap.cssc +0 -0
  146. data/spec/dummy/tmp/cache/assets/development/sass/77bc3b7f842c905df4dddb7e3ac7b7cf15d9035b/setups.sassc +0 -0
  147. data/spec/dummy/tmp/cache/assets/development/sass/77bc3b7f842c905df4dddb7e3ac7b7cf15d9035b/writefully.sassc +0 -0
  148. data/spec/dummy/tmp/cache/assets/development/sprockets/04641fdb653c0ff3c557033d87eb6a16 +0 -0
  149. data/spec/dummy/tmp/cache/assets/development/sprockets/064b3076e29f54ea572ca43d6c5950cc +0 -0
  150. data/spec/dummy/tmp/cache/assets/development/sprockets/0d2e79f7f8c9026d7d8a7f6dc63fb4a8 +0 -0
  151. data/spec/dummy/tmp/cache/assets/development/sprockets/0f1c342384786865a6200cc3ed6234a3 +0 -0
  152. data/spec/dummy/tmp/cache/assets/development/sprockets/13c3568b2854b103512b2658e6507d4b +0 -0
  153. data/spec/dummy/tmp/cache/assets/development/sprockets/18eb9f12c7e8971e0e2fad29c85a8b8e +0 -0
  154. data/spec/dummy/tmp/cache/assets/development/sprockets/18f8d9596e0fba3397539181f63befe1 +0 -0
  155. data/spec/dummy/tmp/cache/assets/development/sprockets/1977498f5af78beca26942a7c812b294 +0 -0
  156. data/spec/dummy/tmp/cache/assets/development/sprockets/1ae121eed970dfdb5f4f09953ade4de2 +0 -0
  157. data/spec/dummy/tmp/cache/assets/development/sprockets/1b5404b64386f619af12582a1a634574 +0 -0
  158. data/spec/dummy/tmp/cache/assets/development/sprockets/22b701cb6ffd8eac83ec1bfc563b54cb +0 -0
  159. data/spec/dummy/tmp/cache/assets/development/sprockets/2d27da60cfa2f1952c3aadd169ea2570 +0 -0
  160. data/spec/dummy/tmp/cache/assets/development/sprockets/2e33b23d27ad5b8771d09ed8a1435cf6 +0 -0
  161. data/spec/dummy/tmp/cache/assets/development/sprockets/3063f229c5edc0e8a3d82d7bf78024de +0 -0
  162. data/spec/dummy/tmp/cache/assets/development/sprockets/31c84f37a0c92c38be6459f19997c981 +0 -0
  163. data/spec/dummy/tmp/cache/assets/development/sprockets/320d61138ae0221b11c7e4ea0f3d53d3 +0 -0
  164. data/spec/dummy/tmp/cache/assets/development/sprockets/3355368d663ec5236287158290d6c297 +0 -0
  165. data/spec/dummy/tmp/cache/assets/development/sprockets/3df2d5c2f4f6b6d502c017346b915051 +0 -0
  166. data/spec/dummy/tmp/cache/assets/development/sprockets/4596b288fc67fdb9037e06897d416879 +0 -0
  167. data/spec/dummy/tmp/cache/assets/development/sprockets/47381977da0f1b2165bdbb09480ccff3 +0 -0
  168. data/spec/dummy/tmp/cache/assets/development/sprockets/4aab863b927c65a4b9e70c43e4e6d482 +0 -0
  169. data/spec/dummy/tmp/cache/assets/development/sprockets/4c0271d24537b8a24979e07bbd75956c +0 -0
  170. data/spec/dummy/tmp/cache/assets/development/sprockets/4c16c5c88ae074d893e1de2ad787b031 +0 -0
  171. data/spec/dummy/tmp/cache/assets/development/sprockets/51610d35f263eb68b1cf73737045113d +0 -0
  172. data/spec/dummy/tmp/cache/assets/development/sprockets/5af65427549750bdf60b3f06ce273b41 +0 -0
  173. data/spec/dummy/tmp/cache/assets/development/sprockets/63958de32a7352bcfb139639ba2d4209 +0 -0
  174. data/spec/dummy/tmp/cache/assets/development/sprockets/63f349e6a646ae0252d46e1816064e0c +0 -0
  175. data/spec/dummy/tmp/cache/assets/development/sprockets/67ae1c504593279ebd6da7b6fdbe99b7 +0 -0
  176. data/spec/dummy/tmp/cache/assets/development/sprockets/68e61e8d5ac667de89a4bf1e732cde0a +0 -0
  177. data/spec/dummy/tmp/cache/assets/development/sprockets/69dfb59cc80e2c111bfbfc108371b27b +0 -0
  178. data/spec/dummy/tmp/cache/assets/development/sprockets/6d0103100e416966beba1039661e234e +0 -0
  179. data/spec/dummy/tmp/cache/assets/development/sprockets/71ea75f9945cdb543e0dc44527fcd926 +0 -0
  180. data/spec/dummy/tmp/cache/assets/development/sprockets/7556620a4f8405144dca74330e54608c +0 -0
  181. data/spec/dummy/tmp/cache/assets/development/sprockets/76598a5aebf24a1b763f5b10ae223c15 +0 -0
  182. data/spec/dummy/tmp/cache/assets/development/sprockets/7af8770b019b471931e4f6cb86027307 +0 -0
  183. data/spec/dummy/tmp/cache/assets/development/sprockets/7b696db3b421aeaa1afd210b07db8aae +0 -0
  184. data/spec/dummy/tmp/cache/assets/development/sprockets/7ff072db2442371da6ee49c9b279efdc +0 -0
  185. data/spec/dummy/tmp/cache/assets/development/sprockets/82b92bb7c88523dc617b3c0c877aeade +0 -0
  186. data/spec/dummy/tmp/cache/assets/development/sprockets/8c388cf0035e064a06ae30a03d96b51b +0 -0
  187. data/spec/dummy/tmp/cache/assets/development/sprockets/95703f30550e80a229dd0ec4a6ddc85c +0 -0
  188. data/spec/dummy/tmp/cache/assets/development/sprockets/98ccb36ebbfc6f6ac684a05ad8543c01 +0 -0
  189. data/spec/dummy/tmp/cache/assets/development/sprockets/9ad5688a6dad8d54658f492eb1fa07d6 +0 -0
  190. data/spec/dummy/tmp/cache/assets/development/sprockets/9b9ee2a899dd8b3bfa592fba44ebf8d2 +0 -0
  191. data/spec/dummy/tmp/cache/assets/development/sprockets/9c48c31b831040e919db903d9edef2ab +0 -0
  192. data/spec/dummy/tmp/cache/assets/development/sprockets/9f9f72b9edf89242aada0d52dbc57635 +0 -0
  193. data/spec/dummy/tmp/cache/assets/development/sprockets/a0e14dd5894f94a561a349d40037db07 +0 -0
  194. data/spec/dummy/tmp/cache/assets/development/sprockets/a125c2261ecc9d800e450373950ea433 +0 -0
  195. data/spec/dummy/tmp/cache/assets/development/sprockets/a3999d8baf1b9ed61d91ea6bd5e42951 +0 -0
  196. data/spec/dummy/tmp/cache/assets/development/sprockets/a8b93e1f061f64547b92633c5bde6b13 +0 -0
  197. data/spec/dummy/tmp/cache/assets/development/sprockets/ad8f1428d5543a9fc4ed7a9e9526e40a +0 -0
  198. data/spec/dummy/tmp/cache/assets/development/sprockets/adae8faa21b116471ec4285998d3f3cf +0 -0
  199. data/spec/dummy/tmp/cache/assets/development/sprockets/aea01e6a7f75a01b9f61f7e0430bd61b +0 -0
  200. data/spec/dummy/tmp/cache/assets/development/sprockets/b690c630e4500da8d405b10c5d827ac9 +0 -0
  201. data/spec/dummy/tmp/cache/assets/development/sprockets/b83537e814e13cf03642ccc3d90fda13 +0 -0
  202. data/spec/dummy/tmp/cache/assets/development/sprockets/ba4f054949cb1c1bea0fd796890fcb11 +0 -0
  203. data/spec/dummy/tmp/cache/assets/development/sprockets/bccc085acd77705bf4cd104dbd5dbec3 +0 -0
  204. data/spec/dummy/tmp/cache/assets/development/sprockets/c0c44ab8b0b90fb0287ca1400731f920 +0 -0
  205. data/spec/dummy/tmp/cache/assets/development/sprockets/c1208bf8d0e9714161d8e6ae61781efc +0 -0
  206. data/spec/dummy/tmp/cache/assets/development/sprockets/c6dae51db325ad18ac445895075e66b5 +0 -0
  207. data/spec/dummy/tmp/cache/assets/development/sprockets/ca8c11b2ed33b38e8b65858a2ba66d6f +0 -0
  208. data/spec/dummy/tmp/cache/assets/development/sprockets/ce5a98586efc888dc74dff9380760c33 +0 -0
  209. data/spec/dummy/tmp/cache/assets/development/sprockets/d0e440792b09f3cc258704d7850f0652 +0 -0
  210. data/spec/dummy/tmp/cache/assets/development/sprockets/d0e6d527077e64dc87dfa25abccd4dd3 +0 -0
  211. data/spec/dummy/tmp/cache/assets/development/sprockets/d10e06dee94ddaa562f7df319407bf18 +0 -0
  212. data/spec/dummy/tmp/cache/assets/development/sprockets/d1238ae38ca7b9522d86d67ee367223e +0 -0
  213. data/spec/dummy/tmp/cache/assets/development/sprockets/d2c2fff5893ce8979ca48bab1c6f1c3a +0 -0
  214. data/spec/dummy/tmp/cache/assets/development/sprockets/e1a679a58449aa2ee72eb4341d85b5d6 +0 -0
  215. data/spec/dummy/tmp/cache/assets/development/sprockets/e8fafe37de58ddbf16ebaf5cdc988320 +0 -0
  216. data/spec/dummy/tmp/cache/assets/development/sprockets/f15276b8745ef08f03a61f6fabe0001f +0 -0
  217. data/spec/dummy/tmp/cache/assets/development/sprockets/f79e04c0583c4be5f17610f948bc7436 +0 -0
  218. data/spec/dummy/tmp/cache/assets/development/sprockets/f966462e6d5e859d5be8f52161d2f53b +0 -0
  219. data/spec/dummy/tmp/cache/assets/development/sprockets/f977be4be94ab364314f054e18c53742 +0 -0
  220. data/spec/dummy/tmp/cache/assets/test/sass/23cfae14a65dc753e1ade92b6095067a45aad26f/bootstrap.scssc +0 -0
  221. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_alerts.scssc +0 -0
  222. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_badges.scssc +0 -0
  223. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_breadcrumbs.scssc +0 -0
  224. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_button-groups.scssc +0 -0
  225. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_buttons.scssc +0 -0
  226. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_carousel.scssc +0 -0
  227. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_close.scssc +0 -0
  228. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_code.scssc +0 -0
  229. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_component-animations.scssc +0 -0
  230. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_dropdowns.scssc +0 -0
  231. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_forms.scssc +0 -0
  232. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_glyphicons.scssc +0 -0
  233. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_grid.scssc +0 -0
  234. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_input-groups.scssc +0 -0
  235. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_jumbotron.scssc +0 -0
  236. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_labels.scssc +0 -0
  237. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_list-group.scssc +0 -0
  238. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_media.scssc +0 -0
  239. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_mixins.scssc +0 -0
  240. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_modals.scssc +0 -0
  241. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_navbar.scssc +0 -0
  242. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_navs.scssc +0 -0
  243. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_normalize.scssc +0 -0
  244. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_pager.scssc +0 -0
  245. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_pagination.scssc +0 -0
  246. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_panels.scssc +0 -0
  247. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_popovers.scssc +0 -0
  248. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_print.scssc +0 -0
  249. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_progress-bars.scssc +0 -0
  250. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_responsive-utilities.scssc +0 -0
  251. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_scaffolding.scssc +0 -0
  252. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_tables.scssc +0 -0
  253. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_thumbnails.scssc +0 -0
  254. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_tooltip.scssc +0 -0
  255. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_type.scssc +0 -0
  256. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_utilities.scssc +0 -0
  257. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_variables.scssc +0 -0
  258. data/spec/dummy/tmp/cache/assets/test/sass/6cd443894d18a18028b11ff7afc2188b8e6a0c6d/_wells.scssc +0 -0
  259. data/spec/dummy/tmp/cache/assets/test/sass/77bc3b7f842c905df4dddb7e3ac7b7cf15d9035b/base.sassc +0 -0
  260. data/spec/dummy/tmp/cache/assets/test/sass/77bc3b7f842c905df4dddb7e3ac7b7cf15d9035b/sessions.sassc +0 -0
  261. data/spec/dummy/tmp/cache/assets/test/sass/77bc3b7f842c905df4dddb7e3ac7b7cf15d9035b/sites.sassc +0 -0
  262. data/spec/dummy/tmp/cache/assets/test/sass/77bc3b7f842c905df4dddb7e3ac7b7cf15d9035b/writefully.sassc +0 -0
  263. data/spec/dummy/tmp/cache/assets/test/sprockets/064b3076e29f54ea572ca43d6c5950cc +0 -0
  264. data/spec/dummy/tmp/cache/assets/test/sprockets/0d2e79f7f8c9026d7d8a7f6dc63fb4a8 +0 -0
  265. data/spec/dummy/tmp/cache/assets/test/sprockets/18eb9f12c7e8971e0e2fad29c85a8b8e +0 -0
  266. data/spec/dummy/tmp/cache/assets/test/sprockets/1977498f5af78beca26942a7c812b294 +0 -0
  267. data/spec/dummy/tmp/cache/assets/test/sprockets/2d27da60cfa2f1952c3aadd169ea2570 +0 -0
  268. data/spec/dummy/tmp/cache/assets/test/sprockets/2e33b23d27ad5b8771d09ed8a1435cf6 +0 -0
  269. data/spec/dummy/tmp/cache/assets/test/sprockets/3063f229c5edc0e8a3d82d7bf78024de +0 -0
  270. data/spec/dummy/tmp/cache/assets/test/sprockets/31c84f37a0c92c38be6459f19997c981 +0 -0
  271. data/spec/dummy/tmp/cache/assets/test/sprockets/3df2d5c2f4f6b6d502c017346b915051 +0 -0
  272. data/spec/dummy/tmp/cache/assets/test/sprockets/4aab863b927c65a4b9e70c43e4e6d482 +0 -0
  273. data/spec/dummy/tmp/cache/assets/test/sprockets/4c0271d24537b8a24979e07bbd75956c +0 -0
  274. data/spec/dummy/tmp/cache/assets/test/sprockets/4c16c5c88ae074d893e1de2ad787b031 +0 -0
  275. data/spec/dummy/tmp/cache/assets/test/sprockets/63f349e6a646ae0252d46e1816064e0c +0 -0
  276. data/spec/dummy/tmp/cache/assets/test/sprockets/67ae1c504593279ebd6da7b6fdbe99b7 +0 -0
  277. data/spec/dummy/tmp/cache/assets/test/sprockets/68e61e8d5ac667de89a4bf1e732cde0a +0 -0
  278. data/spec/dummy/tmp/cache/assets/test/sprockets/6cf5095a6f2a3e346267010d81431898 +0 -0
  279. data/spec/dummy/tmp/cache/assets/test/sprockets/71ea75f9945cdb543e0dc44527fcd926 +0 -0
  280. data/spec/dummy/tmp/cache/assets/test/sprockets/74d56087624f43b73234c3691a21203b +0 -0
  281. data/spec/dummy/tmp/cache/assets/test/sprockets/76598a5aebf24a1b763f5b10ae223c15 +0 -0
  282. data/spec/dummy/tmp/cache/assets/test/sprockets/7af8770b019b471931e4f6cb86027307 +0 -0
  283. data/spec/dummy/tmp/cache/assets/test/sprockets/7ff072db2442371da6ee49c9b279efdc +0 -0
  284. data/spec/dummy/tmp/cache/assets/test/sprockets/82b92bb7c88523dc617b3c0c877aeade +0 -0
  285. data/spec/dummy/tmp/cache/assets/test/sprockets/8789652d56b500257c05b6b3370096a2 +0 -0
  286. data/spec/dummy/tmp/cache/assets/test/sprockets/95703f30550e80a229dd0ec4a6ddc85c +0 -0
  287. data/spec/dummy/tmp/cache/assets/test/sprockets/98ccb36ebbfc6f6ac684a05ad8543c01 +0 -0
  288. data/spec/dummy/tmp/cache/assets/test/sprockets/9ad5688a6dad8d54658f492eb1fa07d6 +0 -0
  289. data/spec/dummy/tmp/cache/assets/test/sprockets/9b9ee2a899dd8b3bfa592fba44ebf8d2 +0 -0
  290. data/spec/dummy/tmp/cache/assets/test/sprockets/9c48c31b831040e919db903d9edef2ab +0 -0
  291. data/spec/dummy/tmp/cache/assets/test/sprockets/9f9f72b9edf89242aada0d52dbc57635 +0 -0
  292. data/spec/dummy/tmp/cache/assets/test/sprockets/a2398b853766dfb3e66e6709e65e0fe8 +0 -0
  293. data/spec/dummy/tmp/cache/assets/test/sprockets/a8b93e1f061f64547b92633c5bde6b13 +0 -0
  294. data/spec/dummy/tmp/cache/assets/test/sprockets/adae8faa21b116471ec4285998d3f3cf +0 -0
  295. data/spec/dummy/tmp/cache/assets/test/sprockets/b776b64154999147a7219e7ab2ec18c5 +0 -0
  296. data/spec/dummy/tmp/cache/assets/test/sprockets/b83537e814e13cf03642ccc3d90fda13 +0 -0
  297. data/spec/dummy/tmp/cache/assets/test/sprockets/bccc085acd77705bf4cd104dbd5dbec3 +0 -0
  298. data/spec/dummy/tmp/cache/assets/test/sprockets/c1208bf8d0e9714161d8e6ae61781efc +0 -0
  299. data/spec/dummy/tmp/cache/assets/test/sprockets/d0e6d527077e64dc87dfa25abccd4dd3 +0 -0
  300. data/spec/dummy/tmp/cache/assets/test/sprockets/d10e06dee94ddaa562f7df319407bf18 +0 -0
  301. data/spec/dummy/tmp/cache/assets/test/sprockets/d1238ae38ca7b9522d86d67ee367223e +0 -0
  302. data/spec/dummy/tmp/cache/assets/test/sprockets/d2c2fff5893ce8979ca48bab1c6f1c3a +0 -0
  303. data/spec/dummy/tmp/cache/assets/test/sprockets/d743017d31a484ac9254192a452e4619 +0 -0
  304. data/spec/dummy/tmp/cache/assets/test/sprockets/e1c18951e718ae5b0d527ddf0099a3b0 +0 -0
  305. data/spec/dummy/tmp/cache/assets/test/sprockets/e1eb88bc099cda2e70c0a0ebc1e99665 +0 -0
  306. data/spec/dummy/tmp/cache/assets/test/sprockets/e8fafe37de58ddbf16ebaf5cdc988320 +0 -0
  307. data/spec/features/writefully/sites_feature_spec.rb +27 -0
  308. data/spec/fixtures/writefully/authorships.yml +11 -0
  309. data/spec/fixtures/writefully/github_hook_test.json +4 -0
  310. data/spec/fixtures/writefully/github_member_add_hook.json +127 -0
  311. data/spec/fixtures/writefully/github_push_hook.json +94 -0
  312. data/spec/fixtures/writefully/posts.yml +14 -0
  313. data/spec/fixtures/writefully/sites.yml +10 -0
  314. data/spec/lib/writefully/asset_spec.rb +22 -0
  315. data/spec/lib/writefully/content_spec.rb +22 -0
  316. data/spec/lib/writefully/indices_spec.rb +17 -0
  317. data/spec/lib/writefully/postable_spec.rb +27 -0
  318. data/spec/lib/writefully/source_spec.rb +23 -0
  319. data/spec/lib/writefully/taxon_spec.rb +27 -0
  320. data/spec/lib/writefully/tools/dispatcher_spec.rb +75 -0
  321. data/spec/lib/writefully/tools/hammer_spec.rb +78 -0
  322. data/spec/lib/writefully/tools/initializer_spec.rb +18 -0
  323. data/spec/lib/writefully/tools/pencil_spec.rb +72 -0
  324. data/spec/lib/writefully/tools/synchronizer_spec.rb +17 -0
  325. data/spec/lib/writefully/workers/handyman_spec.rb +50 -0
  326. data/spec/lib/writefully/workers/journalist_spec.rb +30 -0
  327. data/spec/spec_helper.rb +56 -0
  328. metadata +903 -0
@@ -0,0 +1,9 @@
1
+ development: &default
2
+ :content: <%= Rails.root.join('content') %>
3
+ :storage_folder: 'codemycasts'
4
+ :storage_provider: 'AWS'
5
+ :app_directory: <%= Rails.root %>
6
+ :hook_secret: '00e4de0cf7647cd447b6659bd0b3b5fe'
7
+
8
+ test:
9
+ <<: *default
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,119 @@
1
+ # Hash Selector Pattern
2
+
3
+ Its generally common that our web application needs to take different routes based on certain conditions. There are a few ways we can express these conditions in Ruby. Ifs and Case / Switch come to mind. They're one of the most common ways to express logical paths in our application.
4
+
5
+ Case / Switch can offer very nice syntax and clear code however if / else are much faster than case / switches. At the same time complex if else can make your code very complicated and difficult to read.
6
+
7
+ Lets take a look at a simple example.
8
+
9
+ Remember our flash partials? What if we wanted the color to change based on the type of error. Using ifs we can write it like this.
10
+
11
+ ```ruby
12
+ if flash[:type] == :success
13
+ 'alert-success'
14
+ elsif flash[:type] == :error
15
+ 'alert-danger'
16
+ elsif flash[:type] == :warn
17
+ 'alert-warning'
18
+ elsif flash[:type] == :info
19
+ 'alert-info'
20
+ end
21
+ ```
22
+
23
+ > Note that these outputs are based on bootstrap alert classes that output different colors based on the class names.
24
+
25
+ Lets take a look at the case / switch solution. Its much cleaner but its also a lot slower than the if based solution.
26
+
27
+ ```ruby
28
+ case flash[:type]
29
+ when :success then 'alert-success'
30
+ when :error then 'alert-danger'
31
+ when :warn then 'alert-warning'
32
+ when :info then 'alert-info'
33
+ end
34
+ ```
35
+
36
+ Let me introduce you to the hash selector pattern
37
+
38
+ ```ruby
39
+ { success: 'alert-success',
40
+ error: 'alert-danger',
41
+ notice: 'alert-info',
42
+ warn: 'alert-warning' }[flash[:type]]
43
+ ```
44
+
45
+ We're using hash to store the result for the different routes of our application, and simply selecting the result based on the selector.
46
+
47
+ In this case the selector is the `flash[:type]`. We have a very simple example here of the hash selector pattern. Our code more readable and concise.
48
+
49
+ ## Procs and Lambdas
50
+
51
+ Great so we can output simple text using hashes nothing special. What about calling methods, can we do that? Well absolutely! Let me demonstrate.
52
+
53
+ In your controller you may be fimiliar with this sort of logic
54
+
55
+ ```ruby
56
+ if @comment.save
57
+ respond_with @post, @comment
58
+ else
59
+ xms_error @comment
60
+ end
61
+ ```
62
+
63
+ Generally when you have a simple logic like this I recommend with the if / else solution as its small enough to be clean and readable. However if you have a more complex logic with multiple elsifs you might want to do something like this
64
+
65
+ ```ruby
66
+ { true => -> { self.respond_with @post, @comment },
67
+ false => -> { self.xms_error @comment }
68
+ }[@comment.save].call
69
+ ```
70
+
71
+ The code above does the exact same thing as the if / else solution. However it is much shorter. In this case I wouldn't say that hash / selector has improved our code but here I am just trying to show you that it is possible to call methods using hashes. You just have to wrap it inside of a proc.
72
+
73
+ ## Conclusion
74
+
75
+ The hash selector pattern separates the logic from the result, generally this will make your code easier to read. It gives the right balance between readable code and performance. In most cases Hash / Selector pattern will be faster than if / else, but if your `selector` is very complex it might become slower.
76
+
77
+ My general rule of thumb is if you are using a lot of `elsif` in your codebase chances are you can probably refactor it using hash / selector pattern.
78
+
79
+ Here is my Fizzbuzz solution using Hash / Selector
80
+
81
+ ## Further Examples
82
+
83
+ ```ruby
84
+ class Fizzbuzz
85
+ def initialize(number)
86
+ @number = number
87
+ end
88
+
89
+ def self.count(number)
90
+ count = new(number)
91
+ count.output_data[count.selector]
92
+ end
93
+
94
+ def self.count_if(number)
95
+ count = new(number)
96
+ count.output_if
97
+ end
98
+
99
+ def output_if
100
+ result = 'Fizz' if @number % 3 == 0
101
+ result = 'Buzz' if @number % 5 == 0
102
+ result = 'Fizzbuzz' if @number % 15 == 0
103
+ result
104
+ end
105
+
106
+ def output_data
107
+ { "3" => "Fizz",
108
+ "5" => "Buzz",
109
+ "15" => "Fizzbuzz" }
110
+ end
111
+
112
+ def selector
113
+ output_data.keys.map { |k| k.to_i }.select do |k|
114
+ @number % k == 0
115
+ end.last
116
+ end
117
+ end
118
+ ```
119
+
@@ -0,0 +1,77 @@
1
+ require 'benchmark'
2
+
3
+ class Selector
4
+
5
+
6
+ def initialize(key)
7
+ @key = key
8
+ end
9
+
10
+ def selector_if
11
+ if @key == :success
12
+ 'alert-success'
13
+ elsif @key == :error
14
+ 'alert-danger'
15
+ elsif @key == :warn
16
+ 'alert-warning'
17
+ elsif @key == :info
18
+ 'alert-info'
19
+ end
20
+ end
21
+
22
+ def selector_case
23
+ case @key
24
+ when :success then 'alert-success'
25
+ when :error then 'alert-danger'
26
+ when :warn then 'alert-warning'
27
+ when :info then 'alert-info'
28
+ end
29
+ end
30
+
31
+ ALERT_TYPES = { success: 'alert-success',
32
+ error: 'alert-danger',
33
+ notice: 'alert-info',
34
+ warn: 'alert-warning' }
35
+
36
+ def selector_hash_cached
37
+ ALERT_TYPES[@key]
38
+ end
39
+
40
+ def selector_hash
41
+ { success: 'alert-success',
42
+ error: 'alert-danger',
43
+ notice: 'alert-info',
44
+ warn: 'alert-warning' }[@key]
45
+ end
46
+ end
47
+
48
+ Benchmark.bm(25) do |x|
49
+ x.report("if") {
50
+ 1.times do
51
+ selector = Selector.new([:success, :error, :notice, :warn].sample)
52
+ selector.selector_if
53
+ end
54
+ }
55
+
56
+ x.report("case") {
57
+ 1.times do
58
+ selector = Selector.new([:success, :error, :notice, :warn].sample)
59
+ selector.selector_case
60
+ end
61
+ }
62
+
63
+ x.report("hash_select_cached") {
64
+ 1.times do
65
+ selector = Selector.new([:success, :error, :notice, :warn].sample)
66
+ selector.selector_hash_cached
67
+ end
68
+ }
69
+
70
+ x.report("hash_select") {
71
+ 1.times do
72
+ selector = Selector.new([:success, :error, :notice, :warn].sample)
73
+ selector.selector_hash
74
+ end
75
+ }
76
+ end
77
+
@@ -0,0 +1,7 @@
1
+ title: "Ruby Hash Selector Pattern"
2
+ slug: "ruby-hash-selector-pattern"
3
+ tags: ["Ruby"]
4
+ playlists: ["A Shot of Ruby"]
5
+ details:
6
+ blurb: "We show you an alternative to if / else and case / switch."
7
+ cover: "assets/hash-selector-icon.png"
@@ -0,0 +1,171 @@
1
+ # Rails Flash Partials
2
+
3
+ Outputting flash messages is one of the most convenient ways of letting your users know when things happen in the system. Things like when users update their content or create new content.
4
+
5
+ With rails generally its pretty simple to output flash messages. You just do
6
+
7
+ ![Cover Picture](assets/cover.png)
8
+
9
+ ```ruby
10
+ flash[:notice] = "Your post has been updated!"
11
+ ```
12
+
13
+ And Voila! you can output flash messages in your views. However what if you want to output flash messages that are more than just simple text. What if you want to put links in there or use your view helpers in them? How would you go about handling all that?
14
+
15
+ Well lets take a look!
16
+
17
+ ## Skeleton Partial
18
+
19
+ The best way to use views helper is well in the view. So lets start by creating a simple partial. We create this in the `views/application/_flash.html.erb`. If you don't see an `application` folder in your views simply create it.
20
+
21
+ ```erb
22
+ <div class='alert alert-info'>
23
+ <div class='cotainer'>
24
+ ... flash content goes here ...
25
+ </div>
26
+ </div>
27
+ ```
28
+
29
+ This simple partial will serve as the skeleton for our flash message. It will provide the basic structure. If your using twitter bootstrap the alert box will look something like the above. However you can just as easily come up with your own concoction.
30
+
31
+
32
+ ## Flash Helper
33
+
34
+ Once we have our partial we need some helper code to help us use the flash partial. This code goes into a helper file called `flash_helper.rb`
35
+
36
+ ```ruby
37
+ module FlashHelper
38
+ def render_flash
39
+ render 'flash' if can_flash?
40
+ end
41
+
42
+ def can_flash?
43
+ flash.keys.sort == [:from, :object_id, :object_type, :type]
44
+ end
45
+
46
+ def flash_object
47
+ flash[:object_type].classify.constantize.where(id: flash[:object_id]).first
48
+ end
49
+
50
+ def flash_path
51
+ File.join(controller_name, 'flash', flash[:from].to_s, flash[:type].to_s)
52
+ end
53
+ end
54
+ ```
55
+
56
+ The render_flash is called in our `layouts/application.html.erb` like so.
57
+
58
+ ```html
59
+ ...
60
+ <body>
61
+ <%= render 'navigation' %>
62
+ <%= render_flash %>
63
+ <div class='container'>
64
+ <%= yield %>
65
+ </div>
66
+
67
+ </body>
68
+ ...
69
+ ```
70
+
71
+ The `render_flash` checks with `can_flash?` whether or not it can display the flash message.
72
+
73
+ In our `can_flash?` message all we're doing is making sure that the flash has that is passed to the view has the right keys. Basically for our flash to work right we need those keys. I'll explain abit later where all these are coming from.
74
+
75
+ When we work with flash it means we could also be working with redirection. Which means that the action thats rendering the actual flash message may have different objects in them. For example think of this scenario. We're creating a new post and after the post is created we redirect to the posts index. Well in the `posts#index` action we may not have the original `@post` object. So we need the `flash_object` to ensure that the object that the flash message depends on is available to the flash.
76
+
77
+ Lastly the `flash_path` just generates the partial path for the flash. We will explain later how and where we use this helper method.
78
+
79
+ ## Controller Madness!
80
+
81
+ We need to do a few things in the controlle to get our partials working right. Lets have a look at whats going on with our `application_controller.rb`
82
+
83
+ ```ruby
84
+ class ApplicationController < ActionController::Base
85
+ # Prevent CSRF attacks by raising an exception.
86
+ # For APIs, you may want to use :null_session instead.
87
+ protect_from_forgery with: :exception
88
+
89
+ def set_flash(type, object: nil)
90
+ flash[:from] = action_name
91
+ flash[:type] = type
92
+ flash[:object_type] = object.class.name
93
+ flash[:object_id] = object.id
94
+ end
95
+ end
96
+ ```
97
+
98
+ We just have a `set_flash` method that simply builds our flash hash which we will then use in our `flash_helper.rb`
99
+
100
+ Now all we need to do is call `set_flash` in our controller action as required.
101
+
102
+ ```ruby
103
+ def update
104
+ @post = get_post
105
+ if @post.update_attributes(post_params)
106
+ set_flash :success, object: @post
107
+ redirect_to posts_path
108
+ else
109
+ set_flash :error, object: @post
110
+ render :edit
111
+ end
112
+ end
113
+
114
+ def create
115
+ @post = Post.new(post_params)
116
+ if @post.save
117
+ set_flash :success, object: @post
118
+ redirect_to posts_path
119
+ else
120
+ set_flash :error, object: @post
121
+ render :new
122
+ end
123
+ end
124
+ ```
125
+
126
+ You'll see that we have a case where the flash is being used to handle success messages and error messages. We're going to get back to the views and see how we'll render out these flash messages.
127
+
128
+ ## Into the Views
129
+
130
+ Once we've set everything up all we have to do now is render our flash messages through the partials in our views. However we need to use the path we defined in the FlashHelper called `flash_path` basically this is where its going to look for the flash message. You can change this and structure your flash messages however you like however in this case we're going to put it in the views that correspond to the controller.
131
+
132
+ We're going to create a few files
133
+
134
+ ```bash
135
+ views/posts/flash/create/_success.html
136
+ views/posts/flash/create/_error.html
137
+ views/posts/flash/update/_success.html
138
+ views/posts/flash/update/_error.html
139
+ ```
140
+
141
+ Here are some example content of what you can do with these flash partials. Here is what my `create/_success.html.erb` looks like.
142
+
143
+ ```
144
+ <h4>Congratulations!</h4>
145
+ Your post has been successfully created! <%= link_to object.title, object %>
146
+ ```
147
+
148
+ Here is `update/_success.html.erb`
149
+ ```
150
+ Your post has been successfully saved! <%= link_to "edit: #{object.title}", edit_post_path(object) %>
151
+ ```
152
+
153
+
154
+ Basically this file structure is what we have setup in our `flash_path` method. So your free to use whatever kind of structure you like by modifying the `flash_path` method.
155
+
156
+ ```ruby
157
+ # def set_flash(type, object: nil)
158
+ # flash[:from] = action_name
159
+ # flash[:type] = type
160
+ # flash[:object_type] = object.class.name
161
+ # flash[:object_id] = object.id
162
+ # end
163
+
164
+ def flash_path
165
+ File.join(controller_name, 'flash', flash[:from].to_s, flash[:type].to_s)
166
+ end
167
+ ```
168
+
169
+ ## Conclusion
170
+
171
+ You may be wondering why go through all that trouble. Well if your working with a large scale rails app. Having some sort of structure to help keep your flash messages clean and versatile might be something worth investing time into getting right. There are many solutions out there and they all work in their own way. Depending on what sort of app your building this could be a great solution for you!
@@ -0,0 +1,7 @@
1
+ title: "Rails Flash Partials"
2
+ slug: "rails-flash-partials"
3
+ tags: ["Rails"]
4
+ playlists: ["A Shot of Ruby"]
5
+ details:
6
+ blurb: "How to setup flash messages in your application"
7
+ cover: "assets/cover.png"
@@ -0,0 +1,89 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20140403181629) do
15
+
16
+ # These are extensions that must be enabled in order to support this database
17
+ enable_extension "plpgsql"
18
+ enable_extension "hstore"
19
+
20
+ create_table "writefully_authorships", force: true do |t|
21
+ t.integer "user_id"
22
+ t.hstore "data"
23
+ t.string "role"
24
+ t.datetime "created_at"
25
+ t.datetime "updated_at"
26
+ end
27
+
28
+ add_index "writefully_authorships", ["user_id"], name: "index_writefully_authorships_on_user_id", using: :btree
29
+
30
+ create_table "writefully_posts", force: true do |t|
31
+ t.string "title"
32
+ t.string "slug"
33
+ t.string "type"
34
+ t.text "content"
35
+ t.hstore "details"
36
+ t.datetime "published_at"
37
+ t.integer "position"
38
+ t.string "locale", default: "en"
39
+ t.integer "translation_source_id"
40
+ t.integer "site_id"
41
+ t.integer "authorship_id"
42
+ t.datetime "created_at"
43
+ t.datetime "updated_at"
44
+ end
45
+
46
+ add_index "writefully_posts", ["authorship_id"], name: "index_writefully_posts_on_authorship_id", using: :btree
47
+ add_index "writefully_posts", ["site_id"], name: "index_writefully_posts_on_site_id", using: :btree
48
+ add_index "writefully_posts", ["slug"], name: "index_writefully_posts_on_slug", unique: true, using: :btree
49
+ add_index "writefully_posts", ["translation_source_id"], name: "index_writefully_posts_on_translation_source_id", using: :btree
50
+
51
+ create_table "writefully_sites", force: true do |t|
52
+ t.string "name"
53
+ t.string "branch", default: "master"
54
+ t.string "slug"
55
+ t.hstore "repository"
56
+ t.string "domain"
57
+ t.boolean "processing", default: true
58
+ t.boolean "healthy", default: false
59
+ t.integer "owner_id"
60
+ t.datetime "created_at"
61
+ t.datetime "updated_at"
62
+ end
63
+
64
+ add_index "writefully_sites", ["owner_id"], name: "index_writefully_sites_on_owner_id", using: :btree
65
+ add_index "writefully_sites", ["repository"], name: "index_writefully_sites_on_repository", using: :gin
66
+ add_index "writefully_sites", ["slug"], name: "index_writefully_sites_on_slug", unique: true, using: :btree
67
+
68
+ create_table "writefully_taggings", force: true do |t|
69
+ t.integer "tag_id"
70
+ t.integer "post_id"
71
+ t.datetime "created_at"
72
+ t.datetime "updated_at"
73
+ end
74
+
75
+ add_index "writefully_taggings", ["post_id"], name: "index_writefully_taggings_on_post_id", using: :btree
76
+ add_index "writefully_taggings", ["tag_id"], name: "index_writefully_taggings_on_tag_id", using: :btree
77
+
78
+ create_table "writefully_tags", force: true do |t|
79
+ t.string "name"
80
+ t.string "slug"
81
+ t.string "type"
82
+ t.datetime "created_at"
83
+ t.datetime "updated_at"
84
+ end
85
+
86
+ add_index "writefully_tags", ["slug"], name: "index_writefully_tags_on_slug", unique: true, using: :btree
87
+ add_index "writefully_tags", ["type"], name: "index_writefully_tags_on_type", using: :btree
88
+
89
+ end