Sha256: a499c6ce06eaf7bfafd1869ca02be1b1b9b66edfe4b7850ff43b252656985656

Contents?: true

Size: 971 Bytes

Versions: 2

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

require 'xezat'

module Xezat
  class FilePermissionError < StandardError
  end

  module Command
    class Bump
      def get_changelog(variables, options, readme_file)
        Xezat.logger.debug('Append latest log to changelog')
        current_version = variables[:PVR].intern
        if FileTest.exist?(readme_file)
          raise FilePermissionError, "Cannot read #{readme_file}" unless FileTest.readable?(readme_file)
          raise FilePermissionError, "Cannot write #{readme_file}" unless FileTest.writable?(readme_file)

          changelog = Cygchangelog.new(File.read(readme_file))
          message = options['message'] || 'Version bump.'
          changelog[current_version] = message unless changelog.key?(current_version)
        else
          changelog = Cygchangelog.new
          changelog[current_version] = 'Initial release by fd0 <https://github.com/fd00/>'
        end
        changelog
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xezat-0.2.0 lib/xezat/command/bump/changelog.rb
xezat-0.1.2 lib/xezat/command/bump/changelog.rb