Skip to content

Commit

Permalink
Merge pull request #28 from claytron/updates
Browse files Browse the repository at this point in the history
Update to latest Ruby for testing
  • Loading branch information
claytron authored Oct 26, 2022
2 parents 9c3c160 + 2feb867 commit 4fb4a59
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins:
enabled: true
rubocop:
enabled: true
channel: rubocop-0-92
channel: rubocop-1-31-0
markdownlint:
enabled: true
bundler-audit:
Expand Down
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: [2.6, 2.7, '3.0']
ruby: [2.7, '3.0', '3.1']
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.0'
- 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
17 changes: 15 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
AllCops:
TargetRubyVersion: 2.6
TargetRubyVersion: 2.7
Exclude:
- bin/**/*
- vendor/**/*
NewCops: enable

Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
Expand All @@ -16,6 +17,9 @@ Style/TrailingCommaInArrayLiteral:
Style/RedundantSelf:
Enabled: false

Style/Documentation:
Enabled: false

Layout/IndentationWidth:
Enabled: false

Expand All @@ -40,6 +44,15 @@ Layout/CaseIndentation:
EnforcedStyle: end
IndentOneStep: true

Metrics/AbcSize:
Max: 25

Metrics/CyclomaticComplexity:
Max: 25

Metrics/MethodLength:
Max: 20

# Ignore for rspec
Metrics/BlockLength:
ExcludedMethods: ['describe', 'context']
IgnoredMethods: ['describe', 'context']
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.2
2.7.6
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## 1.2.0 (2022-10-26)

- Test against latest Ruby 3.1, minimum version 2.7

## 1.1.2 (2022-04-12)

