paper_trail-sinatra 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1ae428dbe47f144a4f96dd698bc538c30fd54fbe1887d40ad885b93fdb09c2d
4
- data.tar.gz: be39c611be9c5139750ba27b3c7a4955399af72ae1b9ea9320a22c16295e9034
3
+ metadata.gz: 5a363a9d1719dca25c9773d0f293ba3a39b80ff58100f37d911e301a82e489f3
4
+ data.tar.gz: 2504bf279dccac5ab7ff43a5a7162a24c5f91407e9b8824e3a6afe69447077f1
5
5
  SHA512:
6
- metadata.gz: 7006cc84101f9c7afc80e6f2665aafc71eafce1aca4527f5fc54942e084d8ac2f80e3a0414ae9ebf9b5a66af1d0e25b5176c50f24a80c97d8eef1580115fb86c
7
- data.tar.gz: 25759f2f93eb102832ad9dfa117f8fc47aa1b8f9551472c74ec345f14814f678da2da2c03d0fe19afde2951dbf913c0ccb296ffd2e39e1980715468097ef8d63
6
+ metadata.gz: 50c8ea50b662b098f81a7cf7d0b62c56d7005e142812316014d5d8b208f4f733d1414b5867eb24447378417842dc34c2ff00cebef5c5c716c5066b2b1e423659
7
+ data.tar.gz: 69a9b8b1092cc3109ae04cb518e130102fe2b874ddeac174e89dfdd64eec96cae761e32b43d4c304e863421bd130d4f3fe421867d0d8ade541e4e4fadc7e0547
@@ -0,0 +1,105 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master" ]
13
+ pull_request:
14
+ branches: [ "master" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test-pt9:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ matrix:
24
+ gemfile:
25
+ - 'gemfiles/pt9_sinatra1.rb'
26
+ - 'gemfiles/pt9_sinatra2.rb'
27
+ ruby-version: ['2.7']
28
+ steps:
29
+ - uses: actions/checkout@v3
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby-version }}
34
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
35
+ - name: Setup DB
36
+ run: mkdir db && touch db/test.sqlite3 && sqlite3 db/test.sqlite3 ".read spec/create_db.sql"
37
+ - name: Run tests
38
+ run: bundle exec rspec
39
+ - name: Rubocop
40
+ run: bundle exec rubocop
41
+
42
+ test-pt10:
43
+ runs-on: ubuntu-latest
44
+ strategy:
45
+ matrix:
46
+ gemfile:
47
+ - 'gemfiles/pt10_sinatra1.rb'
48
+ - 'gemfiles/pt10_sinatra2.rb'
49
+ ruby-version: ['2.7']
50
+ steps:
51
+ - uses: actions/checkout@v3
52
+ - name: Set up Ruby
53
+ uses: ruby/setup-ruby@v1
54
+ with:
55
+ ruby-version: ${{ matrix.ruby-version }}
56
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
57
+ - name: Setup DB
58
+ run: mkdir db && touch db/test.sqlite3 && sqlite3 db/test.sqlite3 ".read spec/create_db.sql"
59
+ - name: Run tests
60
+ run: bundle exec rspec
61
+ - name: Rubocop
62
+ run: bundle exec rubocop
63
+
64
+ test-pt11:
65
+ runs-on: ubuntu-latest
66
+ strategy:
67
+ matrix:
68
+ gemfile:
69
+ - 'gemfiles/pt11_sinatra1.rb'
70
+ - 'gemfiles/pt11_sinatra2.rb'
71
+ ruby-version: ['2.7']
72
+ steps:
73
+ - uses: actions/checkout@v3
74
+ - name: Set up Ruby
75
+ uses: ruby/setup-ruby@v1
76
+ with:
77
+ ruby-version: ${{ matrix.ruby-version }}
78
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
79
+ - name: Setup DB
80
+ run: mkdir db && touch db/test.sqlite3 && sqlite3 db/test.sqlite3 ".read spec/create_db.sql"
81
+ - name: Run tests
82
+ run: bundle exec rspec
83
+ - name: Rubocop
84
+ run: bundle exec rubocop
85
+ test-pt13:
86
+ runs-on: ubuntu-latest
87
+ strategy:
88
+ matrix:
89
+ gemfile:
90
+ - 'gemfiles/pt13_sinatra2.rb'
91
+ - 'gemfiles/pt13_sinatra3.rb'
92
+ ruby-version: ['2.7', '3.0']
93
+ steps:
94
+ - uses: actions/checkout@v3
95
+ - name: Set up Ruby
96
+ uses: ruby/setup-ruby@v1
97
+ with:
98
+ ruby-version: ${{ matrix.ruby-version }}
99
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
100
+ - name: Setup DB
101
+ run: mkdir db && touch db/test.sqlite3 && sqlite3 db/test.sqlite3 ".read spec/create_db.sql"
102
+ - name: Run tests
103
+ run: bundle exec rspec
104
+ - name: Rubocop
105
+ run: bundle exec rubocop
data/.rubocop.yml CHANGED
@@ -8,25 +8,33 @@ inherit_from: .rubocop_todo.yml
8
8
 
