Skip to content

Commit edff3ee

Browse files
committed
Update gems and CI
1 parent 1ef3200 commit edff3ee

26 files changed

+345
-263
lines changed

.github/workflows/ci.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
name: CI
3+
on:
4+
push:
5+
tags: ['v*']
6+
branches: [main]
7+
pull_request:
8+
branches: ['**']
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- ruby: '2.3'
17+
rails: '5.2'
18+
bundler: '1'
19+
- ruby: '2.4'
20+
rails: '5.2'
21+
bundler: '1'
22+
- ruby: '2.5'
23+
rails: '6.0'
24+
bundler: 'default'
25+
- ruby: '2.6'
26+
rails: '6.0'
27+
bundler: 'default'
28+
- ruby: '2.7'
29+
rails: '6.1'
30+
bundler: 'default'
31+
env:
32+
RAILS_VERSION: ${{ matrix.rails }}
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: ruby/setup-ruby@v1
37+
with:
38+
ruby-version: ${{ matrix.ruby }}
39+
bundler: ${{ matrix.bundler }}
40+
bundler-cache: true
41+
- run: bundle exec rubocop
42+
if: matrix.ruby == '2.7'
43+
- run: bundle exec rspec --format doc
44+
- uses: codecov/codecov-action@v3
45+
if: matrix.ruby == '2.7'
46+
with:
47+
files: coverage/coverage.xml
48+
- run: bin/yardoc --fail-on-warning
49+
if: matrix.ruby == '2.7'
50+
- run: bin/check-version
51+
52+
release:
53+
needs: test
54+
if: startsWith(github.ref, 'refs/tags/v')
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v2
58+
- uses: dawidd6/action-publish-gem@v1
59+
with:
60+
api_key: ${{secrets.RUBYGEMS_API_KEY}}

.rubocop.yml

+116-23
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,127 @@
11
---
2+
require:
3+
- rubocop-rspec
4+
25
AllCops:
6+
SuggestExtensions: false
37
TargetRubyVersion: 2.3
48

5-
Layout/AlignArguments:
6-
EnforcedStyle: with_fixed_indentation
7-
8-
Layout/EndAlignment:
9-
EnforcedStyleAlignWith: variable
10-
11-
Layout/AlignParameters:
12-
EnforcedStyle: with_fixed_indentation
9+
Gemspec/DeprecatedAttributeAssignment: { Enabled: true }
10+
Gemspec/RequireMFA: { Enabled: true }
1311

14-
Layout/IndentFirstArgument:
15-
EnforcedStyle: consistent
12+
Layout/ArgumentAlignment: { EnforcedStyle: with_fixed_indentation }
13+
Layout/CaseIndentation: { EnforcedStyle: end }
14+
Layout/EndAlignment: { EnforcedStyleAlignWith: start_of_line }
15+
Layout/FirstArgumentIndentation: { EnforcedStyle: consistent }
16+
Layout/FirstArrayElementIndentation: { EnforcedStyle: consistent }
17+
Layout/FirstHashElementIndentation: { EnforcedStyle: consistent }
18+
Layout/LineContinuationLeadingSpace: { Enabled: true }
19+
Layout/LineContinuationSpacing: { Enabled: true }
20+
Layout/LineEndStringConcatenationIndentation: { Enabled: true, EnforcedStyle: indented }
21+
Layout/LineLength: { Max: 120 }
22+
Layout/MultilineMethodCallIndentation: { EnforcedStyle: indented }
23+
Layout/ParameterAlignment: { EnforcedStyle: with_fixed_indentation }
24+
Layout/RescueEnsureAlignment: { Enabled: false }
25+
Layout/SpaceBeforeBrackets: { Enabled: true }
1626

17-
Layout/IndentFirstArrayElement:
18-
EnforcedStyle: consistent
27+
Lint/AmbiguousAssignment: { Enabled: true }
28+
Lint/AmbiguousOperatorPrecedence: { Enabled: true }
29+
Lint/AmbiguousRange: { Enabled: true }
30+
Lint/ConstantOverwrittenInRescue: { Enabled: true }
31+
Lint/DeprecatedConstants: { Enabled: true }
32+
Lint/DuplicateBranch: { Enabled: true }
33+
Lint/DuplicateRegexpCharacterClassElement: { Enabled: true }
34+
Lint/EmptyBlock: { Enabled: true }
35+
Lint/EmptyClass: { Enabled: true }
36+
Lint/EmptyInPattern: { Enabled: true }
37+
Lint/IncompatibleIoSelectWithFiberScheduler: { Enabled: true }
38+
Lint/LambdaWithoutLiteralBlock: { Enabled: true }
39+
Lint/NoReturnInBeginEndBlocks: { Enabled: true }
40+
Lint/NonAtomicFileOperation: { Enabled: true }
41+
Lint/NumberedParameterAssignment: { Enabled: true }
42+
Lint/OrAssignmentToConstant: { Enabled: true }
43+
Lint/RaiseException: { Enabled: true }
44+
Lint/RedundantDirGlobSort: { Enabled: true }
45+
Lint/RefinementImportMethods: { Enabled: true }
46+
Lint/RequireRangeParentheses: { Enabled: true }
47+
Lint/RequireRelativeSelfPath: { Enabled: true }
48+
Lint/StructNewOverride: { Enabled: true }
49+
Lint/SymbolConversion: { Enabled: true }
50+
Lint/ToEnumArguments: { Enabled: true }
51+
Lint/TripleQuotes: { Enabled: true }
52+
Lint/UnexpectedBlockArity: { Enabled: true }
53+
Lint/UnmodifiedReduceAccumulator: { Enabled: true }
54+
Lint/UselessRuby2Keywords: { Enabled: true }
1955

