Sha256: 910d70c48170ff86718255df587728f8bc023687b257f24c27a4ea4dd2f8420d

Contents?: true

Size: 1.27 KB

Versions: 21

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

21 entries across 21 versions & 5 rubygems

Version Path
jomz-google-api-client-0.7.1 tasks/git.rake
google-api-client-0.7.1 tasks/git.rake
google-api-client-0.7.0 tasks/git.rake
google-api-client-0.7.0.rc2 tasks/git.rake
google-api-client-0.6.4 tasks/git.rake
google-api-client-0.6.3 tasks/git.rake
autoparse-0.3.3 tasks/git.rake
google-api-omniauth-0.1.1 tasks/git.rake
google-api-client-0.6.2 tasks/git.rake
google-api-client-0.6.1 tasks/git.rake
google-api-client-0.6.0 tasks/git.rake
google-api-client-0.5.0 tasks/git.rake
google-api-client-0.4.7 tasks/git.rake
ghost_google-api-client-0.4.7.1 tasks/git.rake
google-api-client-0.4.6 tasks/git.rake
google-api-client-0.4.5 tasks/git.rake
autoparse-0.3.2 tasks/git.rake
google-api-client-0.4.4 tasks/git.rake
google-api-client-0.4.3 tasks/git.rake
google-api-client-0.4.2 tasks/git.rake