9
9
  AllCops:
10
10
  Exclude:
11
- # This is where travis CI installs our bundle. If we don't exclude it,
12
- # travis will try to lint all of our dependencies XD
13
- - gemfiles/vendor/bundle/**/*
11
+ # This is where Github Actions installs our bundle. If we don't exclude it,
12
+ # rubocop will try to lint all of our dependencies XD
13
+ - 'vendor/**/*'
14
+ NewCops: enable
15
+ SuggestExtensions: false
14
16
 
15
17
  # Set to lowest supported version
16
18
  TargetRubyVersion: 2.3
17
19
 
18
- Layout/AlignParameters:
19
- EnforcedStyle: with_fixed_indentation
20
-
21
20
  Layout/DotPosition:
22
21
  EnforcedStyle: trailing
23
22
 
23
+ # The Ruby Style Guide recommends to "Limit lines to 80 characters."
24
+ # (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
25
+ # Please aim for 80, but up to 100 is OK.
26
+ Layout/LineLength:
27
+ Max: 100
28
+
24
29
  Layout/MultilineMethodCallIndentation:
25
30
  EnforcedStyle: indented
26
31
 
27
32
  Layout/MultilineOperationIndentation:
28
33
  EnforcedStyle: indented
29
34
 
35
+ Layout/ParameterAlignment:
36
+ EnforcedStyle: with_fixed_indentation
37
+
30
38
  # Use exactly one space on each side of an operator. Do not align operators
31
39
  # because it makes the code harder to edit, and makes lines unnecessarily long.
32
40
  Layout/SpaceAroundOperators:
@@ -40,12 +48,6 @@ Metrics/BlockLength:
40
48
  Metrics/ClassLength:
41
49
  Enabled: false
42
50
 
43
- # The Ruby Style Guide recommends to "Limit lines to 80 characters."
44
- # (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
45
- # Please aim for 80, but up to 100 is OK.
46
- Metrics/LineLength:
47
- Max: 100
48
-
49
51
  # The number of lines in a method is not a useful metric compared to `AbcSize`.
50
52
  # It's common to have very long methods (> 50 lines) which are quite simple. For
51
53
  # example, a method that returns a long string with only a few interpolations.
@@ -69,7 +71,7 @@ Naming/HeredocDelimiterNaming:
69
71
  # Too subtle to lint.
70
72
  # Two-letter param names are OK. Consider `send_email(to:, cc:)`.
71
73
  # Even one-letter names are OK. Consider `draw_point(x, y)`.
72
- Naming/UncommunicativeMethodParamName:
74
+ Naming/MethodParameterName:
73
75
  Enabled: false
74
76
 
75
77
  # Please use semantic style, e.g. `do` when there's a side-effect, else `{}`.
@@ -99,6 +101,13 @@ Style/GuardClause:
99
101
  Style/IfUnlessModifier:
100
102
  Enabled: false