20-
Layout/IndentFirstHashElement:
21-
EnforcedStyle: consistent
56+
RSpec/BeEq: { Enabled: true }
57+
RSpec/BeNil: { Enabled: true }
58+
RSpec/Capybara/SpecificMatcher: { Enabled: true }
59+
RSpec/ChangeByZero: { Enabled: true }
60+
RSpec/ExampleLength: { Enabled: false }
61+
RSpec/ExcessiveDocstringSpacing: { Enabled: true }
62+
RSpec/FactoryBot/SyntaxMethods: { Enabled: true }
63+
RSpec/FilePath: { Enabled: false }
64+
RSpec/IdenticalEqualityAssertion: { Enabled: true }
65+
RSpec/MessageSpies: { Enabled: false }
66+
RSpec/MultipleExpectations: { Enabled: false }
67+
RSpec/MultipleMemoizedHelpers: { Enabled: false }
68+
RSpec/NamedSubject: { Enabled: false }
69+
RSpec/Rails/AvoidSetupHook: { Enabled: true }
70+
RSpec/Rails/HaveHttpStatus: { Enabled: true }
71+
RSpec/SubjectDeclaration: { Enabled: true }
72+
RSpec/SubjectStub: { Enabled: false }
73+
RSpec/VerifiedDoubleReference: { Enabled: true }
2274

23-
Layout/MultilineMethodCallIndentation:
24-
EnforcedStyle: indented
75+
Metrics/AbcSize: { Max: 40 }
76+
Metrics/BlockLength: { Enabled: false }
77+
Metrics/ClassLength: { Enabled: false }
78+
Metrics/CyclomaticComplexity: { Enabled: false }
79+
Metrics/MethodLength: { Max: 30 }
80+
Metrics/PerceivedComplexity: { Enabled: false }
2581

26-
Style/Documentation:
27-
Enabled: false
82+
Naming/BlockForwarding: { Enabled: true }
83+
Naming/MethodParameterName: { MinNameLength: 1 }
2884

29-
Style/FrozenStringLiteralComment:
30-
Enabled: true
31-
EnforcedStyle: always
85+
Security/CompoundHash: { Enabled: true }
86+
Security/IoMethods: { Enabled: true }
3287

33-
Style/EmptyMethod:
34-
EnforcedStyle: expanded
88+
Style/ArgumentsForwarding: { Enabled: true }
89+
Style/CollectionCompact: { Enabled: true }
90+
Style/DocumentDynamicEvalDefinition: { Enabled: false }
91+
Style/Documentation: { Enabled: false }
92+
Style/EmptyHeredoc: { Enabled: true }
93+
Style/EmptyMethod: { EnforcedStyle: expanded }
94+
Style/EndlessMethod: { Enabled: true }
95+
Style/ExplicitBlockArgument: { Enabled: false }
96+
Style/EnvHome: { Enabled: true }
97+
Style/FetchEnvVar: { Enabled: true }
98+
Style/FileRead: { Enabled: true }
99+
Style/FileWrite: { Enabled: true }
100+
Style/FrozenStringLiteralComment: { Enabled: true, EnforcedStyle: always }
101+
Style/GuardClause: { Enabled: false }
102+
Style/HashConversion: { Enabled: true }
103+
Style/HashEachMethods: { Enabled: true }
104+
Style/HashExcept: { Enabled: true }
105+
Style/HashTransformKeys: { Enabled: false }
106+
Style/HashTransformValues: { Enabled: false }
107+
Style/IfUnlessModifier: { Enabled: false }
108+
Style/IfWithBooleanLiteralBranches: { Enabled: true }
109+
Style/InPatternThen: { Enabled: true }
110+
Style/MagicCommentFormat: { Enabled: true }
111+
Style/MapCompactWithConditionalBlock: { Enabled: true }
112+
Style/MapToHash: { Enabled: true }
113+
Style/MultilineInPatternThen: { Enabled: true }
114+
Style/NegatedIfElseCondition: { Enabled: true }
115+
Style/NestedFileDirname: { Enabled: true }
116+
Style/NilLambda: { Enabled: true }
117+
Style/NumberedParameters: { Enabled: true }
118+
Style/NumberedParametersLimit: { Enabled: true }
119+
Style/ObjectThen: { Enabled: true }
120+
Style/OpenStructUse: { Enabled: false }
121+
Style/QuotedSymbols: { Enabled: true }
122+
Style/RedundantArgument: { Enabled: true }
123+
Style/RedundantInitialize: { Enabled: true }
124+
Style/RedundantSelfAssignmentBranch: { Enabled: true }
125+
Style/SelectByRegexp: { Enabled: true }
126+
Style/StringChars: { Enabled: true }
127+
Style/SwapValues: { Enabled: true }

