Sha256: dfaf0120b831b43dc0687d2fa282c12b5485bce89e7e70adcbda803a2b2421d7

Contents?: true

Size: 1.68 KB

Versions: 6603

Compression:

Stored size: 1.68 KB

Contents

require 'bundler'
require 'bundler/gem_helper'

class FfiGemHelper < Bundler::GemHelper
  attr_accessor :cross_platforms

  def install
    super

    task "release:guard_clean" => ["release:update_history"]

    task "release:update_history" do
      update_history
    end

    task "release:rubygem_push" => ["gem:native", "gem:java"]
  end

  def hfile
    "CHANGELOG.md"
  end

  def headline
    '([^\w]*)(\d+\.\d+\.\d+(?:\.\w+)?)([^\w]+)([2Y][0Y][0-9Y][0-9Y]-[0-1M][0-9M]-[0-3D][0-9D])([^\w]*|$)'
  end

  def reldate
    Time.now.strftime("%Y-%m-%d")
  end

  def update_history
    hin = File.read(hfile)
    hout = hin.sub(/#{headline}/) do
      raise "#{hfile} isn't up-to-date for version #{version}" unless $2==version.to_s
      $1 + $2 + $3 + reldate + $5
    end
    if hout != hin
      Bundler.ui.confirm "Updating #{hfile} for release."
      File.write(hfile, hout)
      Rake::FileUtilsExt.sh "git", "commit", hfile, "-m", "Update release date in #{hfile}"
    end
  end

  def tag_version
    Bundler.ui.confirm "Tag release with annotation:"
    m = File.read(hfile).match(/(?<annotation>#{headline}.*?)#{headline}/m) || raise("Unable to find release notes in #{hfile}")
    Bundler.ui.info(m[:annotation].gsub(/^/, "    "))
    IO.popen(["git", "tag", "--file=-", version_tag], "w") do |fd|
      fd.write m[:annotation]
    end
    yield if block_given?
  rescue
    Bundler.ui.error "Untagging #{version_tag} due to error."
    sh_with_code "git tag -d #{version_tag}"
    raise
  end

  def rubygem_push(path)
    cross_platforms.each do |ruby_platform|
      super(path.gsub(/\.gem\z/, "-#{ruby_platform}.gem"))
    end
    super(path.gsub(/\.gem\z/, "-java.gem"))
    super(path)
  end
end

Version data entries

6,603 entries across 6,603 versions & 29 rubygems

Version Path
ory-oathkeeper-client-0.38.18.beta1 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-oathkeeper-client-0.38.17.beta1 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
avalara_sdk-2.4.7 vendor/bundle/ruby/2.6.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha58 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha57 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha56 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha55 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha54 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha53 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha52 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha51 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha50 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha49 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha48 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha47 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha46 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha45 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha44 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.5/rakelib/ffi_gem_helper.rb
ffi-1.15.5 rakelib/ffi_gem_helper.rb
ffi-1.15.5-java rakelib/ffi_gem_helper.rb