From 802432861d238b4d7d3f2ea4ae030047218956ff Mon Sep 17 00:00:00 2001 From: Clayton Parker Date: Wed, 6 Mar 2024 09:50:59 -0500 Subject: [PATCH 1/2] fix for yaml regex in ruby 3 --- lib/augury/cli.rb | 4 +++- spec/fixtures/transforms.yml | 4 ++++ spec/lib/augury/cli_spec.rb | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/transforms.yml diff --git a/lib/augury/cli.rb b/lib/augury/cli.rb index ae1a3bc..458704d 100644 --- a/lib/augury/cli.rb +++ b/lib/augury/cli.rb @@ -86,7 +86,9 @@ def options config_path = File.expand_path(ENV.fetch('AUGURY_CFG_PATH', '~/.augury.yml')) if File.file?(config_path) - config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {}) + config_options = Thor::CoreExt::HashWithIndifferentAccess.new( + YAML.load_file(config_path, permitted_classes: [Regexp]) || {}, + ) defaults = defaults.merge(config_options) end diff --git a/spec/fixtures/transforms.yml b/spec/fixtures/transforms.yml new file mode 100644 index 0000000..2834f8f --- /dev/null +++ b/spec/fixtures/transforms.yml @@ -0,0 +1,4 @@ +global-transforms: + - + - !ruby/regexp /(hello)/i + - "\\1 world" diff --git a/spec/lib/augury/cli_spec.rb b/spec/lib/augury/cli_spec.rb index 53683a7..509d759 100644 --- a/spec/lib/augury/cli_spec.rb +++ b/spec/lib/augury/cli_spec.rb @@ -83,5 +83,14 @@ }, ) end + + it 'allows regex in transforms' do + ENV['AUGURY_CFG_PATH'] = 'spec/fixtures/transforms.yml' + expect(subject.send(:options)).to include( + { + 'global-transforms' => [[/(hello)/i, '\\1 world']], + }, + ) + end end end From 84c6dfc63e8104146482b79f7f3a1f2217fe81f8 Mon Sep 17 00:00:00 2001 From: Clayton Parker Date: Wed, 6 Mar 2024 09:54:22 -0500 Subject: [PATCH 2/2] set minimum ruby to 3.1 --- .github/workflows/ci.yml | 4 ++-- .rubocop.yml | 2 +- CHANGELOG.md | 2 +- augury.gemspec | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ec8323..2b1a6ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - ruby: ['3.0', '3.1', '3.2', "3.3"] + ruby: ['3.1', '3.2', "3.3"] runs-on: ${{ matrix.os }} env: TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} @@ -23,7 +23,7 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - run: bundle exec rake - - if: matrix.os == 'ubuntu-latest' && matrix.ruby == '3.2' + - if: matrix.os == 'ubuntu-latest' && matrix.ruby == '3.1' run: | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter chmod +x ./cc-test-reporter diff --git a/.rubocop.yml b/.rubocop.yml index 767f5f2..3a839f6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 3.2 + TargetRubyVersion: 3.1 Exclude: - bin/**/* - vendor/**/* diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b1df2..e3f512c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2.0.0 (2024-03-05) -- Test against latest Ruby 3.3 and minimum 3.0.x +- Test against latest Ruby 3.3 and minimum 3.1.x ## 1.2.0 (2022-10-26) diff --git a/augury.gemspec b/augury.gemspec index b7da746..4ee011b 100644 --- a/augury.gemspec +++ b/augury.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |spec| spec.description = 'This gem turns a twitter feed into a fortune file that you can use with the fortune program' spec.homepage = 'https://github.com/claytron/augury' spec.license = 'MIT' - spec.required_ruby_version = Gem::Requirement.new('>= 3.0') + spec.required_ruby_version = Gem::Requirement.new('>= 3.1') spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = 'exe'