kawara 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +13 -0
  4. data/Rakefile +26 -0
  5. data/app/assets/javascripts/kawara/application.js +13 -0
  6. data/app/assets/stylesheets/kawara/application.css +15 -0
  7. data/app/controllers/kawara/application_controller.rb +5 -0
  8. data/app/controllers/kawara/articles_controller.rb +9 -0
  9. data/app/helpers/kawara/application_helper.rb +4 -0
  10. data/app/models/kawara/article.rb +25 -0
  11. data/app/models/kawara/article_image.rb +10 -0
  12. data/app/models/kawara/articles_meta_tag.rb +10 -0
  13. data/app/models/kawara/articles_tag.rb +10 -0
  14. data/app/models/kawara/category.rb +11 -0
  15. data/app/models/kawara/meta_tag.rb +9 -0
  16. data/app/models/kawara/tag.rb +9 -0
  17. data/app/views/kawara/articles/show.html.erb +13 -0
  18. data/app/views/layouts/kawara/application.html.erb +14 -0
  19. data/config/routes.rb +3 -0
  20. data/db/migrate/20160310230220_create_kawara_categories.rb +18 -0
  21. data/db/migrate/20160311072058_create_kawara_articles.rb +17 -0
  22. data/db/migrate/20160312220950_create_kawara_article_images.rb +13 -0
  23. data/db/migrate/20160315075716_create_kawara_tags.rb +12 -0
  24. data/db/migrate/20160315075948_create_kawara_articles_tags.rb +13 -0
  25. data/db/migrate/20160316132735_create_kawara_meta_tags.rb +12 -0
  26. data/db/migrate/20160316132838_create_kawara_articles_meta_tags.rb +13 -0
  27. data/lib/kawara/config.rb +29 -0
  28. data/lib/kawara/engine.rb +10 -0
  29. data/lib/kawara/version.rb +3 -0
  30. data/lib/kawara.rb +23 -0
  31. data/lib/tasks/kawara_tasks.rake +4 -0
  32. data/spec/controllers/kawara/articles_controller_spec.rb +30 -0
  33. data/spec/dummy/README.rdoc +28 -0
  34. data/spec/dummy/Rakefile +6 -0
  35. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  36. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  37. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  38. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  39. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  40. data/spec/dummy/bin/bundle +3 -0
  41. data/spec/dummy/bin/rails +4 -0
  42. data/spec/dummy/bin/rake +4 -0
  43. data/spec/dummy/bin/setup +29 -0
  44. data/spec/dummy/config/application.rb +32 -0
  45. data/spec/dummy/config/boot.rb +5 -0
  46. data/spec/dummy/config/database.yml +25 -0
  47. data/spec/dummy/config/environment.rb +5 -0
  48. data/spec/dummy/config/environments/development.rb +41 -0
  49. data/spec/dummy/config/environments/production.rb +79 -0
  50. data/spec/dummy/config/environments/test.rb +42 -0
  51. data/spec/dummy/config/initializers/assets.rb +11 -0
  52. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  53. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  54. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  55. data/spec/dummy/config/initializers/inflections.rb +16 -0
  56. data/spec/dummy/config/initializers/kawara.rb +8 -0
  57. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  58. data/spec/dummy/config/initializers/session_store.rb +3 -0
  59. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  60. data/spec/dummy/config/locales/en.yml +23 -0
  61. data/spec/dummy/config/routes.rb +4 -0
  62. data/spec/dummy/config/secrets.yml +22 -0
  63. data/spec/dummy/config.ru +4 -0
  64. data/spec/dummy/db/development.sqlite3 +0 -0
  65. data/spec/dummy/db/schema.rb +95 -0
  66. data/spec/dummy/db/test.sqlite3 +0 -0
  67. data/spec/dummy/log/development.log +3490 -0
  68. data/spec/dummy/log/test.log +7247 -0
  69. data/spec/dummy/public/404.html +67 -0
  70. data/spec/dummy/public/422.html +67 -0
  71. data/spec/dummy/public/500.html +66 -0
  72. data/spec/dummy/public/favicon.ico +0 -0
  73. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-GHY4pUmIod7aFXzqiTB1085VcN7QqLUq3uKh9EyrW8.cache +0 -0
  74. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-MYVNIBlzheOKmpCnc9D2lhtkhIcEl4YwZM7XVXAOF4.cache +0 -0
  75. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-OglIj6GGRix52-_kOnIVr-BwJbzu-ASbJx1VoScAVA.cache +1 -0
  76. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/1KP7a1QwrH3OAbTdpgJVWZ0-pxpa1fcODRFqDcBPhUg.cache +1 -0
  77. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3QTcI6uIGbaXXd09o7ImhAbo_NMT_RVGZZ0Bqql2u2k.cache +1 -0
  78. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
  79. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5dNmmgZ1z1sZdMLOMqiQQKpTpkTo6o8fHrx7n-0oJPU.cache +1 -0
  80. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5zn7WE2Kf-W7nsLvyC8E0_bzAsEpuUALNf6MZpQBsog.cache +1 -0
  81. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/676ThQEFcacaWo-V6PAFKr8T6A9RnuC46Q2B8s-ZjOs.cache +1 -0
  82. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6mmWcXQAa85jlxLZcRu37akpBv0H2agU6St8MtfaS04.cache +0 -0
  83. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7slj08lcqeYVz-2P5YaSO9ZHEW7CoCftIHZ54iOD14Y.cache +1 -0
  84. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AZf7bqxGe7Q_hy-HImkMdMRShpV1rKoUXSs4KTmpcmM.cache +1 -0
  85. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/BXTz6VGNtrwaaqk-HVXmXiA7tsik9l-SBXnuHU9Y_No.cache +0 -0
  86. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DCUVKuoBkhtoc6-kTiPWpboN5KkmMDn0XD4bIwd3Pjw.cache +1 -0
  87. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DqxZQhVYt_gM_0UrN5DpmgxGqC3qDn0O9LmuOhDFkm4.cache +0 -0
  88. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/G_xLPRR5cXDCXz3k7QOjF82bKq4nUtLYQlo4VmyKzzM.cache +0 -0
  89. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/HHxaySpp8drvBDtjBOIn4Qbo3lmxQkEaERFOCi_oL9c.cache +1 -0
  90. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/IIes6cNhw2ZV5ruwsoW_WsNBDshI7wY5cmAKgEuTEo0.cache +1 -0
  91. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JbBqfMFb60VtkrLmiRjXi08z1Y_IzK0hGW0M6rcCrhs.cache +0 -0
  92. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KmBYHfUKVA9jOPzGx_HHUPtub6yUWtYEatrmy0BO9Xk.cache +0 -0
  93. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/L4n6mOM9s98jDFmv8P54gK08bltUvbeXih_O0z5MrH8.cache +0 -0
  94. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
  95. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/QKxtFPqtZSrBGyy42s3xwoeZ0yazHJvdS6CE7YkgMfc.cache +0 -0
  96. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/R29movm_aMSMs876ETYLiw7MyD3HXJKGU5am0ZWq4LU.cache +0 -0
  97. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/T7rBAlcrHhDGbxQGhznnSSOznpnuwtwRCn-pRBYTfXM.cache +1 -0
  98. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Vaxm8cKAFWFVkcBzzBwkJmMhl-NQyGLF8d9KyznXjWQ.cache +1 -0
  99. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/VlqA2Tp7L959ZnXZJ2F19ar_HaXlQFJaWm9aMW_dVaQ.cache +0 -0
  100. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/WEH9nXReGdSirA6-snq-NBZkvf5FXO1RmeX9Kxja_i8.cache +0 -0
  101. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/XUflKWMWOFmlUyxTWKB2Zu0DezUpfyxW6cyfUi2KLBg.cache +0 -0
  102. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YofvP9QAum93ypgWBKJonzhcZ2_PNe5JUf4SRF5RZ1U.cache +0 -0
  103. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_NlyaoV8oLEkDCn2fcAmyFno2KEhUnYtr5DRh9U15TQ.cache +1 -0
  104. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/_cnDeuQV-P0jn-ZulURi6V3V85VuZAKxKr13-tzpJXg.cache +0 -0
  105. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/aWHOBdA9G2l8rYoQFtX2KKlFA0_SvBQ72InA5a2VHRM.cache +0 -0
  106. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/b3eAB8l1iR3asS5hAxdwJKnSr9-822hw-kz_tuFuwII.cache +1 -0
  107. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/b_bbg7jg6iMQIo1v_HbRrIb_VFSPc4iBSmrY-ZE0FS0.cache +0 -0
  108. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dLkUM4Y-LoV1RrTjpa1z779CL_2UhLTCsOWXYqJ8cks.cache +1 -0
  109. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/fMOP7mUWS6i3djD4kGHlw5lhClI1WAiI_w7FRS7Uauw.cache +0 -0
  110. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/h6mA3Cyu37w7LeutyDNHxX3I9GP7AUOsJPOaRoipXOQ.cache +0 -0
  111. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -0
  112. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hsNnsC_Cc4Tfp-iL7U3GwR1Ex-7FNPC_H5Y2DLoaau4.cache +1 -0
  113. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/iLck0HdkY5V2wTkVW8Gz94GhsWU-2ZPi6CmRzr2Khc8.cache +0 -0
  114. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/im1Ue8etCIJlpp6W1_oHnMC6ssHZItygtXEzI0CDcog.cache +1 -0
  115. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jujnkdX8lDF1tdJW-X4_C0x_zb9G7PbjVwarzJjRHJ8.cache +0 -0
  116. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/kBNj9LEVDLqOQPcQ7ZpnhzNamFSkZwTeVwXKHiI7Yr8.cache +1 -0
  117. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/mFSbefoakcnHeK0qLWpjAKnTqhAFYpqY62C6fdIpkBA.cache +0 -0
  118. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oYtmmKuk57rUOVduym0YSXaybGr3usVwdwBUAmefdHE.cache +1 -0
  119. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/p6C4e7QY0XDBV6j1hSqAEj2v5SwzsRadOpAwkT4EZV0.cache +0 -0
  120. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/p8PjTmao6G3mefh2Iws2vAow2alI3xo_MWxGt1txdwY.cache +0 -0
  121. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -0
  122. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qPFZ2BUN--wo39yQCaOrQr_rH3EB8CScL3RV7ewS2SM.cache +1 -0
  123. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qpJFxG0An23sYQA5CC1MCiDiQfT5UUsaF5-TLb_-9-k.cache +1 -0
  124. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/r03yAMij1DlQRoG0EARN71NBVrdAbSITUiHND4BPBzE.cache +0 -0
  125. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/r6v5Cu2CF5dQcp3UQglo2cIxe2eL5Mm3DWicaRwKYsc.cache +1 -0
  126. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/s-LKybje6prnbkcRfpEzkF02FJhVgyRVgvZQFdzZJ_M.cache +0 -0
  127. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tXes8vdEQhJzM0Fn0w4CHgm1ZIPl51aFjwRju7CW8vs.cache +1 -0
  128. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/w8tmLWOgJTTO3lwqfnkMzpjCrg4gNT1woOJvgfvNkk0.cache +0 -0
  129. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/yCEUk2jp5vTkSyXzUbodvK4RLiHEjKrTtu-oA52gnjs.cache +1 -0
  130. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zLxifIlJePLiBHx46lTNZEW59BZcVM0MNCm64s8FxJo.cache +1 -0
  131. data/spec/dummy/tmp/uploads/store/013af6d43bb3551fa0a01cd29dc07b23431930b5623452c0711a86b7e489 +1 -0
  132. data/spec/dummy/tmp/uploads/store/0339840baaa1ab9ce9894bd4041e00114a0aa12d5dbedf13ca0f99cb43ac +1 -0
  133. data/spec/dummy/tmp/uploads/store/0a638b1863fb5e952a2ebfd44c997be887cd2eb98bfb35bf6651a951da56 +1 -0
  134. data/spec/dummy/tmp/uploads/store/0fc11d5fdcf5d0868f2d3369c8c1057aea3b543d31be04f78b21137ad9ed +1 -0
  135. data/spec/dummy/tmp/uploads/store/122800e6cdacfb975b73c766791017d8fec77bf697826e22aa7aa907d955 +1 -0
  136. data/spec/dummy/tmp/uploads/store/23a5e4931ca0d4397b4688da22a7050aeccccb3b923b13abf4883d508fa2 +1 -0
  137. data/spec/dummy/tmp/uploads/store/2eccfeb1e4b56771a5771eee05577a0b0b3e4d8a6dbb1fcaede36ab135dd +1 -0
  138. data/spec/dummy/tmp/uploads/store/3110cba76b1ecdd6fe3e6ed6e29b1b18a03011bfc46fbd0fa9e91d8d1d1d +1 -0
  139. data/spec/dummy/tmp/uploads/store/337030b57341d1f1a90c7cb1f98d853e48f4a9f31bebc35ac24743f03967 +1 -0
  140. data/spec/dummy/tmp/uploads/store/3f3f95a6b2bd7f04d95a086d807c908b32fc363184482993ef1aea6980e7 +1 -0
  141. data/spec/dummy/tmp/uploads/store/433e1cff4bd65cb1e120a1a50d224173b45e2afc411be9d0d7e0bfbeeb8b +1 -0
  142. data/spec/dummy/tmp/uploads/store/4bd35b09dcf4a51d2c342d8725acdb8d83c0ec48006ab243d68209adc75e +1 -0
  143. data/spec/dummy/tmp/uploads/store/5845bd84cae841b16d430a2995226f89e951d406a50312a264ae0a2a38b9 +1 -0
  144. data/spec/dummy/tmp/uploads/store/58a4fa523400b154fda693194d90841163eb3eeaf7bbb7d760d48cea0a9d +1 -0
  145. data/spec/dummy/tmp/uploads/store/59ee7d66e12f4af9cce18aef8f51e156568bb43cd8493d7ec4c366e83d9a +1 -0
  146. data/spec/dummy/tmp/uploads/store/647dc628a03933f81197cdd5180a85e7b437327b2d44f059253936364356 +1 -0
  147. data/spec/dummy/tmp/uploads/store/6517d67fa347dc15bcdc66abd2b0f5b2bc594ad045837114c9ff153fbb7b +1 -0
  148. data/spec/dummy/tmp/uploads/store/66db2947f50696b190e30fe24a162fda19738cae25187ff6f1b4a4198267 +1 -0
  149. data/spec/dummy/tmp/uploads/store/6bc7da6e76e8c9f08a268f75cd723413f6a1c93dcc53a7741dde4a3e7c66 +1 -0
  150. data/spec/dummy/tmp/uploads/store/779039e6ecd69d19e7902c046cf6c3a5f9315c8df5334b3fb103d5e52df0 +1 -0
  151. data/spec/dummy/tmp/uploads/store/79ebbb49ea728f585ac1d552c687c6e6e63e21a7e984c04361f29712616b +1 -0
  152. data/spec/dummy/tmp/uploads/store/7d883bda5a0e21800d287baeef8e43d5b5393f780c0b6febe3aa37a18b98 +1 -0
  153. data/spec/dummy/tmp/uploads/store/83488b3fecb1f736bc0e6f18b8ce09091d77c74c72929f8e9b13f7e0b339 +1 -0
  154. data/spec/dummy/tmp/uploads/store/87f81b2206257afa9e44de63328f9ffab3adb1310bc65fedf9e568b22f42 +1 -0
  155. data/spec/dummy/tmp/uploads/store/8f1000740668b73a33dd07ab95c845b3473a7c6af14f446d6442523df98c +1 -0
  156. data/spec/dummy/tmp/uploads/store/97fba6b149dde97310735d773cb654975c4d2a45886693d03654b286d5d4 +1 -0
  157. data/spec/dummy/tmp/uploads/store/9a594f4b196ad875fba39c15c49741a449c8836450a781679ce4e9f074ce +1 -0
  158. data/spec/dummy/tmp/uploads/store/b08e0da5725010b809daaf8657b25af53900b38e4bd83e192dd49e6cee16 +1 -0
  159. data/spec/dummy/tmp/uploads/store/b2ed670f04070e8a7708e5c06ec1f9052ed9975fbaa42aec2c0dbfa617aa +1 -0
  160. data/spec/dummy/tmp/uploads/store/c9beb4710f822171201df1f090c41342015629d2dab5b9c4d94ab93c82d1 +1 -0
  161. data/spec/dummy/tmp/uploads/store/cc07ed99bbca4f83dd0b5954b9f1ce9584092bc5c2d05b7e6a92fd4c2e20 +1 -0
  162. data/spec/dummy/tmp/uploads/store/da5afbf24a652dca7390fd4afe5b466999ac0c8f8f1143e8023a4f184f91 +1 -0
  163. data/spec/dummy/tmp/uploads/store/e59f265c25efe736ff455a3faed63d710a21a403a93a1723ebc845438ef0 +1 -0
  164. data/spec/dummy/tmp/uploads/store/e9dd4abf2a9a9c727d864cf471923816cf68d55715a58d0a0496e825b767 +1 -0
  165. data/spec/dummy/tmp/uploads/store/ea4080bdac8b65c0b786a2997cb2a79bef2361e0ffbac573a517c5b979e2 +1 -0
  166. data/spec/dummy/tmp/uploads/store/edaa8c2911d6a2bfc9f4cc5b687887bf67b2aa061fac88426ed83f04eefa +1 -0
  167. data/spec/dummy/tmp/uploads/store/f30311663071fdc59166977a2a20af239c5349268f9725ec033cadfa2976 +1 -0
  168. data/spec/dummy/tmp/uploads/store/fe8c7f9b9c8afedb8a09e7dbe50b1da9db175395104e2e5aaba16cbcb733 +1 -0
  169. data/spec/factories/kawara_article_images.rb +6 -0
  170. data/spec/factories/kawara_articles.rb +17 -0
  171. data/spec/factories/kawara_articles_meta_tags.rb +6 -0
  172. data/spec/factories/kawara_articles_tags.rb +6 -0
  173. data/spec/factories/kawara_categories.rb +5 -0
  174. data/spec/factories/kawara_meta_tags.rb +6 -0
  175. data/spec/factories/kawara_tags.rb +6 -0
  176. data/spec/lib/kawara/config_spec.rb +4 -0
  177. data/spec/models/kawara/article_image_spec.rb +23 -0
  178. data/spec/models/kawara/article_spec.rb +35 -0
  179. data/spec/models/kawara/articles_meta_tag_spec.rb +22 -0
  180. data/spec/models/kawara/articles_tag_spec.rb +22 -0
  181. data/spec/models/kawara/category_spec.rb +13 -0
  182. data/spec/models/kawara/meta_tag_spec.rb +20 -0
  183. data/spec/models/kawara/tag_spec.rb +20 -0
  184. data/spec/rails_helper.rb +58 -0
  185. data/spec/spec_helper.rb +92 -0
  186. data/spec/support/factory_girl.rb +3 -0
  187. data/spec/support/refile.rb +15 -0
  188. data/spec/support/shoulda_matchers.rb +6 -0
  189. data/spec/support/temping.rb +5 -0
  190. metadata +584 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6d88423997a4b585e68971121f88c475d746708a
