Sha256: 4b0320cfae1b451de100eb76497ddf74eefbc4a662f67fde1d7b03930039917b

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

Contents

# frozen_string_literal: true

autoload :Changelog, "#{__dir__}/changelog"

namespace :changelog do
  %i[new fix change].each do |type|
    desc "Create a Changelog entry (#{type})"
    task type, [:id] do |_task, args|
      ref_type = :pull if args[:id]
      path = Changelog::Entry.new(type: type, ref_id: args[:id], ref_type: ref_type).write
      cmd = "git add #{path}"
      system cmd
      puts "Entry '#{path}' created and added to git index"
    end
  end

  desc "Merge entries and delete them"
  task :merge do
    raise "No entries!" unless Changelog.pending?

    Changelog.new.merge!.and_delete!
    cmd = "git commit -a -m 'Update Changelog'"
    puts cmd
    system cmd
  end

  desc "Check to see if there are any entries left"
  task :check_clean do
    next unless Changelog.pending?

    puts "*** Pending changelog entries!"
    puts "Do `bundle exec rake changelog:merge`"
    exit(1)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-rspec-extra-0.1.0 tasks/changelog.rake