paperclip-permanent_records 0.5.0 → 0.7.2

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: a3cc4b67b3ac8a02e0405be5da6e0975088ea86eb9f61fcd53f2738440885fee
4
- data.tar.gz: d9bb55debfeb8e9392b822573eed97ba7799a1119d89ba1a9aaef71584bef1a7
3
+ metadata.gz: f56b10014fe088d4ddef89034e32c1ccd37ba91b13c1425dcf4f1e1a01aac987
4
+ data.tar.gz: e7a20ae5cdc2e5565011883ac89369fd04862210b707d496ab47484c45fba26a
5
5
  SHA512:
6
- metadata.gz: d0ffedc08fa51d0991e4b2ff29ab993e58a4528ad869f43e86cf61c6f849e1a5d413e4af53c46c69821b6bd8d97504fbf24234cdbab2b37f69c9f03cab50d183
7
- data.tar.gz: 31252601357c7cca94f29ac0ba72eb7bf8e33f2089d71c446cd435fbc0a40b69a244c64fea9e6dab2cfdcdde81fad63ec8196df98cd8e80b6771747fa0263b8b
6
+ metadata.gz: 10d9ea111c4fc1e935e825f20a0ccef862533b4ab9ccd4b6d3383a94f3344b923f346c9aa26f51fed825c795bbf77ad9fccc774f6fffd5054e5717d1c70c3b09
7
+ data.tar.gz: 3ba3f2bbb9e47cbaef7056baac02fe0d7305716e2a29e3bda7435305e6888d58bc94458f2bcb6412f7d6901f657ff3e29baa9bb0b08e3acb1e733c70f807a575
data/.editorconfig ADDED
@@ -0,0 +1,7 @@
1
+ [*]
2
+ charset=utf-8
3
+ end_of_line=lf
4
+ trim_trailing_whitespace=true
5
+ insert_final_newline=true
6
+ indent_style=space
7
+ indent_size=2
@@ -0,0 +1,14 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler"
9
+ directory: "/"
10
+ registries: "*"
11
+ insecure-external-code-execution: allow
12
+ schedule:
13
+ interval: "weekly"
14
+ vendor: true
@@ -0,0 +1,62 @@
1
+ name: Lint & Test
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ lint:
7
+ name: Lint
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Install system dependencies
11
+ run: sudo apt-get install -y libsqlite3-dev
12
+ - uses: actions/checkout@master
13
+ - name: Setup ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.7.8
17
+ - name: Install bundle
18
+ run: bundle
19
+ - name: Run rubocop
20
+ run: bundle exec rubocop
21
+ test:
22
+ name: Test
23
+ runs-on: ubuntu-latest
24
+ strategy:
25
+ matrix:
26
+ ruby:
27
+ - 2.7.8
28
+ - 3.0.6
29
+ - 3.1.4
30
+ - 3.2.3
31
+ appraisal:
32
+ - rails_5.2
33
+ - rails_6.0
34
+ - rails_6.1
35
+ - rails_7.0
36
+ - rails_7.1
37
+ exclude:
38
+ - ruby: 3.0.6
39
+ appraisal: rails_5.2
40
+ - ruby: 3.1.4
41
+ appraisal: rails_5.2
42
+ - ruby: 3.2.3
43
+ appraisal: rails_5.2
44
+ - ruby: 2.7.8
45
+ appraisal: rails_7.0
46
+ - ruby: 2.7.8
47
+ appraisal: rails_7.1
48
+ steps:
49
+ - name: Install system dependencies
50
+ run: sudo apt-get install -y libsqlite3-dev
51
+ - uses: actions/checkout@master
52
+ - name: Setup ruby
53
+ uses: ruby/setup-ruby@v1
54
+ with:
55
+ ruby-version: ${{ matrix.ruby }}
56
+ bundler: 2.4
57
+ - name: Install bundle
58
+ run: bundle
59
+ - name: Install appraisal
60
+ run: bundle exec appraisal install
61
+ - name: Run tests
62
+ run: bundle exec appraisal ${{ matrix.appraisal }} rspec
data/.rubocop.yml CHANGED
@@ -2,6 +2,7 @@ inherit_from: .rubocop_todo.yml
2
2
 
3
3
  require:
4
4
  - rubocop-performance
5
+ - rubocop-rake
5
6
  - rubocop-rspec
6
7
 
7
8
  inherit_mode:
@@ -17,10 +18,11 @@ AllCops:
17
18
  - '**/Gemfile'
18
19
  - '**/Rakefile'
19
20
  - '**/Capfile'
20
- TargetRubyVersion: 2.5
21
-
22
- Gemspec/DateAssignment: # (new in 1.10)
23
- Enabled: true
21
+ - '**/*.rb'
22
+ Exclude:
23
+ - 'gemfiles/**/*.gemfile'
24
+ NewCops: enable
25
+ TargetRubyVersion: 2.7
24
26
 
25
27
  Layout/ArgumentAlignment:
26
28
  EnforcedStyle: 'with_fixed_indentation'
