groonga-client-rails 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (172) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +6 -0
  3. data/Gemfile +21 -0
  4. data/README.md +57 -0
  5. data/Rakefile +44 -0
  6. data/doc/text/lgpl-2.1.txt +502 -0
  7. data/doc/text/news.md +5 -0
  8. data/groonga-client-rails.gemspec +52 -0
  9. data/lib/groonga-client-rails.rb +23 -0
  10. data/lib/groonga/client/rails/fixture.rb +35 -0
  11. data/lib/groonga/client/rails/groonga_server_runner.rb +164 -0
  12. data/lib/groonga/client/rails/spec_helper.rb +39 -0
  13. data/lib/groonga/client/rails/test_helper.rb +39 -0
  14. data/lib/groonga/client/rails/version.rb +23 -0
  15. data/lib/groonga/client/railtie.rb +70 -0
  16. data/lib/groonga/client/searcher.rb +165 -0
  17. data/lib/groonga/client/searcher/error.rb +37 -0
  18. data/lib/groonga/client/searcher/raw_request.rb +85 -0
  19. data/lib/groonga/client/searcher/schema.rb +74 -0
  20. data/lib/groonga/client/searcher/schema_synchronizer.rb +137 -0
  21. data/lib/groonga/client/searcher/select.rb +18 -0
  22. data/lib/groonga/client/searcher/select/request.rb +266 -0
  23. data/lib/groonga/client/searcher/select/result_set.rb +117 -0
  24. data/lib/groonga/client/searcher/source.rb +59 -0
  25. data/test/apps/rails4-mongoid/Gemfile +50 -0
  26. data/test/apps/rails4-mongoid/Gemfile.lock +190 -0
  27. data/test/apps/rails4-mongoid/README.rdoc +28 -0
  28. data/test/apps/rails4-mongoid/Rakefile +6 -0
  29. data/test/apps/rails4-mongoid/app/assets/javascripts/application.js +16 -0
  30. data/test/apps/rails4-mongoid/app/assets/javascripts/posts.coffee +3 -0
  31. data/test/apps/rails4-mongoid/app/assets/stylesheets/application.css +15 -0
  32. data/test/apps/rails4-mongoid/app/assets/stylesheets/posts.scss +3 -0
  33. data/test/apps/rails4-mongoid/app/assets/stylesheets/scaffolds.scss +73 -0
  34. data/test/apps/rails4-mongoid/app/controllers/application_controller.rb +5 -0
  35. data/test/apps/rails4-mongoid/app/controllers/posts_controller.rb +74 -0
  36. data/test/apps/rails4-mongoid/app/helpers/application_helper.rb +2 -0
  37. data/test/apps/rails4-mongoid/app/helpers/posts_helper.rb +2 -0
  38. data/test/apps/rails4-mongoid/app/models/post.rb +12 -0
  39. data/test/apps/rails4-mongoid/app/searchers/application_searcher.rb +2 -0
  40. data/test/apps/rails4-mongoid/app/searchers/posts_searcher.rb +16 -0
  41. data/test/apps/rails4-mongoid/app/views/layouts/application.html.erb +14 -0
  42. data/test/apps/rails4-mongoid/app/views/posts/_form.html.erb +25 -0
  43. data/test/apps/rails4-mongoid/app/views/posts/edit.html.erb +6 -0
  44. data/test/apps/rails4-mongoid/app/views/posts/index.html.erb +29 -0
  45. data/test/apps/rails4-mongoid/app/views/posts/index.json.jbuilder +4 -0
  46. data/test/apps/rails4-mongoid/app/views/posts/new.html.erb +5 -0
  47. data/test/apps/rails4-mongoid/app/views/posts/show.html.erb +14 -0
  48. data/test/apps/rails4-mongoid/app/views/posts/show.json.jbuilder +1 -0
  49. data/test/apps/rails4-mongoid/bin/bundle +3 -0
  50. data/test/apps/rails4-mongoid/bin/rails +4 -0
  51. data/test/apps/rails4-mongoid/bin/rake +4 -0
  52. data/test/apps/rails4-mongoid/bin/setup +29 -0
  53. data/test/apps/rails4-mongoid/config.ru +4 -0
  54. data/test/apps/rails4-mongoid/config/application.rb +32 -0
  55. data/test/apps/rails4-mongoid/config/boot.rb +3 -0
  56. data/test/apps/rails4-mongoid/config/environment.rb +5 -0
  57. data/test/apps/rails4-mongoid/config/environments/development.rb +38 -0
  58. data/test/apps/rails4-mongoid/config/environments/production.rb +76 -0
  59. data/test/apps/rails4-mongoid/config/environments/test.rb +42 -0
  60. data/test/apps/rails4-mongoid/config/groonga_client.yml +22 -0
  61. data/test/apps/rails4-mongoid/config/initializers/assets.rb +11 -0
  62. data/test/apps/rails4-mongoid/config/initializers/backtrace_silencers.rb +7 -0
  63. data/test/apps/rails4-mongoid/config/initializers/cookies_serializer.rb +3 -0
  64. data/test/apps/rails4-mongoid/config/initializers/filter_parameter_logging.rb +4 -0
  65. data/test/apps/rails4-mongoid/config/initializers/inflections.rb +16 -0
  66. data/test/apps/rails4-mongoid/config/initializers/mime_types.rb +4 -0
  67. data/test/apps/rails4-mongoid/config/initializers/session_store.rb +3 -0
  68. data/test/apps/rails4-mongoid/config/initializers/wrap_parameters.rb +9 -0
  69. data/test/apps/rails4-mongoid/config/locales/en.yml +23 -0
  70. data/test/apps/rails4-mongoid/config/mongoid.yml +142 -0
  71. data/test/apps/rails4-mongoid/config/routes.rb +57 -0
  72. data/test/apps/rails4-mongoid/config/secrets.yml +22 -0
  73. data/test/apps/rails4-mongoid/db/seeds.rb +7 -0
  74. data/test/apps/rails4-mongoid/log/development.log +764 -0
  75. data/test/apps/rails4-mongoid/log/test.log +15736 -0
  76. data/test/apps/rails4-mongoid/public/404.html +67 -0
  77. data/test/apps/rails4-mongoid/public/422.html +67 -0
  78. data/test/apps/rails4-mongoid/public/500.html +66 -0
  79. data/test/apps/rails4-mongoid/public/favicon.ico +0 -0
  80. data/test/apps/rails4-mongoid/public/robots.txt +5 -0
  81. data/test/apps/rails4-mongoid/test/controllers/posts_controller_test.rb +51 -0
  82. data/test/apps/rails4-mongoid/test/factories/posts.rb +6 -0
  83. data/test/apps/rails4-mongoid/test/models/post_test.rb +9 -0
  84. data/test/apps/rails4-mongoid/test/searchers/posts_searcher_test.rb +119 -0
  85. data/test/apps/rails4-mongoid/test/test_helper.rb +9 -0
  86. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/-Xhj-Mbb82rk571sDsQxrdCywGX36vsenBH1RUlK-LY.cache +1 -0
  87. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/0f_MbWM7kHYaEii2fU46RtcPM1c5AvKKzZXw_HiM0CE.cache +1 -0
  88. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/2PZE0O2lwq-MOTwxKTZxLxQwY8_QyhrbRsthl3Lc4lQ.cache +0 -0
  89. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
  90. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/5dV_yE4FDckg8xSumojLvTuflbNyhpApq7LPOy-e1X0.cache +0 -0
  91. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/7efkcYvlMpIQU8kuDy1jAKDLjakVGoH6N5V-AuzuTZc.cache +0 -0
  92. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/8Zm1d9-lBPsGG_HUw8FP2OCCVucGDVhWAOGaopvOdss.cache +0 -0
  93. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/9B_fDWO-7yTtWLP7C6kgtW5LN2zlpAqr1km-1jSQx2w.cache +1 -0
  94. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/9X7nmZiJ1BxgVp80vJFjKw2uuEfdS1ik3B66O4_iWPo.cache +0 -0
  95. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/APY89OAPJx9A3D3xcCoktvEvQUs7NcWChYXnjjjPzz0.cache +0 -0
  96. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/CWMzfW8FmEfR6gB4BwariPLjTZTtLc4bCVc0r0m2VV4.cache +0 -0
  97. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/C_ZXB0e-P6-9Ty60eBWeAui5uzzA0NzDW8amqmtTk9g.cache +0 -0
  98. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Cg1VzEm4v80ed-e0X3WGAHJWYiC_ybnfBrRrIvltPXc.cache +1 -0
  99. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Cjhm36F4tzUHdc1e0Bho51N0H4HYybVTrxTmbtiqih4.cache +1 -0
  100. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/DSOLSc6A5RVSmvM415eEWAWG_AgOvZcLZOXQjsXyWQA.cache +2 -0
  101. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/EBtbhweQl74JQNkwFL3ahZH_9x44ceqa9hOT8lQ_SfM.cache +2 -0
  102. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/EQICjEOYeXNTngMqEgET0L1SuE4AVuoKyJgio4ks43A.cache +1 -0
  103. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Edyy4hZsoEraZijGtQOEBXtG2121KJUoZeUxxPjVoD8.cache +1 -0
  104. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/HfA_T6XraGo2Ny22jLyDJkU33FwcVIBOxUIXJAfTZnw.cache +1 -0
  105. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/I-oUhfEICgXeCJ30YmQbpoYtgGAJK0-Pql8kOvfHUIs.cache +1 -0
  106. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/ITBgBGR9-8E08Y63Vjo65c8DzPESTHJuYCXZp0y6k_I.cache +0 -0
  107. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/JImLmTmbMkDKlN30hse8U-u0IV8hvfdebOL3EFz71FE.cache +0 -0
  108. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Joxxq6tZo5Z61fNSWcPCGgCyehta1sNKXM0i53ziK0o.cache +2 -0
  109. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/KPHQh44WoGRX0SuVORNxUqq129kPRQ4Sfwr0MgBGTWg.cache +1 -0
  110. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/MQWJrWW-vCooFa9lpB2Z7KDIE9ilL54d5Sf_SRtQhTM.cache +1 -0
  111. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
  112. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Olyga_OJ5Sz5He_RVZLO_BraSHgGvt9BG0ORecSD4A4.cache +1 -0
  113. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/OoG10cMLeO2eGZxk483Gx75vNDQz7Id8sxVt3g26jQE.cache +0 -0
  114. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/P2sNuT6usNXi8DQFFQ2SMByy1v98zmNdwdx6wduUQDg.cache +1 -0
  115. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Pm3ENYpCrQMOJGd-d8lACN_nbGZWiivq_KyPLJoD9Xk.cache +0 -0
  116. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/PrxeUFTxE6CmNlJ4CQLxcmAQKwOGBKNCFYluKNhVPdI.cache +0 -0
  117. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/PuNKoh-EB-UU-NnPetIEhS3emExlV586tfFJnBFhaxo.cache +0 -0
  118. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/QyBzeHR44VD1fMDrJcMOaVyyn1xgHnmhPX2VL3R6EdE.cache +0 -0
  119. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/QyU_Bdj5YdiIQef2XhSDP5MQf7l3u_A81md3KFPQ2N4.cache +2 -0
  120. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/R9YbLXVmFuZvXntmUsVoP9gdFgZaoKuww_0l-ulu_Sw.cache +0 -0
  121. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/RbDvgwCB1ggHONj2Gglg9cljN_KExx-gHiSiItOFBVw.cache +1 -0
  122. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Rkd99KDYtUtVb3U566M9L4YD2Kh-Qp147dHVmyXnDhg.cache +0 -0
  123. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Sin6bEoASrNa45108CpfgF2jcifz-KpbsvvZJtqVZ68.cache +0 -0
  124. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/SuhtC6f7E2-1SXl4bkRvOKqhzFKTjPvbglVtjbjV6WQ.cache +0 -0
  125. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/WDXpPe61HDYBIqMMzcYJWujunl4HLJBvhn0OOP1yQso.cache +1 -0
  126. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Y2HHx2PygDVpbc258EY6XyZq_3ocHy5fEq-5UHSNfh0.cache +0 -0
  127. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/Zot5Dwe9yQ1wvCpegdXXjC8DUGHfH1xLxerosBjUsns.cache +0 -0
  128. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/ZwSejSAeaXOqaevCGNDw6GT4jzf6iGxiDfUGqtjYqxE.cache +0 -0
  129. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/bsYyBqujQ9Bb_NkqKjx8J9lC8MPb-Ed59b__aV46Bic.cache +1 -0
  130. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/cnfLEWE92uT-WDII157E3Z5XISKK99q6__D2IiTRhOM.cache +0 -0
  131. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/cnk28xBZ2NhIHyeh4bImJu1D8MsQZksGaVeYZSDL-Mw.cache +0 -0
  132. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/cyuaVF0ZckKku_VGsQYOntnl3oNlSP381WW5VhCMbE4.cache +1 -0
  133. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/ee9ZqYM3D8GORlAyhQhVVtyNcEArBAXuuAcPhnfTNT8.cache +5 -0
  134. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/fQe7NSWabAv2wB6jtw0Tjp5CT06xwpla822ipJiUCy0.cache +1 -0
  135. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/fme939QD_yb-kVcNE40VAdyOZYRTHgZCxYLVDZLuzF0.cache +1 -0
  136. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/gl7MP7d46hviHXVnGFYORtcWessT58E75rSQUFjfiII.cache +0 -0
  137. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/hHOboG408ksat1oQaCWVNxzf-FIyTREQFXHdFZurlZQ.cache +1 -0
  138. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/i5GV8tvuWRKqi-plBB0bdaAqfdW_CpIMlk_3qZYyask.cache +1 -0
  139. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/ioEvK0rblqqEotrMItm0VrKhWOXnC3vwC-CIU9UCZEg.cache +1 -0
  140. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/ivzms341pOxkVrOTXM3Yog9cLwq3SmsXcwGMbRGmM6s.cache +1 -0
  141. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/j0l28m8jfc6vnBWrkD0zWt2ELCJfEOMeEjW0Q4GADNY.cache +0 -0
  142. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/jPuyl--LQd6DGNNoxSkPhBGx_ul_1kfka93EDJmnc8c.cache +1 -0
  143. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/jaYo3RHF_E7SipTqBJcsnR0JcOOa0rFpEHmp3nLDrQI.cache +1 -0
  144. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/kSkCWaAJCcTgZ_AhrRCjZhNtkE12cubiq70uNtditqk.cache +0 -0
  145. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/mXFXPQpdpe6VdLyG_ATkrFvhK-DzKohwq6B2GOQo9R8.cache +0 -0
  146. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/q2eC-e4sz4yzY37JZQfdjar0jjp4v7rHuGin5JEKV7Q.cache +1 -0
  147. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/s6DK-YkFoxYJMKXt21m9PdMtZi3TJhRoHIi0R5i69Zs.cache +1 -0
  148. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/sLDAakEn7_JrPiyZe0ZUsCLDnaTAal-5HajraaAgdhE.cache +2 -0
  149. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/teXpzhiur3Mnn2KsTY8q4HhEqpbdmKBfBW2iS5-MvUI.cache +1 -0
  150. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/tgZjQMFX0Ebx2i8ovlwnvwULhvrhFNJLAIQjUNZN1RM.cache +0 -0
  151. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/tihMlIo90U72qN2BzGajipIJOWppg8OIJuVnnluwVJM.cache +1 -0
  152. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/vpD8YcdUFmWVggV1ANqLIWcTbMItiGv1aOUd3i_Sf_w.cache +1 -0
  153. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/wBoZhq66JcV9m6-FvOoZ-Q3Cy9mgT-ynjPWZWZdafLw.cache +0 -0
  154. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/wTWJ6pQBopl4RdCt1QzngFCI6BQsl97QiZJO8bkGZd4.cache +1 -0
  155. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/wjVbFqqSw39d-ryprJ1NYmKProunHG47jEI6RFHcLM4.cache +0 -0
  156. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/wm5Vu6DEN0ZExnKV0oAADsKfEn3yvO4aBQJwp6b8FbU.cache +1 -0
  157. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/x0qPZqkeQj_x2GoHegxhwuHhPMrz8iHGdALgbSEtYB0.cache +1 -0
  158. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/xESXQaQoarUInNLmS7yPvF7D9FlSfaR8n8CsT6vIfmU.cache +1 -0
  159. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/xJpeFclkEQS028sCHKPl9C6EyiAcTgUW_lBAqjRuP_c.cache +0 -0
  160. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/yinyMcV6eKC4p76ZeetFBkRq8qYD5b8fWOHbukaCUNk.cache +1 -0
  161. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/ytg8J2fjBhc978nkpdl0f5cBPdcKpig523h4O4eN664.cache +1 -0
  162. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/z5Cl2oKorg00CGt089PLdPdoE1ELvsz4CdtXnlUk7KM.cache +0 -0
  163. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/z6uhOy1uoRnC6c9iKrzc1vRqGH1KQrhArDe51rZL1_k.cache +1 -0
  164. data/test/apps/rails4-mongoid/tmp/cache/assets/sprockets/v3.0/zIFdfoc8nFjrQhTXHyamSnNA6CVVrOcsP4qfDQhOcVI.cache +1 -0
  165. data/test/run-test.rb +43 -0
  166. data/test/unit/run-test.rb +25 -0
  167. data/test/unit/searcher/select/filter_parameter_test.rb +99 -0
  168. data/test/unit/searcher/select/match_columns_parameter_test.rb +59 -0
  169. data/test/unit/searcher/select/output_columns_parameter_test.rb +68 -0
  170. data/test/unit/searcher/select/sortby_parameter_test.rb +63 -0
  171. data/test/unit/test_helper.rb +19 -0
  172. metadata +480 -0
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PostsHelper
2
+ end
@@ -0,0 +1,12 @@
1
+ class Post
2
+ include Mongoid::Document
3
+ include Mongoid::Timestamps
4
+ field :title, type: String
5
+ field :body, type: String
6
+
7
+ PostsSearcher.source(self).title = :title
8
+ PostsSearcher.source(self).body = lambda do |model|
9
+ model.body.gsub(/<.*?>/, "")
10
+ end
11
+ PostsSearcher.source(self).updated_at = true
12
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationSearcher < Groonga::Client::Searcher
2
+ end
@@ -0,0 +1,16 @@
1
+ class PostsSearcher < ApplicationSearcher
2
+ schema.column :title, {
3
+ type: "ShortText",
4
+ index: true,
5
+ index_type: :full_text_search,
6
+ }
7
+ schema.column :body, {
8
+ type: "Text",
9
+ index: true,
10
+ index_type: :full_text_search,
11
+ }
12
+ schema.column :updated_at, {
13
+ type: "Time",
14
+ index: true,
15
+ }
16
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Blog</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,25 @@
1
+ <%= form_for(@post) do |f| %>
2
+ <% if @post.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @post.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :title %><br>
16
+ <%= f.text_field :title %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :body %><br>
20
+ <%= f.text_area :body %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @post %> |
6
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,29 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Listing Posts</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th>Title</th>
9
+ <th>Body</th>
10
+ <th colspan="3"></th>
11
+ </tr>
12
+ </thead>
13
+
14
+ <tbody>
15
+ <% @posts.each do |post| %>
16
+ <tr>
17
+ <td><%= post.title %></td>
18
+ <td><%= post.body %></td>
19
+ <td><%= link_to 'Show', post %></td>
20
+ <td><%= link_to 'Edit', edit_post_path(post) %></td>
21
+ <td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
22
+ </tr>
23
+ <% end %>
24
+ </tbody>
25
+ </table>
26
+
27
+ <br>
28
+
29
+ <%= link_to 'New Post', new_post_path %>
@@ -0,0 +1,4 @@
1
+ json.array!(@posts) do |post|
2
+ json.extract! post, :id, :title, :body
3
+ json.url post_url(post, format: :json)
4
+ end
@@ -0,0 +1,5 @@
1
+ <h1>New Post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,14 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Title:</strong>
5
+ <%= @post.title %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Body:</strong>
10
+ <%= @post.body %>
11
+ </p>
12
+
13
+ <%= link_to 'Edit', edit_post_path(@post) %> |
14
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1 @@
1
+ json.extract! @post, :id, :title, :body, :created_at, :updated_at
@@ -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,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,32 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ require "active_job/railtie"
7
+ # require "active_record/railtie"
8
+ require "action_controller/railtie"
9
+ require "action_mailer/railtie"
10
+ require "action_view/railtie"
11
+ require "sprockets/railtie"
12
+ require "rails/test_unit/railtie"
13
+
14
+ # Require the gems listed in Gemfile, including any gems
15
+ # you've limited to :test, :development, or :production.
16
+ Bundler.require(*Rails.groups)
17
+
18
+ module Blog
19
+ class Application < Rails::Application
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+
24
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
+ # config.time_zone = 'Central Time (US & Canada)'
27
+
28
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
29
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
+ # config.i18n.default_locale = :de
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+
3
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,38 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Debug mode disables concatenation and preprocessing of assets.
23
+ # This option may cause significant delays in view rendering with a large
24
+ # number of complex assets.
25
+ config.assets.debug = true
26
+
27
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
28
+ # yet still be able to expire them through the digest params.
29
+ config.assets.digest = true
30
+
31
+ # Adds additional error checking when serving assets at runtime.
32
+ # Checks for improperly declared sprockets dependencies.
33
+ # Raises helpful error messages.
34
+ config.assets.raise_runtime_errors = true
35
+
36
+ # Raises error for missing translations
37
+ # config.action_view.raise_on_missing_translations = true
38
+ end
@@ -0,0 +1,76 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
+
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
30
+
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
32
+ config.assets.compile = false
33
+
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
36
+ config.assets.digest = true
37
+
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39
+
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
43
+
44
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
+ # config.force_ssl = true
46
+
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
50
+
51
+ # Prepend all log lines with the following tags.
52
+ # config.log_tags = [ :subdomain, :uuid ]
53
+
54
+ # Use a different logger for distributed setups.
55
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56
+
57
+ # Use a different cache store in production.
58
+ # config.cache_store = :mem_cache_store
59
+
60
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
62
+
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
+ # config.action_mailer.raise_delivery_errors = false
66
+
67
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
+ # the I18n.default_locale when a translation cannot be found).
69
+ config.i18n.fallbacks = true
70
+
71
+ # Send deprecation notices to registered listeners.
72
+ config.active_support.deprecation = :notify
73
+
74
+ # Use default logging formatter so that PID and timestamp are not suppressed.
75
+ config.log_formatter = ::Logger::Formatter.new
76
+ end
@@ -0,0 +1,42 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
37
+ # Print deprecation notices to the stderr.
38
+ config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+ end
@@ -0,0 +1,22 @@
1
+ default: &default
2
+ protocol: http
3
+ # protocol: https
4
+ host: 127.0.0.1
5
+ port: 10041
6
+ # user: alice
7
+ # password: secret
8
+ read_timeout: -1
9
+ # read_timeout: 3
10
+ backend: synchronous
11
+
12
+ development:
13
+ <<: *default
14
+
15
+ test:
16
+ <<: *default
17
+ port: 20041
18
+
19
+ production:
20
+ <<: *default
21
+ host: 127.0.0.1
22
+ read_timeout: 10