kt-paperclip 5.4.0 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.github/issue_template.md +3 -0
  3. data/.hound.yml +27 -32
  4. data/.travis.yml +23 -2
  5. data/Appraisals +17 -0
  6. data/Gemfile +9 -7
  7. data/NEWS +21 -0
  8. data/README.md +27 -37
  9. data/Rakefile +29 -21
  10. data/UPGRADING +3 -3
  11. data/features/basic_integration.feature +4 -0
  12. data/features/migration.feature +10 -51
  13. data/features/step_definitions/attachment_steps.rb +12 -12
  14. data/features/step_definitions/html_steps.rb +5 -5
  15. data/features/step_definitions/rails_steps.rb +29 -9
  16. data/features/step_definitions/s3_steps.rb +3 -3
  17. data/features/step_definitions/web_steps.rb +5 -6
  18. data/features/support/env.rb +4 -4
  19. data/features/support/fakeweb.rb +3 -5
  20. data/features/support/file_helpers.rb +2 -2
  21. data/features/support/paths.rb +4 -4
  22. data/features/support/rails.rb +7 -7
  23. data/features/support/selectors.rb +1 -1
  24. data/gemfiles/4.2.gemfile +7 -4
  25. data/gemfiles/5.0.gemfile +7 -4
  26. data/gemfiles/5.1.gemfile +20 -0
  27. data/gemfiles/5.2.gemfile +20 -0
  28. data/gemfiles/6.0.gemfile +20 -0
  29. data/lib/generators/paperclip/paperclip_generator.rb +6 -8
  30. data/lib/paperclip/attachment.rb +102 -104
  31. data/lib/paperclip/attachment_registry.rb +2 -2
  32. data/lib/paperclip/file_command_content_type_detector.rb +1 -3
  33. data/lib/paperclip/filename_cleaner.rb +0 -1
  34. data/lib/paperclip/geometry.rb +18 -19
  35. data/lib/paperclip/geometry_detector_factory.rb +13 -16
  36. data/lib/paperclip/geometry_parser_factory.rb +5 -5
  37. data/lib/paperclip/glue.rb +3 -3
  38. data/lib/paperclip/has_attached_file.rb +5 -4
  39. data/lib/paperclip/helpers.rb +3 -3
  40. data/lib/paperclip/interpolations.rb +42 -38
  41. data/lib/paperclip/io_adapters/abstract_adapter.rb +16 -14
  42. data/lib/paperclip/io_adapters/attachment_adapter.rb +12 -6
  43. data/lib/paperclip/io_adapters/data_uri_adapter.rb +1 -1
  44. data/lib/paperclip/io_adapters/file_adapter.rb +1 -3
  45. data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +3 -3
  46. data/lib/paperclip/io_adapters/identity_adapter.rb +1 -2
  47. data/lib/paperclip/io_adapters/registry.rb +1 -1
  48. data/lib/paperclip/io_adapters/stringio_adapter.rb +1 -1
  49. data/lib/paperclip/io_adapters/uploaded_file_adapter.rb +6 -8
  50. data/lib/paperclip/io_adapters/uri_adapter.rb +9 -7
  51. data/lib/paperclip/logger.rb +1 -1
  52. data/lib/paperclip/matchers/have_attached_file_matcher.rb +4 -4
  53. data/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +19 -18
  54. data/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +4 -4
  55. data/lib/paperclip/matchers/validate_attachment_size_matcher.rb +11 -10
  56. data/lib/paperclip/matchers.rb +4 -4
  57. data/lib/paperclip/media_type_spoof_detector.rb +13 -13
  58. data/lib/paperclip/missing_attachment_styles.rb +11 -6
  59. data/lib/paperclip/processor.rb +13 -6
  60. data/lib/paperclip/processor_helpers.rb +3 -1
  61. data/lib/paperclip/rails_environment.rb +1 -5
  62. data/lib/paperclip/railtie.rb +5 -5
  63. data/lib/paperclip/schema.rb +18 -14
  64. data/lib/paperclip/storage/filesystem.rb +5 -7
  65. data/lib/paperclip/storage/fog.rb +36 -32
  66. data/lib/paperclip/storage/s3.rb +67 -75
  67. data/lib/paperclip/style.rb +3 -6
  68. data/lib/paperclip/tempfile.rb +4 -5
  69. data/lib/paperclip/tempfile_factory.rb +0 -1
  70. data/lib/paperclip/thumbnail.rb +11 -11
  71. data/lib/paperclip/url_generator.rb +5 -12
  72. data/lib/paperclip/validators/attachment_content_type_validator.rb +3 -3
  73. data/lib/paperclip/validators/attachment_file_name_validator.rb +5 -10
  74. data/lib/paperclip/validators/attachment_file_type_ignorance_validator.rb +1 -2
  75. data/lib/paperclip/validators/attachment_presence_validator.rb +3 -5
  76. data/lib/paperclip/validators/attachment_size_validator.rb +8 -8
  77. data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +3 -1
  78. data/lib/paperclip/validators.rb +12 -13
  79. data/lib/paperclip/version.rb +1 -3
  80. data/lib/paperclip.rb +49 -48
  81. data/lib/tasks/paperclip.rake +23 -24
  82. data/paperclip.gemspec +29 -33
  83. data/shoulda_macros/paperclip.rb +16 -16
  84. data/spec/paperclip/attachment_definitions_spec.rb +5 -5
  85. data/spec/paperclip/attachment_processing_spec.rb +22 -23
  86. data/spec/paperclip/attachment_registry_spec.rb +15 -15
  87. data/spec/paperclip/attachment_spec.rb +238 -196
  88. data/spec/paperclip/content_type_detector_spec.rb +11 -12
  89. data/spec/paperclip/file_command_content_type_detector_spec.rb +10 -10
  90. data/spec/paperclip/filename_cleaner_spec.rb +3 -4
  91. data/spec/paperclip/geometry_detector_spec.rb +7 -8
  92. data/spec/paperclip/geometry_parser_spec.rb +31 -31
  93. data/spec/paperclip/geometry_spec.rb +24 -24
  94. data/spec/paperclip/glue_spec.rb +3 -5
  95. data/spec/paperclip/has_attached_file_spec.rb +46 -126
  96. data/spec/paperclip/integration_spec.rb +111 -77
  97. data/spec/paperclip/interpolations_spec.rb +101 -93
  98. data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +41 -13
  99. data/spec/paperclip/io_adapters/attachment_adapter_spec.rb +8 -10
  100. data/spec/paperclip/io_adapters/data_uri_adapter_spec.rb +13 -14
  101. data/spec/paperclip/io_adapters/empty_string_adapter_spec.rb +4 -4
  102. data/spec/paperclip/io_adapters/file_adapter_spec.rb +12 -12
  103. data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +42 -26
  104. data/spec/paperclip/io_adapters/identity_adapter_spec.rb +1 -1
  105. data/spec/paperclip/io_adapters/nil_adapter_spec.rb +2 -2
  106. data/spec/paperclip/io_adapters/registry_spec.rb +4 -4
  107. data/spec/paperclip/io_adapters/stringio_adapter_spec.rb +10 -10
  108. data/spec/paperclip/io_adapters/uploaded_file_adapter_spec.rb +6 -6
  109. data/spec/paperclip/io_adapters/uri_adapter_spec.rb +80 -31
  110. data/spec/paperclip/matchers/have_attached_file_matcher_spec.rb +3 -3
  111. data/spec/paperclip/matchers/validate_attachment_content_type_matcher_spec.rb +4 -5
  112. data/spec/paperclip/matchers/validate_attachment_presence_matcher_spec.rb +4 -4
  113. data/spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb +4 -4
  114. data/spec/paperclip/media_type_spoof_detector_spec.rb +50 -24
  115. data/spec/paperclip/meta_class_spec.rb +3 -3
  116. data/spec/paperclip/paperclip_missing_attachment_styles_spec.rb +28 -24
  117. data/spec/paperclip/paperclip_spec.rb +15 -11
  118. data/spec/paperclip/plural_cache_spec.rb +8 -8
  119. data/spec/paperclip/processor_helpers_spec.rb +35 -35
  120. data/spec/paperclip/processor_spec.rb +8 -8
  121. data/spec/paperclip/rails_environment_spec.rb +7 -10
  122. data/spec/paperclip/rake_spec.rb +39 -39
  123. data/spec/paperclip/schema_spec.rb +57 -53
  124. data/spec/paperclip/storage/filesystem_spec.rb +6 -6
  125. data/spec/paperclip/storage/fog_spec.rb +76 -82
  126. data/spec/paperclip/storage/s3_live_spec.rb +22 -22
  127. data/spec/paperclip/storage/s3_spec.rb +585 -583
  128. data/spec/paperclip/style_spec.rb +67 -71
  129. data/spec/paperclip/tempfile_factory_spec.rb +5 -5
  130. data/spec/paperclip/thumbnail_spec.rb +68 -67
  131. data/spec/paperclip/url_generator_spec.rb +18 -29
  132. data/spec/paperclip/validators/attachment_content_type_validator_spec.rb +27 -27
  133. data/spec/paperclip/validators/attachment_file_name_validator_spec.rb +15 -16
  134. data/spec/paperclip/validators/attachment_presence_validator_spec.rb +5 -5
  135. data/spec/paperclip/validators/attachment_size_validator_spec.rb +21 -21
  136. data/spec/paperclip/validators/media_type_spoof_detection_validator_spec.rb +9 -13
  137. data/spec/paperclip/validators_spec.rb +40 -40
  138. data/spec/spec_helper.rb +21 -23
  139. data/spec/support/assertions.rb +8 -6
  140. data/spec/support/fake_model.rb +1 -2
  141. data/spec/support/fake_rails.rb +1 -1
  142. data/spec/support/matchers/exist.rb +1 -1
  143. data/spec/support/matchers/have_column.rb +1 -1
  144. data/spec/support/mock_url_generator_builder.rb +2 -3
  145. data/spec/support/model_reconstruction.rb +16 -12
  146. data/spec/support/reporting.rb +1 -1
  147. data/spec/support/test_data.rb +2 -2
  148. metadata +49 -105
  149. data/lib/kt-paperclip.rb +0 -1
  150. data/spec/support/conditional_filter_helper.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c43af20e1568a3caee7670d68c39e71f86a0b0342fdaaf0acb7b6ae81204a731
