Make the test plugins install throw bundler, so we don't have to install them every time we run the test (it makes the thing slow). Refactor also the bundler install task into a single one, making calls to it when necessary.

Fixes #2237
This commit is contained in:
Pere Urbon-Bayes 2014-12-14 00:17:32 +01:00 committed by Jordan Sissel
parent e796024cff
commit 549d9e3896
5 changed files with 229 additions and 41 deletions

View file

@ -1,6 +1,7 @@
require_relative "default_plugins"
namespace "plugin" do
task "install", :name do |task, args|
name = args[:name]
puts "[plugin] Installing plugin: #{name}"
@ -12,29 +13,12 @@ namespace "plugin" do
task.reenable # Allow this task to be run again
end # task "install"
task "install-defaults" => [ "dependency:bundler" ] do
# because --path creates a .bundle/config file and changes bundler path
# we need to remove this file so it doesn't influence following bundler calls
FileUtils.rm_rf(::File.join(LogStash::Environment::LOGSTASH_HOME, "tools/.bundle"))
10.times do
begin
ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home
ENV["BUNDLE_PATH"] = LogStash::Environment.logstash_gem_home
ENV["BUNDLE_GEMFILE"] = "tools/Gemfile.plugins"
Bundler.reset!
Bundler::CLI.start(LogStash::Environment.bundler_install_command("tools/Gemfile.plugins", LogStash::Environment::BUNDLE_DIR))
break
rescue => e
# for now catch all, looks like bundler now throws Bundler::InstallError, Errno::EBADF
puts(e.message)
puts("--> Retrying install-defaults upon exception=#{e.class}")
sleep(1)
end
end
# because --path creates a .bundle/config file and changes bundler path
# we need to remove this file so it doesn't influence following bundler calls
FileUtils.rm_rf(::File.join(LogStash::Environment::LOGSTASH_HOME, "tools/.bundle"))
task "install-defaults" do
Rake::Task["vendor:bundle"].invoke("tools/Gemfile.plugins")
end
task "install-test" do
Rake::Task["vendor:bundle"].invoke("tools/Gemfile.plugins.test")
end
end # namespace "plugin"

View file

@ -17,17 +17,7 @@ namespace "test" do
end
task "prep" do
plugins = [
'logstash-filter-clone',
'logstash-filter-mutate',
'logstash-input-generator',
'logstash-input-stdin',
'logstash-input-tcp',
'logstash-output-stdout'
]
plugins.each do |plugin|
Rake::Task["plugin:install"].invoke(plugin)
end
Rake::Task["plugin:install-test"].invoke
end
end

View file

@ -205,23 +205,28 @@ namespace "vendor" do
task "gems" => ["vendor:gems"]
end
task "gems" => [ "dependency:bundler" ] do
task "gems" do
require "logstash/environment"
Rake::Task["dependency:rbx-stdlib"] if LogStash::Environment.ruby_engine == "rbx"
Rake::Task["dependency:stud"].invoke
Rake::Task["vendor:bundle"].invoke("tools/Gemfile")
end # task gems
task "all" => "gems"
task "bundle", [:gemfile] => [ "dependency:bundler" ] do |task, args|
task.reenable
# because --path creates a .bundle/config file and changes bundler path
# we need to remove this file so it doesn't influence following bundler calls
FileUtils.rm_rf(::File.join(LogStash::Environment::LOGSTASH_HOME, "tools/.bundle"))
10.times do
begin
ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home
ENV["BUNDLE_PATH"] = LogStash::Environment.logstash_gem_home
ENV["BUNDLE_GEMFILE"] = "tools/Gemfile"
ENV["BUNDLE_GEMFILE"] = args[:gemfile]
Bundler.reset!
Bundler::CLI.start(LogStash::Environment.bundler_install_command("tools/Gemfile", LogStash::Environment::BUNDLE_DIR))
Bundler::CLI.start(LogStash::Environment.bundler_install_command(args[:gemfile], LogStash::Environment::BUNDLE_DIR))
break
rescue => e
# for now catch all, looks like bundler now throws Bundler::InstallError, Errno::EBADF
@ -234,8 +239,7 @@ namespace "vendor" do
# because --path creates a .bundle/config file and changes bundler path
# we need to remove this file so it doesn't influence following bundler calls
FileUtils.rm_rf(::File.join(LogStash::Environment::LOGSTASH_HOME, "tools/.bundle"))
end # task gems
task "all" => "gems"
end
desc "Clean the vendored files"
task :clean do

View file

