Kouhei Sutou
null+****@clear*****
Wed Nov 20 17:54:12 JST 2013
Kouhei Sutou 2013-11-20 17:54:12 +0900 (Wed, 20 Nov 2013) New Revision: 3fe40bad01053ea2379264163cf429a436e7b99c https://github.com/droonga/fluent-plugin-droonga/commit/3fe40bad01053ea2379264163cf429a436e7b99c Message: Add drntest runner Added files: test/command/Gemfile test/command/run-test.rb Modified files: .gitignore Modified: .gitignore (+4 -0) =================================================================== --- .gitignore 2013-11-20 16:56:00 +0900 (66f8ed3) +++ .gitignore 2013-11-20 17:54:12 +0900 (4219ffe) @@ -1 +1,5 @@ /Gemfile.lock +/test/command/.bundle/ +/test/command/Gemfile.lock +/test/command/bin/ +/test/command/vendor/ Added: test/command/Gemfile (+32 -0) 100644 =================================================================== --- /dev/null +++ test/command/Gemfile 2013-11-20 17:54:12 +0900 (a87fbbb) @@ -0,0 +1,32 @@ +# Copyright (C) 2013 Droonga Project +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +source "https://rubygems.org" + +vendor_dir = File.join(File.dirname(__FILE__), "vendor") + +drntest_dir = File.join(vendor_dir, "drntest") +if File.exist?(drntest_dir) + gem "drntest", :path => drntest_dir +else + gem "drntest", :github => "droonga/drntest" +end + +droonga_client_dir = File.join(endor_dir, "droonga-client-ruby") +if File.exist?(droonga_client_dir) + gem "droonga-client", :path => droonga_client_dir +else + gem "droonga-client", github: "droonga/droonga-client-ruby" +end Added: test/command/run-test.rb (+49 -0) 100755 =================================================================== --- /dev/null +++ test/command/run-test.rb 2013-11-20 17:54:12 +0900 (e1b6ad3) @@ -0,0 +1,49 @@ +#!/usr/bin/env ruby +# +# Copyright (C) 2013 Droonga Project +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +require "rbconfig" +require "fileutils" + +def run(*command_line) + return if system(*command_line) + puts("failed to run: #{command_line.join(' ')}") + exit(false) +end + +def need_bundle_install?(gemfile, gemfile_lock) + return true unless File.exist?(gemfile_lock) + return true if File.mtime(gemfile) > File.mtime(gemfile_lock) + false +end + +base_dir = File.dirname(__FILE__) +gemfile = File.join(base_dir, "Gemfile") +gemfile_lock = "#{gemfile}.lock" + +if need_bundle_install?(gemfile, gemfile_lock) + Dir.chdir(base_dir) do + run("bundle", "install", "--binstubs") + end +end + +ENV["BUNDLE_GEMFILE"] = File.expand_path(gemfile) + +drntest_options = [] +drntest_options << File.join(base_dir, "suite") + +run(File.join(base_dir, "bin", "drntest"), + *drntest_options) -------------- next part -------------- HTML����������������������������... Download