kt-paperclip 6.4.1 → 7.0.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 +4 -4
- data/.github/FUNDING.yml +1 -1
- data/.travis.yml +5 -5
- data/Appraisals +6 -0
- data/Gemfile +0 -1
- data/NEWS +28 -0
- data/README.md +5 -4
- data/features/step_definitions/attachment_steps.rb +11 -1
- data/gemfiles/4.2.gemfile +1 -1
- data/gemfiles/5.0.gemfile +1 -1
- data/gemfiles/5.1.gemfile +1 -1
- data/gemfiles/5.2.gemfile +1 -1
- data/gemfiles/6.0.gemfile +1 -1
- data/gemfiles/6.1.gemfile +21 -0
- data/lib/paperclip.rb +1 -2
- data/lib/paperclip/content_type_detector.rb +4 -4
- data/lib/paperclip/validators/attachment_content_type_validator.rb +1 -1
- data/lib/paperclip/validators/attachment_file_name_validator.rb +1 -1
- data/lib/paperclip/validators/attachment_presence_validator.rb +1 -1
- data/lib/paperclip/validators/attachment_size_validator.rb +1 -1
- data/lib/paperclip/version.rb +1 -1
- data/paperclip.gemspec +2 -2
- data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +1 -1
- data/spec/paperclip/io_adapters/file_adapter_spec.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88e74021df46ad0074287f891fba5ca682856e9e04ee8d4799dd12d3ee6a16b6
|
4
|
+
data.tar.gz: 286dd1db7397931937182a720e399073708eb2288e90fb335ba202cb57209803
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdd6685f4c714492582fd1fce2a2db7b26b0b6499134438aee64c4f384398cbd9e568ef7640c6856d83cde06b0616e04e081143b5a7131a3d0607258655ff6dd
|
7
|
+
data.tar.gz: 258c88aa96a0fee96f8fe1def58e1e6cbf94e59945fed2b41d6e45b71a483fdbb976ccff6b772a8e36fa973ad0f31e1c8d0026975101569393234d4a8f316057
|
data/.github/FUNDING.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 2.2
|
5
4
|
- 2.3
|
6
5
|
- 2.4
|
7
6
|
- 2.5
|
@@ -25,18 +24,19 @@ gemfile:
|
|
25
24
|
- gemfiles/5.1.gemfile
|
26
25
|
- gemfiles/5.2.gemfile
|
27
26
|
- gemfiles/6.0.gemfile
|
27
|
+
- gemfiles/6.1.gemfile
|
28
28
|
|
29
29
|
matrix:
|
30
30
|
fast_finish: true
|
31
31
|
exclude:
|
32
|
-
- gemfile: gemfiles/5.2.gemfile
|
33
|
-
rvm: 2.2
|
34
|
-
- gemfile: gemfiles/6.0.gemfile
|
35
|
-
rvm: 2.2
|
36
32
|
- gemfile: gemfiles/6.0.gemfile
|
37
33
|
rvm: 2.3
|
38
34
|
- gemfile: gemfiles/6.0.gemfile
|
39
35
|
rvm: 2.4
|
36
|
+
- gemfile: gemfiles/6.1.gemfile
|
37
|
+
rvm: 2.3
|
38
|
+
- gemfile: gemfiles/6.1.gemfile
|
39
|
+
rvm: 2.4
|
40
40
|
- gemfile: gemfiles/4.2.gemfile
|
41
41
|
rvm: 2.7
|
42
42
|
- gemfile: gemfiles/5.0.gemfile
|
data/Appraisals
CHANGED
data/Gemfile
CHANGED
data/NEWS
CHANGED
@@ -1,3 +1,31 @@
|
|
1
|
+
7.0.0 (2021-05-28)
|
2
|
+
* Replace `mimemagic` gem with `marcel` due to licensing issues. See https://github.com/kreeti/kt-paperclip/pull/54 for details and limitations
|
3
|
+
|
4
|
+
6.4.1 (2021-01-30)
|
5
|
+
* Improvement: Use URI.open in ruby > 2.5 (PR #45)
|
6
|
+
|
7
|
+
6.4.0 (2020-12-14)
|
8
|
+
* Improvement: Fix Ruby 2.7 method & syntax deprecation warnings (#38)
|
9
|
+
|
10
|
+
6.3.0 (2020-08-10)
|
11
|
+
* Feature: Add validation_errors_to option - customize copying of errors (#26)
|
12
|
+
* Stability: Dropped support for ruby 2.1
|
13
|
+
|
14
|
+
6.2.2 (2020-02-18)
|
15
|
+
* Bugfix: Add support for Aliases in S3 credentials YAML (accidentally removed during 6.2.0 upgrade).
|
16
|
+
|
17
|
+
6.2.1 (2020-01-30)
|
18
|
+
|
19
|
+
* Bugfix: Auto-loading of the gem code (necessitated due to change in gem name).
|
20
|
+
|
21
|
+
6.2.0 (2020-01-23):
|
22
|
+
|
23
|
+
* Bugfix: Don't do post-processing on invalid attachments (#16).
|
24
|
+
* Improvement: Use AWS::S3 built in download_file method (#9).
|
25
|
+
* Stability: Rubocop recommended syntax updates (#10, #11, #13, #14).
|
26
|
+
* Stability: Testing - replace mocha and bourne with rspec mocks (#6).
|
27
|
+
* Stability: Fix test suite to run with Rails 5 and Rails 6 (#19, #20, #7).
|
28
|
+
|
1
29
|
6.1.0 (2018-07-27):
|
2
30
|
|
3
31
|
* BUGFIX: Don't double-encode URLs (Roderick Monje).
|
data/README.md
CHANGED
@@ -90,7 +90,7 @@ Requirements
|
|
90
90
|
|
91
91
|
### Ruby and Rails
|
92
92
|
|
93
|
-
Paperclip now requires Ruby version **>= 2.
|
93
|
+
Paperclip now requires Ruby version **>= 2.3** and Rails version **>= 4.2**
|
94
94
|
(only if you're going to use Paperclip with Ruby on Rails).
|
95
95
|
|
96
96
|
### Image Processor
|
@@ -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.
|
174
|
+
gem "kt-paperclip", "~> 6.4", ">= 6.4.1"
|
175
175
|
```
|
176
176
|
|
177
177
|
Or, if you want to get the latest, you can get master from the main paperclip repository:
|
@@ -1070,5 +1070,6 @@ Thank you to all [the contributors](https://github.com/kreeti/kt-paperclip/graph
|
|
1070
1070
|
License
|
1071
1071
|
-------
|
1072
1072
|
|
1073
|
-
|
1074
|
-
|
1073
|
+
Copyright © 2020-2021 Kreeti Technologies Pvt. Ltd.
|
1074
|
+
Copyright © 2008-2017 thoughtbot, inc.
|
1075
|
+
It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|
@@ -23,7 +23,7 @@ When /^I modify my attachment definition to:$/ do |definition|
|
|
23
23
|
end
|
24
24
|
|
25
25
|
When /^I upload the fixture "([^"]*)"$/ do |filename|
|
26
|
-
|
26
|
+
aruba_run_simple %(bundle exec rails runner "User.create!(:attachment => File.open('#{fixture_path(filename)}'))")
|
27
27
|
end
|
28
28
|
|
29
29
|
Then /^the attachment "([^"]*)" should have a dimension of (\d+x\d+)$/ do |filename, dimension|
|
@@ -108,3 +108,13 @@ Then /^I should not have attachment columns for "([^"]*)"$/ do |attachment_name|
|
|
108
108
|
expect(columns).not_to include(*expect_columns)
|
109
109
|
end
|
110
110
|
end
|
111
|
+
|
112
|
+
# we have to support different versions of aruba, and this method was renamed for 1.0
|
113
|
+
# https://github.com/cucumber/aruba/pull/438
|
114
|
+
def aruba_run_simple(*args)
|
115
|
+
if respond_to?(:run_simple)
|
116
|
+
run_simple(*args)
|
117
|
+
elsif respond_to?(:run_command_and_stop)
|
118
|
+
run_command_and_stop(*args)
|
119
|
+
end
|
120
|
+
end
|
data/gemfiles/4.2.gemfile
CHANGED
data/gemfiles/5.0.gemfile
CHANGED
data/gemfiles/5.1.gemfile
CHANGED
data/gemfiles/5.2.gemfile
CHANGED
data/gemfiles/6.0.gemfile
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "pry"
|
6
|
+
gem "sqlite3", "~> 1.4", platforms: :ruby
|
7
|
+
gem "aruba", "~> 1.0", ">= 1.0.4"
|
8
|
+
gem "rails", "~> 6.1", ">= 6.1.1"
|
9
|
+
|
10
|
+
group :development, :test do
|
11
|
+
gem "activerecord-import"
|
12
|
+
gem "bootsnap", require: false
|
13
|
+
gem "builder"
|
14
|
+
gem "listen", "~> 3.0.8"
|
15
|
+
gem "rspec"
|
16
|
+
gem "rubocop", require: false
|
17
|
+
gem "rubocop-rails"
|
18
|
+
gem "sprockets", "3.7.2"
|
19
|
+
end
|
20
|
+
|
21
|
+
gemspec path: "../"
|
data/lib/paperclip.rb
CHANGED
@@ -60,15 +60,15 @@ module Paperclip
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def type_from_file_contents
|
63
|
-
|
63
|
+
type_from_marcel || type_from_file_command
|
64
64
|
rescue Errno::ENOENT => e
|
65
65
|
Paperclip.log("Error while determining content type: #{e}")
|
66
66
|
SENSIBLE_DEFAULT
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
70
|
-
@
|
71
|
-
|
69
|
+
def type_from_marcel
|
70
|
+
@type_from_marcel ||= File.open(@filepath) do |file|
|
71
|
+
Marcel::Magic.by_magic(file).try(:type)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -47,7 +47,7 @@ module Paperclip
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def mark_invalid(record, attribute, types)
|
50
|
-
record.errors.add attribute, :invalid, options.merge(types: types.join(", "))
|
50
|
+
record.errors.add attribute, :invalid, **options.merge(types: types.join(", "))
|
51
51
|
end
|
52
52
|
|
53
53
|
def allowed_types
|
@@ -43,7 +43,7 @@ module Paperclip
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def mark_invalid(record, attribute, patterns)
|
46
|
-
record.errors.add attribute, :invalid, options.merge(names: patterns.join(", "))
|
46
|
+
record.errors.add attribute, :invalid, **options.merge(names: patterns.join(", "))
|
47
47
|
end
|
48
48
|
|
49
49
|
def allowed
|
@@ -4,7 +4,7 @@ module Paperclip
|
|
4
4
|
module Validators
|
5
5
|
class AttachmentPresenceValidator < ActiveModel::EachValidator
|
6
6
|
def validate_each(record, attribute, _value)
|
7
|
-
record.errors.add(attribute, :blank, options) if record.send("#{attribute}_file_name").blank?
|
7
|
+
record.errors.add(attribute, :blank, **options) if record.send("#{attribute}_file_name").blank?
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.helper_method_name
|
@@ -39,7 +39,7 @@ module Paperclip
|
|
39
39
|
unless value.send(CHECKS[option], option_value)
|
40
40
|
error_message_key = options[:in] ? :in_between : option
|
41
41
|
error_attrs.each do |error_attr_name|
|
42
|
-
record.errors.add(error_attr_name, error_message_key, filtered_options(value).merge(
|
42
|
+
record.errors.add(error_attr_name, error_message_key, **filtered_options(value).merge(
|
43
43
|
min: min_value_in_human_size(record),
|
44
44
|
max: max_value_in_human_size(record),
|
45
45
|
count: human_size(option_value)
|
data/lib/paperclip/version.rb
CHANGED
data/paperclip.gemspec
CHANGED
@@ -20,12 +20,12 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.post_install_message = File.read("UPGRADING") if File.exist?("UPGRADING")
|
21
21
|
|
22
22
|
s.requirements << "ImageMagick"
|
23
|
-
s.required_ruby_version = ">= 2.
|
23
|
+
s.required_ruby_version = ">= 2.3.0"
|
24
24
|
|
25
25
|
s.add_dependency("activemodel", ">= 4.2.0")
|
26
26
|
s.add_dependency("activesupport", ">= 4.2.0")
|
27
27
|
s.add_dependency("mime-types")
|
28
|
-
s.add_dependency("
|
28
|
+
s.add_dependency("marcel", "~> 1.0.1")
|
29
29
|
s.add_dependency("terrapin", "~> 0.6.0")
|
30
30
|
|
31
31
|
s.add_development_dependency("activerecord", ">= 4.2.0")
|
@@ -15,7 +15,7 @@ describe Paperclip::AbstractAdapter do
|
|
15
15
|
before do
|
16
16
|
allow(subject).to receive(:path).and_return("image.png")
|
17
17
|
allow(Paperclip).to receive(:run).and_return("image/png\n")
|
18
|
-
allow_any_instance_of(Paperclip::ContentTypeDetector).to receive(:
|
18
|
+
allow_any_instance_of(Paperclip::ContentTypeDetector).to receive(:type_from_marcel).and_return("image/png")
|
19
19
|
end
|
20
20
|
|
21
21
|
it "returns the content type without newline" do
|
@@ -78,7 +78,7 @@ describe Paperclip::FileAdapter do
|
|
78
78
|
allow(MIME::Types).to receive(:type_for).and_return([])
|
79
79
|
allow(Paperclip).to receive(:run).and_return("application/vnd.ms-office\n")
|
80
80
|
allow_any_instance_of(Paperclip::ContentTypeDetector).
|
81
|
-
to receive(:
|
81
|
+
to receive(:type_from_marcel).and_return("application/vnd.ms-office")
|
82
82
|
|
83
83
|
@subject = Paperclip.io_adapters.for(@file)
|
84
84
|
end
|
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:
|
4
|
+
version: 7.0.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: 2021-
|
11
|
+
date: 2021-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: marcel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 1.0.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 1.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: terrapin
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -393,6 +393,7 @@ files:
|
|
393
393
|
- gemfiles/5.1.gemfile
|
394
394
|
- gemfiles/5.2.gemfile
|
395
395
|
- gemfiles/6.0.gemfile
|
396
|
+
- gemfiles/6.1.gemfile
|
396
397
|
- lib/generators/paperclip/USAGE
|
397
398
|
- lib/generators/paperclip/paperclip_generator.rb
|
398
399
|
- lib/generators/paperclip/templates/paperclip_migration.rb.erb
|
@@ -576,7 +577,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
576
577
|
requirements:
|
577
578
|
- - ">="
|
578
579
|
- !ruby/object:Gem::Version
|
579
|
-
version: 2.
|
580
|
+
version: 2.3.0
|
580
581
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
581
582
|
requirements:
|
582
583
|
- - ">="
|