4
+ data.tar.gz: e2744e4aaf998804426e24f2debbd3be8ef73c1f
5
+ SHA512:
6
+ metadata.gz: 824762e19e26469ffe5669f5efc64ad76c692b116e513140049863be545effe3ddad1848f62c0aacf55b39258afe7a4fffc6649ccaa5625cc82609dbd6f0c8de
7
+ data.tar.gz: eb73b6394bf488f58146b78bbe39d92df153ae36a1d6bc3efccdbf308fbad2bd619f456beb08169f945d42e1998fab3ca6ac06f3553d521a8990f69522d8d2ba
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Rui Onodera
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.
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # Kawara
2
+
3
+ Blog media gem.
4
+ This project rocks and uses MIT-LICENSE.
5
+
6
+ # Features
7
+
8
+ ## Article contents are written by Kramdown gem
9
+
10
+ ## Images are handled by Refile gem
11
+
12
+ ## Categories are managed by Awesome Nested Set gem
13
+
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Kawara'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ module Kawara
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require_dependency "kawara/application_controller"
2
+
3
+ module Kawara
4
+ class ArticlesController < ApplicationController
5
+ def show
6
+ @article = Kawara::Article.find_from_published(params[:id])
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ module Kawara
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,25 @@
1
+ require 'kramdown'
2
+
3
+ module Kawara
4
+ class Article < ActiveRecord::Base
5
+
6
+ belongs_to :category
7
+ has_many :images, class_name: 'ArticleImage', dependent: :destroy
8
+ has_many :articles_tags, dependent: :destroy
9
+ has_many :tags, through: :articles_tags
10
+ has_many :articles_meta_tags, dependent: :destroy
11
+ has_many :meta_tags, through: :articles_meta_tags
12
+
13
+ enum status: { draft: 0, published: 10 }
14
+
15
+ accepts_attachments_for :images
16
+
17
+ def self.find_from_published(id)
18
+ published.find(id)
19
+ end
20
+
21
+ def html_content(auto_ids: true)
22
+ Kramdown::Document.new(content, auto_ids: auto_ids).to_html
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ module Kawara
2
+ class ArticleImage < ActiveRecord::Base
3
+
4
+ belongs_to :article
5
+ attachment :file, type: :image
6
+
7
+ validates :article, presence: true
8
+
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Kawara
2
+ class ArticlesMetaTag < ActiveRecord::Base
3
+
4
+ belongs_to :article
5
+ belongs_to :meta_tag, counter_cache: :articles_count
6
+
7
+ validates :article, presence: true
8
+ validates :meta_tag, presence: true
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Kawara
2
+ class ArticlesTag < ActiveRecord::Base
3
+
4
+ belongs_to :article
5
+ belongs_to :tag, counter_cache: :articles_count
6
+
7
+ validates :article, presence: true
8
+ validates :tag, presence: true
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ require 'awesome_nested_set'
2
+
3
+ module Kawara
4
+ class Category < ActiveRecord::Base
5
+ acts_as_nested_set
6
+
7
+ has_many :articles
8
+
9
+ validates :name, presence: true
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module Kawara
2
+ class MetaTag < ActiveRecord::Base
3
+
4
+ has_many :articles_meta_tags, dependent: :destroy
5
+ has_many :articles, through: :articles_meta_tags
6
+
7
+ validates :name, presence: true, uniqueness: true
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Kawara
2
+ class Tag < ActiveRecord::Base
3
+
4
+ has_many :articles_tags, dependent: :destroy
5
+ has_many :articles, through: :articles_tags
6
+
7
+ validates :name, presence: true, uniqueness: true
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ <article>
2
+ <header>
3
+ <h1><%= @article.title %></h1>
4
+
5
+ <% if @article.subtitle.present? %>
6
+ <p><%= @article.subtitle %></p>
7
+ <% end %>
8
+
9
+ </header>
10
+
11
+ <%= raw(@article.html_content) %>
12
+
13
+ </article>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Kawara</title>
5
+ <%= stylesheet_link_tag "kawara/application", media: "all" %>
6
+ <%= javascript_include_tag "kawara/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Kawara::Engine.routes.draw do
2
+ resources :articles, only: %w(show)
3
+ end
@@ -0,0 +1,18 @@
1
+ class CreateKawaraCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :kawara_categories do |t|
4
+ t.string :name, null: false
5
+ t.integer :parent_id
6
+ t.integer :lft, null: false
7
+ t.integer :rgt, null: false
8
+ t.integer :depth, null: false, default: 0
9
+ t.integer :children_count, null: false, default: 0
10
+
11
+ t.timestamps null: false
12
+ end
13
+
14
+ add_index :kawara_categories, :parent_id
15
+ add_index :kawara_categories, :lft
16
+ add_index :kawara_categories, :rgt
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ class CreateKawaraArticles < ActiveRecord::Migration
2
+ def change
3
+ create_table :kawara_articles do |t|
4
+ t.integer :category_id
5
+ t.string :title
6
+ t.string :subtitle
7
+ t.text :content
8
+ t.integer :status, default: 0, null: false
9
+
10
+ t.timestamps null: false
11
+ end
12
+
13
+ add_index :kawara_articles, [:status, :id]
14
+ add_index :kawara_articles, :category_id
15
+ add_index :kawara_articles, [:status, :category_id]
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ class CreateKawaraArticleImages < ActiveRecord::Migration
2
+ def change
3
+ create_table :kawara_article_images do |t|
4
+ t.integer :article_id, null: false, index: true
5
+ t.string :file_id, null: false
6
+ t.string :file_filename
7
+ t.integer :file_size
8
+ t.string :file_content_type
9
+
10
+ t.timestamps null: false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ class CreateKawaraTags < ActiveRecord::Migration
2
+ def change
3
+ create_table :kawara_tags do |t|
4
+ t.string :name, null: false
5
+ t.integer :articles_count
6
+
7
+ t.timestamps null: false
8
+ end
9
+
10
+ add_index :kawara_tags, :name, unique: true
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ class CreateKawaraArticlesTags < ActiveRecord::Migration
2
+ def change
3
+ create_table :kawara_articles_tags do |t|
4
+ t.integer :article_id, null: false
5
+ t.integer :tag_id, null: false
6
+
7
+ t.timestamps null: false
8
+ end
9
+
10
+ add_index :kawara_articles_tags, [:article_id, :tag_id]
11
+ add_index :kawara_articles_tags, [:tag_id, :article_id]
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ class CreateKawaraMetaTags < ActiveRecord::Migration
2
+ def change
3
+ create_table :kawara_meta_tags do |t|
4
+ t.string :name, null: false
5
+ t.integer :articles_count
6
+
7
+ t.timestamps null: false
8
+ end
9
+
10
+ add_index :kawara_meta_tags, :name, unique: true
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ class CreateKawaraArticlesMetaTags < ActiveRecord::Migration
2
+ def change
3
+ create_table :kawara_articles_meta_tags do |t|
4
+ t.integer :article_id, null: false
5
+ t.integer :meta_tag_id, null: false
6
+
7
+ t.timestamps null: false
8
+ end
9
+
10
+ add_index :kawara_articles_meta_tags, [:article_id, :meta_tag_id]
11
+ add_index :kawara_articles_meta_tags, [:meta_tag_id, :article_id]
12
+ end
13
+ end
@@ -0,0 +1,29 @@
1
+ module Kawara
2
+ class Config
3
+ include Singleton
4
+ include ActiveSupport::Configurable
5
+
6
+ config_accessor :aws_access_key
7
+ config_accessor :aws_secret_key
8
+ config_accessor :aws_region do
9
+ 'ap-northeast-1'
10
+ end
11
+ config_accessor :aws_bucket
12
+
13
+ config_accessor :aws, instance_writer: false
14
+ def aws
15
+ {
16
+ access_key_id: config.aws_access_key,
17
+ secret_access_key: config.aws_secret_key,
18
+ region: config.aws_region,
19
+ bucket: config.aws_bucket
20
+ }
21
+ end
22
+
23
+ config_accessor :image_max_size do
24
+ 10.megabytes
25
+ end
26
+ config_accessor :cdn_host
27
+
28
+ end
29
+ end
@@ -0,0 +1,10 @@
1
+ module Kawara
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Kawara
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Kawara
2
+ VERSION = "0.1.0"
3
+ end
data/lib/kawara.rb ADDED
@@ -0,0 +1,23 @@
1
+ require 'kawara/engine'
2
+ require 'kawara/config'
3
+
4
+ require 'refile/rails'
5
+ require 'refile/mini_magick'
6
+ require "refile/s3"
7
+
8
+ module Kawara
9
+ def self.config
10
+ Config.instance
11
+ end
12
+
13
+ def self.configure
14
+ yield config if block_given?
15
+
16
+ if config.aws_access_key && config.aws_secret_key && config.aws_bucket
17
+ Refile.cache = Refile::S3.new(prefix: "cache", max_size: config.image_max_size, **(config.aws))
18
+ Refile.store = Refile::S3.new(prefix: "store", max_size: config.image_max_size, **(config.aws))
19
+ end
20
+
21
+ Refile.cdn_host = config.cdn_host if config.cdn_host
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :kawara do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,30 @@
1
+ require 'rails_helper'
2
+
3
+ module Kawara
4
+ RSpec.describe ArticlesController, type: :controller do
5
+
6
+ routes { Kawara::Engine.routes }
7
+
8
+ describe 'GET #show' do
9
+ subject { get :show, id: id }
10
+
11
+ let(:draft_article) { create :draft_article }
12
+ let(:published_article) { create :published_article }
13
+
14
+ context 'when there is a published article' do
15
+ let(:id) { published_article.id }
16
+
17
+ before { subject }
18
+
19
+ it { expect(response).to render_template(:show) }
20
+ it { expect(response).to have_http_status(:success) }
21
+ it { expect(assigns(:article)).to eq(published_article) }
22
+ end
23
+
24
+ context 'when there are no published articles' do
25
+ let(:id) { draft_article.id }
26
+ it { expect{subject}.to raise_error(ActiveRecord::RecordNotFound) }
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,32 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ require "action_view/railtie"
8
+ require "sprockets/railtie"
9
+ # require "rails/test_unit/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "kawara"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+
28
+ # Do not swallow errors in after_commit/after_rollback callbacks.
29
+ config.active_record.raise_in_transactional_callbacks = true
30
+ end
31
+ end
32
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)