kt-paperclip 6.3.0 → 6.4.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
2
  SHA256:
3
- metadata.gz: b0c273bab6a78348400356b49b6a713a1119b599d79bfa87c0eefa5660636fd0
4
- data.tar.gz: 46d706576d7f48a94e68c6cfbb6eedd7456df6f18a7f3e68b938649acbe69c6e
3
+ metadata.gz: ff919875bc708cb71a8aa4d23b799de1d78db5bcc9b3ea67681d3a8bde2b52f8
4
+ data.tar.gz: 4c68f86a643f7dd52ed167a8e1b447770fdd8bea4c9a462265e42fefca235125
5
5
  SHA512:
6
- metadata.gz: 924cf86607996af398c917feb50929ca1398a4749cb97dc707605f9d7f59773d407b3e7aafc05e590769df670ab7c555e2c0f5fc082c79dbecb6532b3280ac9e
7
- data.tar.gz: 220f2c1f42cbf52e54c033da40e4f034d4771fb021b56eba3a8c5619e7ba41c01034ed3d8b84bcefd8339b936f9e5cf6f177e99788d02fe1cda3bedc74798ab7
6
+ metadata.gz: 7646e2ae1e2770a48d322d765ace1b0afcea3d4d0da1c2cceab6d97a70e2c562d6c115532373723152f2bd2a2e028a4c68739d5ef5b3e699d9a502c148c0bdc2
7
+ data.tar.gz: c6cebbef6816c9b987a4806a7a1581b213e882d7f8179fb19845f80650622253f27e2a85412ca61743153295ccd09863ac676bbec2a7771555eb750703458a20
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [ssinghi, shalinibhawsingka-kreeti]
data/.hound.yml CHANGED
@@ -1040,7 +1040,7 @@ Lint/UselessAssignment:
1040
1040
  Description: Checks for useless assignment to a local variable.
1041
1041
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars
1042
1042
  Enabled: true
1043
- Lint/UselessComparison:
1043
+ Lint/BinaryOperatorWithIdenticalOperands:
1044
1044
  Description: Checks for comparison of something with itself.
1045
1045
  Enabled: true
1046
1046
  Lint/UselessElseWithoutRescue:
@@ -6,6 +6,7 @@ rvm:
6
6
  - 2.4
7
7
  - 2.5
8
8
  - 2.6
9
+ - 2.7
9
10
 
10
11
  script: "bundle exec rake clean spec cucumber"
11
12
 
@@ -36,3 +37,9 @@ matrix:
36
37
  rvm: 2.3
37
38
  - gemfile: gemfiles/6.0.gemfile
38
39
  rvm: 2.4
40
+ - gemfile: gemfiles/4.2.gemfile
41
+ rvm: 2.7
42
+ - gemfile: gemfiles/5.0.gemfile
43
+ rvm: 2.7
44
+ - gemfile: gemfiles/5.1.gemfile
45
+ rvm: 2.7
data/README.md CHANGED
@@ -171,7 +171,7 @@ Paperclip is distributed as a gem, which is how it should be used in your app.
171
171
  Include the gem in your Gemfile:
172
172
 
173
173
  ```ruby
174
- gem "kt-paperclip", "~> 6.2.0"
174
+ gem "kt-paperclip", "~> 6.3"
175
175
  ```
176
176
 
177
177
  Or, if you want to get the latest, you can get master from the main paperclip repository:
@@ -9,8 +9,8 @@ module Paperclip
9
9
  REGEXP = /\Ahttps?:\/\//.freeze
10
10
 
11
11
  def initialize(target, options = {})
12
- escaped = URI.escape(target)
13
- super(URI(target == URI.unescape(target) ? escaped : target), options)
12
+ escaped = Paperclip::UrlGenerator.escape(target)
13
+ super(URI(target == Paperclip::UrlGenerator.unescape(target) ? escaped : target), options)
14
14
  end
15
15
  end
16
16
  end
@@ -53,7 +53,7 @@ module Paperclip
53
53
  def download_content
54
54
  options = { read_timeout: Paperclip.options[:read_timeout] }.compact
55
55
 
56
- open(@target, **options)
56
+ self.open(@target, options)
57
57
  end
58
58
 
59
59
  def copy_to_tempfile(src)
@@ -26,7 +26,7 @@ module Paperclip
26
26
  attachment_names.each do |attachment_name|
27
27
  COLUMNS.each_pair do |column_name, column_type|
28
28
  column_options = options.merge(options[column_name.to_sym] || {})
29
- add_column(table_name, "#{attachment_name}_#{column_name}", column_type, column_options)
29
+ add_column(table_name, "#{attachment_name}_#{column_name}", column_type, **column_options)
30
30
  end
31
31
  end
32
32
  end
@@ -55,7 +55,7 @@ module Paperclip
55
55
  attachment_names.each do |attachment_name|
56
56
  COLUMNS.each_pair do |column_name, column_type|
57
57
  column_options = options.merge(options[column_name.to_sym] || {})
58
- column("#{attachment_name}_#{column_name}", column_type, column_options)
58
+ column("#{attachment_name}_#{column_name}", column_type, **column_options)
59
59
  end
60
60
  end
61
61
  end
@@ -3,6 +3,13 @@ require "active_support/core_ext/module/delegation"
3
3
 
4
4
  module Paperclip
5
5
  class UrlGenerator
6
+ class << self
7
+ def encoder
8
+ @encoder ||= URI::RFC2396_Parser.new
9
+ end
10
+ delegate :escape, :unescape, to: :encoder
11
+ end
12
+
6
13
  def initialize(attachment)
7
14
  @attachment = attachment
8
15
  end
@@ -65,7 +72,7 @@ module Paperclip
65
72
  if url.respond_to?(:escape)
66
73
  url.escape
67
74
  else
68
- URI.escape(url).gsub(escape_regex) { |m| "%#{m.ord.to_s(16).upcase}" }
75
+ self.class.escape(url).gsub(escape_regex) { |m| "%#{m.ord.to_s(16).upcase}" }
69
76
  end
70
77
  end
71
78
 
@@ -1,3 +1,3 @@
1
1
  module Paperclip
2
- VERSION = "6.3.0" unless defined?(Paperclip::VERSION)
2
+ VERSION = "6.4.0" unless defined?(Paperclip::VERSION)
3
3
  end
@@ -16,54 +16,59 @@ describe Paperclip::HttpUrlProxyAdapter do
16
16
  context "a new instance" do
17
17
  before do
18
18
  @url = "http://thoughtbot.com/images/thoughtbot-logo.png"
19
- @subject = Paperclip.io_adapters.for(@url, hash_digest: Digest::MD5)
20
19
  end
21
20
 
21
+ subject { Paperclip.io_adapters.for(@url, hash_digest: Digest::MD5) }
22
+
22
23
  after do
23
- @subject.close
24
+ subject.close
24
25
  end
25
26
 
26
27
  it "returns a file name" do
27
- assert_equal "thoughtbot-logo.png", @subject.original_filename
28
+ expect(subject.original_filename).to(eq("thoughtbot-logo.png"))
28
29
  end
29
30
 
30
31
  it "closes open handle after reading" do
31
- assert_equal true, @open_return.closed?
32
+ expect { subject }.to(change { @open_return.closed? }.from(false).to(true))
32
33
  end
33
34
 
34
35
  it "returns a content type" do
35
- assert_equal "image/png", @subject.content_type
36
+ expect(subject.content_type).to(eq("image/png"))
36
37
  end
37
38
 
38
39
  it "returns the size of the data" do
39
- assert_equal @open_return.size, @subject.size
40
+ expect(subject.size).to(eq(@open_return.size))
40
41
  end
41
42
 
42
43
  it "generates an MD5 hash of the contents" do
43
- assert_equal Digest::MD5.hexdigest("xxx"), @subject.fingerprint
44
+ expect(subject.fingerprint).to(eq(Digest::MD5.hexdigest("xxx")))
44
45
  end
45
46
 
46
47
  it "generates correct fingerprint after read" do
47
- fingerprint = Digest::MD5.hexdigest(@subject.read)
48
- assert_equal fingerprint, @subject.fingerprint
48
+ fingerprint = Digest::MD5.hexdigest(subject.read)
49
+ expect(subject.fingerprint).to(eq(fingerprint))
49
50
  end
50
51
 
51
52
  it "generates same fingerprint" do
52
- assert_equal @subject.fingerprint, @subject.fingerprint
53
+ expect(subject.fingerprint).to(eq(subject.fingerprint))
53
54
  end
54
55
 
55
56
  it "returns the data contained in the StringIO" do
56
- assert_equal "xxx", @subject.read
57
+ expect(subject.read).to(eq("xxx"))
57
58
  end
58
59
 
59
60
  it "accepts a content_type" do
60
- @subject.content_type = "image/png"
61
- assert_equal "image/png", @subject.content_type
61
+ subject.content_type = "image/png"
62
+ expect(subject.content_type).to(eq("image/png"))
62
63
  end
63
64
 
64
65
  it "accepts an original_filename" do
65
- @subject.original_filename = "image.png"
66
- assert_equal "image.png", @subject.original_filename
66
+ subject.original_filename = "image.png"
67
+ expect(subject.original_filename).to(eq("image.png"))
68
+ end
69
+
70
+ it "doesn't emit deprecation warnings" do
71
+ expect { subject }.to_not(output(/URI\.(un)?escape is obsolete/).to_stderr)
67
72
  end
68
73
  end
69
74
 
@@ -805,9 +805,7 @@ describe Paperclip::Storage::S3 do
805
805
  s3_region: "ap-northeast-1",
806
806
  s3_host_name: "s3-ap-northeast-1.amazonaws.com"
807
807
  },
808
- test: {
809
- s3_region: ""
810
- }
808
+ test: {}
811
809
  }
812
810
  @dummy = Dummy.new
813
811
  end
@@ -194,6 +194,16 @@ describe Paperclip::UrlGenerator do
194
194
  "expected the interpolator to be passed #{expected.inspect} but it wasn't"
195
195
  end
196
196
 
197
+ it "doesn't emit deprecation warnings" do
198
+ expected = "the expected result"
199
+ mock_interpolator = MockInterpolator.new(result: expected)
200
+ options = { interpolator: mock_interpolator }
201
+ mock_attachment = MockAttachment.new(options)
202
+ url_generator = Paperclip::UrlGenerator.new(mock_attachment)
203
+
204
+ expect { url_generator.for(:style_name, escape: true) }.to_not(output(/URI\.(un)?escape is obsolete/).to_stderr)
205
+ end
206
+
197
207
  describe "should be able to escape (, ), [, and ]." do
198
208
  def generate(expected, updated_at = nil)
199
209
  mock_interpolator = MockInterpolator.new(result: expected)
@@ -28,7 +28,7 @@ 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::Base.connection.create_table :dummies, **{ force: true }, &block
32
32
  end
33
33
 
34
34
  def modify_table(&block)
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: 6.3.0
4
+ version: 6.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Surendra Singhi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-10 00:00:00.000000000 Z
11
+ date: 2020-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -354,6 +354,7 @@ extensions: []
354
354
  extra_rdoc_files: []
355
355
  files:
356
356
  - ".codeclimate.yml"
357
+ - ".github/FUNDING.yml"
357
358
  - ".github/ISSUE_TEMPLATE/bug_report.md"
358
359
  - ".github/ISSUE_TEMPLATE/custom.md"
359
360
  - ".github/ISSUE_TEMPLATE/feature_request.md"
@@ -583,8 +584,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
583
584
  version: '0'
584
585
  requirements:
585
586
  - ImageMagick
586
- rubyforge_project:
587
- rubygems_version: 2.7.9
587
+ rubygems_version: 3.0.1
588
588
  signing_key:
589
589
  specification_version: 4
590
590
  summary: File attachments as attributes for ActiveRecord