4
- data.tar.gz: 781342013a902bb2d1d21f805680418eb61f8976b20793f5eaedb86fdfdeb74a
3
+ metadata.gz: cc344d5ddaca988988e3be2fa011830636f2112928511008ac581495eb5ddfb9
4
+ data.tar.gz: e50691209dcecbc2ee0bcaaa58c222b77085e0e70a5c56c803c938abbf6b1f3a
5
5
  SHA512:
6
- metadata.gz: 02b011a01c730ef79202a87367d778fde59ae39584465fd63981905890e550bf86718a028bce46a6cb6826324b2f37f78a19e73402428b771922b70cc0180a5a
7
- data.tar.gz: 17cc690b1c20421a3b35b395eda2076235e70962b6f4cc10855285c6e268ad4a7bdc92e6212a660bc01d9945e9ae60496c6e3bb34c9bfd37546195cc4cfa3d24
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
- IndentWhenRelativeTo: case
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: special_for_inner_method_call_in_parentheses
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
- Style/IfUnlessModifier:
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
- MaxLineLength: 80
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
- NamePrefixBlacklist:
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/TrailingCommaInLiteral:
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
- Whitelist:
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 80 characters.
512
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
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: 80
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
- AlignWith: keyword
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
- AlignWith: start_of_line
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/MethodCallParentheses:
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
- Style/OpMethod:
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/UnneededCapitalW:
907
+ Style/RedundantCapitalW:
909
908
  Description: Checks for %W when interpolation is not needed.
