paperclip-globalize3 3.2.0 → 4.2.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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +54 -0
  3. data/.rubocop.yml +1 -1
  4. data/.rubocop_todo.yml +1 -1
  5. data/.travis.yml +18 -13
  6. data/Appraisals +21 -40
  7. data/CHANGELOG.md +32 -0
  8. data/Gemfile +2 -0
  9. data/README.md +8 -8
  10. data/Rakefile +2 -0
  11. data/gemfiles/{rails_4.2_pc_4_2.gemfile → rails_4.2_pc_5_3.gemfile} +3 -1
  12. data/gemfiles/rails_4.2_pc_6_0.gemfile +2 -0
  13. data/gemfiles/rails_4.2_pc_6_1.gemfile +2 -0
  14. data/gemfiles/{rails_5.0_pc_4_2.gemfile → rails_5.0_pc_5_3.gemfile} +3 -1
  15. data/gemfiles/rails_5.0_pc_6_0.gemfile +2 -0
  16. data/gemfiles/rails_5.0_pc_6_1.gemfile +2 -0
  17. data/gemfiles/{rails_5.1_pc_4_2.gemfile → rails_5.1_pc_5_3.gemfile} +3 -1
  18. data/gemfiles/rails_5.1_pc_6_0.gemfile +2 -0
  19. data/gemfiles/rails_5.1_pc_6_1.gemfile +2 -0
  20. data/gemfiles/{rails_4.2_pc_4_3.gemfile → rails_5.2_pc_6_1.gemfile} +4 -2
  21. data/gemfiles/rails_6.0_pc_6_1.gemfile +11 -0
  22. data/gemfiles/rails_6.1_pc_6_1.gemfile +11 -0
  23. data/lib/paperclip/globalize3/attachment.rb +4 -7
  24. data/lib/paperclip/globalize3/gem_helper.rb +2 -0
  25. data/lib/paperclip/globalize3/gem_tasks.rb +2 -0
  26. data/lib/paperclip/globalize3/version.rb +3 -1
  27. data/lib/paperclip/globalize3.rb +2 -0
  28. data/paperclip-globalize3.gemspec +6 -4
  29. data/spec/data/models.rb +11 -0
  30. data/spec/data/schema.rb +2 -0
  31. data/spec/paperclip/globalize3/attachment_spec.rb +38 -0
  32. data/spec/spec_helper.rb +2 -0
  33. metadata +22 -26
  34. data/gemfiles/rails_4.2_pc_5_0.gemfile +0 -8
  35. data/gemfiles/rails_4.2_pc_5_2.gemfile +0 -8
  36. data/gemfiles/rails_5.0_pc_5_0.gemfile +0 -8
  37. data/gemfiles/rails_5.0_pc_5_2.gemfile +0 -8
  38. data/gemfiles/rails_5.1_pc_5_0.gemfile +0 -8
  39. data/gemfiles/rails_5.1_pc_5_2.gemfile +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 916887c3ed2f6b64562379a1e812572206b19579bf40c989d9f9844576817b59
4
- data.tar.gz: 3650477d61db712a9445f85266297636d10398ca68f9b603371ff0fcf2109520
3
+ metadata.gz: cdf7ad505301920e1e094b1a85b3dbf36a29d0f029e2c6afdbc0d732064cf205
4
+ data.tar.gz: 70f446b422aa3b8d468a121ca1e30536f163e189520520d19934eb2524c5970c
5
5
  SHA512:
6
- metadata.gz: 644a08544db2750462c4c4deb89719a1abe0f7af7430e0d768679ad70a660a93789613af2e6b9324bf40465f4772a701deb62e8b73b812b3e3227d871bf5d02a
7
- data.tar.gz: 06fced48112f95b76265446e239d101322cb88a3dbba3cfb649d2fc63fe164cc66eac1d9589aaf694f4e7a822667ffadbabce64ebe3ed79da9ea55aa2b11e97b
6
+ metadata.gz: 3e31e5bff450b220474df88baf2a23ff5c29977832f63508d5900a3ff1effeead3d369cabff9a80b888b4cbeaaa928a8811e3b56af114a5505e43f114bc07ddc
7
+ data.tar.gz: 63a0a383da787acc13ab4851113f1034e8724eb031f486fd45858b9f9d49eaf0132f4024f893e898823fc5f70960661da3979febb8bc8225157b36cf6433c448
@@ -0,0 +1,54 @@
1
+ # NOTE: when changing this file, please adapt .travis.yml accordingly
2
+
3
+ name: Tests
4
+
5
+ on:
6
+ push:
7
+ branches: [master]
8
+ paths-ignore:
9
+ - '**.md'
10
+
11
+ pull_request:
12
+ branches: [master]
13
+ paths-ignore:
14
+ - '**.md'
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ ruby:
23
+ - 2.4.9
24
+ - 2.5.9
25
+ - 2.6.9
26
+ gemfile:
27
+ - rails_4.2_pc_5_3
28
+ - rails_4.2_pc_6_0
29
+ - rails_4.2_pc_6_1
30
+ - rails_5.0_pc_5_3
31
+ - rails_5.0_pc_6_0
32
+ - rails_5.0_pc_6_1
33
+ - rails_5.1_pc_5_3
34
+ - rails_5.1_pc_6_0
35
+ - rails_5.1_pc_6_1
36
+ - rails_5.2_pc_6_1
37
+ - rails_6.0_pc_6_1
38
+ - rails_6.1_pc_6_1
39
+ exclude:
40
+ - ruby: 2.4.9
41
+ gemfile: rails_6.0_pc_6_1
42
+ - ruby: 2.4.9
43
+ gemfile: rails_6.1_pc_6_1
44
+ env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
45
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
46
+ steps:
47
+ - uses: actions/checkout@v2
48
+ - name: Set up Ruby
49
+ uses: ruby/setup-ruby@v1
50
+ with:
51
+ ruby-version: ${{ matrix.ruby }}
52
+ bundler-cache: true
53
+ bundler: 1.17
54
+ - run: bundle exec rake spec
data/.rubocop.yml CHANGED
@@ -11,7 +11,7 @@ AllCops:
11
11
  - '**/Gemfile'
12
12
  - '**/Rakefile'
13
13
  - '**/Capfile'
14
- TargetRubyVersion: 2.2
14
+ TargetRubyVersion: 2.4
15
15
 
16
16
  Layout/AlignHash:
17
17
  EnforcedColonStyle: 'table'
data/.rubocop_todo.yml CHANGED
@@ -9,7 +9,7 @@
9
9
  # Offense count: 3
10
10
  # Configuration parameters: CountComments, ExcludedMethods.
11
11
  Metrics/BlockLength:
12
- Max: 152
12
+ Max: 182
13
13
 
14
14
  # Offense count: 2
15
15
  # Configuration parameters: .
data/.travis.yml CHANGED
@@ -1,27 +1,32 @@
1
+ # NOTE: when changing this file, please adapt .github/workflows/test.yml accordingly
2
+
1
3
  language: ruby
2
4
  rvm:
3
- - 2.2.10
4
- - 2.3.8
5
- - 2.4.5
5
+ - 2.4.9
6
+ - 2.5.9
7
+ - 2.6.9
6
8
  before_install:
7
9
  - gem uninstall -v '>= 2.0.1' -i $(rvm gemdir)@global -ax bundler || true
8
10
  - gem install bundler -v '1.16.6'
9
11
 
10
12
  script: "bundle exec rake spec"
11
13
  gemfile:
12
- - gemfiles/rails_4.2_pc_4_2.gemfile
13
- - gemfiles/rails_4.2_pc_4_3.gemfile
14
- - gemfiles/rails_4.2_pc_5_0.gemfile
15
- - gemfiles/rails_4.2_pc_5_2.gemfile
14
+ - gemfiles/rails_4.2_pc_5_3.gemfile
16
15
  - gemfiles/rails_4.2_pc_6_0.gemfile
17
16
  - gemfiles/rails_4.2_pc_6_1.gemfile
18
- - gemfiles/rails_5.0_pc_4_2.gemfile
19
- - gemfiles/rails_5.0_pc_5_0.gemfile
20
- - gemfiles/rails_5.0_pc_5_2.gemfile
17
+ - gemfiles/rails_5.0_pc_5_3.gemfile
21
18
  - gemfiles/rails_5.0_pc_6_0.gemfile
22
19
  - gemfiles/rails_5.0_pc_6_1.gemfile
23
- - gemfiles/rails_5.1_pc_4_2.gemfile
24
- - gemfiles/rails_5.1_pc_5_0.gemfile
25
- - gemfiles/rails_5.1_pc_5_2.gemfile
20
+ - gemfiles/rails_5.1_pc_5_3.gemfile
26
21
  - gemfiles/rails_5.1_pc_6_0.gemfile
27
22
  - gemfiles/rails_5.1_pc_6_1.gemfile
23
+ - gemfiles/rails_5.2_pc_6_1.gemfile
24
+ - gemfiles/rails_6.0_pc_6_1.gemfile
25
+ - gemfiles/rails_6.1_pc_6_1.gemfile
26
+
27
+ jobs:
28
+ exclude:
29
+ - rvm: 2.4.9
30
+ gemfile: gemfiles/rails_6.0_pc_6_1.gemfile
31
+ - rvm: 2.4.9
32
+ gemfile: gemfiles/rails_6.1_pc_6_1.gemfile
data/Appraisals CHANGED
@@ -1,23 +1,10 @@
1
- # Rails 4.2
2
-
3
- appraise 'rails-4.2-pc-4-2' do
4
- gem 'rails', '~> 4.2.0'
5
- gem 'paperclip', '~> 4.2.0'
6
- end
7
-
8
- appraise 'rails-4.2-pc-4-3' do
9
- gem 'rails', '~> 4.2.0'
10
- gem 'paperclip', '~> 4.3.0'
11
- end
1
+ # frozen_string_literal: true
12
2
 
13
- appraise 'rails-4.2-pc-5-0' do
14
- gem 'rails', '~> 4.2.0'
15
- gem 'paperclip', '~> 5.0.0'
16
- end
3
+ # Rails 4.2
17
4
 
18
- appraise 'rails-4.2-pc-5-2' do
5
+ appraise 'rails-4.2-pc-5-3' do
19
6
  gem 'rails', '~> 4.2.0'
20
- gem 'paperclip', '~> 5.2.0'
7
+ gem 'paperclip', '~> 5.3.0'
21
8
  end
22
9
 
23
10
  appraise 'rails-4.2-pc-6-0' do
@@ -32,19 +19,9 @@ end
32
19
 
33
20
  # Rails 5.0
34
21
 
35
- appraise 'rails-5.0-pc-4-2' do
36
- gem 'rails', '~> 5.0.0'
37
- gem 'paperclip', '~> 4.2.0'
38
- end
39
-
40
- appraise 'rails-5.0-pc-5-0' do
41
- gem 'rails', '~> 5.0.0'
42
- gem 'paperclip', '~> 5.0.0'
43
- end
44
-
45
- appraise 'rails-5.0-pc-5-2' do
22
+ appraise 'rails-5.0-pc-5-3' do
46
23
  gem 'rails', '~> 5.0.0'
47
- gem 'paperclip', '~> 5.2.0'
24
+ gem 'paperclip', '~> 5.3.0'
48
25
  end
49
26
 
50
27
  appraise 'rails-5.0-pc-6-0' do
@@ -59,27 +36,31 @@ end
59
36
 
60
37
  # Rails 5.1
61
38
 
62
- appraise 'rails-5.1-pc-4-2' do
39
+ appraise 'rails-5.1-pc-5-3' do
63
40
  gem 'rails', '~> 5.1.0'
64
- gem 'paperclip', '~> 4.2.0'
41
+ gem 'paperclip', '~> 5.3.0'
65
42
  end
66
43
 
67
- appraise 'rails-5.1-pc-5-0' do
44
+ appraise 'rails-5.1-pc-6-0' do
68
45
  gem 'rails', '~> 5.1.0'
69
- gem 'paperclip', '~> 5.0.0'
46
+ gem 'paperclip', '~> 6.0.0'
70
47
  end
71
48
 
72
- appraise 'rails-5.1-pc-5-2' do
49
+ appraise 'rails-5.1-pc-6-1' do
73
50
  gem 'rails', '~> 5.1.0'
74
- gem 'paperclip', '~> 5.2.0'
51
+ gem 'paperclip', '~> 6.1.0'
75
52
  end
76
53
 
77
- appraise 'rails-5.1-pc-6-0' do
78
- gem 'rails', '~> 5.1.0'
79
- gem 'paperclip', '~> 6.0.0'
54
+ # Rails 6.0
55
+
56
+ appraise 'rails-6.0-pc-6-1' do
57
+ gem 'rails', '~> 6.0.4'
58
+ gem 'paperclip', '~> 6.1.0'
80
59
  end
81
60
 
82
- appraise 'rails-5.1-pc-6-1' do
83
- gem 'rails', '~> 5.1.0'
61
+ # Rails 6.1
62
+
63
+ appraise 'rails-6.1-pc-6-1' do
64
+ gem 'rails', '~> 6.1.4'
84
65
  gem 'paperclip', '~> 6.1.0'
85
66
  end
data/CHANGELOG.md CHANGED
@@ -5,6 +5,38 @@
5
5
  * Enhancements
6
6
  * (none)
7
7
 
8
+ # 4.2.0 (2021-12-03)
9
+
10
+ * Enhancements
11
+ * Allow rails 6.1 ([#21](https://github.com/emjot/paperclip-globalize3/pull/21))
12
+
13
+ # 4.1.0 (2019-11-04)
14
+
15
+ * Bugfixes
16
+ * (none)
17
+ * Enhancements
18
+ * Allow rails 5.2 and 6.0 ([#20](https://github.com/emjot/paperclip-globalize3/pull/20))
19
+ * Internal / development
20
+ * Update ruby patch versions
21
+
22
+ # 4.0.0 (2019-07-10)
23
+
24
+ * Breaking changes
25
+ * Drop support for ruby < 2.4.6
26
+ * Drop support for globalize < 5.3
27
+ * Drop support for paperclip < 5.3
28
+ * Bugfixes
29
+ * Fix `attachment.clear(:style)` not deleting the files ([#17](https://github.com/emjot/paperclip-globalize3/pull/17))
30
+ * Enhancements
31
+ * Allow globalize 5.3
32
+ With globalize 5.3.0 paperclip-globalize3 is again compatible with Rails 4.2
33
+
34
+ # 3.3.0 (2019-05-14)
35
+
36
+ * Enhancements
37
+ * Allow globalize 5.2 ([#14](https://github.com/emjot/paperclip-globalize3/pull/14)).
38
+ Note that globalize 5.2.0 is currently broken in rails 4.2; see README.
39
+
8
40
  # 3.2.0 (2019-04-18)
9
41
 
10
42
  * Enhancements
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/README.md CHANGED
@@ -1,6 +1,4 @@
1
- # Paperclip::Globalize3
2
-
3
- [![Build Status](https://travis-ci.org/emjot/paperclip-globalize3.png?branch=master)](https://travis-ci.org/emjot/paperclip-globalize3)
1
+ # Paperclip::Globalize3 [![Tests](https://github.com/emjot/paperclip-globalize3/actions/workflows/test.yml/badge.svg)](https://github.com/emjot/paperclip-globalize3/actions/workflows/test.yml)
4
2
 
5
3
  Use locale-specific attachments in your Rails app with [paperclip](https://github.com/thoughtbot/paperclip) and
6
4
  [globalize](https://github.com/globalize/globalize).
@@ -11,15 +9,17 @@ Note that this implementation patches some methods in the `Paperclip::Attachment
11
9
 
12
10
  ## Compatibility
13
11
 
14
- * paperclip 4.2 - 6.1
15
- * globalize 5.0 - 5.1
16
- * Rails 4.2/5.0/5.1
12
+ * paperclip 5.3 - 6.1
13
+ * globalize 5.3/6.0
14
+ * Rails 4.2/5.0/5.1/5.2/6.0/6.1
15
+
16
+ Rails 5.2 and later are only tested with paperclip 6.1 (see `.travis.yml` for details).
17
17
 
18
- For support of previous paperclip / globalize / rails versions please refer to the 2.x versions of this gem.
18
+ For support of previous paperclip / globalize / rails versions please refer to the 3.x versions of this gem.
19
19
 
20
20
  ## Maintainance State of This Gem
21
21
 
22
- Since paperclip itself has been [deprecated](https://thoughtbot.com/blog/closing-the-trombone) and we currently do not use this gem in active projects any more, further development of this gem (e.g. compatibility with Rails 5.2, globalize 5.2 etc.) is unlikely. If anyone wants to submit a PR, we will of course still try to review + merge.
22
+ Since paperclip itself has been [deprecated](https://thoughtbot.com/blog/closing-the-trombone) and we currently do not use this gem in active projects any more, further development of this gem (e.g. compatibility with Rails 7.0) is unlikely. If anyone wants to submit a PR, we will of course still try to review + merge.
23
23
 
24
24
  ## Installation
25
25
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'paperclip/globalize3/gem_tasks'
3
5
  require 'appraisal'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
4
6
 
5
- gem 'paperclip', '~> 4.2.0'
7
+ gem 'paperclip', '~> 5.3.0'
6
8
  gem 'rails', '~> 4.2.0'
7
9
 
8
10
  gemspec path: '../'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
4
6
 
5
- gem 'paperclip', '~> 4.2.0'
7
+ gem 'paperclip', '~> 5.3.0'
6
8
  gem 'rails', '~> 5.0.0'
7
9
 
8
10
  gemspec path: '../'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
4
6
 
5
- gem 'paperclip', '~> 4.2.0'
7
+ gem 'paperclip', '~> 5.3.0'
6
8
  gem 'rails', '~> 5.1.0'
7
9
 
8
10
  gemspec path: '../'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source 'https://rubygems.org'
4
6
 
5
- gem 'paperclip', '~> 4.3.0'
6
- gem 'rails', '~> 4.2.0'
7
+ gem 'paperclip', '~> 6.1.0'
8
+ gem 'rails', '~> 5.2.0'
7
9
 
8
10
  gemspec path: '../'
@@ -0,0 +1,11 @@
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', '~> 6.0'
9
+ gem 'sqlite3', '~> 1.4'
10
+
11
+ gemspec path: '../'
@@ -0,0 +1,11 @@
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', '~> 6.1.4'
9
+ gem 'sqlite3', '~> 1.4'
10
+
11
+ gemspec path: '../'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paperclip
2
4
  module Globalize3
3
5
  # Prepend to the paperclip `Attachment` class to transparently read and write
@@ -10,12 +12,7 @@ module Paperclip
10
12
  # respective columns to be translated.
11
13
  module Attachment
12
14
  def assign(uploaded_file)
13
- @file =
14
- if Paperclip::Attachment.default_options.key?(:adapter_options) # paperclip >= 5.2.0
15
- Paperclip.io_adapters.for(uploaded_file, @options[:adapter_options])
16
- else # paperclip < 5.2.0
17
- Paperclip.io_adapters.for(uploaded_file)
18
- end
15
+ @file = Paperclip.io_adapters.for(uploaded_file, @options[:adapter_options])
19
16
  ensure_required_accessors!
20
17
  ensure_required_validations!
21
18
 
@@ -57,7 +54,7 @@ module Paperclip
57
54
  options = args.extract_options!
58
55
  styles = args
59
56
  with_locales_if_translated(options[:locales]) do
60
- super(styles)
57
+ super(*styles)
61
58
  end
62
59
  end
63
60
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paperclip
2
4
  module Globalize3
3
5
  # Like Bundler::GemHelper, but tags versions without the 'v' prefix (e.g. '1.0.0' instead of 'v1.0.0')
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'paperclip/globalize3/gem_helper'
2
4
  Paperclip::Globalize3::GemHelper.install_tasks
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paperclip
2
4
  module Globalize3
3
- VERSION = '3.2.0'.freeze
5
+ VERSION = '4.2.0'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'paperclip/globalize3/version'
2
4
  require 'paperclip/globalize3/attachment'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'paperclip/globalize3/version'
@@ -18,11 +20,11 @@ Gem::Specification.new do |spec|
18
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
21
  spec.require_paths = ['lib']
20
22
 
21
- spec.required_ruby_version = '>= 2.2.2'
23
+ spec.required_ruby_version = '>= 2.4.6'
22
24
 
23
- spec.add_dependency 'activerecord', ['>= 4.2', '< 5.2']
24
- spec.add_dependency 'globalize', ['>= 5.0.0', '< 5.2.0']
25
- spec.add_dependency 'paperclip', ['>= 4.2', '< 6.2.0']
25
+ spec.add_dependency 'activerecord', ['>= 4.2', '< 7.0']
26
+ spec.add_dependency 'globalize', ['>= 5.3.0', '< 6.1']
27
+ spec.add_dependency 'paperclip', ['>= 5.3', '< 6.2.0']
26
28
 
27
29
  spec.add_development_dependency 'appraisal', '~> 2.2'
28
30
  spec.add_development_dependency 'bundler', ['>= 1.16.6', '< 2.0.1']
data/spec/data/models.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class BasePost < ActiveRecord::Base
2
4
  self.table_name = 'posts'
3
5
  end
@@ -10,6 +12,15 @@ class Post < BasePost
10
12
  translates :image_file_name, :image_content_type, :image_file_size, :image_updated_at, :image_fingerprint
11
13
  end
12
14
 
15
+ class PostWithStyles < BasePost
16
+ has_attached_file :image,
17
+ url: '/system/:test_env_number/:class/:attachment/:id/:locale/:style-:fingerprint.:extension',
18
+ styles: {thumb: '10x10', large: '40x40'}
19
+ validates_attachment :image, content_type: {content_type: ['image/png']}
20
+
21
+ translates :image_file_name, :image_content_type, :image_file_size, :image_updated_at, :image_fingerprint
22
+ end
23
+
13
24
  class OnlyProcessPost < BasePost
14
25
  has_attached_file :image,
15
26
  url: '/system/:test_env_number/:class/:attachment/:id/:locale/: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::Globalize3::Attachment do
@@ -166,6 +168,42 @@ RSpec.describe Paperclip::Globalize3::Attachment do
166
168
  end
167
169
  end
168
170
 
171
+ describe 'clear attachment style' do
172
+ subject(:clear_style) do
173
+ post.image.clear(:large)
174
+ post.save!
175
+ end
176
+
177
+ let!(:post) do
178
+ PostWithStyles.create!.tap do |post|
179
+ with_locale(:en) { post.update!(image: test_image_file) }
180
+ with_locale(:de) { post.update!(image: test_image_file2) }
181
+ end
182
+ end
183
+
184
+ let!(:large_paths) do
185
+ [
186
+ with_locale(:de) { post.image.path(:large) },
187
+ with_locale(:en) { post.image.path(:large) }
188
+ ]
189
+ end
190
+
191
+ let!(:other_paths) do
192
+ with_locale(:en) { [post.image.path, post.image.path(:thumb)] } +
193
+ with_locale(:de) { [post.image.path, post.image.path(:thumb)] }
194
+ end
195
+
196
+ context 'without :locales option' do
197
+ it 'deletes the given attachment style in all locales' do
198
+ expect { clear_style }.to(change { large_paths.collect { |path| File.exist?(path) } }.to([false, false]))
199
+ end
200
+
201
+ it 'does not delete any other attachment styles' do
202
+ expect { clear_style }.not_to(change { other_paths.collect { |path| File.exist?(path) } })
203
+ end
204
+ end
205
+ end
206
+
169
207
  context 'when fallbacks are defined' do
170
208
  around do |example|
171
209
  old_fallbacks = Globalize.fallbacks
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
4
  require 'logger'
3
5
  require 'pathname'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-globalize3
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maximilian Herold
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-18 00:00:00.000000000 Z
11
+ date: 2021-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.2'
22
+ version: '7.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,34 +29,34 @@ dependencies:
29
29
  version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.2'
32
+ version: '7.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: globalize
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 5.0.0
39
+ version: 5.3.0
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: 5.2.0
42
+ version: '6.1'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 5.0.0
49
+ version: 5.3.0
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: 5.2.0
52
+ version: '6.1'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: paperclip
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '4.2'
59
+ version: '5.3'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
62
  version: 6.2.0
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '4.2'
69
+ version: '5.3'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: 6.2.0
@@ -223,6 +223,7 @@ executables: []
223
223
  extensions: []
224
224
  extra_rdoc_files: []
225
225
  files:
226
+ - ".github/workflows/test.yml"
226
227
  - ".gitignore"
227
228
  - ".rspec"
228
229
  - ".rubocop.yml"
@@ -235,22 +236,18 @@ files:
235
236
  - LICENSE.txt
236
237
  - README.md
237
238
  - Rakefile
238
- - gemfiles/rails_4.2_pc_4_2.gemfile
239
- - gemfiles/rails_4.2_pc_4_3.gemfile
240
- - gemfiles/rails_4.2_pc_5_0.gemfile
241
- - gemfiles/rails_4.2_pc_5_2.gemfile
239
+ - gemfiles/rails_4.2_pc_5_3.gemfile
242
240
  - gemfiles/rails_4.2_pc_6_0.gemfile
243
241
  - gemfiles/rails_4.2_pc_6_1.gemfile
244
- - gemfiles/rails_5.0_pc_4_2.gemfile
245
- - gemfiles/rails_5.0_pc_5_0.gemfile
246
- - gemfiles/rails_5.0_pc_5_2.gemfile
242
+ - gemfiles/rails_5.0_pc_5_3.gemfile
247
243
  - gemfiles/rails_5.0_pc_6_0.gemfile
248
244
  - gemfiles/rails_5.0_pc_6_1.gemfile
249
- - gemfiles/rails_5.1_pc_4_2.gemfile
250
- - gemfiles/rails_5.1_pc_5_0.gemfile
251
- - gemfiles/rails_5.1_pc_5_2.gemfile
245
+ - gemfiles/rails_5.1_pc_5_3.gemfile
252
246
  - gemfiles/rails_5.1_pc_6_0.gemfile
253
247
  - gemfiles/rails_5.1_pc_6_1.gemfile
248
+ - gemfiles/rails_5.2_pc_6_1.gemfile
249
+ - gemfiles/rails_6.0_pc_6_1.gemfile
250
+ - gemfiles/rails_6.1_pc_6_1.gemfile
254
251
  - lib/paperclip/globalize3.rb
255
252
  - lib/paperclip/globalize3/attachment.rb
256
253
  - lib/paperclip/globalize3/gem_helper.rb
@@ -267,7 +264,7 @@ homepage: https://github.com/emjot/paperclip-globalize3
267
264
  licenses:
268
265
  - MIT
269
266
  metadata: {}
270
- post_install_message:
267
+ post_install_message:
271
268
  rdoc_options: []
272
269
  require_paths:
273
270
  - lib
@@ -275,16 +272,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
275
272
  requirements:
276
273
  - - ">="
277
274
  - !ruby/object:Gem::Version
278
- version: 2.2.2
275
+ version: 2.4.6
279
276
  required_rubygems_version: !ruby/object:Gem::Requirement
280
277
  requirements:
281
278
  - - ">="
282
279
  - !ruby/object:Gem::Version
283
280
  version: '0'
284
281
  requirements: []
285
- rubyforge_project:
286
- rubygems_version: 2.7.8
287
- signing_key:
282
+ rubygems_version: 3.0.9
283
+ signing_key:
288
284
  specification_version: 4
289
285
  summary: locale-specific attachments with paperclip and globalize
290
286
  test_files:
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'paperclip', '~> 5.0.0'
6
- gem 'rails', '~> 4.2.0'
7
-
8
- gemspec path: '../'
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'paperclip', '~> 5.2.0'
6
- gem 'rails', '~> 4.2.0'
7
-
8
- gemspec path: '../'
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'paperclip', '~> 5.0.0'
6
- gem 'rails', '~> 5.0.0'
7
-
8
- gemspec path: '../'
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'paperclip', '~> 5.2.0'
6
- gem 'rails', '~> 5.0.0'
7
-
8
- gemspec path: '../'
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'paperclip', '~> 5.0.0'
6
- gem 'rails', '~> 5.1.0'
7
-
8
- gemspec path: '../'
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'paperclip', '~> 5.2.0'
6
- gem 'rails', '~> 5.1.0'
7
-
8
- gemspec path: '../'