add a check for a plugin to be in rubygems before going to install it

make sure dependency gems is installed

cleanup unnecessary code

Fixes #3021
This commit is contained in:
Pere Urbon-Bayes 2015-04-15 14:33:42 +02:00 committed by Jordan Sissel
parent b233a34ce9
commit 9e2ae1589e
3 changed files with 13 additions and 3 deletions

View file

@ -146,10 +146,16 @@ module LogStash
# @return [Array<String>] list of all plugin names as defined in the logstash-plugins github organization, minus names that matches the ALL_PLUGINS_SKIP_LIST
def self.fetch_all_plugins
require 'octokit'
Octokit.auto_paginate = true
repos = Octokit.organization_repositories("logstash-plugins")
repos.map(&:name).reject{|name| name =~ ALL_PLUGINS_SKIP_LIST}
repos.map(&:name).reject do |name|
name =~ ALL_PLUGINS_SKIP_LIST || !is_released?(name)
end
end
def self.is_released?(plugin)
require 'gems'
!Gems.search(plugin).empty?
end
end
end

View file

@ -29,4 +29,8 @@ namespace "dependency" do
Rake::Task["gem:require"].invoke("octokit", ">= 0", LogStash::Environment.logstash_gem_home)
end # task octokit
task "gems" do
Rake::Task["gem:require"].invoke("gems", ">= 0", LogStash::Environment.logstash_gem_home)
end # task gems
end # namespace dependency

View file

@ -50,7 +50,7 @@ namespace "plugin" do
task.reenable # Allow this task to be run again
end
task "install-all" => [ "dependency:octokit" ] do
task "install-all" => [ "dependency:octokit", "dependency:gems" ] do
puts("[plugin:install-all] Installing all plugins from https://github.com/logstash-plugins")
install_plugins("--no-verify", *LogStash::RakeLib.fetch_all_plugins)