Sha256: ad7159254be1670b6ac376c3b8d74ce7a0a394d6b109e33eeba67e994ad787da

Contents?: true

Size: 1.27 KB

Versions: 27

Compression:

Stored size: 1.27 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 \(working directory clean\)/
        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

27 entries across 18 versions & 6 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/addressable-2.3.6/tasks/git.rake
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/addressable-2.3.6/tasks/git.rake
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/addressable-2.3.6/tasks/git.rake
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/addressable-2.3.6/tasks/git.rake
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/addressable-2.3.5/tasks/git.rake
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/addressable-2.3.6/tasks/git.rake
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/addressable-2.3.5/tasks/git.rake
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/addressable-2.3.6/tasks/git.rake
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/addressable-2.3.5/tasks/git.rake
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/addressable-2.3.6/tasks/git.rake
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/addressable-2.3.5/tasks/git.rake
whos_dated_who-0.1.0 vendor/bundle/gems/addressable-2.3.6/tasks/git.rake
whos_dated_who-0.0.1 vendor/bundle/gems/addressable-2.3.6/tasks/git.rake
addressable-2.3.6 tasks/git.rake
addressable-2.3.5 tasks/git.rake
addressable-2.3.4 tasks/git.rake
addressable-2.3.3 tasks/git.rake
simple-client-0.0.3 vendor/bundle/ruby/1.9.1/gems/addressable-2.2.8/tasks/git.rake
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/addressable-2.3.2/tasks/git.rake
simple-client-0.0.2 vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/git.rake