@@ -32,126 +34,57 @@ Layout/HashAlignment:
32
34
  EnforcedColonStyle: 'table'
33
35
  EnforcedHashRocketStyle: 'table'
34
36
 
35
- Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
36
- Enabled: true
37
+ Layout/LineLength:
38
+ Exclude:
39
+ - 'app/controllers/**/*'
40
+ - 'config/initializers/devise.rb'
37
41
 
38
42
  Layout/ParameterAlignment:
39
43
  EnforcedStyle: 'with_fixed_indentation'
40
44
 
41
- Layout/SpaceBeforeBrackets: # (new in 1.7)
42
- Enabled: true
45
+ Layout/SpaceBeforeFirstArg:
46
+ Exclude:
47
+ - 'config/routes.rb'
48
+ - 'spec/factories/**/*'
43
49
 
44
50
  Layout/SpaceInsideHashLiteralBraces:
45
51
  EnforcedStyle: 'no_space'
46
52
 
47
- Lint/AmbiguousAssignment: # (new in 1.7)
48
- Enabled: true
49
-
50
53
  Lint/AmbiguousBlockAssociation:
51
54
  Exclude:
52
55
  - "spec/**/*"
53
56
 
54
- Lint/AmbiguousRange: # (new in 1.19)
55
- Enabled: true
56
-
57
- Lint/DeprecatedConstants: # (new in 1.8)
58
- Enabled: true
59
-
60
- Lint/DuplicateBranch: # (new in 1.3)
61
- Enabled: true
62
-
63
- Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
64
- Enabled: true
65
-
66
- Lint/EmptyBlock: # (new in 1.1)
67
- Enabled: true
68
-
69
- Lint/EmptyClass: # (new in 1.3)
70
- Enabled: true
71
-
72
- Lint/EmptyInPattern: # (new in 1.16)
73
- Enabled: true
74
-
75
- Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
76
- Enabled: true
77
-
78
- Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
79
- Enabled: true
80
-
81
- Lint/NumberedParameterAssignment: # (new in 1.9)
82
- Enabled: true
83
-
84
- Lint/OrAssignmentToConstant: # (new in 1.9)
85
- Enabled: true
86
-
87
- Lint/RedundantDirGlobSort: # (new in 1.8)
88
- Enabled: true
89
-
90
- Lint/SymbolConversion: # (new in 1.9)
91
- Enabled: true
92
-
93
- Lint/ToEnumArguments: # (new in 1.1)
94
- Enabled: true
95
-
96
- Lint/TripleQuotes: # (new in 1.9)
97
- Enabled: true
98
-
99
- Lint/UnexpectedBlockArity: # (new in 1.5)
100
- Enabled: true
101
-
102
- Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
103
- Enabled: true
104
-
105
- Naming/InclusiveLanguage: # (new in 1.18)
106
- Enabled: true
107
-
108
- Performance/AncestorsInclude: # (new in 1.7)
109
- Enabled: true
110
-
111
- Performance/BigDecimalWithNumericArgument: # (new in 1.7)
112
- Enabled: true
113
-
114
- Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
115
- Enabled: true
116
-
117
- Performance/CollectionLiteralInLoop: # (new in 1.8)
118
- Enabled: true
119
-
120
- Performance/ConstantRegexp: # (new in 1.9)
121
- Enabled: true
122
-
123
- Performance/MapCompact: # (new in 1.11)
124
- Enabled: true
125
-
126
- Performance/MethodObjectAsBlock: # (new in 1.9)
127
- Enabled: true
128
-
129
- Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
130
- Enabled: true
131
-
132
- Performance/RedundantSortBlock: # (new in 1.7)
133
- Enabled: true
134
-
135
- Performance/RedundantSplitRegexpArgument: # (new in 1.10)
136
- Enabled: true
137
-
138
- Performance/RedundantStringChars: # (new in 1.7)
139
- Enabled: true
140
-
141
- Performance/ReverseFirst: # (new in 1.7)
142
- Enabled: true
143
-
144
- Performance/SortReverse: # (new in 1.7)
145
- Enabled: true
146
-
147
- Performance/Squeeze: # (new in 1.7)
148
- Enabled: true
149
-
150
- Performance/StringInclude: # (new in 1.7)
151
- Enabled: true
152
-
153
- Performance/Sum: # (new in 1.8)
154
- Enabled: true
57
+ Naming/MethodParameterName:
58
+ AllowedNames:
59
+ # defaults:
60
+ - io
61
+ - id
62
+ - to
63
+ - by
64
+ - 'on'
65
+ - in
66
+ - at
67
+ - ip
68
+ - db
69
+ - os
70
+ - pp
71
+ # emjot additions:
72
+ - q
73
+ - dj
74
+
75
+ Naming/VariableNumber:
76
+ EnforcedStyle: 'snake_case'
77
+ AllowedIdentifiers:
78
+ # defaults (as of rubocop 1.9.1):
79
+ - capture3 # Open3.capture3
80
+ - iso8601 # Time#iso8601
81
+ - rfc1123_date # CGI.rfc1123_date
82
+ - rfc822 # Time#rfc822
83
+ - rfc2822 # Time#rfc2822
84
+ - rfc3339 # DateTime.rfc3339
85
+ # emjot additions:
86
+ - html5
87
+ - s3
155
88
 