.travis.yml

-42
This file was deleted.

.yamllint.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
rules:
3+
braces:
4+
min-spaces-inside: 1
5+
max-spaces-inside: 1
6+

.yardopts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
--markup markdown
2-
lib/**/*.rb
3-
-
4-
LICENSE.txt
2+
--markup-provider redcarpet
3+
--no-private
4+
--no-api

Gemfile

+20-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,24 @@
33
source 'https://rubygems.org'
44
gemspec
55

6-
group :test do
7-
gem 'rails', "~> #{ENV.fetch('RAILS_VERSION', '5.2')}"
8-
if ENV.fetch('RAILS_VERSION', '5.2').to_f >= 5
9-
gem 'sqlite3', '~> 1.4'
10-
else
11-
gem 'sqlite3', '= 1.3.10' # rubocop:disable Bundler/DuplicatedGem
12-
end
6+
not_jruby = %i[ruby mingw x64_mingw].freeze
7+
ruby_version = Gem::Version.new(RUBY_VERSION)
8+
rails_version = Gem::Version.new(ENV.fetch('RAILS_VERSION', '5.2'))
9+
10+
gem 'byebug', platforms: not_jruby
11+
gem 'rails', "~> #{rails_version}"
12+
gem 'redcarpet', '~> 3.5', platforms: not_jruby
13+
gem 'yard', '~> 0.9.25', platforms: not_jruby
14+
15+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6')
16+
gem 'rubocop', '~> 1.36.0'
17+
gem 'rubocop-rspec', '~> 2.12.0'
18+
gem 'simplecov', '>= 0.17.1'
19+
gem 'simplecov-cobertura', '~> 2.1'
20+
end
21+
22+
if ruby_version >= Gem::Version.new('2.6')
23+
gem 'sqlite3', '~> 1.5'
24+
else
25+
gem 'sqlite3', '~> 1.4', '< 1.5'
1326
end

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Epilog Gem
22

33
[![Gem Version](https://badge.fury.io/rb/epilog.svg)](https://badge.fury.io/rb/epilog)
4-
[![Build Status](https://travis-ci.org/nullscreen/epilog.svg?branch=master)](https://travis-ci.org/nullscreen/epilog)
5-
[![Code Climate](https://codeclimate.com/github/nullscreen/epilog/badges/gpa.svg)](https://codeclimate.com/github/nullscreen/epilog)
6-
[![Test Coverage](https://codeclimate.com/github/nullscreen/epilog/badges/coverage.svg)](https://codeclimate.com/github/nullscreen/epilog)
7-
[![Inline docs](http://inch-ci.org/github/nullscreen/epilog.svg?branch=master)](http://inch-ci.org/github/nullscreen/epilog)
4+
[![CI](https://github.com/nullscreen/epilog/workflows/CI/badge.svg)](https://github.com/nullscreen/epilog/actions?query=workflow%3ACI+branch%main)
5+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/28734dd732d34bc3b014760508b2d3da)](https://www.codacy.com/gh/nullscreen/epilog/dashboard)
6+
[![Code Coverage](https://codecov.io/gh/nullscreen/epilog/branch/main/graph/badge.svg?token=3Q3M49C5ZI)](https://codecov.io/gh/nullscreen/epilog)
87

98
A JSON logger with Rails support.
109

Rakefile

-13
This file was deleted.

bin/check-version

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/usr/bin/env sh
22

3-
tag="$(git describe --abbrev=0)"
3+
set -e
4+
5+
tag="$(git describe --abbrev=0 2>/dev/null || echo)"
6+
echo "Tag: ${tag}"
47
tag="${tag#v}"
5-
gt=$(ruby -r ./lib/epilog/version -e "puts Gem::Version.new(Epilog::VERSION) >= Gem::Version.new('${tag}')")
6-
test "$gt" = true
8+
echo "Git Version: ${tag}"
9+
[ "$tag" = '' ] && exit 0
10+
gem_version="$(ruby -r ./lib/epilog/version -e "puts Epilog.version" | tail -n1)"
11+
echo "Gem Version: ${gem_version}"
12+
13+
tag_gt_version="$(ruby -r ./lib/epilog/version -e "puts Epilog.version >= Gem::Version.new('${tag}')" | tail -n1)"
14+
test "$tag_gt_version" = true

bin/rake

-18
This file was deleted.

0 commit comments

Comments
 (0)