- Fix issue with mismatched case for Twitter screen_name. (#22)
Expand Down
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ gem 'pry-doc'

# Linting / completion
gem 'bundler-audit'
gem 'rubocop', '0.92'
# This has to match the code climate channel in .codeclimate.yml
gem 'rubocop', '1.31.0'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'solargraph'
71 changes: 35 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
PATH
remote: .
specs:
augury (1.1.2)
augury (1.2.0)
thor (~> 1.0.0)
twitter (~> 7.0)
word_wrap (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
awesome_print (1.9.2)
backport (1.2.0)
benchmark (0.2.0)
buftok (0.2.0)
bundler-audit (0.9.0.1)
bundler-audit (0.9.1)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
byebug (11.1.3)
Expand All @@ -39,47 +39,47 @@ GEM
http-cookie (~> 1.0)
http-form_data (~> 2.2)
http-parser (~> 1.2.0)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
http-form_data (2.3.0)
http-parser (1.2.3)
ffi-compiler (>= 1.0, < 2.0)
http_parser.rb (0.6.0)
jaro_winkler (1.5.4)
json (2.6.1)
kramdown (2.3.2)
json (2.6.2)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
memoizable (0.4.2)
thread_safe (~> 0.3, >= 0.3.1)
method_source (1.0.0)
mini_portile2 (2.8.0)
multipart-post (2.1.1)
multipart-post (2.2.3)
naught (1.1.0)
nokogiri (1.13.4)
nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
parallel (1.22.1)
parser (3.1.1.0)
parser (3.1.2.1)
ast (~> 2.4.1)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-awesome_print (9.6.11)
awesome_print (>= 1.1.0, < 999)
pry (>= 0.9.0, < 999)
pry-byebug (3.8.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (~> 0.10)
pry (>= 0.13, < 0.15)
pry-doc (1.3.0)
pry (~> 0.11)
yard (~> 0.9.11)
public_suffix (4.0.7)
public_suffix (5.0.0)
racc (1.6.0)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.3.0)
regexp_parser (2.6.0)
reverse_markdown (2.1.1)
nokogiri
rexml (3.2.5)
Expand All @@ -89,37 +89,36 @@ GEM
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
rspec-expectations (3.11.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (0.92.0)
rspec-support (3.11.1)
rubocop (1.31.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.5.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.18.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.17.0)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
rubocop-rake (0.5.1)
rubocop
rubocop-rspec (1.44.1)
rubocop (~> 0.87)
rubocop-ast (>= 0.7.1)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.12.1)
rubocop (~> 1.31)
ruby-progressbar (1.11.0)
simple_oauth (0.3.1)
simplecov (0.17.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
solargraph (0.44.3)
solargraph (0.47.2)
backport (~> 1.2)
benchmark
bundler (>= 1.17.2)
Expand All @@ -136,7 +135,7 @@ GEM
yard (~> 0.9, >= 0.9.24)
thor (1.0.1)
thread_safe (0.3.6)
tilt (2.0.10)
tilt (2.0.11)
twitter (7.0.0)
addressable (~> 2.3)
buftok (~> 0.2.0)
Expand All @@ -150,16 +149,16 @@ GEM
simple_oauth (~> 0.3.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.1)
unicode-display_width (1.8.0)
unf_ext (0.0.8.2)
unicode-display_width (2.3.0)
vcr (6.1.0)
webmock (3.14.0)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.7.0)
word_wrap (1.0.0)
yard (0.9.27)
yard (0.9.28)
webrick (~> 1.7.0)

PLATFORMS
Expand All @@ -174,7 +173,7 @@ DEPENDENCIES
pry-doc
rake
rspec (~> 3.0)
rubocop (= 0.92)
rubocop (= 1.31.0)
rubocop-rake
rubocop-rspec
simplecov (< 0.18)
Expand All @@ -183,4 +182,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.1.4
2.3.24
4 changes: 3 additions & 1 deletion augury.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ 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('>= 2.6.0')
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']

# Actual dependencies
# TODO: The options override in Augury::CLI doesn't work in Thor 1.1+
spec.add_dependency 'thor', '~>1.0.0'
spec.add_dependency 'twitter', '~>7.0'
## For the word_wrap function
spec.add_dependency 'word_wrap', '~>1.0'
spec.metadata['rubygems_mfa_required'] = 'true'
end
5 changes: 4 additions & 1 deletion bin/extract_creds
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
require 'yaml'

begin
augury_config = YAML.load_file(File.expand_path('~/.augury.yml'))
augury_config = YAML.load_file(
File.expand_path('~/.augury.yml'),
permitted_classes: [Regexp],
)
puts augury_config['twitter'].collect { |k, v| "export TWITTER_#{k.upcase}=#{v}" }.join("\n")
rescue Errno::ENOENT
puts 'echo "No config file present (~/.augury.yml) no env vars set"'
Expand Down
2 changes: 2 additions & 0 deletions exe/augury
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'augury/cli'
Augury::CLI.start
1 change: 1 addition & 0 deletions lib/augury/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def generate(username, *path)

private

# TODO: This override doesn't work in Thor 1.1+
def options
original_options = super
defaults = Thor::CoreExt::HashWithIndifferentAccess.new(
Expand Down
2 changes: 1 addition & 1 deletion lib/augury/fortune.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def twitter_setup

def transforms
all_transforms = []
all_transforms << [/https?:\/\/[^\s]+/, ''] if @config[:remove_links]
all_transforms << [%r{https?://[^\s]+}, ''] if @config[:remove_links]
return all_transforms unless @config[:apply_transforms]

all_transforms.push(*@config.dig('transforms', @username) || [])
Expand Down
2 changes: 1 addition & 1 deletion lib/augury/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Augury
VERSION = '1.1.2'
VERSION = '1.2.0'
end
8 changes: 4 additions & 4 deletions spec/lib/augury/fortune_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
let(:twitter_auth) do
{
twitter: {
'consumer_key' => ENV['TWITTER_CONSUMER_KEY'],
'consumer_secret' => ENV['TWITTER_CONSUMER_SECRET'],
'access_token' => ENV['TWITTER_ACCESS_TOKEN'],
'access_token_secret' => ENV['TWITTER_ACCESS_TOKEN_SECRET'],
'consumer_key' => ENV.fetch('TWITTER_CONSUMER_KEY', nil),
'consumer_secret' => ENV.fetch('TWITTER_CONSUMER_SECRET', nil),
'access_token' => ENV.fetch('TWITTER_ACCESS_TOKEN', nil),
'access_token_secret' => ENV.fetch('TWITTER_ACCESS_TOKEN_SECRET', nil),
},
}
end
Expand Down
6 changes: 0 additions & 6 deletions spec/lib/augury_spec.rb

This file was deleted.

0 comments on commit 4fb4a59

Please sign in to comment.