Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for yaml regex in ruby 3 #33

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 3.2
TargetRubyVersion: 3.1
Exclude:
- bin/**/*
- vendor/**/*
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion augury.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 3 additions & 1 deletion lib/augury/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions spec/fixtures/transforms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
global-transforms:
-
- !ruby/regexp /(hello)/i
- "\\1 world"
9 changes: 9 additions & 0 deletions spec/lib/augury/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading