kt-paperclip 7.2.1 → 7.2.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: 206e4e7dd6b6f2ad56c7a0395e9b845a8033c7efa20f19f4ef5c33d09edcbf39
4
- data.tar.gz: 492bfb36e312bd31c4511a91f6b0b4d779d31b5d098f616cb75871c2a6a4e527
3
+ metadata.gz: a7308352f1d792e5e861ba828d1eb3994b5956fc51df06a4cbfedfe134ce105d
4
+ data.tar.gz: be4d4161c411a18edaf2a92b5a48d746d87d01f3d5a6e4fe5fecc20f87ad42a4
5
5
  SHA512:
6
- metadata.gz: 86a39461732fd83389253cc444168d30a9af957362d90694e04852d86619e3d4ac4a84ea71db0d904784de74d5c5e019bdcec86fc18484fce2e26568cf390d55
7
- data.tar.gz: 9506c9fc401cb9ccee3dcfe9186ec8787df2abdc3472f947592d7a79a2e6c32e917cc3eae2de1bfc49f366129a67f793c436b69ecafe501aee0fb7c265662bdc
6
+ metadata.gz: e202f7d5a1a9466f69118e485c5c747f10942644337940b6141ffb41904118353cab09858fbdabf4e68ba87d9e5199109a1a1525d7eaeea4a1601ba9e384459f
7
+ data.tar.gz: 20fb1d6bd39a2d21a5b2f627d5ab92aba95ae88d523319de7b06e5e0983c281e76ae218a6bccf64fdc16362652cb1cc1251eab7fdacc14b6428b8dbafd2bdc81
data/NEWS CHANGED
@@ -1,5 +1,12 @@
1
1
  [UNRELEASED]
2
+
3
+ 7.2.1 (2023-09-09)
2
4
  * Improvement: Support file extension names both as symbols and strings for :content_type_mappings
5
+
6
+ 7.2.0 (2023-05-30)
7
+ * Paperclip schema statements are consistent with ActiveRecord::Migration::Compatibility versioning. Old migrations containing Paperclip schema statements perform the same schema changes both before and after an ActiveRecord version upgrade.
8
+
9
+ 7.0.1 (2021-10-06)
3
10
  * Issue file delete only once per unique style when nullifying attachment or destroying an object. Avoids triggering a rate limit error on Google Cloud Storage.
4
11
 
5
12
  7.0.0 (2021-05-28)
@@ -11,7 +11,7 @@ module Paperclip
11
11
  def self.included(_base)
12
12
  ActiveRecord::ConnectionAdapters::Table.include TableDefinition
13
13
  ActiveRecord::ConnectionAdapters::TableDefinition.include TableDefinition
14
- ActiveRecord::ConnectionAdapters::AbstractAdapter.include Statements
14
+ ActiveRecord::Migration.include Statements
15
15
  ActiveRecord::Migration::CommandRecorder.include CommandRecorder
16
16
  end
17
17
 
@@ -1,3 +1,3 @@
1
1
  module Paperclip
2
- VERSION = "7.2.1" unless defined?(Paperclip::VERSION)
2
+ VERSION = "7.2.2" unless defined?(Paperclip::VERSION)
3
3
  end
data/paperclip.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency("activesupport", ">= 4.2.0")
27
27
  s.add_dependency("mime-types")
28
28
  s.add_dependency("marcel", "~> 1.0.1")
29
- s.add_dependency("terrapin", "~> 0.6.0")
29
+ s.add_dependency("terrapin", ">= 0.6.0", "< 2.0")
30
30
 
31
31
  s.add_development_dependency("activerecord", ">= 4.2.0")
32
32
  s.add_development_dependency("appraisal")
@@ -1333,7 +1333,7 @@ describe Paperclip::Attachment do
1333
1333
 
1334
1334
  context "An attachment with only a avatar_file_name column" do
1335
1335
  before do
1336
- ActiveRecord::Base.connection.create_table :dummies, force: true do |table|
1336
+ ActiveRecord::Migration.create_table :dummies, force: true do |table|
1337
1337
  table.column :avatar_file_name, :string
1338
1338
  end
1339
1339
  rebuild_class
@@ -1359,7 +1359,7 @@ describe Paperclip::Attachment do
1359
1359
 
1360
1360
  context "and avatar_created_at column" do
1361
1361
  before do
1362
- ActiveRecord::Base.connection.add_column :dummies, :avatar_created_at, :timestamp
1362
+ ActiveRecord::Migration.add_column :dummies, :avatar_created_at, :timestamp
1363
1363
  rebuild_class
1364
1364
  @dummy = Dummy.new
1365
1365
  end
@@ -1396,7 +1396,7 @@ describe Paperclip::Attachment do
1396
1396
 
1397
1397
  context "and avatar_updated_at column" do
1398
1398
  before do
1399
- ActiveRecord::Base.connection.add_column :dummies, :avatar_updated_at, :timestamp
1399
+ ActiveRecord::Migration.add_column :dummies, :avatar_updated_at, :timestamp
1400
1400
  rebuild_class
1401
1401
  @dummy = Dummy.new
1402
1402
  end
@@ -1426,7 +1426,7 @@ describe Paperclip::Attachment do
1426
1426
 
1427
1427
  context "and avatar_content_type column" do
1428
1428
  before do
1429
- ActiveRecord::Base.connection.add_column :dummies, :avatar_content_type, :string
1429
+ ActiveRecord::Migration.add_column :dummies, :avatar_content_type, :string
1430
1430
  rebuild_class
1431
1431
  @dummy = Dummy.new
1432
1432
  end
@@ -1443,7 +1443,7 @@ describe Paperclip::Attachment do
1443
1443
 
1444
1444
  context "and avatar_file_size column" do
1445
1445
  before do
1446
- ActiveRecord::Base.connection.add_column :dummies, :avatar_file_size, :bigint
1446
+ ActiveRecord::Migration.add_column :dummies, :avatar_file_size, :bigint
1447
1447
  rebuild_class
1448
1448
  @dummy = Dummy.new
1449
1449
  end
@@ -1467,7 +1467,7 @@ describe Paperclip::Attachment do
1467
1467
 
1468
1468
  context "and avatar_fingerprint column" do
1469
1469
  before do
1470
- ActiveRecord::Base.connection.add_column :dummies, :avatar_fingerprint, :string
1470
+ ActiveRecord::Migration.add_column :dummies, :avatar_fingerprint, :string
1471
1471
  rebuild_class
1472
1472
  @dummy = Dummy.new
1473
1473
  end
@@ -49,7 +49,7 @@ describe "Missing Attachment Styles" do
49
49
  expected_hash = { Dummy: { avatar: [:export, :thumb] } }
50
50
  assert_equal expected_hash, Paperclip.missing_attachments_styles
51
51
 
52
- ActiveRecord::Base.connection.create_table :books, force: true
52
+ ActiveRecord::Migration.create_table :books, force: true
53
53
  class ::Book < ActiveRecord::Base
54
54
  has_attached_file :cover, styles: { small: "x100", large: "1000x1000>" }
55
55
  has_attached_file :sample, styles: { thumb: "x100" }
@@ -11,7 +11,7 @@ describe Paperclip::Schema do
11
11
 
12
12
  after do
13
13
  begin
14
- Dummy.connection.drop_table :dummies
14
+ ActiveRecord::Migration.drop_table :dummies
15
15
  rescue StandardError
16
16
  nil
17
17
  end
@@ -23,7 +23,7 @@ describe Paperclip::Schema do
23
23
  ActiveSupport::Deprecation.silenced = false
24
24
  end
25
25
  it "creates attachment columns" do
26
- Dummy.connection.create_table :dummies, force: true do |t|
26
+ ActiveRecord::Migration.create_table :dummies, force: true do |t|
27
27
  ActiveSupport::Deprecation.silence do
28
28
  t.has_attached_file :avatar
29
29
  end
@@ -38,7 +38,7 @@ describe Paperclip::Schema do
38
38
  end
39
39
 
40
40
  it "displays deprecation warning" do
41
- Dummy.connection.create_table :dummies, force: true do |t|
41
+ ActiveRecord::Migration.create_table :dummies, force: true do |t|
42
42
  assert_deprecated do
43
43
  t.has_attached_file :avatar
44
44
  end
@@ -48,7 +48,7 @@ describe Paperclip::Schema do
48
48
 
49
49
  context "using #attachment" do
50
50
  before do
51
- Dummy.connection.create_table :dummies, force: true do |t|
51
+ ActiveRecord::Migration.create_table :dummies, force: true do |t|
52
52
  t.attachment :avatar
53
53
  end
54
54
  end
@@ -65,7 +65,7 @@ describe Paperclip::Schema do
65
65
 
66
66
  context "using #attachment with options" do
67
67
  before do
68
- Dummy.connection.create_table :dummies, force: true do |t|
68
+ ActiveRecord::Migration.create_table :dummies, force: true do |t|
69
69
  t.attachment :avatar, default: 1, file_name: { default: "default" }
70
70
  end
71
71
  end
@@ -83,13 +83,13 @@ describe Paperclip::Schema do
83
83
 
84
84
  context "within schema statement" do
85
85
  before do
86
- Dummy.connection.create_table :dummies, force: true
86
+ ActiveRecord::Migration.create_table :dummies, force: true
87
87
  end
88
88
 
89
89
  context "migrating up" do
90
90
  context "with single attachment" do
91
91
  before do
92
- Dummy.connection.add_attachment :dummies, :avatar
92
+ ActiveRecord::Migration.add_attachment :dummies, :avatar
93
93
  end
94
94
 
95
95
  it "creates attachment columns" do
@@ -104,7 +104,7 @@ describe Paperclip::Schema do
104
104
 
105
105
  context "with single attachment and options" do
106
106
  before do
107
- Dummy.connection.add_attachment :dummies, :avatar, default: "1", file_name: { default: "default" }
107
+ ActiveRecord::Migration.add_attachment :dummies, :avatar, default: "1", file_name: { default: "default" }
108
108
  end
109
109
 
110
110
  it "sets defaults on columns" do
@@ -119,7 +119,7 @@ describe Paperclip::Schema do
119
119
 
120
120
  context "with multiple attachments" do
121
121
  before do
122
- Dummy.connection.add_attachment :dummies, :avatar, :photo
122
+ ActiveRecord::Migration.add_attachment :dummies, :avatar, :photo
123
123
  end
124
124
 
125
125
  it "creates attachment columns" do
@@ -138,7 +138,7 @@ describe Paperclip::Schema do
138
138
 
139
139
  context "with multiple attachments and options" do
140
140
  before do
141
- Dummy.connection.add_attachment :dummies, :avatar, :photo, default: "1", file_name: { default: "default" }
141
+ ActiveRecord::Migration.add_attachment :dummies, :avatar, :photo, default: "1", file_name: { default: "default" }
142
142
  end
143
143
 
144
144
  it "sets defaults on columns" do
@@ -157,7 +157,7 @@ describe Paperclip::Schema do
157
157
  context "with no attachment" do
158
158
  it "raises an error" do
159
159
  assert_raises ArgumentError do
160
- Dummy.connection.add_attachment :dummies
160
+ ActiveRecord::Migration.add_attachment :dummies
161
161
  end
162
162
  end
163
163
  end
@@ -165,7 +165,7 @@ describe Paperclip::Schema do
165
165
 
166
166
  context "migrating down" do
167
167
  before do
168
- Dummy.connection.change_table :dummies do |t|
168
+ ActiveRecord::Migration.change_table :dummies do |t|
169
169
  t.column :avatar_file_name, :string
170
170
  t.column :avatar_content_type, :string
171
171
  t.column :avatar_file_size, :bigint
@@ -179,7 +179,7 @@ describe Paperclip::Schema do
179
179
  end
180
180
  it "removes the attachment columns" do
181
181
  ActiveSupport::Deprecation.silence do
182
- Dummy.connection.drop_attached_file :dummies, :avatar
182
+ ActiveRecord::Migration.drop_attached_file :dummies, :avatar
183
183
  end
184
184
 
185
185
  columns = Dummy.columns.map { |column| [column.name, column.sql_type] }
@@ -192,7 +192,7 @@ describe Paperclip::Schema do
192
192
 
193
193
  it "displays a deprecation warning" do
194
194
  assert_deprecated do
195
- Dummy.connection.drop_attached_file :dummies, :avatar
195
+ ActiveRecord::Migration.drop_attached_file :dummies, :avatar
196
196
  end
197
197
  end
198
198
  end
@@ -200,7 +200,7 @@ describe Paperclip::Schema do
200
200
  context "using #remove_attachment" do
201
201
  context "with single attachment" do
202
202
  before do
203
- Dummy.connection.remove_attachment :dummies, :avatar
203
+ ActiveRecord::Migration.remove_attachment :dummies, :avatar
204
204
  end
205
205
 
206
206
  it "removes the attachment columns" do
@@ -215,14 +215,14 @@ describe Paperclip::Schema do
215
215
 
216
216
  context "with multiple attachments" do
217
217
  before do
218
- Dummy.connection.change_table :dummies do |t|
218
+ ActiveRecord::Migration.change_table :dummies do |t|
219
219
  t.column :photo_file_name, :string
220
220
  t.column :photo_content_type, :string
221
221
  t.column :photo_file_size, :bigint
222
222
  t.column :photo_updated_at, :datetime
223
223
  end
224
224
 
225
- Dummy.connection.remove_attachment :dummies, :avatar, :photo
225
+ ActiveRecord::Migration.remove_attachment :dummies, :avatar, :photo
226
226
  end
227
227
 
228
228
  it "removes the attachment columns" do
@@ -242,7 +242,7 @@ describe Paperclip::Schema do
242
242
  context "with no attachment" do
243
243
  it "raises an error" do
244
244
  assert_raises ArgumentError do
245
- Dummy.connection.remove_attachment :dummies
245
+ ActiveRecord::Migration.remove_attachment :dummies
246
246
  end
247
247
  end
248
248
  end
data/spec/spec_helper.rb CHANGED
@@ -21,6 +21,7 @@ FIXTURES_DIR = File.join(File.dirname(__FILE__), "fixtures")
21
21
  config = YAML::safe_load(IO.read(File.dirname(__FILE__) + "/database.yml"))
22
22
  ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
23
23
  ActiveRecord::Base.establish_connection(config["test"])
24
+ ActiveRecord::Migration.verbose = false
24
25
  if ActiveRecord::VERSION::STRING >= "4.2" &&
25
26
  ActiveRecord::VERSION::STRING < "5.0"
26
27
  ActiveRecord::Base.raise_in_transactional_callbacks = true
@@ -28,15 +28,15 @@ module ModelReconstruction
28
28
 
29
29
  def reset_table(_table_name, &block)
30
30
  block ||= lambda { |_table| true }
31
- ActiveRecord::Base.connection.create_table :dummies, **{ force: true }, &block
31
+ ActiveRecord::Migration.create_table :dummies, **{ force: true }, &block
32
32
  end
33
33
 
34
34
  def modify_table(&block)
35
- ActiveRecord::Base.connection.change_table :dummies, &block
35
+ ActiveRecord::Migration.change_table :dummies, &block
36
36
  end
37
37
 
38
38
  def rebuild_model(options = {})
39
- ActiveRecord::Base.connection.create_table :dummies, force: true do |table|
39
+ ActiveRecord::Migration.create_table :dummies, force: true do |table|
40
40
  table.column :title, :string
41
41
  table.column :other, :string
42
42
  table.column :avatar_file_name, :string
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kt-paperclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.1
4
+ version: 7.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surendra Singhi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-09 00:00:00.000000000 Z
11
+ date: 2024-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -70,16 +70,22 @@ dependencies:
70
70
  name: terrapin
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.6.0
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '2.0'
76
79
  type: :runtime
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
80
- - - "~>"
83
+ - - ">="
81
84
  - !ruby/object:Gem::Version
82
85
  version: 0.6.0
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: activerecord
85
91
  requirement: !ruby/object:Gem::Requirement