Added review comments and improvements

fix the logstash_gem_path

added some love from @jsvd comments

added an LS_ENV variable that if set to test it install the plugin dependencies when running the plugin:install-all rake task2

made the vendor:deps task has a more concret behaviour and proper naming

cleanup the all plugins install to only do the installation

added some code to fetch dependencies throw some gemcode within the gemfile as @electrical proposed

Revert "added some code to fetch dependencies throw some gemcode within the gemfile as @electrical proposed"

This reverts commit 20c3243485129c388d1da4ac930a479f017e0d99.

fix a path on the run all plugins test rake task

Fixes #2371
This commit is contained in:
Pere Urbon-Bayes 2015-01-19 15:58:11 +01:00 committed by Jordan Sissel
parent 6e63f6c6b2
commit 002104f3c8
3 changed files with 7 additions and 12 deletions

View file

@ -23,7 +23,6 @@ namespace "plugin" do
task "install-all" => [ "dependency:octokit" ] do
Rake::Task["vendor:bundle"].invoke("tools/Gemfile.plugins.all")
Rake::Task["vendor:deps"].invoke("tools/Gemfile.plugins.all")
end
end # namespace "plugin"

View file

@ -19,7 +19,7 @@ namespace "test" do
task "all-plugins" => [ "bootstrap","plugin:install-all" ] do
require "logstash/environment"
gem_home = LogStash::Environment.logstash_gem_home
pattern = "#{gem_home}/logstash-*/spec/{input,filter,codec,output}s/*_spec.rb"
pattern = "#{gem_home}/gems/logstash-*/spec/{input,filter,codec,output}s/*_spec.rb"
sh "#{LogStath::Environment::LOGSTASH_HOME}/bin/logstash rspec --order rand #{pattern}"
end

View file

@ -124,30 +124,26 @@ namespace "vendor" do
end # task gems
task "all" => "gems"
task "deps", [:gemfile] => [ "dependency:bundler" ] do |task, args|
dependencies = {}
task "append_development_dependencies", [:gemfile] do |task, args|
dependencies = []
# grab the development dependencies
Dir.glob("vendor/bundle/jruby/*/gems/logstash-*/*.gemspec") do |gemspec|
gem_home = LogStash::Environment.logstash_gem_home
Dir.glob("#{gem_home}/gems/logstash-*/*.gemspec") do |gemspec|
spec = Gem::Specification.load(gemspec)
spec.development_dependencies.each do |dependency|
dependencies[dependency.name] = dependency
dependencies << dependency
end
end
deps_gemfile = args[:gemfile]
temp_data = File.read(deps_gemfile)
# generate the gemfile.
File.open(deps_gemfile, "a") do |file|
dependencies.values.each do |dependency|
dependencies.each do |dependency|
next if dependency.name.start_with?('logstash-')
requirements = dependency.requirement.to_s.split(',').map { |s| "'#{s.strip}'" }.join(',')
s = "gem '#{dependency.name}', #{requirements}"
file.puts s
end
end
# run bundle install with this new gemfile
Rake::Task["vendor:bundle"].invoke(deps_gemfile)
FileUtils.rm(deps_gemfile)
File.write(deps_gemfile, temp_data)
end
task "bundle", [:gemfile] => [ "dependency:bundler" ] do |task, args|