paper_trail-sinatra 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6d6d8c636449a424b7c0abdbc05cc80bdfe79d2a
4
- data.tar.gz: a0a674060d20173bc2fdc012b91d479043ab5f38
2
+ SHA256:
3
+ metadata.gz: c788651f7b1d67705204a69b0237a5e421260ef730c6b1c52be686b8c5edb5ab
4
+ data.tar.gz: 63095c80ffb4bd5c44f547585b25ea93c1ff88f052fd49aa71bcdaac51a66ad9
5
5
  SHA512:
6
- metadata.gz: 7e4c53518748ed4db5417ca3c55c345e4e4e29df03e354e3c728800e3568695f674e8b10748b7613afc9d512b7b153337c9fca274fa3424a3ddf58bdb40f6cfa
7
- data.tar.gz: 0b1a95a6976c92541cfd027e85b61f21aa682c19f9421cd59f0ce354ded240254d5173bd84c0e4f3683412186fe51f58f8a1f63fb2e3f14abb678a21fa4860b9
6
+ metadata.gz: '09a285afcd2272101ed389eaa5cd98eae372251d4fae622ebe0c759e985879fde9be5c0a9d78816875ac9376fc1d9021cc06acced80e8e644aad97a3dca61134'
7
+ data.tar.gz: 259bea423f113db5c6858a03c4794eda24c9276754df567e661eb7ee5b2748dd1785bf9e969e9b8c363ba717bf1fabaadfd4c4689c034fbda7822482a14863d1
data/.rubocop.yml ADDED
@@ -0,0 +1,106 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ # Please:
4
+ #
5
+ # - Comment any deviations from the Ruby Style Guide
6
+ # - Alphabetize cops
7
+ # - Only include permanent config; temporary goes in .rubocop_todo.yml
8
+
9
+ AllCops:
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/**/*
14
+
15
+ # Set to lowest supported version
16
+ TargetRubyVersion: 2.2
17
+
18
+ Layout/AlignParameters:
19
+ EnforcedStyle: with_fixed_indentation
20
+
21
+ Layout/DotPosition:
22
+ EnforcedStyle: trailing
23
+
24
+ Layout/MultilineMethodCallIndentation:
25
+ EnforcedStyle: indented
26
+
27
+ Layout/MultilineOperationIndentation:
28
+ EnforcedStyle: indented
29
+
30
+ # Use exactly one space on each side of an operator. Do not align operators
31
+ # because it makes the code harder to edit, and makes lines unnecessarily long.
32
+ Layout/SpaceAroundOperators:
33
+ AllowForAlignment: false
34
+
35
+ # Not a useful metric compared to, e.g. `AbcSize`.
36
+ Metrics/BlockLength:
37
+ Enabled: false
38
+
39
+ # Not a useful metric compared to, e.g. `AbcSize`.
40
+ Metrics/ClassLength:
41
+ Enabled: false
42
+
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
+ # The number of lines in a method is not a useful metric compared to `AbcSize`.
50
+ # It's common to have very long methods (> 50 lines) which are quite simple. For
51
+ # example, a method that returns a long string with only a few interpolations.
52
+ Metrics/MethodLength:
53
+ Enabled: false
54
+
55
+ # Not a useful metric compared to, e.g. `AbcSize`.
56
+ Metrics/ModuleLength:
57
+ Enabled: false
58
+
59
+ # Heredocs are usually assigned to a variable or constant, which already has a
60
+ # name, so naming the heredoc doesn't add much value. Feel free to name
61
+ # heredocs that are used as anonymous values (not a variable, constant, or
62
+ # named parameter).
63
+ #
64
+ # All heredocs containing SQL should be named SQL, to support editor syntax
65
+ # highlighting.
66
+ Naming/HeredocDelimiterNaming:
67
+ Enabled: false
68
+
69
+ # Too subtle to lint.
70
+ # Two-letter param names are OK. Consider `send_email(to:, cc:)`.
71
+ # Even one-letter names are OK. Consider `draw_point(x, y)`.
72
+ Naming/UncommunicativeMethodParamName:
73
+ Enabled: false
74
+
75
+ # Please use semantic style, e.g. `do` when there's a side-effect, else `{}`.
76
+ # The semantic style is too nuanced to lint, so the cop is disabled.
77
+ Style/BlockDelimiters:
78
+ Enabled: false
79
+
80
+ # Use double negation wherever it would otherwise be impractical to convert
81
+ # a value to an actual boolean.
82
+ Style/DoubleNegation:
83
+ Enabled: false
84
+
85
+ # Avoid annotated tokens except in desperately complicated format strings.
86
+ # In 99% of format strings they actually make it less readable.
87
+ Style/FormatStringToken:
88
+ Enabled: false
89
+
90
+ # The decision of when to use a guard clause to improve readability is subtle,
91
+ # and it's not clear that it can be linted. Certainly, the default
92
+ # `MinBodyLength` of 1 can actually hurt readability.
93
+ Style/GuardClause:
94
+ Enabled: false
95
+
96
+ # Only use postfix (modifier) conditionals for utterly simple statements.
97
+ # As a rule of thumb, the entire statement should not exceed 60 chars.
98
+ # Rubocop used to support this level of configuration, but no longer does.
99
+ Style/IfUnlessModifier:
100
+ Enabled: false
101
+
102
+ # The Ruby Style Guide does not prescribe a particular quote character, only
103
+ # that a project should pick one and be consistent. The decision has no
104
+ # performance implications. Double quotes are slightly easier to read.
105
+ Style/StringLiterals:
106
+ EnforcedStyle: double_quotes
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,82 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-05-08 22:55:10 -0400 using RuboCop version 0.55.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
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
+ # Offense count: 1
26
+ Style/Documentation:
27
+ Exclude:
28
+ - 'spec/**/*'
29
+ - 'test/**/*'
30
+ - 'lib/paper_trail/sinatra/version.rb'
31
+
32
+ # Offense count: 1
33
+ # Cop supports --auto-correct.
34
+ Style/Encoding:
35
+ Exclude:
36
+ - 'paper_trail-sinatra.gemspec'
37
+
38
+ # Offense count: 1
39
+ # Cop supports --auto-correct.
40
+ Style/ExpandPathArguments:
41
+ Exclude:
42
+ - 'paper_trail-sinatra.gemspec'
43
+
44
+ # Offense count: 2
45
+ # Cop supports --auto-correct.
46
+ Style/IfUnlessModifier:
47
+ Exclude:
48
+ - 'lib/paper_trail/sinatra.rb'
49
+ - 'spec/spec_helper.rb'
50
+
51
+ # Offense count: 1
52
+ # Cop supports --auto-correct.
53
+ Style/MutableConstant:
54
+ Exclude:
55
+ - 'lib/paper_trail/sinatra/version.rb'
56
+
57
+ # Offense count: 149
58
+ # Cop supports --auto-correct.
59
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
60
+ # SupportedStyles: single_quotes, double_quotes
61
+ Style/StringLiterals:
62
+ Exclude:
63
+ - 'bin/console'
64
+ - 'lib/paper_trail/sinatra.rb'
65
+ - 'lib/paper_trail/sinatra/version.rb'
66
+ - 'paper_trail-sinatra.gemspec'
67
+ - 'spec/gem_version_spec.rb'
68
+ - 'spec/gemfiles/Gemfile_pt7_sinatra1.rb'
69
+ - 'spec/gemfiles/Gemfile_pt7_sinatra2.rb'
70
+ - 'spec/gemfiles/Gemfile_pt8_sinatra1.rb'
71
+ - 'spec/gemfiles/Gemfile_pt8_sinatra2.rb'
72
+ - 'spec/gemfiles/Gemfile_pt9_sinatra1.rb'
73
+ - 'spec/gemfiles/Gemfile_pt9_sinatra2.rb'
74
+ - 'spec/modular_sinatra_spec.rb'
75
+ - 'spec/sinatra_spec.rb'
76
+ - 'spec/spec_helper.rb'
77
+
78
+ # Offense count: 1
79
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
80
+ # URISchemes: http, https
81
+ Metrics/LineLength:
82
+ Max: 89
data/.travis.yml CHANGED
@@ -5,18 +5,42 @@ before_script:
5
5
  - mkdir db