156
89
  RSpec/DescribeClass:
157
90
  Exclude:
@@ -160,70 +93,19 @@ RSpec/DescribeClass:
160
93
  RSpec/DescribedClass:
161
94
  Enabled: false
162
95
 
163
- RSpec/FilePath:
164
- Enabled: false
165
-
166
- RSpec/IdenticalEqualityAssertion: # (new in 2.4)
167
- Enabled: true
168
-
169
96
  RSpec/ImplicitSubject:
170
97
  EnforcedStyle: 'single_statement_only'
171
98
 
172
99
  RSpec/LetSetup:
173
100
  Enabled: false
174
101
 
175
- RSpec/Rails/AvoidSetupHook: # (new in 2.4)
176
- Enabled: true
177
-
178
- Style/ArgumentsForwarding: # (new in 1.1)
179
- Enabled: true
180
-
181
- Style/EndlessMethod: # (new in 1.8)
182
- Enabled: true
183
-
184
- Style/CollectionCompact: # (new in 1.2)
185
- Enabled: true
186
-
187
102
  Style/Documentation:
188
103
  Exclude:
189
104
  - 'db/migrate/**/*'
190
105
 
191
- Style/DocumentDynamicEvalDefinition: # (new in 1.1)
192
- Enabled: true
193
-
194
106
  Style/FormatStringToken:
195
107
  Enabled: false # too many false positives in version 0.49.1; see e.g. https://github.com/bbatsov/rubocop/issues/4425
196
108
 
197
- Style/HashConversion: # (new in 1.10)
198
- Enabled: true
199
-
200
- Style/HashExcept: # (new in 1.7)
201
- Enabled: true
202
-
203
- Style/IfWithBooleanLiteralBranches: # (new in 1.9)
204
- Enabled: true
205
-
206
- Style/InPatternThen: # (new in 1.16)
207
- Enabled: true
208
-
209
- Style/MultilineInPatternThen: # (new in 1.16)
210
- Enabled: true
211
-
212
- Style/NegatedIfElseCondition: # (new in 1.2)
213
- Enabled: true
214
-
215
- Style/NilLambda: # (new in 1.3)
216
- Enabled: true
217
-
218
- Style/QuotedSymbols: # (new in 1.16)
219
- Enabled: true
220
-
221
- Style/RedundantArgument: # (new in 1.4)
222
- Enabled: true
223
-
224
- Style/RedundantSelfAssignmentBranch: # (new in 1.19)
225
- Enabled: true
226
-
227
109
  Style/RescueStandardError:
228
110
  Enabled: false
229
111
 
@@ -232,9 +114,3 @@ Style/SignalException:
232
114
 
233
115
  Style/SoleNestedConditional:
234
116
  AllowModifier: true
235
-
236
- Style/StringChars: # (new in 1.12)
237
- Enabled: true
238
-
239
- Style/SwapValues: # (new in 1.1)
240
- Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,7 +1,57 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-08-12 11:38:34 UTC using RuboCop version 1.19.0.
3
+ # on 2024-03-13 13:32:20 UTC using RuboCop version 1.62.1.
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
+
9
+ # Offense count: 1
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: Severity, Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/RequireMFA:
14
+ Exclude:
15
+ - 'paperclip-permanent_records.gemspec'
16
+
17
+ # Offense count: 4
18
+ # Configuration parameters: Prefixes, AllowedPatterns.
19
+ # Prefixes: when, with, without
20
+ RSpec/ContextWording:
21
+ Exclude:
22
+ - 'spec/paperclip/permanent_records_spec.rb'
23
+
24
+ # Offense count: 2
25
+ # Configuration parameters: CountAsOne.
26
+ RSpec/ExampleLength:
27
+ Max: 6
28
+
29
+ # Offense count: 4
30
+ RSpec/MultipleExpectations:
31
+ Max: 4
32
+
33
+ # Offense count: 2
34
+ # Configuration parameters: AllowedGroups.
35
+ RSpec/NestedGroups:
36
+ Max: 4
37
+
38
+ # Offense count: 2
39
+ # This cop supports unsafe autocorrection (--autocorrect-all).
40
+ RSpec/ReceiveMessages:
41
+ Exclude:
42
+ - 'spec/paperclip/permanent_records_spec.rb'
43
+
44
+ # Offense count: 1
45
+ # This cop supports unsafe autocorrection (--autocorrect-all).
46
+ # Configuration parameters: .
47
+ # SupportedStyles: constant, string
48
+ RSpec/VerifiedDoubleReference:
49
+ EnforcedStyle: string
50
+
51
+ # Offense count: 3
52
+ # Configuration parameters: AllowedConstants.
53
+ Style/Documentation:
54
+ Exclude:
55
+ - 'lib/paperclip/permanent_records.rb'
56
+ - 'lib/paperclip/permanent_records/active_record.rb'
57
+ - 'lib/paperclip/permanent_records/paperclip_patch.rb'
data/Appraisals CHANGED
@@ -1,11 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise 'rails_5.2_pc_6.0' do
3
+ appraise 'rails_5.2' do
4
4
  gem 'rails', '~> 5.2.0'
