kt-paperclip 5.4.0 → 6.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.
- checksums.yaml +4 -4
- data/.github/issue_template.md +3 -0
- data/.hound.yml +27 -32
- data/.travis.yml +23 -2
- data/Appraisals +17 -0
- data/Gemfile +9 -7
- data/NEWS +21 -0
- data/README.md +27 -37
- data/Rakefile +29 -21
- data/UPGRADING +3 -3
- data/features/basic_integration.feature +4 -0
- data/features/migration.feature +10 -51
- data/features/step_definitions/attachment_steps.rb +12 -12
- data/features/step_definitions/html_steps.rb +5 -5
- data/features/step_definitions/rails_steps.rb +29 -9
- data/features/step_definitions/s3_steps.rb +3 -3
- data/features/step_definitions/web_steps.rb +5 -6
- data/features/support/env.rb +4 -4
- data/features/support/fakeweb.rb +3 -5
- data/features/support/file_helpers.rb +2 -2
- data/features/support/paths.rb +4 -4
- data/features/support/rails.rb +7 -7
- data/features/support/selectors.rb +1 -1
- data/gemfiles/4.2.gemfile +7 -4
- data/gemfiles/5.0.gemfile +7 -4
- data/gemfiles/5.1.gemfile +20 -0
- data/gemfiles/5.2.gemfile +20 -0
- data/gemfiles/6.0.gemfile +20 -0
- data/lib/generators/paperclip/paperclip_generator.rb +6 -8
- data/lib/paperclip/attachment.rb +102 -104
- data/lib/paperclip/attachment_registry.rb +2 -2
- data/lib/paperclip/file_command_content_type_detector.rb +1 -3
- data/lib/paperclip/filename_cleaner.rb +0 -1
- data/lib/paperclip/geometry.rb +18 -19
- data/lib/paperclip/geometry_detector_factory.rb +13 -16
- data/lib/paperclip/geometry_parser_factory.rb +5 -5
- data/lib/paperclip/glue.rb +3 -3
- data/lib/paperclip/has_attached_file.rb +5 -4
- data/lib/paperclip/helpers.rb +3 -3
- data/lib/paperclip/interpolations.rb +42 -38
- data/lib/paperclip/io_adapters/abstract_adapter.rb +16 -14
- data/lib/paperclip/io_adapters/attachment_adapter.rb +12 -6
- data/lib/paperclip/io_adapters/data_uri_adapter.rb +1 -1
- data/lib/paperclip/io_adapters/file_adapter.rb +1 -3
- data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +3 -3
- data/lib/paperclip/io_adapters/identity_adapter.rb +1 -2
- data/lib/paperclip/io_adapters/registry.rb +1 -1
- data/lib/paperclip/io_adapters/stringio_adapter.rb +1 -1
- data/lib/paperclip/io_adapters/uploaded_file_adapter.rb +6 -8
- data/lib/paperclip/io_adapters/uri_adapter.rb +9 -7
- data/lib/paperclip/logger.rb +1 -1
- data/lib/paperclip/matchers/have_attached_file_matcher.rb +4 -4
- data/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +19 -18
- data/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +4 -4
- data/lib/paperclip/matchers/validate_attachment_size_matcher.rb +11 -10
- data/lib/paperclip/matchers.rb +4 -4
- data/lib/paperclip/media_type_spoof_detector.rb +13 -13
- data/lib/paperclip/missing_attachment_styles.rb +11 -6
- data/lib/paperclip/processor.rb +13 -6
- data/lib/paperclip/processor_helpers.rb +3 -1
- data/lib/paperclip/rails_environment.rb +1 -5
- data/lib/paperclip/railtie.rb +5 -5
- data/lib/paperclip/schema.rb +18 -14
- data/lib/paperclip/storage/filesystem.rb +5 -7
- data/lib/paperclip/storage/fog.rb +36 -32
- data/lib/paperclip/storage/s3.rb +67 -75
- data/lib/paperclip/style.rb +3 -6
- data/lib/paperclip/tempfile.rb +4 -5
- data/lib/paperclip/tempfile_factory.rb +0 -1
- data/lib/paperclip/thumbnail.rb +11 -11
- data/lib/paperclip/url_generator.rb +5 -12
- data/lib/paperclip/validators/attachment_content_type_validator.rb +3 -3
- data/lib/paperclip/validators/attachment_file_name_validator.rb +5 -10
- data/lib/paperclip/validators/attachment_file_type_ignorance_validator.rb +1 -2
- data/lib/paperclip/validators/attachment_presence_validator.rb +3 -5
- data/lib/paperclip/validators/attachment_size_validator.rb +8 -8
- data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +3 -1
- data/lib/paperclip/validators.rb +12 -13
- data/lib/paperclip/version.rb +1 -3
- data/lib/paperclip.rb +49 -48
- data/lib/tasks/paperclip.rake +23 -24
- data/paperclip.gemspec +29 -33
- data/shoulda_macros/paperclip.rb +16 -16
- data/spec/paperclip/attachment_definitions_spec.rb +5 -5
- data/spec/paperclip/attachment_processing_spec.rb +22 -23
- data/spec/paperclip/attachment_registry_spec.rb +15 -15
- data/spec/paperclip/attachment_spec.rb +238 -196
- data/spec/paperclip/content_type_detector_spec.rb +11 -12
- data/spec/paperclip/file_command_content_type_detector_spec.rb +10 -10
- data/spec/paperclip/filename_cleaner_spec.rb +3 -4
- data/spec/paperclip/geometry_detector_spec.rb +7 -8
- data/spec/paperclip/geometry_parser_spec.rb +31 -31
- data/spec/paperclip/geometry_spec.rb +24 -24
- data/spec/paperclip/glue_spec.rb +3 -5
- data/spec/paperclip/has_attached_file_spec.rb +46 -126
- data/spec/paperclip/integration_spec.rb +111 -77
- data/spec/paperclip/interpolations_spec.rb +101 -93
- data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +41 -13
- data/spec/paperclip/io_adapters/attachment_adapter_spec.rb +8 -10
- data/spec/paperclip/io_adapters/data_uri_adapter_spec.rb +13 -14
- data/spec/paperclip/io_adapters/empty_string_adapter_spec.rb +4 -4
- data/spec/paperclip/io_adapters/file_adapter_spec.rb +12 -12
- data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +42 -26
- data/spec/paperclip/io_adapters/identity_adapter_spec.rb +1 -1
- data/spec/paperclip/io_adapters/nil_adapter_spec.rb +2 -2
- data/spec/paperclip/io_adapters/registry_spec.rb +4 -4
- data/spec/paperclip/io_adapters/stringio_adapter_spec.rb +10 -10
- data/spec/paperclip/io_adapters/uploaded_file_adapter_spec.rb +6 -6
- data/spec/paperclip/io_adapters/uri_adapter_spec.rb +80 -31
- data/spec/paperclip/matchers/have_attached_file_matcher_spec.rb +3 -3
- data/spec/paperclip/matchers/validate_attachment_content_type_matcher_spec.rb +4 -5
- data/spec/paperclip/matchers/validate_attachment_presence_matcher_spec.rb +4 -4
- data/spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb +4 -4
- data/spec/paperclip/media_type_spoof_detector_spec.rb +50 -24
- data/spec/paperclip/meta_class_spec.rb +3 -3
- data/spec/paperclip/paperclip_missing_attachment_styles_spec.rb +28 -24
- data/spec/paperclip/paperclip_spec.rb +15 -11
- data/spec/paperclip/plural_cache_spec.rb +8 -8
- data/spec/paperclip/processor_helpers_spec.rb +35 -35
- data/spec/paperclip/processor_spec.rb +8 -8
- data/spec/paperclip/rails_environment_spec.rb +7 -10
- data/spec/paperclip/rake_spec.rb +39 -39
- data/spec/paperclip/schema_spec.rb +57 -53
- data/spec/paperclip/storage/filesystem_spec.rb +6 -6
- data/spec/paperclip/storage/fog_spec.rb +76 -82
- data/spec/paperclip/storage/s3_live_spec.rb +22 -22
- data/spec/paperclip/storage/s3_spec.rb +585 -583
- data/spec/paperclip/style_spec.rb +67 -71
- data/spec/paperclip/tempfile_factory_spec.rb +5 -5
- data/spec/paperclip/thumbnail_spec.rb +68 -67
- data/spec/paperclip/url_generator_spec.rb +18 -29
- data/spec/paperclip/validators/attachment_content_type_validator_spec.rb +27 -27
- data/spec/paperclip/validators/attachment_file_name_validator_spec.rb +15 -16
- data/spec/paperclip/validators/attachment_presence_validator_spec.rb +5 -5
- data/spec/paperclip/validators/attachment_size_validator_spec.rb +21 -21
- data/spec/paperclip/validators/media_type_spoof_detection_validator_spec.rb +9 -13
- data/spec/paperclip/validators_spec.rb +40 -40
- data/spec/spec_helper.rb +21 -23
- data/spec/support/assertions.rb +8 -6
- data/spec/support/fake_model.rb +1 -2
- data/spec/support/fake_rails.rb +1 -1
- data/spec/support/matchers/exist.rb +1 -1
- data/spec/support/matchers/have_column.rb +1 -1
- data/spec/support/mock_url_generator_builder.rb +2 -3
- data/spec/support/model_reconstruction.rb +16 -12
- data/spec/support/reporting.rb +1 -1
- data/spec/support/test_data.rb +2 -2
- metadata +49 -105
- data/lib/kt-paperclip.rb +0 -1
- data/spec/support/conditional_filter_helper.rb +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc344d5ddaca988988e3be2fa011830636f2112928511008ac581495eb5ddfb9
|
|
4
|
+
data.tar.gz: e50691209dcecbc2ee0bcaaa58c222b77085e0e70a5c56c803c938abbf6b1f3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f9cb2f295d4f60c65accf057f3c19de3e675abda8c2c339005cca5683b2706e00995b014570de1d9d96f51c2cbd41f26a6a654acef4b3104e3cf0c6707b6d18
|
|
7
|
+
data.tar.gz: 0de4285c8b1c029650f662d3556e0d04cf92c01c9b3854423f85a3f2b7bcad3c7a9beb8530059cbbde3d7a518b9cb823be5256b006365f9c527d82cf50d71e3c
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
## Deprecation notice
|
|
2
|
+
|
|
3
|
+
Paperclip is currently undergoing [deprecation in favor of ActiveStorage](https://github.com/thoughtbot/paperclip/blob/master/MIGRATING.md). Maintainers of this repository will no longer be tending to new issues. We're leaving the issues page open so Paperclip users can still see & search through old issues, and continue existing discussions if they wish.
|
data/.hound.yml
CHANGED
|
@@ -79,7 +79,7 @@ Style/CaseIndentation:
|
|
|
79
79
|
Description: Indentation of when in a case/when/[else/]end.
|
|
80
80
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#indent-when-to-case
|
|
81
81
|
Enabled: true
|
|
82
|
-
|
|
82
|
+
EnforcedStyle: case
|
|
83
83
|
SupportedStyles:
|
|
84
84
|
- case
|
|
85
85
|
- end
|
|
@@ -157,10 +157,6 @@ Style/Encoding:
|
|
|
157
157
|
Description: Use UTF-8 as the source file encoding.
|
|
158
158
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#utf-8
|
|
159
159
|
Enabled: false
|
|
160
|
-
EnforcedStyle: always
|
|
161
|
-
SupportedStyles:
|
|
162
|
-
- when_needed
|
|
163
|
-
- always
|
|
164
160
|
Style/FileName:
|
|
165
161
|
Description: Use snake_case for source file names.
|
|
166
162
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
|
|
@@ -169,7 +165,7 @@ Style/FileName:
|
|
|
169
165
|
Style/FirstParameterIndentation:
|
|
170
166
|
Description: Checks the indentation of the first parameter in a method call.
|
|
171
167
|
Enabled: true
|
|
172
|
-
EnforcedStyle:
|
|
168
|
+
EnforcedStyle: consistent
|
|
173
169
|
SupportedStyles:
|
|
174
170
|
- consistent
|
|
175
171
|
- special_for_inner_method_call
|
|
@@ -210,11 +206,11 @@ Style/HashSyntax:
|
|
|
210
206
|
SupportedStyles:
|
|
211
207
|
- ruby19
|
|
212
208
|
- hash_rockets
|
|
213
|
-
|
|
209
|
+
Metrics/LineLength:
|
|
214
210
|
Description: Favor modifier if/unless usage when you have a single-line body.
|
|
215
211
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
|
|
216
212
|
Enabled: false
|
|
217
|
-
|
|
213
|
+
Max: 80
|
|
218
214
|
Style/IndentationWidth:
|
|
219
215
|
Description: Use 2 spaces for indentation.
|
|
220
216
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-indentation
|
|
@@ -311,7 +307,7 @@ Style/PredicateName:
|
|
|
311
307
|
- is_
|
|
312
308
|
- has_
|
|
313
309
|
- have_
|
|
314
|
-
|
|
310
|
+
ForbiddenPrefixes:
|
|
315
311
|
- is_
|
|
316
312
|
Style/RaiseArgs:
|
|
317
313
|
Description: Checks the arguments passed to raise/fail.
|
|
@@ -435,7 +431,15 @@ Style/TrailingBlankLines:
|
|
|
435
431
|
SupportedStyles:
|
|
436
432
|
- final_newline
|
|
437
433
|
- final_blank_line
|
|
438
|
-
Style/
|
|
434
|
+
Style/TrailingCommaInArrayLiteral:
|
|
435
|
+
Description: Checks for trailing comma in parameter lists and literals.
|
|
436
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
|
|
437
|
+
Enabled: false
|
|
438
|
+
EnforcedStyleForMultiline: no_comma
|
|
439
|
+
SupportedStyles:
|
|
440
|
+
- comma
|
|
441
|
+
- no_comma
|
|
442
|
+
Style/TrailingCommaInHashLiteral:
|
|
439
443
|
Description: Checks for trailing comma in parameter lists and literals.
|
|
440
444
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
|
|
441
445
|
Enabled: false
|
|
@@ -450,7 +454,7 @@ Style/TrivialAccessors:
|
|
|
450
454
|
ExactNameMatch: false
|
|
451
455
|
AllowPredicates: false
|
|
452
456
|
AllowDSLWriters: false
|
|
453
|
-
|
|
457
|
+
AllowedMethods:
|
|
454
458
|
- to_ary
|
|
455
459
|
- to_a
|
|
456
460
|
- to_c
|
|
@@ -476,11 +480,6 @@ Style/VariableName:
|
|
|
476
480
|
SupportedStyles:
|
|
477
481
|
- snake_case
|
|
478
482
|
- camelCase
|
|
479
|
-
Style/WhileUntilModifier:
|
|
480
|
-
Description: Favor modifier while/until usage when you have a single-line body.
|
|
481
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier
|
|
482
|
-
Enabled: false
|
|
483
|
-
MaxLineLength: 80
|
|
484
483
|
Style/WordArray:
|
|
485
484
|
Description: Use %w or %W for arrays of words.
|
|
486
485
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-w
|
|
@@ -508,10 +507,10 @@ Metrics/CyclomaticComplexity:
|
|
|
508
507
|
Enabled: false
|
|
509
508
|
Max: 6
|
|
510
509
|
Metrics/LineLength:
|
|
511
|
-
Description: Limit lines to
|
|
512
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#
|
|
510
|
+
Description: Limit lines to 120 characters.
|
|
511
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#120-character-limits
|
|
513
512
|
Enabled: true
|
|
514
|
-
Max:
|
|
513
|
+
Max: 120
|
|
515
514
|
AllowURI: true
|
|
516
515
|
URISchemes:
|
|
517
516
|
- http
|
|
@@ -541,14 +540,14 @@ Lint/AssignmentInCondition:
|
|
|
541
540
|
Lint/EndAlignment:
|
|
542
541
|
Description: Align ends correctly.
|
|
543
542
|
Enabled: true
|
|
544
|
-
|
|
543
|
+
EnforcedStyleAlignWith: keyword
|
|
545
544
|
SupportedStyles:
|
|
546
545
|
- keyword
|
|
547
546
|
- variable
|
|
548
547
|
Lint/DefEndAlignment:
|
|
549
548
|
Description: Align ends corresponding to defs correctly.
|
|
550
549
|
Enabled: true
|
|
551
|
-
|
|
550
|
+
EnforcedStyleAlignWith: start_of_line
|
|
552
551
|
SupportedStyles:
|
|
553
552
|
- start_of_line
|
|
554
553
|
- def
|
|
@@ -752,7 +751,7 @@ Style/LineEndConcatenation:
|
|
|
752
751
|
Description: Use \ instead of + or << to concatenate two string literals at line
|
|
753
752
|
end.
|
|
754
753
|
Enabled: false
|
|
755
|
-
Style/
|
|
754
|
+
Style/MethodCallWithoutArgsParentheses:
|
|
756
755
|
Description: Do not use parentheses for method calls with no arguments.
|
|
757
756
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-args-no-parens
|
|
758
757
|
Enabled: true
|
|
@@ -799,7 +798,7 @@ Style/OneLineConditional:
|
|
|
799
798
|
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
|
800
799
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
|
|
801
800
|
Enabled: false
|
|
802
|
-
|
|
801
|
+
Naming/BinaryOperatorParameterName:
|
|
803
802
|
Description: When defining binary operators, name the argument other.
|
|
804
803
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg
|
|
805
804
|
Enabled: false
|
|
@@ -905,10 +904,10 @@ Style/UnlessElse:
|
|
|
905
904
|
Description: Do not use unless with else. Rewrite these with the positive case first.
|
|
906
905
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-else-with-unless
|
|
907
906
|
Enabled: true
|
|
908
|
-
Style/
|
|
907
|
+
Style/RedundantCapitalW:
|
|
909
908
|
Description: Checks for %W when interpolation is not needed.
|
|
910
909
|
Enabled: true
|
|
911
|
-
Style/
|
|
910
|
+
Style/RedundantPercentQ:
|
|
912
911
|
Description: Checks for %q/%Q when single quotes or double quotes would do.
|
|
913
912
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-q
|
|
914
913
|
Enabled: true
|
|
@@ -974,14 +973,10 @@ Lint/EnsureReturn:
|
|
|
974
973
|
Lint/Eval:
|
|
975
974
|
Description: The use of eval represents a serious security risk.
|
|
976
975
|
Enabled: true
|
|
977
|
-
Lint/
|
|
976
|
+
Lint/SuppressedException:
|
|
978
977
|
Description: Don't suppress exception.
|
|
979
978
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
|
|
980
979
|
Enabled: false
|
|
981
|
-
Lint/InvalidCharacterLiteral:
|
|
982
|
-
Description: Checks for invalid character literals with a non-escaped whitespace
|
|
983
|
-
character.
|
|
984
|
-
Enabled: false
|
|
985
980
|
Lint/LiteralInCondition:
|
|
986
981
|
Description: Checks of literals used in conditions.
|
|
987
982
|
Enabled: false
|
|
@@ -1012,7 +1007,7 @@ Lint/SpaceBeforeFirstArg:
|
|
|
1012
1007
|
Description: Put a space between a method name and the first argument in a method
|
|
1013
1008
|
call without parentheses.
|
|
1014
1009
|
Enabled: true
|
|
1015
|
-
Lint/
|
|
1010
|
+
Lint/RedundantStringCoercion:
|
|
1016
1011
|
Description: Checks for Object#to_s usage in string interpolation.
|
|
1017
1012
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-to-s
|
|
1018
1013
|
Enabled: true
|
|
@@ -1037,7 +1032,7 @@ Lint/UselessAssignment:
|
|
|
1037
1032
|
Description: Checks for useless assignment to a local variable.
|
|
1038
1033
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars
|
|
1039
1034
|
Enabled: true
|
|
1040
|
-
Lint/
|
|
1035
|
+
Lint/UselessComparison:
|
|
1041
1036
|
Description: Checks for comparison of something with itself.
|
|
1042
1037
|
Enabled: true
|
|
1043
1038
|
Lint/UselessElseWithoutRescue:
|
data/.travis.yml
CHANGED
|
@@ -1,26 +1,47 @@
|
|
|
1
1
|
language: ruby
|
|
2
|
-
sudo: false
|
|
3
2
|
|
|
4
3
|
rvm:
|
|
5
4
|
- 2.1
|
|
6
5
|
- 2.2
|
|
7
6
|
- 2.3
|
|
8
7
|
- 2.4
|
|
9
|
-
- 2.
|
|
8
|
+
- 2.5
|
|
9
|
+
- 2.6
|
|
10
10
|
|
|
11
11
|
script: "bundle exec rake clean spec cucumber"
|
|
12
12
|
|
|
13
13
|
addons:
|
|
14
14
|
apt:
|
|
15
|
+
update: true
|
|
15
16
|
packages:
|
|
16
17
|
- ghostscript
|
|
17
18
|
|
|
19
|
+
before_install:
|
|
20
|
+
- sudo rm /etc/ImageMagick-6/policy.xml
|
|
21
|
+
|
|
18
22
|
gemfile:
|
|
19
23
|
- gemfiles/4.2.gemfile
|
|
20
24
|
- gemfiles/5.0.gemfile
|
|
25
|
+
- gemfiles/5.1.gemfile
|
|
26
|
+
- gemfiles/5.2.gemfile
|
|
27
|
+
- gemfiles/6.0.gemfile
|
|
21
28
|
|
|
22
29
|
matrix:
|
|
23
30
|
fast_finish: true
|
|
24
31
|
exclude:
|
|
25
32
|
- gemfile: gemfiles/5.0.gemfile
|
|
26
33
|
rvm: 2.1
|
|
34
|
+
- gemfile: gemfiles/5.1.gemfile
|
|
35
|
+
rvm: 2.1
|
|
36
|
+
- gemfile: gemfiles/5.2.gemfile
|
|
37
|
+
rvm: 2.1
|
|
38
|
+
- gemfile: gemfiles/5.2.gemfile
|
|
39
|
+
rvm: 2.2
|
|
40
|
+
- gemfile: gemfiles/6.0.gemfile
|
|
41
|
+
rvm: 2.1
|
|
42
|
+
- gemfile: gemfiles/6.0.gemfile
|
|
43
|
+
rvm: 2.2
|
|
44
|
+
- gemfile: gemfiles/6.0.gemfile
|
|
45
|
+
rvm: 2.3
|
|
46
|
+
- gemfile: gemfiles/6.0.gemfile
|
|
47
|
+
rvm: 2.4
|
data/Appraisals
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
appraise "4.2" do
|
|
2
|
+
gem "sqlite3", "~> 1.3.8", platforms: :ruby
|
|
2
3
|
gem "rails", "~> 4.2.0"
|
|
3
4
|
end
|
|
4
5
|
|
|
5
6
|
appraise "5.0" do
|
|
7
|
+
gem "sqlite3", "~> 1.3.8", platforms: :ruby
|
|
6
8
|
gem "rails", "~> 5.0.0"
|
|
7
9
|
end
|
|
10
|
+
|
|
11
|
+
appraise "5.1" do
|
|
12
|
+
gem "sqlite3", "~> 1.3.8", platforms: :ruby
|
|
13
|
+
gem "rails", "~> 5.1.0"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
appraise "5.2" do
|
|
17
|
+
gem "sqlite3", "~> 1.3.8", platforms: :ruby
|
|
18
|
+
gem "rails", "~> 5.2.0"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
appraise "6.0" do
|
|
22
|
+
gem "sqlite3", "~> 1.4", platforms: :ruby
|
|
23
|
+
gem "rails", "~> 6.0.0"
|
|
24
|
+
end
|
data/Gemfile
CHANGED
|
@@ -2,15 +2,17 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
gem
|
|
6
|
-
gem 'pry'
|
|
5
|
+
gem "pry"
|
|
7
6
|
|
|
8
7
|
# Hinting at development dependencies
|
|
9
8
|
# Prevents bundler from taking a long-time to resolve
|
|
10
9
|
group :development, :test do
|
|
11
|
-
gem
|
|
12
|
-
gem '
|
|
13
|
-
gem
|
|
14
|
-
gem '
|
|
15
|
-
gem
|
|
10
|
+
gem "activerecord-import"
|
|
11
|
+
gem 'bootsnap', require: false
|
|
12
|
+
gem "builder"
|
|
13
|
+
gem 'listen', '~> 3.0.8'
|
|
14
|
+
gem "mime-types"
|
|
15
|
+
gem "rspec"
|
|
16
|
+
gem "rubocop", require: false
|
|
17
|
+
gem "sprockets", "3.7.2"
|
|
16
18
|
end
|
data/NEWS
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
6.1.0 (2018-07-27):
|
|
2
|
+
|
|
3
|
+
* BUGFIX: Don't double-encode URLs (Roderick Monje).
|
|
4
|
+
* BUGFIX: Only use the content_type when it exists (Jean-Philippe Doyle).
|
|
5
|
+
* STABILITY: Better handling of the content-disposition header. Now supports
|
|
6
|
+
file name that is either enclosed or not in double quotes and is case
|
|
7
|
+
insensitive as per RC6266 grammar (Hasan Kumar, Yves Riel).
|
|
8
|
+
* STABILITY: Change database column type of attachment file size from unsigned 4-byte
|
|
9
|
+
`integer` to unsigned 8-byte `bigint`. The former type limits attachment size
|
|
10
|
+
to just over 2GB, which can easily be exceeded by a large video file (Laurent
|
|
11
|
+
Arnoud, Alen Zamanyan).
|
|
12
|
+
* STABILITY: Better error message when thumbnail processing errors (Hayden Ball).
|
|
13
|
+
* STABILITY: Fix file linking issues around Windows (Akihiko Odaki).
|
|
14
|
+
* STABILITY: Files without an extension will now be checked for spoofing attempts
|
|
15
|
+
(George Walters II).
|
|
16
|
+
* STABILITY: Manually close Tempfiles when we are done with them (Erkki Eilonen).
|
|
17
|
+
|
|
18
|
+
6.0.0 (2018-03-09):
|
|
19
|
+
|
|
20
|
+
* Improvement: Depend only on `aws-sdk-s3` instead of `aws-sdk` (https://github.com/thoughtbot/paperclip/pull/2481)
|
|
21
|
+
|
|
1
22
|
5.3.0 (2018-03-09):
|
|
2
23
|
|
|
3
24
|
* Improvement: Use `FactoryBot` instead of `FactoryGirl` (https://github.com/thoughtbot/paperclip/pull/2501)
|
data/README.md
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
Paperclip
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
We plan to support and maintain paperclip, as well as clean it up.
|
|
5
|
+
|
|
6
|
+
Please feel free to contribute Issues and pull requests.
|
|
7
|
+
|
|
8
|
+
# Existing documentation
|
|
9
|
+
|
|
4
10
|
## Documentation valid for `master` branch
|
|
5
11
|
|
|
6
12
|
Please check the documentation for the paperclip version you are using:
|
|
7
|
-
https://github.com/
|
|
13
|
+
https://github.com/kreeti/paperclip/releases
|
|
8
14
|
|
|
9
15
|
---
|
|
10
16
|
|
|
11
|
-
[](http://travis-ci.org/kreeti/paperclip)
|
|
18
|
+
[](https://gemnasium.com/kreeti/paperclip)
|
|
19
|
+
[](https://codeclimate.com/github/kreeti/paperclip)
|
|
20
|
+
[](http://inch-ci.org/github/kreeti/paperclip)
|
|
21
|
+
[](https://hakiri.io/github/kreeti/paperclip/master)
|
|
16
22
|
|
|
17
23
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
18
24
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
@@ -58,7 +64,6 @@ https://github.com/thoughtbot/paperclip/releases
|
|
|
58
64
|
- [Testing](#testing)
|
|
59
65
|
- [Contributing](#contributing)
|
|
60
66
|
- [License](#license)
|
|
61
|
-
- [About thoughtbot](#about-thoughtbot)
|
|
62
67
|
|
|
63
68
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
64
69
|
|
|
@@ -167,13 +172,13 @@ Paperclip is distributed as a gem, which is how it should be used in your app.
|
|
|
167
172
|
Include the gem in your Gemfile:
|
|
168
173
|
|
|
169
174
|
```ruby
|
|
170
|
-
gem "paperclip", "~>
|
|
175
|
+
gem "kt-paperclip", "~> 6.0.0"
|
|
171
176
|
```
|
|
172
177
|
|
|
173
178
|
Or, if you want to get the latest, you can get master from the main paperclip repository:
|
|
174
179
|
|
|
175
180
|
```ruby
|
|
176
|
-
gem "paperclip", git: "git://github.com/
|
|
181
|
+
gem "paperclip", git: "git://github.com/kreeti/paperclip.git"
|
|
177
182
|
```
|
|
178
183
|
|
|
179
184
|
If you're trying to use features that don't seem to be in the latest released gem, but are
|
|
@@ -341,7 +346,7 @@ Lastly, you can also define multiple validations on a single attachment using `v
|
|
|
341
346
|
|
|
342
347
|
```ruby
|
|
343
348
|
validates_attachment :avatar, presence: true,
|
|
344
|
-
content_type:
|
|
349
|
+
content_type: "image/jpeg",
|
|
345
350
|
size: { in: 0..10.kilobytes }
|
|
346
351
|
```
|
|
347
352
|
|
|
@@ -368,7 +373,7 @@ afterwards, then assign manually:
|
|
|
368
373
|
```ruby
|
|
369
374
|
class Book < ActiveRecord::Base
|
|
370
375
|
has_attached_file :document, styles: { thumbnail: "60x60#" }
|
|
371
|
-
validates_attachment :document, content_type:
|
|
376
|
+
validates_attachment :document, content_type: "application/pdf"
|
|
372
377
|
validates_something_else # Other validations that conflict with Paperclip's
|
|
373
378
|
end
|
|
374
379
|
|
|
@@ -400,7 +405,7 @@ image-y ones:
|
|
|
400
405
|
|
|
401
406
|
```ruby
|
|
402
407
|
validates_attachment :avatar,
|
|
403
|
-
content_type:
|
|
408
|
+
content_type: ["image/jpeg", "image/gif", "image/png"]
|
|
404
409
|
```
|
|
405
410
|
|
|
406
411
|
`Paperclip::ContentTypeDetector` will attempt to match a file's extension to an
|
|
@@ -412,7 +417,7 @@ Internationalization (I18n)
|
|
|
412
417
|
---------------------------
|
|
413
418
|
|
|
414
419
|
For using or adding locale files in different languages, check the project
|
|
415
|
-
https://github.com/
|
|
420
|
+
https://github.com/kreeti/paperclip-i18n.
|
|
416
421
|
|
|
417
422
|
Security Validations
|
|
418
423
|
====================
|
|
@@ -567,7 +572,7 @@ Storage
|
|
|
567
572
|
Paperclip ships with 3 storage adapters:
|
|
568
573
|
|
|
569
574
|
* File Storage
|
|
570
|
-
* S3 Storage (via `aws-sdk`)
|
|
575
|
+
* S3 Storage (via `aws-sdk-s3`)
|
|
571
576
|
* Fog Storage
|
|
572
577
|
|
|
573
578
|
If you would like to use Paperclip with another storage, you can install these
|
|
@@ -593,10 +598,10 @@ _**NOTE**: This is a change from previous versions of Paperclip, but is overall
|
|
|
593
598
|
safer choice for the default file store._
|
|
594
599
|
|
|
595
600
|
You may also choose to store your files using Amazon's S3 service. To do so, include
|
|
596
|
-
the `aws-sdk` gem in your Gemfile:
|
|
601
|
+
the `aws-sdk-s3` gem in your Gemfile:
|
|
597
602
|
|
|
598
603
|
```ruby
|
|
599
|
-
gem 'aws-sdk'
|
|
604
|
+
gem 'aws-sdk-s3'
|
|
600
605
|
```
|
|
601
606
|
|
|
602
607
|
And then you can specify using S3 from `has_attached_file`.
|
|
@@ -663,7 +668,7 @@ has more information on the accepted style formats.
|
|
|
663
668
|
For more fine-grained control of the conversion process, `source_file_options` and `convert_options` can be used to pass flags and settings directly to ImageMagick's powerful Convert tool, [documented here](https://www.imagemagick.org/script/convert.php). For example:
|
|
664
669
|
|
|
665
670
|
```ruby
|
|
666
|
-
has_attached_file :image, styles: { regular: ['800x800>', :png]},
|
|
671
|
+
has_attached_file :image, styles: { regular: ['800x800>', :png]},
|
|
667
672
|
source_file_options: { regular: "-density 96 -depth 8 -quality 85" },
|
|
668
673
|
convert_options: { regular: "-posterize 3"}
|
|
669
674
|
```
|
|
@@ -684,7 +689,7 @@ Custom Attachment Processors
|
|
|
684
689
|
You can write your own custom attachment processors to carry out tasks like
|
|
685
690
|
adding watermarks, compressing images, or encrypting files. Custom processors
|
|
686
691
|
must be defined within the `Paperclip` module, inherit from
|
|
687
|
-
`Paperclip::Processor` (see [`lib/paperclip/processor.rb`](https://github.com/
|
|
692
|
+
`Paperclip::Processor` (see [`lib/paperclip/processor.rb`](https://github.com/kreeti/paperclip/blob/master/lib/paperclip/processor.rb)),
|
|
688
693
|
and implement a `make` method that returns a `File`. All files in your Rails
|
|
689
694
|
app's `lib/paperclip` and `lib/paperclip_processors` directories will be
|
|
690
695
|
automatically loaded by Paperclip. Processors are specified using the
|
|
@@ -1031,33 +1036,18 @@ If you'd like to contribute a feature or bugfix: Thanks! To make sure your
|
|
|
1031
1036
|
fix/feature has a high chance of being included, please read the following
|
|
1032
1037
|
guidelines:
|
|
1033
1038
|
|
|
1034
|
-
1. Post a [pull request](https://github.com/
|
|
1039
|
+
1. Post a [pull request](https://github.com/kreeti/paperclip/compare/).
|
|
1035
1040
|
2. Make sure there are tests! We will not accept any patch that is not tested.
|
|
1036
1041
|
It's a rare time when explicit tests aren't needed. If you have questions
|
|
1037
1042
|
about writing tests for paperclip, please open a
|
|
1038
|
-
[GitHub issue](https://github.com/
|
|
1043
|
+
[GitHub issue](https://github.com/kreeti/paperclip/issues/new).
|
|
1039
1044
|
|
|
1040
1045
|
Please see [`CONTRIBUTING.md`](./CONTRIBUTING.md) for more details on contributing and running test.
|
|
1041
1046
|
|
|
1042
|
-
Thank you to all [the contributors](https://github.com/
|
|
1047
|
+
Thank you to all [the contributors](https://github.com/kreeti/paperclip/graphs/contributors)!
|
|
1043
1048
|
|
|
1044
1049
|
License
|
|
1045
1050
|
-------
|
|
1046
1051
|
|
|
1047
|
-
Paperclip is Copyright
|
|
1052
|
+
Paperclip is Copyright © 2008-2017 thoughtbot, inc. It is free software, and may be
|
|
1048
1053
|
redistributed under the terms specified in the MIT-LICENSE file.
|
|
1049
|
-
|
|
1050
|
-
About thoughtbot
|
|
1051
|
-
----------------
|
|
1052
|
-
|
|
1053
|
-

|
|
1054
|
-
|
|
1055
|
-
Paperclip is maintained and funded by thoughtbot.
|
|
1056
|
-
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
|
1057
|
-
|
|
1058
|
-
We love open source software!
|
|
1059
|
-
See [our other projects][community] or
|
|
1060
|
-
[hire us][hire] to design, develop, and grow your product.
|
|
1061
|
-
|
|
1062
|
-
[community]: https://thoughtbot.com/community?utm_source=github
|
|
1063
|
-
[hire]: https://thoughtbot.com?utm_source=github
|
data/Rakefile
CHANGED
|
@@ -1,44 +1,52 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "appraisal"
|
|
3
|
+
require "rspec/core/rake_task"
|
|
4
|
+
require "cucumber/rake/task"
|
|
5
5
|
|
|
6
|
-
desc
|
|
7
|
-
task :
|
|
6
|
+
desc "Default: run unit tests."
|
|
7
|
+
task default: [:clean, :all]
|
|
8
8
|
|
|
9
|
-
desc
|
|
10
|
-
task :all do |
|
|
11
|
-
if ENV[
|
|
12
|
-
exec(
|
|
9
|
+
desc "Test the paperclip plugin under all supported Rails versions."
|
|
10
|
+
task :all do |_t|
|
|
11
|
+
if ENV["BUNDLE_GEMFILE"]
|
|
12
|
+
exec("rake spec && cucumber")
|
|
13
13
|
else
|
|
14
14
|
exec("rm -f gemfiles/*.lock")
|
|
15
15
|
Rake::Task["appraisal:gemfiles"].execute
|
|
16
16
|
Rake::Task["appraisal:install"].execute
|
|
17
|
-
exec(
|
|
17
|
+
exec("rake appraisal")
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
desc
|
|
21
|
+
desc "Test the paperclip plugin."
|
|
22
22
|
RSpec::Core::RakeTask.new(:spec)
|
|
23
23
|
|
|
24
|
-
desc
|
|
24
|
+
desc "Run integration test"
|
|
25
25
|
Cucumber::Rake::Task.new do |t|
|
|
26
26
|
t.cucumber_opts = %w{--format progress}
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
desc
|
|
30
|
-
task :shell do |
|
|
29
|
+
desc "Start an IRB session with all necessary files required."
|
|
30
|
+
task :shell do |_t|
|
|
31
31
|
chdir File.dirname(__FILE__)
|
|
32
|
-
exec
|
|
32
|
+
exec "irb -I lib/ -I lib/paperclip -r rubygems -r active_record -r tempfile -r init"
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
desc
|
|
36
|
-
task :clean do |
|
|
35
|
+
desc "Clean up files."
|
|
36
|
+
task :clean do |_t|
|
|
37
37
|
FileUtils.rm_rf "doc"
|
|
38
38
|
FileUtils.rm_rf "tmp"
|
|
39
39
|
FileUtils.rm_rf "pkg"
|
|
40
40
|
FileUtils.rm_rf "public"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
begin
|
|
42
|
+
FileUtils.rm "test/debug.log"
|
|
43
|
+
rescue StandardError
|
|
44
|
+
nil
|
|
45
|
+
end
|
|
46
|
+
begin
|
|
47
|
+
FileUtils.rm "test/paperclip.db"
|
|
48
|
+
rescue StandardError
|
|
49
|
+
nil
|
|
50
|
+
end
|
|
51
|
+
Dir.glob("paperclip-*.gem").each { |f| FileUtils.rm f }
|
|
44
52
|
end
|
data/UPGRADING
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
# NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER #
|
|
3
3
|
##################################################
|
|
4
4
|
|
|
5
|
-
Paperclip is now compatible with aws-sdk
|
|
5
|
+
Paperclip is now compatible with aws-sdk-s3.
|
|
6
6
|
|
|
7
|
-
If you are using S3 storage, aws-sdk
|
|
7
|
+
If you are using S3 storage, aws-sdk-s3 requires you to make a few small
|
|
8
8
|
changes:
|
|
9
9
|
|
|
10
10
|
* You must set the `s3_region`
|
|
@@ -13,5 +13,5 @@ changes:
|
|
|
13
13
|
using a hyphen. For example, `:public_read` needs to be changed to
|
|
14
14
|
`public-read`.
|
|
15
15
|
|
|
16
|
-
For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
|
|
16
|
+
For a walkthrough of upgrading from 4 to *5* (not 6) and aws-sdk >= 2.0 you can watch
|
|
17
17
|
http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5
|
|
@@ -8,6 +8,10 @@ Feature: Rails integration
|
|
|
8
8
|
And I update my new user view to include the file upload field
|
|
9
9
|
And I update my user view to include the attachment
|
|
10
10
|
And I allow the attachment to be submitted
|
|
11
|
+
And I replace this snippet to app/views/layouts/application.html.erb:
|
|
12
|
+
"""
|
|
13
|
+
<%= javascript_tag 'application', 'data-turbolinks-track': 'reload' %>
|
|
14
|
+
"""
|
|
11
15
|
|
|
12
16
|
Scenario: Configure defaults for all attachments through Railtie
|
|
13
17
|
Given I add this snippet to config/application.rb:
|