6
6
  - touch db/test.sqlite3
7
7
  - sqlite3 db/test.sqlite3 < spec/create_db.sql
8
+ cache: bundler
8
9
  gemfile:
9
- - spec/gemfiles/Gemfile_pt7_sinatra1.rb
10
- - spec/gemfiles/Gemfile_pt7_sinatra2.rb
11
- - spec/gemfiles/Gemfile_pt8_sinatra1.rb
12
- - spec/gemfiles/Gemfile_pt8_sinatra2.rb
10
+ - gemfiles/pt7_sinatra1.rb
11
+ - gemfiles/pt7_sinatra2.rb
12
+ - gemfiles/pt8_sinatra1.rb
13
+ - gemfiles/pt8_sinatra2.rb
14
+ - gemfiles/pt9_sinatra1.rb
15
+ - gemfiles/pt9_sinatra2.rb
13
16
  language: ruby
17
+ matrix:
18
+ exclude:
19
+ # PT 9 requires ruby >= 2.3
20
+ - rvm: 2.2.9
21
+ gemfile: gemfiles/pt9_sinatra1.rb
22
+ - rvm: 2.2.9
23
+ gemfile: gemfiles/pt9_sinatra2.rb
14
24
 
15
- # For ruby compatibility, we test the highest and lowest minor versions only.
25
+ # We only test ruby 2.3 against PT 9. Lower versions of PT are tested
26
+ # against ruby 2.2.
27
+ - rvm: 2.3.7
28
+ gemfile: gemfiles/pt7_sinatra1.rb
29
+ - rvm: 2.3.7
30
+ gemfile: gemfiles/pt7_sinatra2.rb
31
+ - rvm: 2.3.7
32
+ gemfile: gemfiles/pt8_sinatra1.rb
33
+ - rvm: 2.3.7
34
+ gemfile: gemfiles/pt8_sinatra2.rb
35
+
36
+ # For ruby compatibility, we usually only test the highest and lowest supported
37
+ # versions. However see above re: PT 9.
16
38
  rvm:
17
39
  - 2.5.0
40
+ - 2.3.7
18
41
  - 2.2.9
19
42
 
20
43
  script:
44
+ - bundle exec rubocop
21
45
  - bundle exec rspec
22
46
  sudo: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
+
3
8
  ## Unreleased
4
9
 
5
10
  Breaking Changes
@@ -14,6 +19,21 @@ Fixed
14
19
 
15
20
  - None
16
21
 
22
+ ## 0.5.0 (2018-05-08)
23
+
24
+ Breaking Changes
25
+
26
+ - None
27
+
28
+ Added
29
+
30
+ - Support for PaperTrail 9
31
+ - PaperTrail::Sinatra.gem_version
32
+
33
+ Fixed
34
+
35
+ - None
36
+
17
37
  ## 0.4.0 (2018-02-22)
18
38
 
19
39
  Breaking Changes
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,14 @@
1
+ ## Contributing
2
+
3
+ ```
4
+ git clone
5
+ bundle
6
+ mkdir db
7
+ sqlite3 db/test.sqlite3
8
+ .read spec/create_db.sql
9
+ bundle exec rubocop
10
+
11
+ # Test specific dependency versions
12
+ BUNDLE_GEMFILE=gemfiles/pt9_sinatra2.rb bundle
13
+ BUNDLE_GEMFILE=gemfiles/pt9_sinatra2.rb bundle exec rspec
14
+ ```
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
data/README.md CHANGED
@@ -62,17 +62,6 @@ class BlehApp < Sinatra::Base
62
62
  end
