Sha256: 313c9f429aa2020c629e3ea2f4fe6ef0e4c1bb1433e96fbaea5e1565ce2acf56

Contents?: true

Size: 1.65 KB

Versions: 21

Compression:

Stored size: 1.65 KB

Contents

require 'bundler'
Bundler::GemHelper.install_tasks

task :my_release => ['changelog', 'release'] do
end

task :changelog do

  helper = Bundler::GemHelper.new(Dir.pwd)
  version = "v#{helper.gemspec.version}"

  changelog_file = 'CHANGELOG'
  entries = ""

  # Get a list of current tags
  tags = `git tag -l`.split
  tags = tags.sort_by {|t| t[1..-1].split(".").collect {|s| s.to_i } }
  newest_tag = tags[-1]
  
  if version == newest_tag
    puts "You need to update version, same as most recent tag: #{version}"
    exit
  end

  # If we already have a changelog, make the last tag be the
  # last one in the changelog, and the next one be the one
  # following that in the tag list
  newest_changelog_version = nil
  if File.exist?(changelog_file)
    entries = File.read(changelog_file)
    head = entries.split.first
    if head =~ /\d\.\d\.\d/
      newest_changelog_version = "v#{head}"

      if version == newest_changelog_version
        puts "You need to update version, same as most recent changelog: #{version}"
        exit
      end

    end
  end

  # Generate changelog from repo
  log=`git log --pretty='format:%s <%h> [%cn]' #{newest_tag}..HEAD`

  # Strip out maintenance entries
  log = log.lines.to_a.delete_if do |l|
     l =~ /^Regenerated? gemspec/ ||
         l =~ /^version bump/i ||
         l =~ /^Updated changelog/ ||
         l =~ /^Merged? branch/
  end

  # Write out changelog file
  File.open(changelog_file, 'w') do |out|
    out.puts version.gsub(/^v/, '')
    out.puts "-----"
    out.puts "\n"
    out.puts log
    out.puts "\n"
    out.puts entries
  end

  # Commit and push
  sh "git ci -m'Updated changelog' #{changelog_file}"
  sh "git push"
end

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
sidekiq-dynamic-queues-0.6.0 Rakefile
resque-queue-priority-0.6.2 Rakefile
sidekiq-dynamic-queues-0.5.6 Rakefile
sidekiq-dynamic-queues-0.5.5 Rakefile
sidekiq-dynamic-queues-0.5.4 Rakefile
sidekiq-dynamic-queues-0.5.3 Rakefile
sidekiq-dynamic-queues-0.5.2 Rakefile
sidekiq-dynamic-queues-0.5.1 Rakefile
sidekiq-dynamic-queues-0.5.0 Rakefile
resque-dynamic-queues-0.8.1 Rakefile
resque-queue-priority-0.6.1 Rakefile
resque-filter-0.5.0 Rakefile
resque-dynamic-queues-0.8.0 Rakefile
resque-queue-priority-0.6.0 Rakefile
resque-queue-priority-0.5.3 Rakefile
resque-queue-priority-0.5.2 Rakefile
resque-dynamic-queues-0.7.1 Rakefile
resque-dynamic-queues-0.7.0 Rakefile
resque-queue-priority-0.5.1 Rakefile
resque-queue-priority-0.5.0 Rakefile