Sha256: 9923555ed0f5c8dc6fe21b01ff2e54cd9355a49158617cade448cb5cd0df43a7

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

# Extract META-INFO/services/* files from jars
#
require "optparse"

output = nil

flags = OptionParser.new do |opts|
  opts.on("-o", "--output DIR",
          "Where to write the merged META-INF/services/* files") do |dir|
    output = dir
  end
end

flags.parse!(ARGV)

ARGV.each do |jar|
  # Find any files matching /META-INF/services/* in any jar given on the
  # command line.
  # Append all file content to the output directory with the same file name
  # as is in the jar.
  glob = "file:///#{File.expand_path(jar)}!/META-INF/services/*"
  Dir.glob(glob).each do |service|
    name = File.basename(service)
    File.open(File.join(output, name), "a") do |fd|
      puts "Adding #{name} from #{File.basename(jar)}"
      fd.write(File.read(service))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-lib-1.3.2 extract_services.rb