63
63
  ```
64
64
 
65
- ## Contributing
66
-
67
- ```
68
- git clone
69
- bundle
70
- mkdir db
71
- sqlite3 db/test.sqlite3
72
- .read spec/create_db.sql
73
- bundle exec rspec
74
- ```
75
-
76
65
  [1]: http://www.sinatrarb.com
77
66
  [2]: https://github.com/janko-m/sinatra-activerecord
78
67
  [3]: https://raw.github.com/airblade/paper_trail/master/lib/generators/paper_trail/templates/create_versions.rb
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec(path: "..")
3
+ gem "activesupport", "4.2.10"
4
+ gem "paper_trail", "7.1.3"
5
+ gem "sinatra", "1.4.8"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec(path: "..")
3
+ gem "activesupport", "4.2.10"
4
+ gem "paper_trail", "7.1.3"
5
+ gem "sinatra", "2.0.1"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec(path: "..")
3
+ gem "activesupport", "4.2.10"
4
+ gem "paper_trail", "8.1.2"
5
+ gem "sinatra", "1.4.8"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec(path: "..")
3
+ gem "activesupport", "4.2.10"
4
+ gem "paper_trail", "8.1.2"
5
+ gem "sinatra", "2.0.1"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec(path: "..")
3
+ gem "activesupport", "4.2.10"
4
+ gem "paper_trail", "9.0.1"
5
+ gem "sinatra", "1.4.8"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+ gemspec(path: "..")
3
+ gem "activesupport", "4.2.10"
4
+ gem "paper_trail", "9.0.1"
5
+ gem "sinatra", "2.0.1"
@@ -66,19 +66,34 @@ module PaperTrail
66
66
 
67
67
  # Tells PaperTrail who is responsible for any changes that occur.
68
68
  def set_paper_trail_whodunnit
69
- ::PaperTrail.whodunnit = user_for_paper_trail if ::PaperTrail.enabled?
69
+ return unless ::PaperTrail.enabled?
70
+ if ::Gem::Version.new(::PaperTrail::VERSION) >= ::Gem::Version.new('9')
71
+ ::PaperTrail.request.whodunnit = user_for_paper_trail
72
+ else
73
+ ::PaperTrail.whodunnit = user_for_paper_trail
74
+ end
70
75
  end
71
76
 
72
77
  # Tells PaperTrail any information from the controller you want to store
73
78
  # alongside any changes that occur.
74
79
  def set_paper_trail_request_info
75
- ::PaperTrail.controller_info = info_for_paper_trail if ::PaperTrail.enabled?
80
+ return unless ::PaperTrail.enabled?
81
+ if ::Gem::Version.new(::PaperTrail::VERSION) >= ::Gem::Version.new('9')
82
+ ::PaperTrail.request.controller_info = info_for_paper_trail
83
+ else
84
+ ::PaperTrail.controller_info = info_for_paper_trail
85
+ end
76
86
  end
77
87
 
78
88
  # Tells PaperTrail whether versions should be saved in the current
79
89
  # request.
80
90
  def set_paper_trail_enabled_for_request
81
- ::PaperTrail.enabled_for_controller = paper_trail_enabled_for_request if ::PaperTrail.enabled?
91
+ return unless ::PaperTrail.enabled?
92
+ if ::Gem::Version.new(::PaperTrail::VERSION) >= ::Gem::Version.new('9')
93
+ ::PaperTrail.request.enabled = paper_trail_enabled_for_request
94
+ else
95
+ ::PaperTrail.enabled_for_controller = paper_trail_enabled_for_request
96
+ end
82
97
  end
83
98
  end
84
99
  end
@@ -1,5 +1,11 @@
1
1
  module PaperTrail
2
2
  module Sinatra
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
+
5
+ # Added in 0.5.0
6
+ # @api public
7
+ def self.gem_version
8
+ ::Gem::Version.new(VERSION)
9
+ end
4
10
  end
5
11
  end
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'paper_trail/sinatra/version'
@@ -28,10 +29,11 @@ Gem::Specification.new do |spec|
28
29
 
29
30
  # This gem should not be used with PT < 7 because both define
30
31
  # `::PaperTrail::Sinatra`.
31
- spec.add_dependency "paper_trail", [">= 7", "< 9"]
32
+ spec.add_dependency "paper_trail", [">= 7", "< 10"]
32
33
 
33
34
  spec.add_dependency "sinatra", [">= 1.0.0", "< 3"]
34
35
  spec.add_development_dependency "rack-test", "~> 0.6"
35
- spec.add_development_dependency "rspec", "~> 3.5"
36
+ spec.add_development_dependency "rspec", "~> 3.7"
37
+ spec.add_development_dependency "rubocop", "~> 0.55.0"
36
38
  spec.add_development_dependency "sqlite3", "~> 1.3"
37
39
  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.4.0
4
+ version: 0.5.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: 2018-02-22 00:00:00.000000000 Z
11
+ date: 2018-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: '7'
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: '9'
56
+ version: '10'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: '7'
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: '9'
66
+ version: '10'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: sinatra
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -104,14 +104,28 @@ dependencies:
104
104
  requirements:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
- version: '3.5'
107
+ version: '3.7'
108
108
  type: :development
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - "~>"
113
113
  - !ruby/object:Gem::Version
114
- version: '3.5'
114
+ version: '3.7'
115
+ - !ruby/object:Gem::Dependency
116
+ name: rubocop
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: 0.55.0
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - "~>"
127
+ - !ruby/object:Gem::Version
128
+ version: 0.55.0
115
129
  - !ruby/object:Gem::Dependency
116
130
  name: sqlite3
117
131
  requirement: !ruby/object:Gem::Requirement
@@ -134,13 +148,22 @@ extensions: []
134
148
  extra_rdoc_files: []
135
149
  files:
136
150
  - ".gitignore"
151
+ - ".rubocop.yml"
152
+ - ".rubocop_todo.yml"
137
153
  - ".travis.yml"
138
154
  - CHANGELOG.md
155
+ - CONTRIBUTING.md
139
156
  - Gemfile
140
157
  - LICENSE
141
158
  - README.md
142
159
  - bin/console
143
160
  - bin/setup
161
+ - gemfiles/pt7_sinatra1.rb
162
+ - gemfiles/pt7_sinatra2.rb
163
+ - gemfiles/pt8_sinatra1.rb
164
+ - gemfiles/pt8_sinatra2.rb
165
+ - gemfiles/pt9_sinatra1.rb
166
+ - gemfiles/pt9_sinatra2.rb
144
167
  - lib/paper_trail/sinatra.rb
145
168
  - lib/paper_trail/sinatra/version.rb
146
169
  - paper_trail-sinatra.gemspec
@@ -164,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
187
  version: '0'
165
188
  requirements: []
166
189
  rubyforge_project:
167
- rubygems_version: 2.6.14
190
+ rubygems_version: 2.7.6
168
191
  signing_key:
169
192
  specification_version: 4
170
193
  summary: Sinatra support for paper_trail