Sha256: e7d6d01412e622dd4a7e2f7f764c1dc44e87785e280ed0891e56e836b4aa46a1

Contents?: true

Size: 1.24 KB

Versions: 69

Compression:

Stored size: 1.24 KB

Contents

namespace :git do
  namespace :tag do
    desc "List tags from the Git repository"
    task :list do
      tags = `git tag -l`
      tags.gsub!("\r", "")
      tags = tags.split("\n").sort {|a, b| b <=> a }
      puts tags.join("\n")
    end

    desc "Create a new tag in the Git repository"
    task :create do
      changelog = File.open("CHANGELOG.md", "r") { |file| file.read }
      puts "-" * 80
      puts changelog
      puts "-" * 80
      puts

      v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
      abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION

      git_status = `git status`
      if git_status !~ /^nothing to commit/
        abort "Working directory isn't clean."
      end

      tag = "#{PKG_NAME}-#{PKG_VERSION}"
      msg = "Release #{PKG_NAME}-#{PKG_VERSION}"

      existing_tags = `git tag -l #{PKG_NAME}-*`.split('\n')
      if existing_tags.include?(tag)
        warn("Tag already exists, deleting...")
        unless system "git tag -d #{tag}"
          abort "Tag deletion failed."
        end
      end
      puts "Creating git tag '#{tag}'..."
      unless system "git tag -a -m \"#{msg}\" #{tag}"
        abort "Tag creation failed."
      end
    end
  end
end

task "gem:release" => "git:tag:create"

Version data entries

69 entries across 56 versions & 13 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/addressable-2.5.2/tasks/git.rake
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/addressable-2.5.2/tasks/git.rake
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/addressable-2.5.2/tasks/git.rake
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/addressable-2.5.2/tasks/git.rake
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/addressable-2.5.1/tasks/git.rake
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/git.rake
tdiary-5.0.7 vendor/bundle/gems/addressable-2.5.2/tasks/git.rake
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/addressable-2.5.2/tasks/git.rake
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/addressable-2.5.1/tasks/git.rake
cloudsmith-api-0.21.4 vendor/bundle/ruby/2.3.0/gems/addressable-2.5.2/tasks/git.rake
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/addressable-2.4.0/tasks/git.rake
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/addressable-2.4.0/tasks/git.rake
tdiary-5.0.6 vendor/bundle/gems/addressable-2.5.2/tasks/git.rake
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/addressable-2.5.1/tasks/git.rake
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/addressable-2.5.1/tasks/git.rake
addressable-2.5.2 tasks/git.rake
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/addressable-2.5.1/tasks/git.rake
tdiary-5.0.5 vendor/bundle/gems/addressable-2.5.0/tasks/git.rake
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/addressable-2.5.0/tasks/git.rake
tdiary-5.0.5 vendor/bundle/gems/addressable-2.5.1/tasks/git.rake