From 07b6f4533cea6efed4d7618f99ea73ce527703bf Mon Sep 17 00:00:00 2001 From: Colin Surprenant Date: Mon, 4 May 2015 20:15:57 -0400 Subject: [PATCH] support remote or local gem packaging typo --- rakelib/artifacts.rake | 15 ++++++++++++++- rakelib/plugin.rake | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rakelib/artifacts.rake b/rakelib/artifacts.rake index 0f2758195..53bb46d72 100644 --- a/rakelib/artifacts.rake +++ b/rakelib/artifacts.rake @@ -51,7 +51,20 @@ namespace "artifact" do File.open(".bundle/config", "w") { } end - task "prepare" => ["bootstrap", "plugin:install-default", "plugin:install-local-logstash-core-gem", "clean-bundle-config"] + # locate the "gem "logstash-core" ..." line in Gemfile, and if the :path => "." option if specified + # build and install the local logstash-core gem otherwise just do nothing, bundler will deal with it. + task "install-logstash-core" do + lines = File.readlines("Gemfile") + matches = lines.select{|line| line[/^gem\s+["']logstash-core["']/i]} + abort("ERROR: Gemfile format error, need a single logstash-core gem specification") if matches.size != 1 + if matches.first =~ /:path\s*=>\s*["']\.["']/ + Rake::Task["plugin:install-local-logstash-core-gem"].invoke + else + puts("[artifact:install-logstash-core] using logstash-core from Rubygems") + end + end + + task "prepare" => ["bootstrap", "plugin:install-default", "install-logstash-core", "clean-bundle-config"] desc "Build a tar.gz of logstash with all dependencies" task "tar" => ["prepare"] do diff --git a/rakelib/plugin.rake b/rakelib/plugin.rake index 487086672..2affde9bf 100644 --- a/rakelib/plugin.rake +++ b/rakelib/plugin.rake @@ -61,6 +61,8 @@ namespace "plugin" do Dir["logstash-core*.gem"].each do |gem| rm(gem) end + + task.reenable # Allow this task to be run again end task "build-logstash-core-gem" => [ "clean-logstash-core-gem" ] do