@ -0,0 +1,16 @@
require 'rakelib/default_plugins'
source 'https://rubygems.org'
gemspec :name => "logstash", :path => File.expand_path(File.join(File.dirname(__FILE__), ".."))
plugins = [ 'logstash-filter-clone',
'logstash-filter-mutate',
'logstash-input-generator',
'logstash-input-stdin',
'logstash-input-tcp',
'logstash-output-stdout']
plugins.each do |plugin|
gem plugin
end

View file

@ -0,0 +1,194 @@
PATH
remote: /Users/purbon/work/logstash
specs:
logstash (2.0.0.dev-java)
cabin (>= 0.6.0)
ci_reporter (= 1.9.3)
clamp
ftw (~> 0.0.40)
i18n (= 0.6.9)
insist (= 1.0.0)
jar-dependencies (= 0.1.2)
jrjackson
jruby-httpclient
logstash-devutils
maven-tools
mime-types
minitar
minitest
mocha
msgpack-jruby
pry
rack
rspec (~> 2.14.0)
ruby-maven
rumbster
shoulda
sinatra
spoon
stud
GEM
remote: https://rubygems.org/
specs:
activesupport (4.1.8)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
backports (3.6.4)
builder (3.2.2)
cabin (0.6.1)
ci_reporter (1.9.3)
builder (>= 2.1.2)
clamp (0.6.3)
coderay (1.1.0)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.2.5)
equalizer (0.0.9)
ffi (1.9.6-java)
ftw (0.0.42)
addressable
backports (>= 2.6.2)
cabin (> 0)
http_parser.rb (~> 0.6)
gem_publisher (1.5.0)
http_parser.rb (0.6.0-java)
i18n (0.6.9)
ice_nine (0.11.1)
insist (1.0.0)
jar-dependencies (0.1.2)
jls-grok (0.11.0)
cabin (>= 0.6.0)
jrjackson (0.2.7)
jruby-httpclient (1.1.1-java)
json (1.8.1-java)
logstash-codec-json (0.1.3)
logstash (>= 1.4.0, < 2.0.0)
logstash-codec-json_lines (0.1.3)
logstash (>= 1.4.0, < 2.0.0)
logstash-codec-line
logstash-codec-line (0.1.3)
logstash (>= 1.4.0, < 2.0.0)
logstash-codec-plain (0.1.3)
logstash (>= 1.4.0, < 2.0.0)
logstash-devutils (0.0.5-java)
gem_publisher
jar-dependencies
minitar
rake
logstash-filter-clone (0.1.2)
logstash (>= 1.4.0, < 2.0.0)
logstash-filter-grok (0.1.2)
jls-grok (= 0.11.0)
logstash (>= 1.4.0, < 2.0.0)
logstash-patterns-core
logstash-filter-mutate (0.1.2)
logstash (>= 1.4.0, < 2.0.0)
logstash-filter-grok
logstash-patterns-core
logstash-input-generator (0.1.1)
logstash (>= 1.4.0, < 2.0.0)
logstash-codec-plain
logstash-input-stdin (0.1.1)
logstash (>= 1.4.0, < 2.0.0)
logstash-codec-json
logstash-codec-json_lines
logstash-codec-line
logstash-codec-plain
logstash-input-tcp (0.1.1)
logstash (>= 1.4.0, < 2.0.0)
logstash-codec-json
logstash-codec-json_lines
logstash-codec-line
logstash-codec-plain
logstash-output-stdout (0.1.2)
logstash (>= 1.4.0, < 2.0.0)
logstash-codec-line
logstash-patterns-core (0.1.2)
logstash (>= 1.4.0, < 2.0.0)
mail (2.5.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
maven-tools (1.0.7)
virtus (~> 1.0)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (1.25.1)
minitar (0.5.4)
minitest (5.5.0)
mocha (1.1.0)
metaclass (~> 0.0.1)
msgpack-jruby (1.4.0-java)
polyglot (0.3.5)
pry (0.10.1-java)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
spoon (~> 0.0)
rack (1.5.2)
rack-protection (1.5.3)
rack
rake (10.4.2)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
ruby-maven (3.1.1.0.8)
maven-tools (~> 1.0.1)
ruby-maven-libs (= 3.1.1)
ruby-maven-libs (3.1.1)
rumbster (1.1.1)
mail (= 2.5.3)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.2.1)
shoulda-matchers (2.7.0)
activesupport (>= 3.0.0)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
slop (3.6.0)
spoon (0.0.4)
ffi
stud (0.0.18)
thread_safe (0.3.4-java)
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (1.2.2)
thread_safe (~> 0.1)
virtus (1.0.3)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
PLATFORMS
java
DEPENDENCIES
logstash!
logstash-filter-clone
logstash-filter-mutate
logstash-input-generator
logstash-input-stdin
logstash-input-tcp
logstash-output-stdout