101
103
 
104
+ # Usage of OpenStruct is discouraged since it's breaking some performance
105
+ # optimizations in the Ruby VM. But when using it in tests, these can be
106
+ # ignored.
107
+ Style/OpenStructUse:
108
+ Exclude:
109
+ - spec/**/*
110
+
102
111
  # The Ruby Style Guide does not prescribe a particular quote character, only
103
112
  # that a project should pick one and be consistent. The decision has no
104
113
  # performance implications. Double quotes are slightly easier to read.
data/.rubocop_todo.yml CHANGED
@@ -1,28 +1,13 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-05-08 22:55:10 -0400 using RuboCop version 0.55.0.
3
+ # on 2022-09-27 07:06:52 UTC using RuboCop version 1.36.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 4
10
- # Configuration parameters: CountComments, ExcludedMethods.
11
- Metrics/BlockLength:
12
- Max: 42
13
-
14
- # Offense count: 1
15
- # Cop supports --auto-correct.
16
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods.
17
- # SupportedStyles: line_count_based, semantic, braces_for_chaining
18
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
19
- # FunctionalMethods: let, let!, subject, watch
20
- # IgnoredMethods: lambda, proc, it
21
- Style/BlockDelimiters:
22
- Exclude:
23
- - 'lib/paper_trail/sinatra.rb'
24
-
25
9
  # Offense count: 1
10
+ # Configuration parameters: AllowedConstants.
26
11
  Style/Documentation:
27
12
  Exclude:
28
13
  - 'spec/**/*'
@@ -30,56 +15,39 @@ Style/Documentation:
30
15
  - 'lib/paper_trail/sinatra/version.rb'
31
16
 
32
17
  # Offense count: 1
33
- # Cop supports --auto-correct.
18
+ # This cop supports safe autocorrection (--autocorrect).
34
19
  Style/Encoding:
35
20
  Exclude:
36
21
  - 'paper_trail-sinatra.gemspec'
37
22
 
38
23
  # Offense count: 1
39
- # Cop supports --auto-correct.
24
+ # This cop supports safe autocorrection (--autocorrect).
40
25
  Style/ExpandPathArguments:
41
26
  Exclude:
42
27
  - 'paper_trail-sinatra.gemspec'
43
28
 
29
+ # Offense count: 19
30
+ # This cop supports unsafe autocorrection (--autocorrect-all).
31
+ # Configuration parameters: EnforcedStyle.
32
+ # SupportedStyles: always, always_true, never
44
33
  Style/FrozenStringLiteralComment:
45
34
  Enabled: false
46
35
 
47
- # Offense count: 2
48
- # Cop supports --auto-correct.
49
- Style/IfUnlessModifier:
50
- Exclude:
51
- - 'lib/paper_trail/sinatra.rb'
52
- - 'spec/spec_helper.rb'
53
-
54
36
  # Offense count: 1
55
- # Cop supports --auto-correct.
37
+ # This cop supports unsafe autocorrection (--autocorrect-all).
38
+ # Configuration parameters: EnforcedStyle.
39
+ # SupportedStyles: literals, strict
56
40
  Style/MutableConstant:
57
41
  Exclude:
58
42
  - 'lib/paper_trail/sinatra/version.rb'
59
43
 
60
- # Offense count: 149
61
- # Cop supports --auto-correct.
44
+ # Offense count: 12
45
+ # This cop supports safe autocorrection (--autocorrect).
62
46
  # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
63
47
  # SupportedStyles: single_quotes, double_quotes
64
48
  Style/StringLiterals:
65
49
  Exclude:
66
- - 'bin/console'
67
50
  - 'lib/paper_trail/sinatra.rb'
68
- - 'lib/paper_trail/sinatra/version.rb'
69
51
  - 'paper_trail-sinatra.gemspec'
70
52
  - 'spec/gem_version_spec.rb'