910
909
  Enabled: true
911
- Style/UnneededPercentQ:
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/HandleExceptions:
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/StringConversionInInterpolation:
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/BinaryOperatorWithIdenticalOperands:
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.7
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 'sqlite3', '~> 1.3.8', :platforms => :ruby
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 'activerecord-import'
12
- gem 'mime-types'
13
- gem 'builder'
14
- gem 'rubocop', require: false
15
- gem 'rspec'
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/thoughtbot/paperclip/releases
13
+ https://github.com/kreeti/paperclip/releases
8
14
 
9
15
  ---
10
16
 
11
- [![Build Status](https://secure.travis-ci.org/thoughtbot/paperclip.svg?branch=master)](http://travis-ci.org/thoughtbot/paperclip)
12
- [![Dependency Status](https://gemnasium.com/thoughtbot/paperclip.svg?travis)](https://gemnasium.com/thoughtbot/paperclip)
13
- [![Code Climate](https://codeclimate.com/github/thoughtbot/paperclip.svg)](https://codeclimate.com/github/thoughtbot/paperclip)
14
- [![Inline docs](http://inch-ci.org/github/thoughtbot/paperclip.svg)](http://inch-ci.org/github/thoughtbot/paperclip)
15
- [![Security](https://hakiri.io/github/thoughtbot/paperclip/master.svg)](https://hakiri.io/github/thoughtbot/paperclip/master)
17
+ [![Build Status](https://secure.travis-ci.org/kreeti/paperclip.svg?branch=master)](http://travis-ci.org/kreeti/paperclip)
18
+ [![Dependency Status](https://gemnasium.com/kreeti/paperclip.svg?travis)](https://gemnasium.com/kreeti/paperclip)
19
+ [![Code Climate](https://codeclimate.com/github/kreeti/paperclip.svg)](https://codeclimate.com/github/kreeti/paperclip)
20
+ [![Inline docs](http://inch-ci.org/github/kreeti/paperclip.svg)](http://inch-ci.org/github/kreeti/paperclip)
21
+ [![Security](https://hakiri.io/github/kreeti/paperclip/master.svg)](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", "~> 5.2.1"
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/thoughtbot/paperclip.git"
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: { content_type: "image/jpeg" },
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: { content_type: "application/pdf" }
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: { content_type: ["image/jpeg", "image/gif", "image/png"] }
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/thoughtbot/paperclip-i18n.
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', '~> 2.3.0'
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/thoughtbot/paperclip/blob/master/lib/paperclip/processor.rb)),
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/thoughtbot/paperclip/compare/).
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/thoughtbot/paperclip/issues/new).
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/thoughtbot/paperclip/graphs/contributors)!
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 © 2008-2017 thoughtbot, inc. It is free software, and may be
1052
+ Paperclip is Copyright &copy; 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
- ![thoughtbot](http://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)
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 'bundler/gem_tasks'
2
- require 'appraisal'
3
- require 'rspec/core/rake_task'
4
- require 'cucumber/rake/task'
1
+ require "bundler/gem_tasks"
2
+ require "appraisal"
3
+ require "rspec/core/rake_task"
4
+ require "cucumber/rake/task"
5
5
 
6
- desc 'Default: run unit tests.'
7
- task :default => [:clean, :all]
6
+ desc "Default: run unit tests."
7
+ task default: [:clean, :all]
8
8
 
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')
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('rake appraisal')
17
+ exec("rake appraisal")
18
18
  end
19
19
  end
20
20
 
21
- desc 'Test the paperclip plugin.'
21
+ desc "Test the paperclip plugin."
22
22
  RSpec::Core::RakeTask.new(:spec)
23
23
 
24
- desc 'Run integration test'
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 'Start an IRB session with all necessary files required.'
30
- task :shell do |t|
29
+ desc "Start an IRB session with all necessary files required."
30
+ task :shell do |_t|
31
31
  chdir File.dirname(__FILE__)
32
- exec 'irb -I lib/ -I lib/paperclip -r rubygems -r active_record -r tempfile -r init'
32
+ exec "irb -I lib/ -I lib/paperclip -r rubygems -r active_record -r tempfile -r init"
33
33
  end
34
34
 
35
- desc 'Clean up files.'
36
- task :clean do |t|
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
- FileUtils.rm "test/debug.log" rescue nil
42
- FileUtils.rm "test/paperclip.db" rescue nil
43
- Dir.glob("paperclip-*.gem").each{|f| FileUtils.rm f }
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 >= 2.0.0.
5
+ Paperclip is now compatible with aws-sdk-s3.
6
6
 
7
- If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small
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: