Kouhei Sutou
null+****@clear*****
Thu Dec 1 18:34:50 JST 2016
Kouhei Sutou 2016-12-01 18:34:50 +0900 (Thu, 01 Dec 2016) New Revision: 89f6481ae41498df1f4498fd6e912b242967ff2f https://github.com/ranguba/groonga-client-model/commit/89f6481ae41498df1f4498fd6e912b242967ff2f Message: Import Added files: .gitignore .travis.yml .yardopts Gemfile README.md Rakefile doc/text/lgpl-2.1.txt doc/text/news.md groonga-client-model.gemspec lib/groonga-client-model.rb lib/groonga_client_model/client.rb lib/groonga_client_model/error.rb lib/groonga_client_model/railtie.rb lib/groonga_client_model/record.rb lib/groonga_client_model/schema.rb lib/groonga_client_model/version.rb test/apps/rails5/.gitignore test/apps/rails5/Gemfile test/apps/rails5/Gemfile.lock test/apps/rails5/README.md test/apps/rails5/Rakefile test/apps/rails5/app/assets/config/manifest.js test/apps/rails5/app/assets/images/.keep test/apps/rails5/app/assets/javascripts/application.js test/apps/rails5/app/assets/javascripts/cable.js test/apps/rails5/app/assets/javascripts/channels/.keep test/apps/rails5/app/assets/javascripts/posts.coffee test/apps/rails5/app/assets/stylesheets/application.css test/apps/rails5/app/assets/stylesheets/posts.scss test/apps/rails5/app/assets/stylesheets/scaffolds.scss test/apps/rails5/app/channels/application_cable/channel.rb test/apps/rails5/app/channels/application_cable/connection.rb test/apps/rails5/app/controllers/application_controller.rb test/apps/rails5/app/controllers/concerns/.keep test/apps/rails5/app/controllers/posts_controller.rb test/apps/rails5/app/helpers/application_helper.rb test/apps/rails5/app/helpers/posts_helper.rb test/apps/rails5/app/jobs/application_job.rb test/apps/rails5/app/mailers/application_mailer.rb test/apps/rails5/app/models/concerns/.keep test/apps/rails5/app/models/post.rb test/apps/rails5/app/views/layouts/application.html.erb test/apps/rails5/app/views/layouts/mailer.html.erb test/apps/rails5/app/views/layouts/mailer.text.erb test/apps/rails5/app/views/posts/_form.html.erb test/apps/rails5/app/views/posts/_post.json.jbuilder test/apps/rails5/app/views/posts/edit.html.erb test/apps/rails5/app/views/posts/index.html.erb test/apps/rails5/app/views/posts/index.json.jbuilder test/apps/rails5/app/views/posts/new.html.erb test/apps/rails5/app/views/posts/show.html.erb test/apps/rails5/app/views/posts/show.json.jbuilder test/apps/rails5/bin/bundle test/apps/rails5/bin/rails test/apps/rails5/bin/rake test/apps/rails5/bin/setup test/apps/rails5/bin/spring test/apps/rails5/bin/update test/apps/rails5/config.ru test/apps/rails5/config/application.rb test/apps/rails5/config/boot.rb test/apps/rails5/config/cable.yml test/apps/rails5/config/environment.rb test/apps/rails5/config/environments/development.rb test/apps/rails5/config/environments/production.rb test/apps/rails5/config/environments/test.rb test/apps/rails5/config/groonga.yml test/apps/rails5/config/initializers/application_controller_renderer.rb test/apps/rails5/config/initializers/assets.rb test/apps/rails5/config/initializers/backtrace_silencers.rb test/apps/rails5/config/initializers/cookies_serializer.rb test/apps/rails5/config/initializers/filter_parameter_logging.rb test/apps/rails5/config/initializers/inflections.rb test/apps/rails5/config/initializers/mime_types.rb test/apps/rails5/config/initializers/new_framework_defaults.rb test/apps/rails5/config/initializers/session_store.rb test/apps/rails5/config/initializers/wrap_parameters.rb test/apps/rails5/config/locales/en.yml test/apps/rails5/config/puma.rb test/apps/rails5/config/routes.rb test/apps/rails5/config/secrets.yml test/apps/rails5/config/spring.rb test/apps/rails5/db/seeds.rb test/apps/rails5/lib/assets/.keep test/apps/rails5/lib/tasks/.keep test/apps/rails5/log/.keep test/apps/rails5/public/404.html test/apps/rails5/public/422.html test/apps/rails5/public/500.html test/apps/rails5/public/apple-touch-icon-precomposed.png test/apps/rails5/public/apple-touch-icon.png test/apps/rails5/public/favicon.ico test/apps/rails5/public/robots.txt test/apps/rails5/test/controllers/.keep test/apps/rails5/test/controllers/posts_controller_test.rb test/apps/rails5/test/fixtures/.keep test/apps/rails5/test/fixtures/files/.keep test/apps/rails5/test/helpers/.keep test/apps/rails5/test/integration/.keep test/apps/rails5/test/mailers/.keep test/apps/rails5/test/models/.keep test/apps/rails5/test/test_helper.rb test/apps/rails5/tmp/.keep test/apps/rails5/vendor/assets/javascripts/.keep test/apps/rails5/vendor/assets/stylesheets/.keep test/run-test.rb test/unit/run-test.rb Added: .gitignore (+4 -0) 100644 =================================================================== --- /dev/null +++ .gitignore 2016-12-01 18:34:50 +0900 (7ff5746) @@ -0,0 +1,4 @@ +/Gemfile.lock +/pkg/ +/.yardoc/ +/doc/reference/ Added: .travis.yml (+10 -0) 100644 =================================================================== --- /dev/null +++ .travis.yml 2016-12-01 18:34:50 +0900 (f769c43) @@ -0,0 +1,10 @@ +notifications: + email: + recipients: + - groonga-commit �� lists.sourceforge.jp +rvm: + - 2.1 + - 2.2 + - 2.3.0 +before_install: + - gem update bundler Added: .yardopts (+5 -0) 100644 =================================================================== --- /dev/null +++ .yardopts 2016-12-01 18:34:50 +0900 (a98abc8) @@ -0,0 +1,5 @@ +--output-dir doc/reference/en +--markup markdown +lib/**/*.rb +- +doc/text/**/* Added: Gemfile (+21 -0) 100644 =================================================================== --- /dev/null +++ Gemfile 2016-12-01 18:34:50 +0900 (641196c) @@ -0,0 +1,21 @@ +# -*- ruby -*- +# +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +source "https://rubygems.org/" + +gemspec Added: README.md (+38 -0) 100644 =================================================================== --- /dev/null +++ README.md 2016-12-01 18:34:50 +0900 (3e9315c) @@ -0,0 +1,38 @@ +# README + +## Name + +groonga-client-model + +## Description + +Groonga-client-model is a model interface for groonga-client. + +## Install + + % gem install groonga-client-model + +## Usage + +TODO + +## Dependencies + +* Ruby +* groonga-client + +## Mailing list + +* English: [groonga-talk �� lists.sourceforge.net](https://lists.sourceforge.net/lists/listinfo/groonga-talk) +* Japanese: [groonga-dev �� lists.osdn.me](http://lists.osdn.me/mailman/listinfo/groonga-dev) + +## Authors + +* Kouhei Sutou \<kou �� clear-code.com\> + +## License + +LGPLv2.1 or later. See doc/text/lgpl-2.1.txt for details. + +(Kouhei Sutou has a right to change the license including contributed +patches.) Added: Rakefile (+46 -0) 100644 =================================================================== --- /dev/null +++ Rakefile 2016-12-01 18:34:50 +0900 (6e16959) @@ -0,0 +1,46 @@ +# -*- ruby -*- +# +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +task :default => :test + +require "rubygems" +require "bundler/gem_helper" +require "packnga" + +base_dir = File.join(File.dirname(__FILE__)) + +helper = Bundler::GemHelper.new(base_dir) +def helper.version_tag + version +end + +helper.install +spec = helper.gemspec + +Packnga::DocumentTask.new(spec) do |task| + task.original_language = "en" + task.translate_language = "ja" +end + +Packnga::ReleaseTask.new(spec) do +end + +desc "Run tests" +task :test do + ruby("test/run-test.rb") +end Added: doc/text/lgpl-2.1.txt (+502 -0) 100644 =================================================================== --- /dev/null +++ doc/text/lgpl-2.1.txt 2016-12-01 18:34:50 +0900 (4362b49) @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! Added: doc/text/news.md (+5 -0) 100644 =================================================================== --- /dev/null +++ doc/text/news.md 2016-12-01 18:34:50 +0900 (ce9d903) @@ -0,0 +1,5 @@ +# NEWS + +## 0.9.0 - 2016-12-29 + +Initial release!!! Added: groonga-client-model.gemspec (+54 -0) 100644 =================================================================== --- /dev/null +++ groonga-client-model.gemspec 2016-12-01 18:34:50 +0900 (1f435a6) @@ -0,0 +1,54 @@ +# -*- ruby -*- +# +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +clean_white_space = lambda do |entry| + entry.gsub(/(\A\n+|\n+\z)/, '') + "\n" +end + +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib")) +require "groonga_client_model/version" + +Gem::Specification.new do |spec| + spec.name = "groonga-client-model" + spec.version = GroongaClientModel::VERSION + spec.homepage = "https://github.com/ranguba/groonga-client-model" + spec.authors = ["Kouhei Sutou"] + spec.email = ["kou �� clear-code.com"] + + readme = File.read("README.md") + readme.force_encoding("UTF-8") + entries = readme.split(/^\#\#\s(.*)$/) + clean_white_space.call(entries[entries.index("Description") + 1]) + description = clean_white_space.call(entries[entries.index("Description") + 1]) + spec.summary, spec.description, = description.split(/\n\n+/, 3) + spec.license = "LGPL-2.1+" + spec.files = ["README.md", "Rakefile", "Gemfile", "#{spec.name}.gemspec"] + spec.files += [".yardopts"] + spec.files += Dir.glob("lib/**/*.rb") + spec.files += Dir.glob("doc/text/*") + spec.test_files += Dir.glob("test/**/*") + + spec.add_runtime_dependency("groonga-client") + spec.add_runtime_dependency("activemodel") + + spec.add_development_dependency("bundler") + spec.add_development_dependency("rake") + spec.add_development_dependency("test-unit") + spec.add_development_dependency("packnga") + spec.add_development_dependency("redcarpet") +end Added: lib/groonga-client-model.rb (+32 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga-client-model.rb 2016-12-01 18:34:50 +0900 (fb1bfb6) @@ -0,0 +1,32 @@ +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +require "active_model" + +require "groonga/client" + +require "groonga_client_model/version" + +require "groonga_client_model/client" +require "groonga_client_model/error" +require "groonga_client_model/record" +require "groonga_client_model/schema" + +module GroongaClientModel + mattr_accessor :logger, instance_writer: false +end + +ActiveSupport.run_load_hooks(:groonga_client_model, GroongaClientModel) Added: lib/groonga_client_model/client.rb (+37 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga_client_model/client.rb 2016-12-01 18:34:50 +0900 (771751e) @@ -0,0 +1,37 @@ +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +module GroongaClientModel + class Client + class_attribute :url + + class << self + def open(&block) + new.open(&block) + end + end + + def initialize(url=nil) + @url = url || self.class.url || "http://127.0.0.1:10041" + end + + def open + Groonga::Client.open(url: @url) do |client| + yield(client) + end + end + end +end Added: lib/groonga_client_model/error.rb (+46 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga_client_model/error.rb 2016-12-01 18:34:50 +0900 (d4bfe17) @@ -0,0 +1,46 @@ +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +module GroongaClientModel + class Error < StandardError + end + + class RecordNotFound < Error + end + + class RecordNotSaved < Error + attr_reader :record + + def initialize(message, record) + @record = record + super(message) + end + end + + class RecordInvalid < Error + attr_reader :record + + def initialize(record) + @record = record + errors =****@recor*****_messages.join(", ") + i18n_scope =****@recor*****_scope + message = I18n.t(:"#{i18n_scope}.errors.messages.record_invalid", + errors: errors, + default: :"errors.messages.record_invalid") + super(message) + end + end +end Added: lib/groonga_client_model/railtie.rb (+58 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga_client_model/railtie.rb 2016-12-01 18:34:50 +0900 (d6c2e8f) @@ -0,0 +1,58 @@ +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +require "active_model/railtie" +require "action_controller/railtie" + +module GroongaClientModel + class Railtie < Rails::Railtie + config.groonga_client_model = ActiveSupport::OrderedOptions.new + + # TODO + # config.app_generators.orm(:groonga_client_model, + # migration: true, + # timestamps: true) + + config.action_dispatch.rescue_responses.merge!( + "GroongaClientModel::RecordNotFound" => :not_found, + "GroongaClientModel::RecordInvalid" => :unprocessable_entity, + "GroongaClientModel::RecordNotSaved" => :unprocessable_entity, + ) + + config.eager_load_namespaces << GroongaClientModel + + initializer "groonga_client_model.logger" do + ActiveSupport.on_load(:groonga_client_model) do + self.logger ||= Rails.logger + end + end + + initializer "groonga_client_model.set_configs" do |app| + ActiveSupport.on_load(:groonga_client_model) do + app.config.groonga_client_model.each do |key, value| + send("#{key}=", value) + end + end + end + + initializer "groonga_client_model.initialize_client" do + ActiveSupport.on_load(:groonga_client_model) do + config = Rails.application.config_for(:groonga) + Client.url = config["url"] + end + end + end +end Added: lib/groonga_client_model/record.rb (+158 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga_client_model/record.rb 2016-12-01 18:34:50 +0900 (ffdbabe) @@ -0,0 +1,158 @@ +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +module GroongaClientModel + class Record + extend ActiveModel::Naming + include ActiveModel::Validations + include ActiveModel::AttributeMethods + include ActiveModel::AttributeAssignment + + class << self + def schema + @@schema ||= Schema.new + end + + def table_name + name.to_s.demodulize.underscore.pluralize + end + + def columns + schema.tables[table_name].columns + end + + def define_attributes + return if defined?(@defined) + @defined = true + columns.each do |name, column| + define_attribute_methods name + + attribute_method_suffix "=" + define_attribute_methods name + end + end + + def all + Client.open do |client| + response = client.select(table: table_name, + limit: -1) + response.records.collect do |attributes| + record = new(attributes) + record.instance_variable_set(:@new_record, false) + record + end + end + end + + def find(id) + Client.open do |client| + response = client.select(table: table_name, + filter: "_id == #{id}", + limit: 1) + attributes = response.records.first + if attributes.nil? + raise RecordNotFound.new("Record not found: _id: <#{id}>") + end + record = new(attributes) + record.instance_variable_set(:@new_record, false) + record + end + end + + private + def define_method_attribute(name) + define_method(name) do + @attributes[name] + end + end + + def define_method_attribute=(name) + define_method("#{name}=") do |value| + @attributes[name] = value + end + end + end + + attr_reader :attributes + + def initialize(attributes=nil) + @attributes = {} + self.class.define_attributes + assign_attributes(attributes) if attributes + + @new_record = true + end + + def save(validate: false) + if validate + if valid? + upsert + else + false + end + else + upsert + end + end + + def to_model + self + end + + def to_key + if persisted? + [_id.to_s] + else + nil + end + end + + def to_param + if persisted? + _id.to_s + else + nil + end + end + + def new_record? + @new_record + end + + def persisted? + not @new_record + end + + private + def upsert + Client.open do |client| + response = client.load(table: self.class.table_name, + values: [attributes]) + unless response.success? + message = "Failed to save: " + message << "#{response.error_code}: #{response.error_message}" + raise RecordNotSaved.new(message, self) + end + if response.body.zero? + message = "Failed to save: #{self.inspect}" + raise RecordNotSaved.new(message, self) + end + @new_record = false + true + end + end + end +end Added: lib/groonga_client_model/schema.rb (+79 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga_client_model/schema.rb 2016-12-01 18:34:50 +0900 (53441dc) @@ -0,0 +1,79 @@ +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +module GroongaClientModel + class Schema + def initialize + @raw = GroongaClientModel::Client.open do |client| + response = client.schema + unless response.success? + message = "failed to retrieve schema: " + message << "#{response.error_code}:#{response.error_message}" + raise Error, message + end + response + end + end + + def tables + Tables.new(@raw.tables) + end + + class Tables + def initialize(raw) + @raw = raw + end + + def [](name) + raw_table = @raw[name] + raise Error, "table doesn't exist: <#{name}>" if raw_table.nil? + Table.new(raw_table) + end + end + + class Table + def initialize(raw) + @raw = raw + end + + def columns + raw_columns =****@raw*****("_id" => {"name" => "_id"}) + if****@raw*****_type + raw_columns = raw_columns.merge("_key" => {"name" => "_key"}) + end + Columns.new(raw_columns) + end + end + + class Columns + include Enumerable + + def initialize(raw) + @raw = raw + end + + def names + @raw.keys + end + + def each + @raw.each do |name, column| + yield(name, column) + end + end + end + end +end Added: lib/groonga_client_model/version.rb (+19 -0) 100644 =================================================================== --- /dev/null +++ lib/groonga_client_model/version.rb 2016-12-01 18:34:50 +0900 (c783a34) @@ -0,0 +1,19 @@ +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +module GroongaClientModel + VERSION = "0.9.0" +end Added: test/apps/rails5/.gitignore (+17 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/.gitignore 2016-12-01 18:34:50 +0900 (48fb168) @@ -0,0 +1,17 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +# Ignore bundler config. +/.bundle + +# Ignore all logfiles and tempfiles. +/log/* +/tmp/* +!/log/.keep +!/tmp/.keep + +# Ignore Byebug command history file. +.byebug_history Added: test/apps/rails5/Gemfile (+48 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/Gemfile 2016-12-01 18:34:50 +0900 (fc6409f) @@ -0,0 +1,48 @@ +source 'https://rubygems.org' + + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '~> 5.0.0', '>= 5.0.0.1' +# Use Puma as the app server +gem 'puma', '~> 3.0' +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5.0' +# Use Uglifier as compressor for JavaScript assets +gem 'uglifier', '>= 1.3.0' +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.2' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby + +# Use jquery as the JavaScript library +gem 'jquery-rails' +# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks +gem 'turbolinks', '~> 5' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.5' +# Use Redis adapter to run Action Cable in production +# gem 'redis', '~> 3.0' +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' + +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug', platform: :mri +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. + gem 'web-console' + gem 'listen', '~> 3.0.5' + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' + gem 'spring-watcher-listen', '~> 2.0.0' +end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] + +gem 'groonga-client-model', path: '../../../' Added: test/apps/rails5/Gemfile.lock (+189 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/Gemfile.lock 2016-12-01 18:34:50 +0900 (25da572) @@ -0,0 +1,189 @@ +PATH + remote: ../../../ + specs: + groonga-client-model (0.9.0) + activemodel + groonga-client + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.0.0.1) + actionpack (= 5.0.0.1) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.0.0.1) + actionview (= 5.0.0.1) + activesupport (= 5.0.0.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.0.0.1) + activesupport (= 5.0.0.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (5.0.0.1) + activesupport (= 5.0.0.1) + globalid (>= 0.3.6) + activemodel (5.0.0.1) + activesupport (= 5.0.0.1) + activerecord (5.0.0.1) + activemodel (= 5.0.0.1) + activesupport (= 5.0.0.1) + arel (~> 7.0) + activesupport (5.0.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (~> 0.7) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (7.1.4) + builder (3.2.2) + byebug (9.0.6) + coffee-rails (4.2.1) + coffee-script (>= 2.2.0) + railties (>= 4.0.0, < 5.2.x) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.11.1) + concurrent-ruby (1.0.2) + debug_inspector (0.0.2) + erubis (2.7.0) + execjs (2.7.0) + ffi (1.9.14) + globalid (0.3.7) + activesupport (>= 4.1.0) + gqtp (1.0.6) + groonga-client (0.3.1) + gqtp (>= 1.0.4) + groonga-command (>= 1.2.8) + hashie + groonga-command (1.2.9) + json + hashie (3.4.6) + i18n (0.7.0) + jbuilder (2.6.1) + activesupport (>= 3.0.0, < 5.1) + multi_json (~> 1.2) + jquery-rails (4.2.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json (2.0.2) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.4) + mime-types (>= 1.16, < 4) + method_source (0.8.2) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mini_portile2 (2.1.0) + minitest (5.10.0) + multi_json (1.12.1) + nio4r (1.2.1) + nokogiri (1.6.8.1) + mini_portile2 (~> 2.1.0) + puma (3.6.2) + rack (2.0.1) + rack-test (0.6.3) + rack (>= 1.0) + rails (5.0.0.1) + actioncable (= 5.0.0.1) + actionmailer (= 5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) + activemodel (= 5.0.0.1) + activerecord (= 5.0.0.1) + activesupport (= 5.0.0.1) + bundler (>= 1.3.0, < 2.0) + railties (= 5.0.0.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.1) + activesupport (>= 4.2.0, < 6.0) + nokogiri (~> 1.6.0) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (5.0.0.1) + actionpack (= 5.0.0.1) + activesupport (= 5.0.0.1) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (11.3.0) + rb-fsevent (0.9.8) + rb-inotify (0.9.7) + ffi (>= 0.5.0) + sass (3.4.22) + sass-rails (5.0.6) + railties (>= 4.0.0, < 6) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + spring (2.0.0) + activesupport (>= 4.2) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (3.7.0) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.0) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + thor (0.19.4) + thread_safe (0.3.5) + tilt (2.0.5) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.0) + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (3.0.4) + execjs (>= 0.3.0, < 3) + web-console (3.4.0) + actionview (>= 5.0) + activemodel (>= 5.0) + debug_inspector + railties (>= 5.0) + websocket-driver (0.6.4) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) + +PLATFORMS + ruby + +DEPENDENCIES + byebug + coffee-rails (~> 4.2) + groonga-client-model! + jbuilder (~> 2.5) + jquery-rails + listen (~> 3.0.5) + puma (~> 3.0) + rails (~> 5.0.0, >= 5.0.0.1) + sass-rails (~> 5.0) + spring + spring-watcher-listen (~> 2.0.0) + turbolinks (~> 5) + tzinfo-data + uglifier (>= 1.3.0) + web-console + +BUNDLED WITH + 1.13.6 Added: test/apps/rails5/README.md (+24 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/README.md 2016-12-01 18:34:50 +0900 (7db80e4) @@ -0,0 +1,24 @@ +# README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... Added: test/apps/rails5/Rakefile (+6 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/Rakefile 2016-12-01 18:34:50 +0900 (e85f913) @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative 'config/application' + +Rails.application.load_tasks Added: test/apps/rails5/app/assets/config/manifest.js (+3 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/config/manifest.js 2016-12-01 18:34:50 +0900 (b16e53d) @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css Added: test/apps/rails5/app/assets/images/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/images/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/app/assets/javascripts/application.js (+16 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/javascripts/application.js 2016-12-01 18:34:50 +0900 (b12018d) @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. JavaScript code in this file should be added after the last require_* statement. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . Added: test/apps/rails5/app/assets/javascripts/cable.js (+13 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/javascripts/cable.js 2016-12-01 18:34:50 +0900 (71ee1e6) @@ -0,0 +1,13 @@ +// Action Cable provides the framework to deal with WebSockets in Rails. +// You can generate new channels where WebSocket features live using the rails generate channel command. +// +//= require action_cable +//= require_self +//= require_tree ./channels + +(function() { + this.App || (this.App = {}); + + App.cable = ActionCable.createConsumer(); + +}).call(this); Added: test/apps/rails5/app/assets/javascripts/channels/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/javascripts/channels/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/app/assets/javascripts/posts.coffee (+3 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/javascripts/posts.coffee 2016-12-01 18:34:50 +0900 (24f83d1) @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ Added: test/apps/rails5/app/assets/stylesheets/application.css (+15 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/stylesheets/application.css 2016-12-01 18:34:50 +0900 (0ebd7fe) @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS + * files in this directory. Styles in this file should be added after the last require_* statement. + * It is generally better to create a new file per style scope. + * + *= require_tree . + *= require_self + */ Added: test/apps/rails5/app/assets/stylesheets/posts.scss (+3 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/stylesheets/posts.scss 2016-12-01 18:34:50 +0900 (1a7e153) @@ -0,0 +1,3 @@ +// Place all the styles related to the posts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ Added: test/apps/rails5/app/assets/stylesheets/scaffolds.scss (+89 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/assets/stylesheets/scaffolds.scss 2016-12-01 18:34:50 +0900 (4ce4266) @@ -0,0 +1,89 @@ +body { + background-color: #fff; + color: #333; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; + margin: 33px; +} + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; + margin: 33px; +} + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; +} + +a { + color: #000; + + &:visited { + color: #666; + } + + &:hover { + color: #fff; + background-color: #000; + } +} + +th { + padding-bottom: 5px; +} + +td { + padding-bottom: 7px; + padding-left: 5px; + padding-right: 5px; +} + +div { + &.field, &.actions { + margin-bottom: 10px; + } +} + +#notice { + color: green; +} + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; +} + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px; + padding-bottom: 0; + margin-bottom: 20px; + background-color: #f0f0f0; + + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px; + margin-bottom: 0; + background-color: #c00; + color: #fff; + } + + ul li { + font-size: 12px; + list-style: square; + } +} + +label { + display: block; +} Added: test/apps/rails5/app/channels/application_cable/channel.rb (+4 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/channels/application_cable/channel.rb 2016-12-01 18:34:50 +0900 (d672697) @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end Added: test/apps/rails5/app/channels/application_cable/connection.rb (+4 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/channels/application_cable/connection.rb 2016-12-01 18:34:50 +0900 (0ff5442) @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end Added: test/apps/rails5/app/controllers/application_controller.rb (+3 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/controllers/application_controller.rb 2016-12-01 18:34:50 +0900 (1c07694) @@ -0,0 +1,3 @@ +class ApplicationController < ActionController::Base + protect_from_forgery with: :exception +end Added: test/apps/rails5/app/controllers/concerns/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/controllers/concerns/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/app/controllers/posts_controller.rb (+74 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/controllers/posts_controller.rb 2016-12-01 18:34:50 +0900 (16bba99) @@ -0,0 +1,74 @@ +class PostsController < ApplicationController + before_action :set_post, only: [:show, :edit, :update, :destroy] + + # GET /posts + # GET /posts.json + def index + @posts = Post.all + end + + # GET /posts/1 + # GET /posts/1.json + def show + end + + # GET /posts/new + def new + @post = Post.new + end + + # GET /posts/1/edit + def edit + end + + # POST /posts + # POST /posts.json + def create + @post = Post.new(post_params) + + respond_to do |format| + if****@post***** + format.html { redirect_to @post, notice: 'Post was successfully created.' } + format.json { render :show, status: :created, location: @post } + else + format.html { render :new } + format.json { render json: @post.errors, status: :unprocessable_entity } + end + end + end + + # PATCH/PUT /posts/1 + # PATCH/PUT /posts/1.json + def update + respond_to do |format| + if****@post*****(post_params) + format.html { redirect_to @post, notice: 'Post was successfully updated.' } + format.json { render :show, status: :ok, location: @post } + else + format.html { render :edit } + format.json { render json: @post.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /posts/1 + # DELETE /posts/1.json + def destroy + @post.destroy + respond_to do |format| + format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' } + format.json { head :no_content } + end + end + + private + # Use callbacks to share common setup or constraints between actions. + def set_post + @post = Post.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def post_params + params.require(:post).permit(:title, :body) + end +end Added: test/apps/rails5/app/helpers/application_helper.rb (+2 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/helpers/application_helper.rb 2016-12-01 18:34:50 +0900 (de6be79) @@ -0,0 +1,2 @@ +module ApplicationHelper +end Added: test/apps/rails5/app/helpers/posts_helper.rb (+2 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/helpers/posts_helper.rb 2016-12-01 18:34:50 +0900 (a7b8cec) @@ -0,0 +1,2 @@ +module PostsHelper +end Added: test/apps/rails5/app/jobs/application_job.rb (+2 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/jobs/application_job.rb 2016-12-01 18:34:50 +0900 (a009ace) @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end Added: test/apps/rails5/app/mailers/application_mailer.rb (+4 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/mailers/application_mailer.rb 2016-12-01 18:34:50 +0900 (286b223) @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from �� example.com' + layout 'mailer' +end Added: test/apps/rails5/app/models/concerns/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/models/concerns/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/app/models/post.rb (+2 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/models/post.rb 2016-12-01 18:34:50 +0900 (90666d2) @@ -0,0 +1,2 @@ +class Post < GroongaClientModel::Record +end Added: test/apps/rails5/app/views/layouts/application.html.erb (+14 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/layouts/application.html.erb 2016-12-01 18:34:50 +0900 (1dd80e4) @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html> + <head> + <title>Blog</title> + <%= csrf_meta_tags %> + + <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + </head> + + <body> + <%= yield %> + </body> +</html> Added: test/apps/rails5/app/views/layouts/mailer.html.erb (+13 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/layouts/mailer.html.erb 2016-12-01 18:34:50 +0900 (cbd34d2) @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <style> + /* Email styles need to be inline */ + </style> + </head> + + <body> + <%= yield %> + </body> +</html> Added: test/apps/rails5/app/views/layouts/mailer.text.erb (+1 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/layouts/mailer.text.erb 2016-12-01 18:34:50 +0900 (37f0bdd) @@ -0,0 +1 @@ +<%= yield %> Added: test/apps/rails5/app/views/posts/_form.html.erb (+27 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/posts/_form.html.erb 2016-12-01 18:34:50 +0900 (8733928) @@ -0,0 +1,27 @@ +<%= form_for(post) do |f| %> + <% if post.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:</h2> + + <ul> + <% post.errors.full_messages.each do |message| %> + <li><%= message %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :title %> + <%= f.text_field :title %> + </div> + + <div class="field"> + <%= f.label :body %> + <%= f.text_area :body %> + </div> + + <div class="actions"> + <%= f.submit %> + </div> +<% end %> Added: test/apps/rails5/app/views/posts/_post.json.jbuilder (+2 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/posts/_post.json.jbuilder 2016-12-01 18:34:50 +0900 (084ca51) @@ -0,0 +1,2 @@ +json.extract! post, :id, :title, :body, :created_at, :updated_at +json.url post_url(post, format: :json) \ No newline at end of file Added: test/apps/rails5/app/views/posts/edit.html.erb (+6 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/posts/edit.html.erb 2016-12-01 18:34:50 +0900 (ded33f7) @@ -0,0 +1,6 @@ +<h1>Editing Post</h1> + +<%= render 'form', post: @post %> + +<%= link_to 'Show', @post %> | +<%= link_to 'Back', posts_path %> Added: test/apps/rails5/app/views/posts/index.html.erb (+29 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/posts/index.html.erb 2016-12-01 18:34:50 +0900 (dd12307) @@ -0,0 +1,29 @@ +<p id="notice"><%= notice %></p> + +<h1>Posts</h1> + +<table> + <thead> + <tr> + <th>Title</th> + <th>Body</th> + <th colspan="3"></th> + </tr> + </thead> + + <tbody> + <% @posts.each do |post| %> + <tr> + <td><%= post.title %></td> + <td><%= post.body %></td> + <td><%= link_to 'Show', post %></td> + <td><%= link_to 'Edit', edit_post_path(post) %></td> + <td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Post', new_post_path %> Added: test/apps/rails5/app/views/posts/index.json.jbuilder (+1 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/posts/index.json.jbuilder 2016-12-01 18:34:50 +0900 (af157a6) @@ -0,0 +1 @@ +json.array! @posts, partial: 'posts/post', as: :post \ No newline at end of file Added: test/apps/rails5/app/views/posts/new.html.erb (+5 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/posts/new.html.erb 2016-12-01 18:34:50 +0900 (fb1e2a1) @@ -0,0 +1,5 @@ +<h1>New Post</h1> + +<%= render 'form', post: @post %> + +<%= link_to 'Back', posts_path %> Added: test/apps/rails5/app/views/posts/show.html.erb (+14 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/posts/show.html.erb 2016-12-01 18:34:50 +0900 (c14ef10) @@ -0,0 +1,14 @@ +<p id="notice"><%= notice %></p> + +<p> + <strong>Title:</strong> + <%=****@post***** %> +</p> + +<p> + <strong>Body:</strong> + <%=****@post***** %> +</p> + +<%= link_to 'Edit', edit_post_path(@post) %> | +<%= link_to 'Back', posts_path %> Added: test/apps/rails5/app/views/posts/show.json.jbuilder (+1 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/app/views/posts/show.json.jbuilder 2016-12-01 18:34:50 +0900 (2c7bc27) @@ -0,0 +1 @@ +json.partial! "posts/post", post: @post \ No newline at end of file Added: test/apps/rails5/bin/bundle (+3 -0) 100755 =================================================================== --- /dev/null +++ test/apps/rails5/bin/bundle 2016-12-01 18:34:50 +0900 (66e9889) @@ -0,0 +1,3 @@ +#!/usr/bin/env ruby +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +load Gem.bin_path('bundler', 'bundle') Added: test/apps/rails5/bin/rails (+9 -0) 100755 =================================================================== --- /dev/null +++ test/apps/rails5/bin/rails 2016-12-01 18:34:50 +0900 (5badb2f) @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' Added: test/apps/rails5/bin/rake (+9 -0) 100755 =================================================================== --- /dev/null +++ test/apps/rails5/bin/rake 2016-12-01 18:34:50 +0900 (d87d5f5) @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end +require_relative '../config/boot' +require 'rake' +Rake.application.run Added: test/apps/rails5/bin/setup (+34 -0) 100755 =================================================================== --- /dev/null +++ test/apps/rails5/bin/setup 2016-12-01 18:34:50 +0900 (e620b4d) @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end Added: test/apps/rails5/bin/spring (+16 -0) 100755 =================================================================== --- /dev/null +++ test/apps/rails5/bin/spring 2016-12-01 18:34:50 +0900 (9bc076b) @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby + +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. + +unless defined?(Spring) + require 'rubygems' + require 'bundler' + + lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) + if spring = lockfile.specs.detect { |spec| spec.name == "spring" } + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path + gem 'spring', spring.version + require 'spring/binstub' + end +end Added: test/apps/rails5/bin/update (+29 -0) 100755 =================================================================== --- /dev/null +++ test/apps/rails5/bin/update 2016-12-01 18:34:50 +0900 (a8e4462) @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end Added: test/apps/rails5/config.ru (+5 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config.ru 2016-12-01 18:34:50 +0900 (f7ba0b5) @@ -0,0 +1,5 @@ +# This file is used by Rack-based servers to start the application. + +require_relative 'config/environment' + +run Rails.application Added: test/apps/rails5/config/application.rb (+26 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/application.rb 2016-12-01 18:34:50 +0900 (90d7809) @@ -0,0 +1,26 @@ +require_relative 'boot' + +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +require "active_job/railtie" +# require "active_record/railtie" +require "groonga_client_model/railtie" +require "action_controller/railtie" +require "action_mailer/railtie" +require "action_view/railtie" +require "action_cable/engine" +require "sprockets/railtie" +require "rails/test_unit/railtie" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module Blog + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + end +end Added: test/apps/rails5/config/boot.rb (+3 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/boot.rb 2016-12-01 18:34:50 +0900 (30f5120) @@ -0,0 +1,3 @@ +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) + +require 'bundler/setup' # Set up gems listed in the Gemfile. Added: test/apps/rails5/config/cable.yml (+9 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/cable.yml 2016-12-01 18:34:50 +0900 (0bbde6f) @@ -0,0 +1,9 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 Added: test/apps/rails5/config/environment.rb (+5 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/environment.rb 2016-12-01 18:34:50 +0900 (426333b) @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative 'application' + +# Initialize the Rails application. +Rails.application.initialize! Added: test/apps/rails5/config/environments/development.rb (+51 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/environments/development.rb 2016-12-01 18:34:50 +0900 (58d20de) @@ -0,0 +1,51 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=172800' + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false + + config.action_mailer.perform_caching = false + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. + config.assets.debug = true + + # Suppress logger output for asset requests. + config.assets.quiet = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker +end Added: test/apps/rails5/config/environments/production.rb (+83 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/environments/production.rb 2016-12-01 18:34:50 +0900 (84704b2) @@ -0,0 +1,83 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + config.log_tags = [ :request_id ] + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "blog_#{Rails.env}" + config.action_mailer.perform_caching = false + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end +end Added: test/apps/rails5/config/environments/test.rb (+42 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/environments/test.rb 2016-12-01 18:34:50 +0900 (30587ef) @@ -0,0 +1,42 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. + config.eager_load = false + + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=3600' + } + + # Show full error reports and disable caching. + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates. + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end Added: test/apps/rails5/config/groonga.yml (+8 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/groonga.yml 2016-12-01 18:34:50 +0900 (60822df) @@ -0,0 +1,8 @@ +development: + url: http://127.0.0.1:10041 + +test: + url: http://127.0.0.1:10041 + +production: + url: http://127.0.0.1:10041 Added: test/apps/rails5/config/initializers/application_controller_renderer.rb (+6 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/application_controller_renderer.rb 2016-12-01 18:34:50 +0900 (51639b6) @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) Added: test/apps/rails5/config/initializers/assets.rb (+11 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/assets.rb 2016-12-01 18:34:50 +0900 (01ef3e6) @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) Added: test/apps/rails5/config/initializers/backtrace_silencers.rb (+7 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/backtrace_silencers.rb 2016-12-01 18:34:50 +0900 (59385cd) @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! Added: test/apps/rails5/config/initializers/cookies_serializer.rb (+5 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/cookies_serializer.rb 2016-12-01 18:34:50 +0900 (5a6a32d) @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json Added: test/apps/rails5/config/initializers/filter_parameter_logging.rb (+4 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/filter_parameter_logging.rb 2016-12-01 18:34:50 +0900 (4a994e1) @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] Added: test/apps/rails5/config/initializers/inflections.rb (+16 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/inflections.rb 2016-12-01 18:34:50 +0900 (ac033bf) @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end Added: test/apps/rails5/config/initializers/mime_types.rb (+4 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/mime_types.rb 2016-12-01 18:34:50 +0900 (dc18996) @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf Added: test/apps/rails5/config/initializers/new_framework_defaults.rb (+21 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/new_framework_defaults.rb 2016-12-01 18:34:50 +0900 (b5b71ff) @@ -0,0 +1,21 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.0 upgrade. +# +# Read the Rails 5.0 release notes for more info on each option. + +# Enable per-form CSRF tokens. Previous versions had false. +Rails.application.config.action_controller.per_form_csrf_tokens = true + +# Enable origin-checking CSRF mitigation. Previous versions had false. +Rails.application.config.action_controller.forgery_protection_origin_check = true + +# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. +# Previous versions had false. +ActiveSupport.to_time_preserves_timezone = true + +# Do not halt callback chains when a callback returns false. Previous versions had true. +ActiveSupport.halt_callback_chains_on_return_false = false + +# Configure SSL options to enable HSTS with subdomains. Previous versions had false. +Rails.application.config.ssl_options = { hsts: { subdomains: true } } Added: test/apps/rails5/config/initializers/session_store.rb (+3 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/session_store.rb 2016-12-01 18:34:50 +0900 (1b9fa32) @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.session_store :cookie_store, key: '_blog_session' Added: test/apps/rails5/config/initializers/wrap_parameters.rb (+9 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/initializers/wrap_parameters.rb 2016-12-01 18:34:50 +0900 (633c1c8) @@ -0,0 +1,9 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end Added: test/apps/rails5/config/locales/en.yml (+23 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/locales/en.yml 2016-12-01 18:34:50 +0900 (0653957) @@ -0,0 +1,23 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +en: + hello: "Hello world" Added: test/apps/rails5/config/puma.rb (+47 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/puma.rb 2016-12-01 18:34:50 +0900 (c7f311f) @@ -0,0 +1,47 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum, this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart Added: test/apps/rails5/config/routes.rb (+4 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/routes.rb 2016-12-01 18:34:50 +0900 (abba78d) @@ -0,0 +1,4 @@ +Rails.application.routes.draw do + resources :posts + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html +end Added: test/apps/rails5/config/secrets.yml (+22 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/secrets.yml 2016-12-01 18:34:50 +0900 (14c8aaa) @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rails secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: 88412fa1b226959b98c2aafda9cb8401c0c78fc0d8ea0b5508d80f2d20f5c4c620519e865f9f3bd6d5aa84b91cd8ab724189b7cf72ea55538e0ebccfef9c7596 + +test: + secret_key_base: e9f1b465491d5865d3481e8c0caf517f56f24fc3d1a2bac5cbf5bbfca25683abdfa33fd2c2040d48ed3b12654ef85bf792d8a203b07776363d7e2abf1e7fae8d + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> Added: test/apps/rails5/config/spring.rb (+6 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/config/spring.rb 2016-12-01 18:34:50 +0900 (c9119b4) @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) } Added: test/apps/rails5/db/seeds.rb (+7 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/db/seeds.rb 2016-12-01 18:34:50 +0900 (1beea2a) @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). +# +# Examples: +# +# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) +# Character.create(name: 'Luke', movie: movies.first) Added: test/apps/rails5/lib/assets/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/lib/assets/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/lib/tasks/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/lib/tasks/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/log/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/log/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/public/404.html (+67 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/public/404.html 2016-12-01 18:34:50 +0900 (b612547) @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<html> +<head> + <title>The page you were looking for doesn't exist (404)</title> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <style> + body { + background-color: #EFEFEF; + color: #2E2F30; + text-align: center; + font-family: arial, sans-serif; + margin: 0; + } + + div.dialog { + width: 95%; + max-width: 33em; + margin: 4em auto 0; + } + + div.dialog > div { + border: 1px solid #CCC; + border-right-color: #999; + border-left-color: #999; + border-bottom-color: #BBB; + border-top: #B00100 solid 4px; + border-top-left-radius: 9px; + border-top-right-radius: 9px; + background-color: white; + padding: 7px 12% 0; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); + } + + h1 { + font-size: 100%; + color: #730E15; + line-height: 1.5em; + } + + div.dialog > p { + margin: 0 0 1em; + padding: 1em; + background-color: #F7F7F7; + border: 1px solid #CCC; + border-right-color: #999; + border-left-color: #999; + border-bottom-color: #999; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + border-top-color: #DADADA; + color: #666; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); + } + </style> +</head> + +<body> + <!-- This file lives in public/404.html --> + <div class="dialog"> + <div> + <h1>The page you were looking for doesn't exist.</h1> + <p>You may have mistyped the address or the page may have moved.</p> + </div> + <p>If you are the application owner check the logs for more information.</p> + </div> +</body> +</html> Added: test/apps/rails5/public/422.html (+67 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/public/422.html 2016-12-01 18:34:50 +0900 (a21f82b) @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<html> +<head> + <title>The change you wanted was rejected (422)</title> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <style> + body { + background-color: #EFEFEF; + color: #2E2F30; + text-align: center; + font-family: arial, sans-serif; + margin: 0; + } + + div.dialog { + width: 95%; + max-width: 33em; + margin: 4em auto 0; + } + + div.dialog > div { + border: 1px solid #CCC; + border-right-color: #999; + border-left-color: #999; + border-bottom-color: #BBB; + border-top: #B00100 solid 4px; + border-top-left-radius: 9px; + border-top-right-radius: 9px; + background-color: white; + padding: 7px 12% 0; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); + } + + h1 { + font-size: 100%; + color: #730E15; + line-height: 1.5em; + } + + div.dialog > p { + margin: 0 0 1em; + padding: 1em; + background-color: #F7F7F7; + border: 1px solid #CCC; + border-right-color: #999; + border-left-color: #999; + border-bottom-color: #999; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + border-top-color: #DADADA; + color: #666; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); + } + </style> +</head> + +<body> + <!-- This file lives in public/422.html --> + <div class="dialog"> + <div> + <h1>The change you wanted was rejected.</h1> + <p>Maybe you tried to change something you didn't have access to.</p> + </div> + <p>If you are the application owner check the logs for more information.</p> + </div> +</body> +</html> Added: test/apps/rails5/public/500.html (+66 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/public/500.html 2016-12-01 18:34:50 +0900 (061abc5) @@ -0,0 +1,66 @@ +<!DOCTYPE html> +<html> +<head> + <title>We're sorry, but something went wrong (500)</title> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <style> + body { + background-color: #EFEFEF; + color: #2E2F30; + text-align: center; + font-family: arial, sans-serif; + margin: 0; + } + + div.dialog { + width: 95%; + max-width: 33em; + margin: 4em auto 0; + } + + div.dialog > div { + border: 1px solid #CCC; + border-right-color: #999; + border-left-color: #999; + border-bottom-color: #BBB; + border-top: #B00100 solid 4px; + border-top-left-radius: 9px; + border-top-right-radius: 9px; + background-color: white; + padding: 7px 12% 0; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); + } + + h1 { + font-size: 100%; + color: #730E15; + line-height: 1.5em; + } + + div.dialog > p { + margin: 0 0 1em; + padding: 1em; + background-color: #F7F7F7; + border: 1px solid #CCC; + border-right-color: #999; + border-left-color: #999; + border-bottom-color: #999; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; + border-top-color: #DADADA; + color: #666; + box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17); + } + </style> +</head> + +<body> + <!-- This file lives in public/500.html --> + <div class="dialog"> + <div> + <h1>We're sorry, but something went wrong.</h1> + </div> + <p>If you are the application owner check the logs for more information.</p> + </div> +</body> +</html> Added: test/apps/rails5/public/apple-touch-icon-precomposed.png (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/public/apple-touch-icon-precomposed.png 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/public/apple-touch-icon.png (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/public/apple-touch-icon.png 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/public/favicon.ico (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/public/favicon.ico 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/public/robots.txt (+5 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/public/robots.txt 2016-12-01 18:34:50 +0900 (3c9c7c0) @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / Added: test/apps/rails5/test/controllers/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/controllers/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/test/controllers/posts_controller_test.rb (+48 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/controllers/posts_controller_test.rb 2016-12-01 18:34:50 +0900 (8cd9d5d) @@ -0,0 +1,48 @@ +require 'test_helper' + +class PostsControllerTest < ActionDispatch::IntegrationTest + setup do + @post = posts(:one) + end + + test "should get index" do + get posts_url + assert_response :success + end + + test "should get new" do + get new_post_url + assert_response :success + end + + test "should create post" do + assert_difference('Post.count') do + post posts_url, params: { post: { body: @post.body, title: @post.title } } + end + + assert_redirected_to post_url(Post.last) + end + + test "should show post" do + get post_url(@post) + assert_response :success + end + + test "should get edit" do + get edit_post_url(@post) + assert_response :success + end + + test "should update post" do + patch post_url(@post), params: { post: { body: @post.body, title: @post.title } } + assert_redirected_to post_url(@post) + end + + test "should destroy post" do + assert_difference('Post.count', -1) do + delete post_url(@post) + end + + assert_redirected_to posts_url + end +end Added: test/apps/rails5/test/fixtures/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/fixtures/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/test/fixtures/files/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/fixtures/files/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/test/helpers/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/helpers/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/test/integration/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/integration/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/test/mailers/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/mailers/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/test/models/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/models/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/test/test_helper.rb (+7 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/test/test_helper.rb 2016-12-01 18:34:50 +0900 (3acf9ae) @@ -0,0 +1,7 @@ +ENV['RAILS_ENV'] ||= 'test' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Add more helper methods to be used by all tests here... +end Added: test/apps/rails5/tmp/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/tmp/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/vendor/assets/javascripts/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/vendor/assets/javascripts/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/apps/rails5/vendor/assets/stylesheets/.keep (+0 -0) 100644 =================================================================== --- /dev/null +++ test/apps/rails5/vendor/assets/stylesheets/.keep 2016-12-01 18:34:50 +0900 (e69de29) Added: test/run-test.rb (+47 -0) 100755 =================================================================== --- /dev/null +++ test/run-test.rb 2016-12-01 18:34:50 +0900 (0d0b699) @@ -0,0 +1,47 @@ +#!/usr/bin/env ruby +# +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +require "rbconfig" + +success = true + +unless system(RbConfig.ruby, "test/unit/run-test.rb", *ARGV) + success = false +end + +Dir.glob("#{__dir__}/apps/*") do |test_application| + env = { + "BUNDLE_GEMFILE" => "#{test_application}/Gemfile", + } + command_line = [ + "bundle", + "exec", + RbConfig.ruby, + "bin/rails", + "test", + "TESTOPTS=#{ARGV.join(' ')}", + ] + options = { + :chdir => test_application, + } + unless system(env, *command_line, options) + succuess = false + end +end + +exit(success) Added: test/unit/run-test.rb (+35 -0) 100755 =================================================================== --- /dev/null +++ test/unit/run-test.rb 2016-12-01 18:34:50 +0900 (867f89b) @@ -0,0 +1,35 @@ +#!/usr/bin/env ruby +# +# Copyright (C) 2016 Kouhei Sutou <kou �� clear-code.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +$VERBOSE = true + +require "pathname" + +base_dir = Pathname.new(__FILE__).dirname.parent.parent.expand_path + +lib_dir = base_dir + "lib" +test_dir = base_dir + "test" + +$LOAD_PATH.unshift(lib_dir.to_s) + +require "test-unit" +require "groonga-client-model" + +Thread.abort_on_exception = true + +exit(Test::Unit::AutoRunner.run(true, test_dir.to_s))