71
- - 'spec/gemfiles/Gemfile_pt7_sinatra1.rb'
72
- - 'spec/gemfiles/Gemfile_pt7_sinatra2.rb'
73
- - 'spec/gemfiles/Gemfile_pt8_sinatra1.rb'
74
- - 'spec/gemfiles/Gemfile_pt8_sinatra2.rb'
75
- - 'spec/gemfiles/Gemfile_pt9_sinatra1.rb'
76
- - 'spec/gemfiles/Gemfile_pt9_sinatra2.rb'
77
- - 'spec/modular_sinatra_spec.rb'
78
- - 'spec/sinatra_spec.rb'
79
53
  - 'spec/spec_helper.rb'
80
-
81
- # Offense count: 1
82
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
83
- # URISchemes: http, https
84
- Metrics/LineLength:
85
- Max: 89
data/CHANGELOG.md CHANGED
@@ -19,6 +19,20 @@ Fixed
19
19
 
20
20
  - None
21
21
 
22
+ ## 0.9.0 (2021-10-02)
23
+
24
+ Breaking Changes
25
+
26
+ - None
27
+
28
+ Added
29
+
30
+ - Support for Sinatra 3
31
+
32
+ Fixed
33
+
34
+ - None
35
+
22
36
  ## 0.8.0 (2021-01-06)
23
37
 
24
38
  Breaking Changes
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
- gem 'rake'
4
+ gem "rake"
data/README.md CHANGED
@@ -4,7 +4,7 @@ Register this module inside your Sinatra application to gain access to
4
4
  controller-level methods used by PaperTrail.
5
5
 
6
6
  To configure PaperTrail for usage with [Sinatra][1], your `Sinatra` app must be
7
- using `ActiveRecord` 3, 4, 5, or 6.
7
+ using `ActiveRecord`.
8
8
 
9
9
  It is recommended to use the
10
10
  [Sinatra ActiveRecord Extension][2] or something similar for managing your
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec(path: "..")
3
+ gem "activesupport", "~> 7.0"
4
+ gem "paper_trail", "~> 13.0"
5
+ gem "sinatra", "~> 2.0.0"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec(path: "..")
3
+ gem "activesupport", "~> 7.0"
4
+ gem "paper_trail", "~> 13.0"
5
+ gem "sinatra", "~> 3.0.0"
@@ -1,6 +1,6 @@
1
1
  module PaperTrail
2
2
  module Sinatra
3
- VERSION = "0.8.0"
3
+ VERSION = "0.9.0"
4
4
 
5
5
  # Added in 0.5.0
6
6
  # @api public
@@ -27,6 +27,7 @@ module PaperTrail
27
27
  # method, e.g. `current_person`, or anything you like.
28
28
  def user_for_paper_trail
29
29
  return unless defined?(current_user)
30
+
30
31
  current_user&.id || current_user
31
32
  end
32
33
 
@@ -66,6 +67,7 @@ module PaperTrail
66
67
  # Tells PaperTrail who is responsible for any changes that occur.
67
68
  def set_paper_trail_whodunnit
68
69
  return unless ::PaperTrail.enabled?
70
+
69
71
  if ::Gem::Version.new(::PaperTrail::VERSION) >= ::Gem::Version.new('9')
70
72
  ::PaperTrail.request.whodunnit = user_for_paper_trail
71
73
  else
@@ -77,6 +79,7 @@ module PaperTrail
77
79
  # alongside any changes that occur.
78
80
  def set_paper_trail_request_info
79
81
  return unless ::PaperTrail.enabled?
82
+
80
83
  if ::Gem::Version.new(::PaperTrail::VERSION) >= ::Gem::Version.new('9')
81
84
  ::PaperTrail.request.controller_info = info_for_paper_trail
82
85
  else
@@ -88,6 +91,7 @@ module PaperTrail
88
91
  # request.
89
92
  def set_paper_trail_enabled_for_request
90
93
  return unless ::PaperTrail.enabled?
94
+
91
95
  if ::Gem::Version.new(::PaperTrail::VERSION) >= ::Gem::Version.new('9')
92
96
  ::PaperTrail.request.enabled = paper_trail_enabled_for_request
