Sha256: 554822c4c7b4907a3dc58866ee4e07303b99187e9c255f5044c0f5201b5254b5

Contents?: true

Size: 1.16 KB

Versions: 11

Compression:

Stored size: 1.16 KB

Contents

require "bundler/gem_tasks"

# Require RSpec tasks
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

# Monkey patch Bundler::GemHelper
#
# Git flow create the tag after finishing a release however this breaks
# <b>rake release</b> because it expects that no tag for the current version
# is present, this patch overrides this behaviour to skip version tagging if
# the tag already exists instead of raising an exception
Bundler::GemHelper.class_eval <<-END, __FILE__, __LINE__ + 1
  # Tag the current version
  def tag_version
    unless already_tagged?
      sh %(git tag -a -m "Version \#{version}" \#{version_tag})
      Bundler.ui.confirm "Tagged \#{version_tag}"
    end
    yield if block_given?
  rescue
    Bundler.ui.error "Untagged \#{version_tag} due to error"
    sh_with_code "git tag -d \#{version_tag}"
    raise
  end

  # The original method raises an exception, we should override it
  def guard_already_tagged
  end

  # This method check if the tag has already been tagged
  def already_tagged?
    if sh('git tag').split(/\n/).include?(version_tag)
      true
    else
      false
    end
  end
END

# The default task is tests
task :default => :spec

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
watch_tower-0.0.3 Rakefile
watch_tower-0.0.2 Rakefile
watch_tower-0.0.1 Rakefile
watch_tower-0.0.1.beta12 Rakefile
watch_tower-0.0.1.beta11 Rakefile
watch_tower-0.0.1.beta10 Rakefile
watch_tower-0.0.1.beta9 Rakefile
watch_tower-0.0.1.beta8 Rakefile
watch_tower-0.0.1.beta7 Rakefile
watch_tower-0.0.1.beta6 Rakefile
watch_tower-0.0.1.beta5 Rakefile