diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e5fe937..dfac7ba 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2024-05-02 18:53:23 UTC using RuboCop version 1.50.2. +# on 2024-05-02 19:00:08 UTC using RuboCop version 1.50.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -157,12 +157,6 @@ Performance/StringInclude: Exclude: - 'lib/hiera/backend/eyaml/utils.rb' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -Security/IoMethods: - Exclude: - - 'tools/git_tag_release.rb' - # Offense count: 1 Security/Open: Exclude: @@ -230,7 +224,7 @@ Style/EnvHome: Style/FormatStringToken: EnforcedStyle: unannotated -# Offense count: 37 +# Offense count: 36 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle. # SupportedStyles: always, always_true, never @@ -282,7 +276,7 @@ Style/MutableConstant: Exclude: - 'lib/hiera/backend/eyaml.rb' -# Offense count: 8 +# Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns. # SupportedStyles: predicate, comparison @@ -293,7 +287,6 @@ Style/NumericPredicate: - 'lib/hiera/backend/eyaml/parser/parser.rb' - 'lib/hiera/backend/eyaml/subcommands/edit.rb' - 'lib/hiera/backend/eyaml/utils.rb' - - 'tools/git_tag_release.rb' # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -347,12 +340,11 @@ Style/SelectByRegexp: Exclude: - 'hiera-eyaml.gemspec' -# Offense count: 2 +# Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). Style/SlicingWithRange: Exclude: - 'lib/hiera/backend/eyaml/edithelper.rb' - - 'tools/git_tag_release.rb' # Offense count: 4 # This cop supports unsafe autocorrection (--autocorrect-all). @@ -369,7 +361,7 @@ Style/StderrPuts: Exclude: - 'lib/hiera/backend/eyaml/logginghelper.rb' -# Offense count: 12 +# Offense count: 11 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. Style/StringConcatenation: @@ -382,7 +374,6 @@ Style/StringConcatenation: - 'lib/hiera/backend/eyaml/subcommands/help.rb' - 'lib/hiera/backend/eyaml/subcommands/unknown_command.rb' - 'lib/hiera/backend/eyaml/utils.rb' - - 'tools/git_tag_release.rb' # Offense count: 9 # This cop supports unsafe autocorrection (--autocorrect-all). diff --git a/Rakefile b/Rakefile index c3a0c87..da46006 100644 --- a/Rakefile +++ b/Rakefile @@ -21,7 +21,6 @@ else SimpleCov::Formatter::Codecov, ] end -require 'bundler/gem_tasks' # https://cucumber.io/docs/tools/ruby/ # https://stackoverflow.com/questions/6473419/using-simplecov-to-display-cucumber-code-coverage diff --git a/tools/git_tag_release.rb b/tools/git_tag_release.rb deleted file mode 100755 index eaa437f..0000000 --- a/tools/git_tag_release.rb +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9') - warn 'This script requires Ruby >= 1.9' - exit 1 -end - -require 'open3' -result = Open3.capture3('git rev-parse --show-toplevel') -unless result[2].exitstatus == 0 - warn 'You do not appear to be in a git repository. This script must be run from inside a git repository.' - exit 2 -end -filename = result[0].lines.first.chomp + '/CHANGES.md' -unless File.exist?(filename) - warn 'CHANGES.md not found. Please ensure that CHANGES.md exists.' - exit 3 -end -contents = IO.read(filename) - -lines = contents.lines.drop(3).map(&:chomp).reject(&:empty?) -versions = {} -currentversion = nil -versions[nil] = [] -lines.each_with_index do |line, index| - if /\A-+\z/.match?(line) - versions[currentversion].pop - currentversion = lines[index - 1] - versions[currentversion] = [] - else - versions[currentversion] << line - end -end -versions.delete(nil) - -def prompt(*args) - print(*args) - gets.chomp -end - -newest = versions.first[0] -version = prompt "Version [#{newest}]: " -version = newest if version.empty? - -unless versions[version] - warn "Version #{version} is invalid. Valid versions are: #{versions.keys.join(', ')}" - exit 4 -end - -tagname = "v#{version}" - -result = Open3.capture3("git rev-parse #{tagname}") -if result[2].exitstatus == 0 - warn "Tag #{tagname} already exists." - exit 5 -end - -commit = prompt 'Commit: ' - -result = Open3.capture3("git --no-pager log -1 #{commit} --format='%ci'") -unless result[2].exitstatus == 0 - warn "Commit '#{commit}' is not valid." - exit result[2].exitstatus -end -commitdate = result[0].lines.first.chomp - -def word_wrap(line, width) - first_prefix = line.match(/([ -]*)/)[1] - prefix = ' ' * first_prefix.size - real_width = width - (prefix.size * 2) - line[prefix.size..-1].gsub(/(^)?(.{1,#{real_width}})(?: +|$)/) do |s| - Regexp.last_match(1) ? "#{first_prefix}#{s}\n" : "#{prefix}#{s}\n" - end -end - -require 'tempfile' -begin - tf = Tempfile.new('tag-message') - tf.puts "Version #{version} release" - tf.puts '' - tf.puts 'Changes:' - versions[version].each do |line| - tf.puts word_wrap(line, 80) - end - tf.flush - - result = Open3.capture3({ 'GIT_COMMITTER_DATE' => commitdate }, "git tag -a #{tagname} #{commit} -F #{tf.path}") - warn result[1] - if result[2].exitstatus == 0 - system "git --no-pager show #{tagname} --no-patch" - puts '' - puts "Tag created. Please push to GitHub with `git push origin #{tagname}`." - end - exit result[2].exitstatus -ensure - tf.close! -end diff --git a/tools/regem.sh b/tools/regem.sh deleted file mode 100755 index 726ae15..0000000 --- a/tools/regem.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -# ToDo: Remove as 'rake install' task will build and install the latest gem? - -gem uninstall hiera-eyaml --executables -RAKE_OUT=`rake build` -echo ${RAKE_OUT} -VERSION=`echo ${RAKE_OUT} | awk '{print $2}'` -echo Installing version: ${VERSION} ... -gem install pkg/hiera-eyaml-${VERSION}.gem -eyaml version