Sha256: 5553e44c6d2f7cd0b0722e96e508d812d85d355b2b10d3eba8870023000d9129

Contents?: true

Size: 1.68 KB

Versions: 61

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:windows", "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

61 entries across 59 versions & 10 rubygems

Version Path
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.0.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
svix-0.53.1 vendor/bundle/ruby/2.7.0/gems/ffi-1.15.1/rakelib/ffi_gem_helper.rb
svix-0.53.0 vendor/bundle/ruby/2.7.0/gems/ffi-1.15.1/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha43 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha42 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha41 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha40 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha39 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha38 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha37 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha36 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-kratos-client-0.8.2.alpha1 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha31 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha30 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha29 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb
ory-client-0.0.1.alpha28 vendor/bundle/ruby/2.5.0/gems/ffi-1.15.4/rakelib/ffi_gem_helper.rb