5
- gem 'paperclip', '~> 6.0.0'
6
5
  end
7
6
 
8
- appraise 'rails_5.2_pc_6.1' do
9
- gem 'rails', '~> 5.2.0'
10
- gem 'paperclip', '~> 6.1.0'
7
+ appraise 'rails_6.0' do
8
+ gem 'rails', '~> 6.0.0'
9
+ end
10
+
11
+ appraise 'rails_6.1' do
12
+ gem 'rails', '~> 6.1.0'
13
+ end
14
+
15
+ appraise 'rails_7.0' do
16
+ gem 'rails', '~> 7.0.0'
17
+ end
18
+
19
+ appraise 'rails_7.1' do
20
+ gem 'rails', '~> 7.1.0'
11
21
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # (unreleased)
2
+
3
+ # 0.7.2 (2024-11-11)
4
+
5
+ * (backport) (dev) Fix: gem should be pushed to rubygems.org
6
+
7
+ # 0.7.1 (2024-04-04)
8
+
9
+ * (dev) Fix some requires
10
+
11
+ # 0.7.0 (not released)
12
+
13
+ * Add support for rails 6.0/6.1/7.0/7.1, ruby 3.0/3.1/3.2
14
+ * Drop support for kt-paperclip < 7.2
15
+ * Drop support for ruby < 2.7
16
+ * (dev) switch to GitHub Actions for CI tests
17
+ * (dev) add rake:release task
18
+ * (dev) update dev dependencies, fix rubocop config, fix rubocop warnings
19
+
20
+ # 0.6.0 (2022-09-02)
21
+
22
+ To upgrade to this version, remove any dependencies to paperclip from your project and switch to kt-paperclip (https://github.com/kreeti/kt-paperclip).
23
+
24
+ * Change dependency from the discontinued paperclip to kt-paperclip
25
+ * Drop support for (kt-)paperclip < 6.2.2
26
+ * Drop support for ruby < 2.6
27
+ * (dev) remove rake `local` task (unnecessary alias for `wwtd:local`)
28
+ * (internal) use current rubocop (1.36) + configs, add rubocop-rake, re-generate todos + fix warnings
29
+
1
30
  # 0.5.0 (2021-08-12)
2
31
 
3
32
  * Drop support for rails < 5.2
@@ -7,7 +36,7 @@
7
36
  * Update permanent_records to at least 5.0.0 (currently the latest)
8
37
  * paperclip: drop support for < 6.0, test 6.0 and 6.1
9
38
  * Update dev dependencies (+ some code style fixes), incl. bundler to 2.x
10
- (UPGRADING: you might need to remove your local Gemfile.lock and check that you have bundler 2.x
39
+ (UPGRADING: you might need to remove your local Gemfile.lock and check that you have bundler 2.x
11
40
  installed in all the rubies referenced in .travis.yml)
12
41
 
13
42
  # 0.4.0 (2018-01-18)
@@ -16,7 +45,7 @@
16
45
  * Remove support for ruby 2.1
17
46
  * Test with rails 5.0 and 5.1
18
47
  * Test on ruby 2.4 and 2.5
19
- * Update permanent_records dependency to at least 4.2.7 (currenly the latest)
48
+ * Update permanent_records dependency to at least 4.2.7 (currently the latest)
20
49
  * paperclip: update patch to its 5.1.0 counterpart, test with 5.0 and 5.1
21
50
  * Don't trigger ActiveRecord loading on requiring this gem
22
51
  * Dev dependencies: update rake and rubocop/rubocop-rspec (+ some code style fixes)
data/Gemfile CHANGED
@@ -4,3 +4,13 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in paperclip-permanent_records.gemspec
6
6
  gemspec
7
+
8
+ gem 'appraisal', '~> 2.5'
9
+ gem 'bundler', '~> 2.4'
10
+ gem 'rake', '>= 13.0'
11
+ gem 'rspec-rails', '~> 5.0'
12
+ gem 'rubocop'
13
+ gem 'rubocop-performance'
14
+ gem 'rubocop-rake'
15
+ gem 'rubocop-rspec'
16
+ gem 'sqlite3'
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015-2018 emjot GmbH & Co. KG
1
+ Copyright (c) 2015-2022 emjot GmbH & Co. KG
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -5,13 +5,17 @@ when the model is really destroyed.
5
5
 
6
6
  See [paperclip #804](https://github.com/thoughtbot/paperclip/issues/804#issuecomment-4946231).
7
7
 
8
+ NOTE: Since paperclip is not maintained any more, we have switched the dependency to the fork [kt-paperclip](https://github.com/kreeti/kt-paperclip) in the 0.6+ versions of this gem.
9
+
8
10
  ## Compatibility
9
11
 
10
- * rails 5.2: works with paperclip 6.x and ruby 2.5 or later
11
- * tested with permanent_records 5.0.0
12
- * previous versions of ruby/rails/paperclip: please check version 0.4.x of this gem
12
+ * rails 5.2: works with kt-paperclip 7 and ruby ~> 2.7
13
+ * rails 6.0/6.1: works with kt-paperclip ~> 7.2 and ruby 2.7.8 or later
14
+ * rails 7.0/7.1: works with kt-paperclip ~> 7.2 and ruby 3.0.6 or later
15
+ * tested with permanent_records 6.0.0
16
+ * previous versions of ruby/rails/paperclip: please check version 0.6.x of this gem
13
17
 
14
- Please see `.travis.yml` and `Appraisals` for what combinations have actually been tested. Usage with other versions
18
+ Please see `.github/workflows/test.yml` and `Appraisals` for what combinations have actually been tested. Usage with other versions
15
19
  might cause data loss.
16
20
 
17
21
  ## Installation
@@ -30,6 +34,8 @@ Or install it yourself as:
30
34
 
31
35
  $ gem install paperclip-permanent_records
32
36
 
37
+ Ensure that you don't have any dependencies to the paperclip gem in your project, only to the kt-paperclip gem!
38
+
33
39
  ## Usage
34
40
 
35
41
  Nothing to do, this should just work.
@@ -47,11 +53,24 @@ This gem does basically two things:
47
53
 
48
54
  Code style: Please use rubocop before you commit (`bundle exec rubocop`) and fix any warnings.
49
55
 
50
- To setup tests, make sure all the ruby versions defined in `.travis.yml` are installed on your system.
51
- Use `bundle exec appraisal generate` to generate the gemfiles if you change them in `Appraisals` and `.travis.yml`.
56
+ Use `bundle exec appraisal generate` to generate the gemfiles if you change them in `Appraisals` and `.github/workflows/test.yml`.
57
+
58
+ ### Running tests
59
+
60
+ To setup tests, make sure all the ruby versions defined in `.github/workflows/test.yml` are installed on your system.
61
+
62
+ Assuming you are using [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/), run tests with each of the supported ruby versions:
63
+
64
+ ```
65
+ RBENV_VERSION=2.7.8 bundle exec appraisal rspec
66
+ ```
67
+
68
+ ## Install and release
52
69
 
53
- Run tests via:
70
+ To install this gem onto your local machine, run `bundle exec rake install`.
54
71
 
55
- * `rake wwtd` for all combinations of ruby/rails/paperclip versions
56
- * `rake wwtd:local` for all rails/paperclip versions, but only on current ruby
57
- * `rake spec` (or e.g. `bundle exec rspec spec --format documentation`) with main Gemfile and only on current ruby
72
+ * Prepare:
73
+ * update `CHANGELOG.md` documentation
74
+ * update the version number in `lib/paperclip/permanent_records/version.rb`
75
+ * Release
76
+ * run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to rubygems.org
data/Rakefile CHANGED
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/setup'
4
- require 'paperclip/permanent_records/gem_tasks'
4
+
5
+ require 'bundler/gem_helper'
6
+ require 'paperclip/permanent_records/gem_helper'
7
+ Bundler::GemHelper.prepend(Paperclip::PermanentRecords::GemHelper)
8
+ require 'bundler/gem_tasks'
9
+
5
10
  require 'appraisal'
6
11
  require 'rspec/core/rake_task'
7
- require 'wwtd/tasks'
8
12
 
9
13
  desc 'Default: run all tests with all supported versions'
10
14
  task default: :all
@@ -14,8 +18,6 @@ task all: ['appraisal:install'] do
14
18
  exec('rake appraisal spec')
15
19
  end
16
20
 
17
- task local: 'wwtd:local' # run all gemfiles with local ruby
18
-
19
21
  desc 'Run all tests'
20
22
  RSpec::Core::RakeTask.new('spec') do |t|
21
23
  t.pattern = FileList['spec/**/*_spec.rb']
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.5"
6
+ gem "bundler", "~> 2.4"
7
+ gem "rake", ">= 13.0"
8
+ gem "rspec-rails", "~> 5.0"
9
+ gem "rubocop"
10
+ gem "rubocop-performance"
11
+ gem "rubocop-rake"
12
+ gem "rubocop-rspec"
13
+ gem "sqlite3"
14
+ gem "rails", "~> 5.2.0"
15
+
16
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.5"
6
+ gem "bundler", "~> 2.4"
7
+ gem "rake", ">= 13.0"
8
+ gem "rspec-rails", "~> 5.0"
9
+ gem "rubocop"
10
+ gem "rubocop-performance"
11
+ gem "rubocop-rake"
12
+ gem "rubocop-rspec"
13
+ gem "sqlite3"
14
+ gem "rails", "~> 6.0.0"
15
+
16
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.5"
6
+ gem "bundler", "~> 2.4"
7
+ gem "rake", ">= 13.0"
8
+ gem "rspec-rails", "~> 5.0"
9
+ gem "rubocop"
10
+ gem "rubocop-performance"
11
+ gem "rubocop-rake"
12
+ gem "rubocop-rspec"
13
+ gem "sqlite3"
14
+ gem "rails", "~> 6.1.0"
15
+
16
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.5"
6
+ gem "bundler", "~> 2.4"
7
+ gem "rake", ">= 13.0"
8
+ gem "rspec-rails", "~> 5.0"
9
+ gem "rubocop"
10
+ gem "rubocop-performance"
11
+ gem "rubocop-rake"
12
+ gem "rubocop-rspec"
13
+ gem "sqlite3"
14
+ gem "rails", "~> 7.0.0"
15
+
16
+ gemspec path: "../"
@@ -0,0 +1,16 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.5"
6
+ gem "bundler", "~> 2.4"
7
+ gem "rake", ">= 13.0"
8
+ gem "rspec-rails", "~> 5.0"
9
+ gem "rubocop"
10
+ gem "rubocop-performance"
11
+ gem "rubocop-rake"
12
+ gem "rubocop-rspec"
13
+ gem "sqlite3"
14
+ gem "rails", "~> 7.1.0"
15
+
16
+ gemspec path: "../"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paperclip
2
4
  module PermanentRecords
3
5
  module ActiveRecord
@@ -1,22 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paperclip
2
4
  module PermanentRecords
3
- # Like Bundler::GemHelper, but without the 'release' task
4
- # (would need to be implemented for release on gems.emjot.de)
5
- class GemHelper < Bundler::GemHelper
6
- def install
7
- built_gem_path = nil
8
- desc "Build #{name}-#{version}.gem into the pkg directory."
9
- task 'build' do
10
- built_gem_path = build_gem
11
- end
12
-
13
- desc "Build and install #{name}-#{version}.gem into system gems."
14
- task 'install' => 'build' do
15
- install_gem(built_gem_path)
16
- end
17
-
18
- GemHelper.instance = self
19
- end
5
+ # Patches Bundler::GemHelper to change version tagging without the "v" Prefix, just the plain version
6
+ # (also ignores any GemHelper.tag_prefix if you would set it!).
7
+ #
8
+ # Based on bundler v2.5.23
9
+ module GemHelper
10
+ protected
20
11
 
21
12
  def version_tag
22
13
  version.to_s
@@ -1,4 +1,6 @@
1
- # Patch for paperclip >= 3.5.0 (based on 6.1.0)
1
+ # frozen_string_literal: true
2
+
3
+ # Patch for (kt-)paperclip >= 3.5.0 (based on 7.2.2)
2
4
 
3
5
  module Paperclip
4
6
  class HasAttachedFile
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paperclip
2
4
  module PermanentRecords
3
- VERSION = '0.5.0'.freeze
5
+ VERSION = '0.7.2'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'paperclip/permanent_records/version'
2
4
 
3
5
  require 'paperclip'
@@ -7,7 +9,7 @@ require 'paperclip/permanent_records/active_record'
7
9
  module Paperclip
8
10
  module PermanentRecords
9
11
  ActiveSupport.on_load(:active_record) do
10
- ::ActiveRecord::Base.send :include, Paperclip::PermanentRecords::ActiveRecord
12
+ ::ActiveRecord::Base.include Paperclip::PermanentRecords::ActiveRecord
11
13
  end
12
14
 
13
15
  require 'paperclip/permanent_records/paperclip_patch'
@@ -11,27 +11,16 @@ Gem::Specification.new do |spec|
11
11
  spec.email = ['herold@emjot.de']
12
12
  spec.summary = 'Make paperclip attachments work with permanent_records'
13
13
  spec.description = 'Make paperclip attachments work with permanent_records'
14
- spec.homepage = ''
14
+ spec.homepage = 'https://github.com/emjot/paperclip-permanent_records'
15
15
  spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0")
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
19
  spec.require_paths = ['lib']
21
20
 
22
- spec.required_ruby_version = '>= 2.5'
21
+ spec.required_ruby_version = '>= 2.7'
23
22
 
24
23
  spec.add_dependency 'activerecord', '>= 5.2'
25
- spec.add_dependency 'paperclip', '>= 6.0'
26
- spec.add_dependency 'permanent_records', '>= 5.0'
27
-
28
- spec.add_development_dependency 'appraisal', '~> 2.2'
29
- spec.add_development_dependency 'bundler', '~> 2.0'
30
- spec.add_development_dependency 'rake', '>= 10.0'
31
- spec.add_development_dependency 'rspec-rails', '~> 5.0'
32
- spec.add_development_dependency 'rubocop'
33
- spec.add_development_dependency 'rubocop-performance'
34
- spec.add_development_dependency 'rubocop-rspec'
35
- spec.add_development_dependency 'sqlite3'
36
- spec.add_development_dependency 'wwtd', '~> 1.3'
24
+ spec.add_dependency 'kt-paperclip', ['>= 7.2', '< 8']
25
+ spec.add_dependency 'permanent_records', '>= 6.0'
37
26
  end
data/spec/data/models.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Post < ActiveRecord::Base
2
4
  has_attached_file :image,
3
5
  url: '/system/:test_env_number/:class/:attachment/:id/:style-:fingerprint.:extension'
data/spec/data/schema.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ActiveRecord::Migration.verbose = false
2
4
 
3
5
  ActiveRecord::Schema.define do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe Paperclip::PermanentRecords do
@@ -32,23 +34,23 @@ RSpec.describe Paperclip::PermanentRecords do
32
34
  it "keeps the attachments' files" do
33
35
  model.destroy
34
36
  expect(model).to be_image
35
- expect(File).to be_exist(file_path)
37
+ expect(File).to exist(file_path)
36
38
 
37
39
  # should still be okay even after saving again
38
40
  model.save!
39
41
  expect(model).to be_image
40
- expect(File).to be_exist(file_path)
42
+ expect(File).to exist(file_path)
41
43
  end
42
44
 
43
45
  it "keeps the attachments' files after revive" do
44
46
  model.destroy.revive
45
47
  expect(model).to be_image
46
- expect(File).to be_exist(file_path)
48
+ expect(File).to exist(file_path)
47
49
 
48
50
  # should still be okay even after saving again
49
51
  model.save!
50
52
  expect(model).to be_image
51
- expect(File).to be_exist(file_path)
53
+ expect(File).to exist(file_path)
52
54
  end
53
55
 
54
56
  context 'with :force option' do
@@ -59,7 +61,7 @@ RSpec.describe Paperclip::PermanentRecords do
59
61
  it "deletes the attachments' files" do
60
62
  model.destroy(:force)
61
63
  expect(model).not_to be_image
62
- expect(File).not_to be_exist(file_path)
64
+ expect(File).not_to exist(file_path)
63
65
  end
64
66
  end
65
67
  end
@@ -93,7 +95,7 @@ RSpec.describe Paperclip::PermanentRecords do
93
95
  it "deletes the attachments' files" do
94
96
  model.destroy
95
97
  expect(model).not_to be_image
96
- expect(File).not_to be_exist(file_path)
98
+ expect(File).not_to exist(file_path)
97
99
  end
98
100
  end
99
101
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,6 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2
4
  require 'pathname'
3
5
  require 'fileutils'
4
6
 
@@ -26,7 +28,7 @@ RSpec.configure do |config|
26
28
  Kernel.srand config.seed
27
29
 
28
30
  config.after(:suite) do
29
- FileUtils.rm_rf TEST_ASSETS_PATH if File.exist?(TEST_ASSETS_PATH)
31
+ FileUtils.rm_rf TEST_ASSETS_PATH
30
32
  end
31
33
  end
32
34
 
@@ -34,22 +36,21 @@ require 'active_record'
34
36
  require 'active_support'
35
37
  require 'paperclip/permanent_records'
36
38
 
37
- ActiveRecord::Base.send(:include, Paperclip::Glue)
39
+ ActiveRecord::Base.include Paperclip::Glue
38
40
 
39
41
  Paperclip.interpolates(:test_env_number) do |_, _|
40
42
  ENV['TEST_ENV_NUMBER'].presence || '0'
41
43
  end
42
44
 
43
45
  # set up models
44
- require 'fileutils'
45
46
  require 'logger'
46
47
  tmpdir = File.join(File.dirname(__FILE__), '../tmp')
47
- FileUtils.mkdir(tmpdir) unless File.exist?(tmpdir)
48
+ FileUtils.mkdir_p(tmpdir)
48
49
  log = File.expand_path(File.join(tmpdir, 'permanent_records_test.log'))
49
50
  FileUtils.touch(log) unless File.exist?(log)
50
51
  ActiveRecord::Base.logger = Logger.new(log)
51
52
  ActiveRecord::LogSubscriber.attach_to(:active_record)
52
53
  ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
53
- require File.expand_path('../data/schema', __FILE__)
54
- require File.expand_path('../data/models', __FILE__)
54
+ require File.expand_path('data/schema', __dir__)
55
+ require File.expand_path('data/models', __dir__)
55
56
  I18n.locale = I18n.default_locale = :en
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-permanent_records
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maximilian Herold
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-12 00:00:00.000000000 Z
11
+ date: 2024-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -25,159 +25,39 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.2'
27
27
  - !ruby/object:Gem::Dependency
28
- name: paperclip
28
+ name: kt-paperclip
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '6.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '6.0'
41
- - !ruby/object:Gem::Dependency
42
- name: permanent_records
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
33
+ version: '7.2'
34
+ - - "<"
46
35
  - !ruby/object:Gem::Version
47
- version: '5.0'
36
+ version: '8'
48
37
  type: :runtime
49
38
  prerelease: false
50
39
  version_requirements: !ruby/object:Gem::Requirement
51
40
  requirements:
52
41
  - - ">="
53
42
  - !ruby/object:Gem::Version
54
- version: '5.0'
55
- - !ruby/object:Gem::Dependency
56
- name: appraisal
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.2'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
43
+ version: '7.2'
44
+ - - "<"
67
45
  - !ruby/object:Gem::Version
68
- version: '2.2'
46
+ version: '8'
69
47
  - !ruby/object:Gem::Dependency
70
- name: bundler
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '10.0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '10.0'
97
- - !ruby/object:Gem::Dependency
98
- name: rspec-rails
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '5.0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '5.0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop-performance
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: rubocop-rspec
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: sqlite3
48
+ name: permanent_records
155
49
  requirement: !ruby/object:Gem::Requirement
156
50
  requirements:
157
51
  - - ">="
158
52
  - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
53
+ version: '6.0'
54
+ type: :runtime
161
55
  prerelease: false
162
56
  version_requirements: !ruby/object:Gem::Requirement
163
57
  requirements:
164
58
  - - ">="
165
59
  - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: wwtd
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '1.3'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: '1.3'
60
+ version: '6.0'
181
61
  description: Make paperclip attachments work with permanent_records
182
62
  email:
183
63
  - herold@emjot.de
@@ -185,23 +65,27 @@ executables: []
185
65
  extensions: []
186
66
  extra_rdoc_files: []
187
67
  files:
68
+ - ".editorconfig"
69
+ - ".github/dependabot.yml"
70
+ - ".github/workflows/lint_and_test.yml"
188
71
  - ".gitignore"
189
72
  - ".rspec"
190
73
  - ".rubocop.yml"
191
74
  - ".rubocop_todo.yml"
192
- - ".travis.yml"
193
75
  - Appraisals
194
76
  - CHANGELOG.md
195
77
  - Gemfile
196
78
  - LICENSE.txt
197
79
  - README.md
198
80
  - Rakefile
199
- - gemfiles/rails_5.2_pc_6.0.gemfile
200
- - gemfiles/rails_5.2_pc_6.1.gemfile
81
+ - gemfiles/rails_5.2.gemfile
82
+ - gemfiles/rails_6.0.gemfile
83
+ - gemfiles/rails_6.1.gemfile
84
+ - gemfiles/rails_7.0.gemfile
85
+ - gemfiles/rails_7.1.gemfile
201
86
  - lib/paperclip/permanent_records.rb
202
87
  - lib/paperclip/permanent_records/active_record.rb
203
88
  - lib/paperclip/permanent_records/gem_helper.rb
204
- - lib/paperclip/permanent_records/gem_tasks.rb
205
89
  - lib/paperclip/permanent_records/paperclip_patch.rb
206
90
  - lib/paperclip/permanent_records/version.rb
207
91
  - paperclip-permanent_records.gemspec
@@ -210,7 +94,7 @@ files:
210
94
  - spec/data/test.png
211
95
  - spec/paperclip/permanent_records_spec.rb
212
96
  - spec/spec_helper.rb
213
- homepage: ''
97
+ homepage: https://github.com/emjot/paperclip-permanent_records
214
98
  licenses:
215
99
  - MIT
216
100
  metadata: {}
@@ -222,20 +106,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
106
  requirements:
223
107
  - - ">="
224
108
  - !ruby/object:Gem::Version
225
- version: '2.5'
109
+ version: '2.7'
226
110
  required_rubygems_version: !ruby/object:Gem::Requirement
227
111
  requirements:
228
112
  - - ">="
229
113
  - !ruby/object:Gem::Version
230
114
  version: '0'
231
115
  requirements: []
232
- rubygems_version: 3.0.9
116
+ rubygems_version: 3.2.33
233
117
  signing_key:
234
118
  specification_version: 4
235
119
  summary: Make paperclip attachments work with permanent_records
236
- test_files:
237
- - spec/data/models.rb
238
- - spec/data/schema.rb
239
- - spec/data/test.png
240
- - spec/paperclip/permanent_records_spec.rb
241
- - spec/spec_helper.rb
120
+ test_files: []
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.5.9
4
- - 2.6.8
5
- - 2.7.4
6
- script: "bundle exec rake spec"
7
- gemfile:
8
- - gemfiles/rails_5.2_pc_6.0.gemfile
9
- - gemfiles/rails_5.2_pc_6.1.gemfile
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This file was generated by Appraisal
4
-
5
- source 'https://rubygems.org'
6
-
7
- gem 'paperclip', '~> 6.0.0'
8
- gem 'rails', '~> 5.2.0'
9
-
10
- gemspec path: '../'
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # This file was generated by Appraisal
4
-
5
- source 'https://rubygems.org'
6
-
7
- gem 'paperclip', '~> 6.1.0'
8
- gem 'rails', '~> 5.2.0'
9
-
10
- gemspec path: '../'
@@ -1,2 +0,0 @@
1
- require 'paperclip/permanent_records/gem_helper'
2
- Paperclip::PermanentRecords::GemHelper.install_tasks