groonga-client-model 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +5 -0
- data/Gemfile +23 -0
- data/README.md +38 -0
- data/Rakefile +46 -0
- data/doc/text/lgpl-2.1.txt +502 -0
- data/doc/text/news.md +5 -0
- data/groonga-client-model.gemspec +55 -0
- data/lib/groonga-client-model.rb +40 -0
- data/lib/groonga_client_model/client.rb +37 -0
- data/lib/groonga_client_model/client_opener.rb +24 -0
- data/lib/groonga_client_model/error.rb +46 -0
- data/lib/groonga_client_model/load_value_generator.rb +54 -0
- data/lib/groonga_client_model/modelizable.rb +26 -0
- data/lib/groonga_client_model/modelize.rb +83 -0
- data/lib/groonga_client_model/railtie.rb +62 -0
- data/lib/groonga_client_model/record.rb +324 -0
- data/lib/groonga_client_model/schema.rb +109 -0
- data/lib/groonga_client_model/spec_helper.rb +27 -0
- data/lib/groonga_client_model/test_helper.rb +27 -0
- data/lib/groonga_client_model/version.rb +19 -0
- data/test/apps/rails5/Gemfile +50 -0
- data/test/apps/rails5/Gemfile.lock +208 -0
- data/test/apps/rails5/README.md +24 -0
- data/test/apps/rails5/Rakefile +6 -0
- data/test/apps/rails5/app/assets/config/manifest.js +3 -0
- data/test/apps/rails5/app/assets/javascripts/application.js +16 -0
- data/test/apps/rails5/app/assets/javascripts/cable.js +13 -0
- data/test/apps/rails5/app/assets/javascripts/posts.coffee +3 -0
- data/test/apps/rails5/app/assets/stylesheets/application.css +15 -0
- data/test/apps/rails5/app/assets/stylesheets/posts.scss +3 -0
- data/test/apps/rails5/app/assets/stylesheets/scaffolds.scss +89 -0
- data/test/apps/rails5/app/channels/application_cable/channel.rb +4 -0
- data/test/apps/rails5/app/channels/application_cable/connection.rb +4 -0
- data/test/apps/rails5/app/controllers/application_controller.rb +3 -0
- data/test/apps/rails5/app/controllers/posts_controller.rb +74 -0
- data/test/apps/rails5/app/helpers/application_helper.rb +2 -0
- data/test/apps/rails5/app/helpers/posts_helper.rb +2 -0
- data/test/apps/rails5/app/jobs/application_job.rb +2 -0
- data/test/apps/rails5/app/mailers/application_mailer.rb +4 -0
- data/test/apps/rails5/app/models/post.rb +2 -0
- data/test/apps/rails5/app/views/layouts/application.html.erb +14 -0
- data/test/apps/rails5/app/views/layouts/mailer.html.erb +13 -0
- data/test/apps/rails5/app/views/layouts/mailer.text.erb +1 -0
- data/test/apps/rails5/app/views/posts/_form.html.erb +27 -0
- data/test/apps/rails5/app/views/posts/_post.json.jbuilder +2 -0
- data/test/apps/rails5/app/views/posts/edit.html.erb +6 -0
- data/test/apps/rails5/app/views/posts/index.html.erb +29 -0
- data/test/apps/rails5/app/views/posts/index.json.jbuilder +1 -0
- data/test/apps/rails5/app/views/posts/new.html.erb +5 -0
- data/test/apps/rails5/app/views/posts/show.html.erb +14 -0
- data/test/apps/rails5/app/views/posts/show.json.jbuilder +1 -0
- data/test/apps/rails5/bin/bundle +3 -0
- data/test/apps/rails5/bin/rails +9 -0
- data/test/apps/rails5/bin/rake +9 -0
- data/test/apps/rails5/bin/setup +34 -0
- data/test/apps/rails5/bin/spring +16 -0
- data/test/apps/rails5/bin/update +29 -0
- data/test/apps/rails5/config.ru +5 -0
- data/test/apps/rails5/config/application.rb +25 -0
- data/test/apps/rails5/config/boot.rb +3 -0
- data/test/apps/rails5/config/cable.yml +9 -0
- data/test/apps/rails5/config/environment.rb +5 -0
- data/test/apps/rails5/config/environments/development.rb +51 -0
- data/test/apps/rails5/config/environments/production.rb +83 -0
- data/test/apps/rails5/config/environments/test.rb +42 -0
- data/test/apps/rails5/config/groonga.yml +8 -0
- data/test/apps/rails5/config/initializers/application_controller_renderer.rb +6 -0
- data/test/apps/rails5/config/initializers/assets.rb +11 -0
- data/test/apps/rails5/config/initializers/backtrace_silencers.rb +7 -0
- data/test/apps/rails5/config/initializers/cookies_serializer.rb +5 -0
- data/test/apps/rails5/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/apps/rails5/config/initializers/inflections.rb +16 -0
- data/test/apps/rails5/config/initializers/mime_types.rb +4 -0
- data/test/apps/rails5/config/initializers/new_framework_defaults.rb +21 -0
- data/test/apps/rails5/config/initializers/session_store.rb +3 -0
- data/test/apps/rails5/config/initializers/wrap_parameters.rb +9 -0
- data/test/apps/rails5/config/locales/en.yml +23 -0
- data/test/apps/rails5/config/puma.rb +47 -0
- data/test/apps/rails5/config/routes.rb +4 -0
- data/test/apps/rails5/config/secrets.yml +22 -0
- data/test/apps/rails5/config/spring.rb +6 -0
- data/test/apps/rails5/db/schema.grn +9 -0
- data/test/apps/rails5/db/seeds.rb +7 -0
- data/test/apps/rails5/log/development.log +348 -0
- data/test/apps/rails5/log/test.log +1824 -0
- data/test/apps/rails5/public/404.html +67 -0
- data/test/apps/rails5/public/422.html +67 -0
- data/test/apps/rails5/public/500.html +66 -0
- data/test/apps/rails5/public/apple-touch-icon-precomposed.png +0 -0
- data/test/apps/rails5/public/apple-touch-icon.png +0 -0
- data/test/apps/rails5/public/favicon.ico +0 -0
- data/test/apps/rails5/public/robots.txt +5 -0
- data/test/apps/rails5/test/controllers/posts_controller_test.rb +50 -0
- data/test/apps/rails5/test/factories/posts.rb +6 -0
- data/test/apps/rails5/test/test_helper.rb +9 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/-8/-8MPXp-nRdAuudlPZG0-fjIhSfT9c-mruIMNR_HnpTE.cache +2 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/04/04zh1ytKDagWzWcqUyadXtzzohCn9iVvSVG4KrjpfPU.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/0M/0M4bZ4tQh0MQYZMb72U5yr-ELStAsUSb8akkTME9TPM.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/0g/0gB1rYz79RuAa43DzVci1GUjc5so0F1dU_LyLSmm3oQ.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/1w/1w3lEnPL9oZPD-uk9Y9HOAO5TBywbDUumPsLKAD1trs.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/2g/2gve43APDqh4mVsNSvvDZWU7XBUFJ22DjchDFC7BLHE.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/3F/3Fsw9a9YyB3-WaDSpA1HTGJrWn_7xMLLpUYcNv4f4zs.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/3P/3Px3lDIUtsiFfGy4nQGown3yldwKCp1MNuWbSDX1pvg.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/46/46uDYcwHwTAfdjT4Cxqs7pC3FEBf4GNj8S36-TDtT18.cache +2 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/5g/5gcXfyU_2YGZzzLIX2HgVkpwSaUUyIH9beyVvR4-RyM.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/6a/6ae9A4LxsOF8WxXqTRrY_OfmiKLzuX-k8CdxcYhyH2w.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/6g/6gfb-nNauXmim2itNUscPWKLGmjzBgnE4ee76bNftS4.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/71/71Km0xL27urBNH3LVGVQ7MXXtuIePWU9VsJ4VjSeMac.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/8Z/8Zm1d9-lBPsGG_HUw8FP2OCCVucGDVhWAOGaopvOdss.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/8w/8wTyiibSVQ_CunXEyCjFUbzdSEAuSbH0z5XuCUXG0EA.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/9p/9pkKAqd_Ia0HpbbUCZtpJ8WiDzr5stcFJsnqsOsJwCc.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/B9/B9QeeLv4GR9sOdrwyvxa8jIr4MkxjYh4Ow6MOZ8slX8.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/BK/BKtHbqHUW-BUh6yXbZoSBLGYZdH4xpyEVJZ85mre3dI.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Bx/BxzoG0KxeNLac4xTNeJv3qfeytbNBw58xj2zD-xdbrE.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/DG/DGB9_ZZc6xf8xDs1C8MTwsnZGITqTg5w6Fi8loIoAz0.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/DI/DIQbAB3xoMpwIuVisoyQuLOOLReZGqTzMsMSqPTvNlU.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Dc/Dcujr9N54L76juPEo4EOYs8buHy8vO2fp-AjoG42-uQ.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Dw/DwMpASR_zMhZCB0WD5ibeEaOAEhod-gPDA-cl83A0NQ.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/F2/F2G2wQz7oPKX0Y4KCAUyw79ULHKyiweLkqbo4uclz2M.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/F4/F4Vm2jVryhME1Ux-h1fCIbynttYJmSOV0lzVQihiIas.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/G0/G0kukI-r0q0Vbrg6e_jnYJoYcOX8K__h-mwKbCf4twE.cache +2 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/H4/H4qMae4wP-2E0IT3OzIKJm7TAmkfgTg5GG-mDvrpRr8.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/HJ/HJmxnxAVu4ESMb2RUFATQhzd8xP7qwk0i7Or2WU6tHY.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Ih/IhFDQr9KaIbw7KJmoi9sRJ2CWZtxt72J0Eu2HDAQYJA.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/J-/J-hbdFdKmhYgVvczTzQyQ6ToGIL2Ucw2qCT6Y1oOPhg.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/KZ/KZDZMIUD9LD98z__9bjCHLnzjcGoKSnlxuHH1cEiw6M.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/LD/LDzW9KshYb0NgRzu1HyrKQlc3satBlIIOEHET_I4TjA.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Mw/MwUXpv2ArJcHhHfRN-i_SHhOyrhE2ED5DP6j2_tHtDM.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/N6/N6_UDcd-9vm063oO9Kj2UKERXHyG53mpljIHhMP_sX0.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Ot/OttEu6oltiTErpVGZQJA3vWOb24u3_w28yMEG-Gs0tA.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/P1/P1Ojlz0OChhbxGf83KhMWxJFzKZ3unhLwJ1UoH5U7ss.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Pz/PzsjxNnBT0RlIX-T49i6Iyrc_XG8IaJ-F55_x52md8M.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Q0/Q0AeQIZuDbFTvWKLlSaL-R4XKHuiymwgVvQUqxxVq_k.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Qr/Qrr38H1OZvkfozoMfcDEQ-arpbO7PFQ47i70UTEeWnk.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Qw/QwtseSptjk29vLQAs9XVSY_9GY6mR4wLQ6e3xJZzwuo.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Rf/RfAETGxupO0E6Sf50S9Rs_7H_8IFQkZ0V_Ot0qRcMaM.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/S1/S1RgRu3SVlB0u9krRyLUpNzVgKMN9Pk_KMWLehP2SUc.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/SN/SNLpl8dBME7slRhucvmV_kjMQImk-VGiILaga5lEcBM.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/SO/SOU1TEHFYRVejiA6nBNRm3Bwq_YtPlxSXK0VM3y3vto.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Sd/Sda0ZUElAQoD0SXBgNqF99THI2KdVA4YOcdhAyZxPsY.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Sh/ShN-ZUpoxLJLJiMV5gFDP00vcSMHw87YzFBlXH4adPA.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Si/Sin6bEoASrNa45108CpfgF2jcifz-KpbsvvZJtqVZ68.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/TI/TIt8bfq26rstydJvFM28p05FfB6s8Qjr6EoF6EtQUEc.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Uk/UkodNPk80caeUqn1HNQXMB1qV-c-4l-vBFHb7fd5ZGw.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Uw/Uws4qYyGLobvE_JD4L6dQNcIOOhv4LEZ3D0mK86tZOA.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Wm/WmtvDDxglSnhmavMeA7WNn7waN3QbagRHeoZHvZJN84.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/X6/X6u2Cul1j8SpBq0WC1S8WhzGiT6f-6L_djUngh_gQfw.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Xe/XeuTfsFtikyfcpzyNjJW7GvVARtV7EFUF8V9lJuS9zs.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Ya/YayMISAqD-Y3vBFywwKrXbUovGf5o77HUF5s8mnQgO0.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Z2/Z2fYOjvDRsoVXYUWY_QLV3gqU-HobuEZ7vKRjuJO-80.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/Zj/ZjPZKMxS8BzA1QxHFURXSpprFItP8iIYNCg6yfbO69Y.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/a7/a7_aLHXKzPVK1lGdqvWuCl5hXxwSIGH4kcxuF7jMzgE.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/c9/c9YydpmE9rI8VeQ4sVqd5JrA1VSEFGGzpuMBUSrAGac.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/cB/cBjyp28toLdtY2EFK9cqrbDnrwBSFI7T_vLNoGz-u_U.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/cT/cT8i2C4yg0R2UYvutxD-4kbdJF09toG1OUgtd6NAf2M.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/cU/cUegCc5wz5f7rfqzD7wrbN633pZRWeewi9j1lJ895Y0.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/dA/dAab_MVPXubReIXiKSsP0TGA9dXca0KkwVLz7xNJNmA.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/eY/eYUlaSCg8w9Jp-IVGbffopOhH4C94vGA0w6SaC88FM8.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/eo/eoSb6VtmOhc2zv4rO1yMBf6hjUj7zHVkSMiNZ7Y576w.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/gm/gmeq3PfpFbfe2L0ijWzw1Dzny6T-kD3zREQjh6XGs-o.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/he/heptoj4xFW23bqbGAnQ2g6MsS3OKgswQZOu4EFQA9CE.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/kN/kNQUVmgZpBoZh9oC57J3qRmnvFOb8zfDeJWar6cPJFM.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/km/km1UJe7Uvz3cE03ctzec3Mpcow_vgKO36rq50_Szy3o.cache +5 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/kv/kvOgs1tp83VikXcBjupUg71ybkDcx1pBzH2Dw6mVa7A.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/kz/kzw210ITXFWNFV8kw5e-_kRlpS48lGotSQWKPlUfMJ4.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/m-/m-gDByrlve8T_OZCCZCaGVlLUnbGWk0qkv7naFMcLDg.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/m8/m8XSfEV5J53MzAtMK6udqOZh9S_uC-tELG327hLnWT4.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/na/naKBB6bJXEjSAfrBfAiXlIzJDRGTsRrbQlI5FezRxnM.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/oU/oUgVYeNUmvSbf5MWq5a-nknLIlepM8oMGSWyD1J5bzg.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/pN/pNBMBzHv-_a5u4lbxQmRsv_hzWZOk93wX3hlG4y4X5E.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/pb/pb0V-IHbOTzmTuDDHO7dn8kl3G4RWqXYY1-Gtuklh-M.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/pq/pqi4pYpSRroaGdwCXuATmVeb1U-mvzUU8zeWu6o5ooo.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/q9/q9zC8RrLhOO1dVXJ3fZqc9dSbshhjSpsDQxh5MpbnDA.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/qP/qPmv5snMrDw830S6hSICDcnIy7kVEWoFKXhGKT38lG4.cache +2 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/rn/rnjUJtM3qyEybb7S3NaVbV36OvY6ulGzqxgvp6vtkW0.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/rv/rvA5ImExxmMtvHSKmwVMXxnVzM4istECfBR-LxbUf8I.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/sS/sSg6UsW5PPi591GTK35btFew1r3_HpbNHoyZv3vZ_HY.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/t3/t39F_1zIFMdWiKVUNJyhWOOnP8Lgr6AD5R1HWdVYwbU.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/tV/tVL6qud2OxyiMT_-izeWpZa4KnypOUhK0XjwBIPVgi0.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/uo/uo2nRPLQSA3FmFVLvE-9uXW64Xx-Gp799qSF3vui1WE.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/x7/x7PYh8DJvPykcEqpVab2vcY9-GFz-3cqtoMlRAu94Uc.cache +0 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/xU/xUR-yFcc0UZR2BLp-jBU9bjPiIYophx6ep5yBEeQCM8.cache +1 -0
- data/test/apps/rails5/tmp/cache/assets/sprockets/v3.0/zh/zhmfmdnnow0QqwfT_7IXfN-FAU8qAMm03N7XQjFct6E.cache +1 -0
- data/test/apps/rails5/tmp/restart.txt +0 -0
- data/test/run-test.rb +49 -0
- data/test/unit/run-test.rb +35 -0
- data/test/unit/test_load_value_generator.rb +79 -0
- data/test/unit/test_record.rb +52 -0
- metadata +516 -0
data/doc/text/news.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# -*- ruby -*-
|
|
2
|
+
#
|
|
3
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
4
|
+
#
|
|
5
|
+
# This library is free software; you can redistribute it and/or
|
|
6
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
7
|
+
# License as published by the Free Software Foundation; either
|
|
8
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# This library is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13
|
+
# Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
16
|
+
# License along with this library; if not, write to the Free Software
|
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18
|
+
|
|
19
|
+
clean_white_space = lambda do |entry|
|
|
20
|
+
entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
|
24
|
+
require "groonga_client_model/version"
|
|
25
|
+
|
|
26
|
+
Gem::Specification.new do |spec|
|
|
27
|
+
spec.name = "groonga-client-model"
|
|
28
|
+
spec.version = GroongaClientModel::VERSION
|
|
29
|
+
spec.homepage = "https://github.com/ranguba/groonga-client-model"
|
|
30
|
+
spec.authors = ["Kouhei Sutou"]
|
|
31
|
+
spec.email = ["kou@clear-code.com"]
|
|
32
|
+
|
|
33
|
+
readme = File.read("README.md")
|
|
34
|
+
readme.force_encoding("UTF-8")
|
|
35
|
+
entries = readme.split(/^\#\#\s(.*)$/)
|
|
36
|
+
clean_white_space.call(entries[entries.index("Description") + 1])
|
|
37
|
+
description = clean_white_space.call(entries[entries.index("Description") + 1])
|
|
38
|
+
spec.summary, spec.description, = description.split(/\n\n+/, 3)
|
|
39
|
+
spec.license = "LGPL-2.1+"
|
|
40
|
+
spec.files = ["README.md", "Rakefile", "Gemfile", "#{spec.name}.gemspec"]
|
|
41
|
+
spec.files += [".yardopts"]
|
|
42
|
+
spec.files += Dir.glob("lib/**/*.rb")
|
|
43
|
+
spec.files += Dir.glob("doc/text/*")
|
|
44
|
+
spec.test_files += Dir.glob("test/**/*")
|
|
45
|
+
|
|
46
|
+
spec.add_runtime_dependency("groonga-client", ">= 0.3.4")
|
|
47
|
+
spec.add_runtime_dependency("groonga-command-parser")
|
|
48
|
+
spec.add_runtime_dependency("activemodel")
|
|
49
|
+
|
|
50
|
+
spec.add_development_dependency("bundler")
|
|
51
|
+
spec.add_development_dependency("rake")
|
|
52
|
+
spec.add_development_dependency("test-unit")
|
|
53
|
+
spec.add_development_dependency("packnga")
|
|
54
|
+
spec.add_development_dependency("redcarpet")
|
|
55
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
require "active_model"
|
|
18
|
+
|
|
19
|
+
require "groonga/client"
|
|
20
|
+
|
|
21
|
+
require "groonga_client_model/version"
|
|
22
|
+
|
|
23
|
+
require "groonga_client_model/client"
|
|
24
|
+
require "groonga_client_model/client_opener"
|
|
25
|
+
require "groonga_client_model/error"
|
|
26
|
+
require "groonga_client_model/load_value_generator"
|
|
27
|
+
require "groonga_client_model/modelizable"
|
|
28
|
+
require "groonga_client_model/modelize"
|
|
29
|
+
require "groonga_client_model/record"
|
|
30
|
+
require "groonga_client_model/schema"
|
|
31
|
+
|
|
32
|
+
module GroongaClientModel
|
|
33
|
+
mattr_accessor :logger, instance_writer: false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
ActiveSupport.run_load_hooks(:groonga_client_model, GroongaClientModel)
|
|
37
|
+
|
|
38
|
+
if defined?(Rails)
|
|
39
|
+
require "groonga_client_model/railtie"
|
|
40
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
module GroongaClientModel
|
|
18
|
+
class Client
|
|
19
|
+
class_attribute :url
|
|
20
|
+
|
|
21
|
+
class << self
|
|
22
|
+
def open(&block)
|
|
23
|
+
new.open(&block)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def initialize(url=nil)
|
|
28
|
+
@url = url || self.class.url || "http://127.0.0.1:10041"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def open
|
|
32
|
+
Groonga::Client.open(url: @url) do |client|
|
|
33
|
+
yield(client)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
module GroongaClientModel
|
|
18
|
+
module ClientOpener
|
|
19
|
+
private
|
|
20
|
+
def open_client(&block)
|
|
21
|
+
Client.open(&block)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
module GroongaClientModel
|
|
18
|
+
class Error < StandardError
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class RecordNotFound < Error
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class RecordNotSaved < Error
|
|
25
|
+
attr_reader :record
|
|
26
|
+
|
|
27
|
+
def initialize(message, record)
|
|
28
|
+
@record = record
|
|
29
|
+
super(message)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class RecordInvalid < Error
|
|
34
|
+
attr_reader :record
|
|
35
|
+
|
|
36
|
+
def initialize(record)
|
|
37
|
+
@record = record
|
|
38
|
+
errors = @record.errors.full_messages.join(", ")
|
|
39
|
+
i18n_scope = @record.class.i18n_scope
|
|
40
|
+
message = I18n.t(:"#{i18n_scope}.errors.messages.record_invalid",
|
|
41
|
+
errors: errors,
|
|
42
|
+
default: :"errors.messages.record_invalid")
|
|
43
|
+
super(message)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
require "date"
|
|
18
|
+
|
|
19
|
+
module GroongaClientModel
|
|
20
|
+
class LoadValueGenerator
|
|
21
|
+
def initialize(record)
|
|
22
|
+
@record = record
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def generate
|
|
26
|
+
load_value = {}
|
|
27
|
+
@record.attributes.each do |name, value|
|
|
28
|
+
load_value[name] = format_value(value)
|
|
29
|
+
end
|
|
30
|
+
if load_value.key?("_id") and load_value.key?("_key")
|
|
31
|
+
load_value.delete("_id")
|
|
32
|
+
end
|
|
33
|
+
load_value
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
def format_value(value)
|
|
38
|
+
case value
|
|
39
|
+
when Date
|
|
40
|
+
value.strftime("%Y-%m-%d 00:00:00")
|
|
41
|
+
when Time
|
|
42
|
+
value.strftime("%Y-%m-%d %H:%M:%S.%6N")
|
|
43
|
+
when Record
|
|
44
|
+
format_value(value._key)
|
|
45
|
+
when Array
|
|
46
|
+
value.collect do |sub_value|
|
|
47
|
+
format_value(sub_value)
|
|
48
|
+
end
|
|
49
|
+
else
|
|
50
|
+
value
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
module GroongaClientModel
|
|
18
|
+
module Modelizable
|
|
19
|
+
def create_response(*args)
|
|
20
|
+
response = super
|
|
21
|
+
response.extend(Modelize)
|
|
22
|
+
response.model_class = model_class
|
|
23
|
+
response
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
module GroongaClientModel
|
|
18
|
+
module Modelize
|
|
19
|
+
def model_class=(model_class)
|
|
20
|
+
@model_class = model_class
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# For Kaminari
|
|
24
|
+
def entry_name(options={})
|
|
25
|
+
model_name = @model_class.model_name
|
|
26
|
+
if options[:count] == 1
|
|
27
|
+
default = model_name.human
|
|
28
|
+
else
|
|
29
|
+
default = model_name.human.pluralize
|
|
30
|
+
end
|
|
31
|
+
model_name.human(options.reverse_merge(default: default))
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def records
|
|
35
|
+
@modelized_records ||= build_records(super)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
def build_records(raw_records)
|
|
40
|
+
columns = @model_class.columns
|
|
41
|
+
raw_records.collect do |raw_record|
|
|
42
|
+
attributes, dynamic_attributes = build_attributes(columns, raw_record)
|
|
43
|
+
record = @model_class.new(attributes)
|
|
44
|
+
record.assign_dynamic_attributes(dynamic_attributes)
|
|
45
|
+
record
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def build_attributes(columns, raw_record)
|
|
50
|
+
attributes = {}
|
|
51
|
+
dynamic_attributes = {}
|
|
52
|
+
raw_record.each do |name, value|
|
|
53
|
+
primary_name, sub_name = name.split(".", 2)
|
|
54
|
+
if sub_name.nil?
|
|
55
|
+
if columns.exist?(primary_name)
|
|
56
|
+
if attributes.key?(primary_name)
|
|
57
|
+
value = attributes[primary_name].merge("_key" => value)
|
|
58
|
+
end
|
|
59
|
+
attributes[primary_name] = value
|
|
60
|
+
else
|
|
61
|
+
dynamic_attributes[primary_name] = value
|
|
62
|
+
end
|
|
63
|
+
else
|
|
64
|
+
if columns.exist?(primary_name)
|
|
65
|
+
if attributes.key?(primary_name)
|
|
66
|
+
unless attributes[primary_name].is_a?(Hash)
|
|
67
|
+
attributes[primary_name] = {
|
|
68
|
+
"_key" => attributes[primary_name],
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
else
|
|
72
|
+
attributes[primary_name] = {}
|
|
73
|
+
end
|
|
74
|
+
attributes[primary_name][sub_name] = value
|
|
75
|
+
else
|
|
76
|
+
dynamic_attributes[name] = value
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
[attributes, dynamic_attributes]
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Copyright (C) 2016 Kouhei Sutou <kou@clear-code.com>
|
|
2
|
+
#
|
|
3
|
+
# This library is free software; you can redistribute it and/or
|
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
|
5
|
+
# License as published by the Free Software Foundation; either
|
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
|
7
|
+
#
|
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11
|
+
# Lesser General Public License for more details.
|
|
12
|
+
#
|
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
|
14
|
+
# License along with this library; if not, write to the Free Software
|
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16
|
+
|
|
17
|
+
require "active_model/railtie"
|
|
18
|
+
require "action_controller/railtie"
|
|
19
|
+
|
|
20
|
+
module GroongaClientModel
|
|
21
|
+
class Railtie < Rails::Railtie
|
|
22
|
+
config.groonga_client_model = ActiveSupport::OrderedOptions.new
|
|
23
|
+
|
|
24
|
+
# TODO
|
|
25
|
+
# config.app_generators.orm(:groonga_client_model,
|
|
26
|
+
# migration: true,
|
|
27
|
+
# timestamps: true)
|
|
28
|
+
|
|
29
|
+
config.action_dispatch.rescue_responses.merge!(
|
|
30
|
+
"GroongaClientModel::RecordNotFound" => :not_found,
|
|
31
|
+
"GroongaClientModel::RecordInvalid" => :unprocessable_entity,
|
|
32
|
+
"GroongaClientModel::RecordNotSaved" => :unprocessable_entity,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
config.eager_load_namespaces << GroongaClientModel
|
|
36
|
+
|
|
37
|
+
rake_tasks do
|
|
38
|
+
load "groonga_client_model/railties/groonga.rake"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
initializer "groonga_client_model.logger" do
|
|
42
|
+
ActiveSupport.on_load(:groonga_client_model) do
|
|
43
|
+
self.logger ||= Rails.logger
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
initializer "groonga_client_model.set_configs" do |app|
|
|
48
|
+
ActiveSupport.on_load(:groonga_client_model) do
|
|
49
|
+
app.config.groonga_client_model.each do |key, value|
|
|
50
|
+
send("#{key}=", value)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
initializer "groonga_client_model.initialize_client" do
|
|
56
|
+
ActiveSupport.on_load(:groonga_client_model) do
|
|
57
|
+
config = Rails.application.config_for(:groonga)
|
|
58
|
+
Client.url = config["url"]
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|