93
97
  else
@@ -19,14 +19,16 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
  spec.required_ruby_version = ">= 2.3.0"
21
21
 
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
23
+
22
24
  # This gem should not be used with PT < 7 because both define
23
25
  # `::PaperTrail::Sinatra`.
24
26
  spec.add_dependency "paper_trail", ">= 9"
25
27
 
26
- spec.add_dependency "sinatra", [">= 1.0.0", "< 3"]
28
+ spec.add_dependency "sinatra", [">= 1.0.0", "< 4"]
27
29
  spec.add_development_dependency "bundler", [">= 1.13", "< 3"]
28
30
  spec.add_development_dependency "rack-test", "~> 0.6"
29
31
  spec.add_development_dependency "rspec", "~> 3.7"
30
- spec.add_development_dependency "rubocop", "~> 0.55.0"
32
+ spec.add_development_dependency "rubocop", "~> 1.36.0"
31
33
  spec.add_development_dependency "sqlite3", "~> 1.4.0"
32
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail-sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Beck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2022-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paper_trail
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 1.0.0
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '3'
36
+ version: '4'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.0.0
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '3'
46
+ version: '4'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -98,14 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: 0.55.0
101
+ version: 1.36.0
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: 0.55.0
108
+ version: 1.36.0
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: sqlite3
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -127,10 +127,10 @@ executables: []
127
127
  extensions: []
128
128
  extra_rdoc_files: []
129
129
  files:
130
+ - ".github/workflows/ruby.yml"
130
131
  - ".gitignore"
131
132
  - ".rubocop.yml"
132
133
  - ".rubocop_todo.yml"
133
- - ".travis.yml"
134
134
  - CHANGELOG.md
135
135
  - CONTRIBUTING.md
136
136
  - Gemfile
@@ -143,6 +143,8 @@ files:
143
143
  - gemfiles/pt10_sinatra2.rb
144
144
  - gemfiles/pt11_sinatra1.rb
145
145
  - gemfiles/pt11_sinatra2.rb
146
+ - gemfiles/pt13_sinatra2.rb
147
+ - gemfiles/pt13_sinatra3.rb
146
148
  - gemfiles/pt9_sinatra1.rb
147
149
  - gemfiles/pt9_sinatra2.rb
148
150
  - lib/paper_trail/sinatra.rb
@@ -151,7 +153,8 @@ files:
151
153
  homepage: https://github.com/jaredbeck/paper_trail-sinatra
152
154
  licenses:
153
155
  - GPL-3.0
154
- metadata: {}
156
+ metadata:
157
+ rubygems_mfa_required: 'true'
155
158
  post_install_message:
156
159
  rdoc_options: []
157
160
  require_paths:
@@ -167,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
170
  - !ruby/object:Gem::Version
168
171
  version: '0'
169
172
  requirements: []
170
- rubygems_version: 3.0.8
173
+ rubygems_version: 3.2.3
171
174
  signing_key:
172
175
  specification_version: 4
173
176
  summary: Sinatra support for paper_trail
data/.travis.yml DELETED
@@ -1,26 +0,0 @@
1
- before_install:
2
- - gem update --system
3
- - gem update bundler
4
- before_script:
5
- - mkdir db
6
- - touch db/test.sqlite3
7
- - sqlite3 db/test.sqlite3 < spec/create_db.sql
8
- cache: bundler
9
- gemfile:
10
- - gemfiles/pt9_sinatra1.rb
11
- - gemfiles/pt9_sinatra2.rb
12
- - gemfiles/pt10_sinatra1.rb
13
- - gemfiles/pt10_sinatra2.rb
14
- - gemfiles/pt11_sinatra1.rb
15
- - gemfiles/pt11_sinatra2.rb
16
- language: ruby
17
-
18
- # For ruby compatibility, we usually only test the highest and lowest supported
19
- # versions.
20
- rvm:
21
- - 2.6.6
22
-
23
- script:
24
- - bundle exec rubocop
25
- - bundle exec rspec
26
- sudo: false