Sha256: ccd54926056ffda2a6ecd54bfde8c04220f1ffe89d6feabeee1c2e3f6cce1890

Contents?: true

Size: 887 Bytes

Versions: 2

Compression:

Stored size: 887 Bytes

Contents

raise "Only JRuby is supported at this time." unless RUBY_PLATFORM == "java"
require "gem_publisher"

# gem_publisher uses Open3.capture3 to call git binary
# this does not work on jruby. Open3.popen3 works
if RUBY_PLATFORM == "java"
  module GemPublisher
    class CliFacade
      def execute(*arguments)
        cmd = Shellwords.join(arguments)
        puts cmd
        Open3.popen3(cmd) do |_i, stdout, stderr, thr|
          output = [stderr.read, stdout.read].join.strip
          raise Error, output if thr.value.exitstatus > 0
          return output
        end
      end
    end
  end
end

desc "Publish gem to RubyGems.org"
task :publish_gem do |t|
  gem_file = Dir.glob("*.gemspec").first
  if gem_file.nil?
    raise "Cannot find any gemspec, checked for '*.gemspec.'" 
  end
  gem = GemPublisher.publish_if_updated(gem_file, :rubygems)
  puts "Published #{gem}" if gem
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
logstash-devutils-0.0.4-java lib/logstash/devutils/rake/publish.rake
logstash-devutils-0.0.3-java lib/logstash/devutils/rake/publish.rake