kt-paperclip 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.hound.yml +1066 -0
  4. data/.rubocop.yml +1 -0
  5. data/.travis.yml +23 -0
  6. data/Appraisals +11 -0
  7. data/CONTRIBUTING.md +75 -0
  8. data/Gemfile +21 -0
  9. data/LICENSE +24 -0
  10. data/NEWS +420 -0
  11. data/README.md +977 -0
  12. data/RELEASING.md +17 -0
  13. data/Rakefile +44 -0
  14. data/UPGRADING +14 -0
  15. data/cucumber/paperclip_steps.rb +6 -0
  16. data/features/basic_integration.feature +80 -0
  17. data/features/migration.feature +94 -0
  18. data/features/rake_tasks.feature +62 -0
  19. data/features/step_definitions/attachment_steps.rb +110 -0
  20. data/features/step_definitions/html_steps.rb +15 -0
  21. data/features/step_definitions/rails_steps.rb +236 -0
  22. data/features/step_definitions/s3_steps.rb +14 -0
  23. data/features/step_definitions/web_steps.rb +107 -0
  24. data/features/support/env.rb +11 -0
  25. data/features/support/fakeweb.rb +13 -0
  26. data/features/support/file_helpers.rb +34 -0
  27. data/features/support/fixtures/boot_config.txt +15 -0
  28. data/features/support/fixtures/gemfile.txt +5 -0
  29. data/features/support/fixtures/preinitializer.txt +20 -0
  30. data/features/support/paths.rb +28 -0
  31. data/features/support/rails.rb +63 -0
  32. data/features/support/selectors.rb +19 -0
  33. data/gemfiles/3.2.gemfile +19 -0
  34. data/gemfiles/4.1.gemfile +19 -0
  35. data/gemfiles/4.2.gemfile +19 -0
  36. data/lib/generators/paperclip/USAGE +8 -0
  37. data/lib/generators/paperclip/paperclip_generator.rb +30 -0
  38. data/lib/generators/paperclip/templates/paperclip_migration.rb.erb +15 -0
  39. data/lib/kt-paperclip.rb +1 -0
  40. data/lib/paperclip/attachment.rb +608 -0
  41. data/lib/paperclip/attachment_registry.rb +59 -0
  42. data/lib/paperclip/callbacks.rb +40 -0
  43. data/lib/paperclip/content_type_detector.rb +79 -0
  44. data/lib/paperclip/deprecations.rb +42 -0
  45. data/lib/paperclip/errors.rb +32 -0
  46. data/lib/paperclip/file_command_content_type_detector.rb +30 -0
  47. data/lib/paperclip/filename_cleaner.rb +16 -0
  48. data/lib/paperclip/geometry.rb +158 -0
  49. data/lib/paperclip/geometry_detector_factory.rb +48 -0
  50. data/lib/paperclip/geometry_parser_factory.rb +31 -0
  51. data/lib/paperclip/glue.rb +17 -0
  52. data/lib/paperclip/has_attached_file.rb +109 -0
  53. data/lib/paperclip/helpers.rb +56 -0
  54. data/lib/paperclip/interpolations/plural_cache.rb +18 -0
  55. data/lib/paperclip/interpolations.rb +197 -0
  56. data/lib/paperclip/io_adapters/abstract_adapter.rb +47 -0
  57. data/lib/paperclip/io_adapters/attachment_adapter.rb +36 -0
  58. data/lib/paperclip/io_adapters/data_uri_adapter.rb +22 -0
  59. data/lib/paperclip/io_adapters/empty_string_adapter.rb +18 -0
  60. data/lib/paperclip/io_adapters/file_adapter.rb +22 -0
  61. data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +16 -0
  62. data/lib/paperclip/io_adapters/identity_adapter.rb +12 -0
  63. data/lib/paperclip/io_adapters/nil_adapter.rb +34 -0
  64. data/lib/paperclip/io_adapters/registry.rb +32 -0
  65. data/lib/paperclip/io_adapters/stringio_adapter.rb +33 -0
  66. data/lib/paperclip/io_adapters/uploaded_file_adapter.rb +42 -0
  67. data/lib/paperclip/io_adapters/uri_adapter.rb +63 -0
  68. data/lib/paperclip/locales/de.yml +18 -0
  69. data/lib/paperclip/locales/en.yml +18 -0
  70. data/lib/paperclip/locales/es.yml +18 -0
  71. data/lib/paperclip/locales/ja.yml +18 -0
  72. data/lib/paperclip/locales/pt-BR.yml +18 -0
  73. data/lib/paperclip/locales/zh-CN.yml +18 -0
  74. data/lib/paperclip/locales/zh-HK.yml +18 -0
  75. data/lib/paperclip/locales/zh-TW.yml +18 -0
  76. data/lib/paperclip/logger.rb +21 -0
  77. data/lib/paperclip/matchers/have_attached_file_matcher.rb +54 -0
  78. data/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb +100 -0
  79. data/lib/paperclip/matchers/validate_attachment_presence_matcher.rb +59 -0
  80. data/lib/paperclip/matchers/validate_attachment_size_matcher.rb +96 -0
  81. data/lib/paperclip/matchers.rb +64 -0
  82. data/lib/paperclip/media_type_spoof_detector.rb +89 -0
  83. data/lib/paperclip/missing_attachment_styles.rb +79 -0
  84. data/lib/paperclip/processor.rb +48 -0
  85. data/lib/paperclip/processor_helpers.rb +50 -0
  86. data/lib/paperclip/rails_environment.rb +25 -0
  87. data/lib/paperclip/railtie.rb +31 -0
  88. data/lib/paperclip/schema.rb +83 -0
  89. data/lib/paperclip/storage/filesystem.rb +90 -0
  90. data/lib/paperclip/storage/fog.rb +242 -0
  91. data/lib/paperclip/storage/s3.rb +440 -0
  92. data/lib/paperclip/storage.rb +3 -0
  93. data/lib/paperclip/style.rb +109 -0
  94. data/lib/paperclip/tempfile.rb +43 -0
  95. data/lib/paperclip/tempfile_factory.rb +23 -0
  96. data/lib/paperclip/thumbnail.rb +121 -0
  97. data/lib/paperclip/url_generator.rb +79 -0
  98. data/lib/paperclip/validators/attachment_content_type_validator.rb +88 -0
  99. data/lib/paperclip/validators/attachment_file_name_validator.rb +80 -0
  100. data/lib/paperclip/validators/attachment_file_type_ignorance_validator.rb +29 -0
  101. data/lib/paperclip/validators/attachment_presence_validator.rb +30 -0
  102. data/lib/paperclip/validators/attachment_size_validator.rb +115 -0
  103. data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +27 -0
  104. data/lib/paperclip/validators.rb +74 -0
  105. data/lib/paperclip/version.rb +3 -0
  106. data/lib/paperclip.rb +213 -0
  107. data/lib/tasks/paperclip.rake +127 -0
  108. data/paperclip.gemspec +52 -0
  109. data/shoulda_macros/paperclip.rb +134 -0
  110. data/spec/database.yml +4 -0
  111. data/spec/paperclip/attachment_definitions_spec.rb +13 -0
  112. data/spec/paperclip/attachment_processing_spec.rb +82 -0
  113. data/spec/paperclip/attachment_registry_spec.rb +130 -0
  114. data/spec/paperclip/attachment_spec.rb +1494 -0
  115. data/spec/paperclip/content_type_detector_spec.rb +48 -0
  116. data/spec/paperclip/deprecations_spec.rb +65 -0
  117. data/spec/paperclip/file_command_content_type_detector_spec.rb +26 -0
  118. data/spec/paperclip/filename_cleaner_spec.rb +14 -0
  119. data/spec/paperclip/geometry_detector_spec.rb +39 -0
  120. data/spec/paperclip/geometry_parser_spec.rb +73 -0
  121. data/spec/paperclip/geometry_spec.rb +255 -0
  122. data/spec/paperclip/glue_spec.rb +44 -0
  123. data/spec/paperclip/has_attached_file_spec.rb +142 -0
  124. data/spec/paperclip/integration_spec.rb +667 -0
  125. data/spec/paperclip/interpolations_spec.rb +262 -0
  126. data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +78 -0
  127. data/spec/paperclip/io_adapters/attachment_adapter_spec.rb +139 -0
  128. data/spec/paperclip/io_adapters/data_uri_adapter_spec.rb +83 -0
  129. data/spec/paperclip/io_adapters/empty_string_adapter_spec.rb +17 -0
  130. data/spec/paperclip/io_adapters/file_adapter_spec.rb +131 -0
  131. data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +104 -0
  132. data/spec/paperclip/io_adapters/identity_adapter_spec.rb +8 -0
  133. data/spec/paperclip/io_adapters/nil_adapter_spec.rb +25 -0
  134. data/spec/paperclip/io_adapters/registry_spec.rb +35 -0
  135. data/spec/paperclip/io_adapters/stringio_adapter_spec.rb +64 -0
  136. data/spec/paperclip/io_adapters/uploaded_file_adapter_spec.rb +146 -0
  137. data/spec/paperclip/io_adapters/uri_adapter_spec.rb +127 -0
  138. data/spec/paperclip/matchers/have_attached_file_matcher_spec.rb +19 -0
  139. data/spec/paperclip/matchers/validate_attachment_content_type_matcher_spec.rb +99 -0
  140. data/spec/paperclip/matchers/validate_attachment_presence_matcher_spec.rb +69 -0
  141. data/spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb +88 -0
  142. data/spec/paperclip/media_type_spoof_detector_spec.rb +79 -0
  143. data/spec/paperclip/meta_class_spec.rb +30 -0
  144. data/spec/paperclip/paperclip_missing_attachment_styles_spec.rb +84 -0
  145. data/spec/paperclip/paperclip_spec.rb +222 -0
  146. data/spec/paperclip/plural_cache_spec.rb +37 -0
  147. data/spec/paperclip/processor_helpers_spec.rb +57 -0
  148. data/spec/paperclip/processor_spec.rb +26 -0
  149. data/spec/paperclip/rails_environment_spec.rb +33 -0
  150. data/spec/paperclip/rake_spec.rb +103 -0
  151. data/spec/paperclip/schema_spec.rb +248 -0
  152. data/spec/paperclip/storage/filesystem_spec.rb +79 -0
  153. data/spec/paperclip/storage/fog_spec.rb +540 -0
  154. data/spec/paperclip/storage/s3_live_spec.rb +182 -0
  155. data/spec/paperclip/storage/s3_spec.rb +1526 -0
  156. data/spec/paperclip/style_spec.rb +255 -0
  157. data/spec/paperclip/tempfile_factory_spec.rb +33 -0
  158. data/spec/paperclip/thumbnail_spec.rb +500 -0
  159. data/spec/paperclip/url_generator_spec.rb +221 -0
  160. data/spec/paperclip/validators/attachment_content_type_validator_spec.rb +322 -0
  161. data/spec/paperclip/validators/attachment_file_name_validator_spec.rb +160 -0
  162. data/spec/paperclip/validators/attachment_presence_validator_spec.rb +85 -0
  163. data/spec/paperclip/validators/attachment_size_validator_spec.rb +229 -0
  164. data/spec/paperclip/validators/media_type_spoof_detection_validator_spec.rb +52 -0
  165. data/spec/paperclip/validators_spec.rb +164 -0
  166. data/spec/spec_helper.rb +43 -0
  167. data/spec/support/assertions.rb +71 -0
  168. data/spec/support/deprecations.rb +9 -0
  169. data/spec/support/fake_model.rb +25 -0
  170. data/spec/support/fake_rails.rb +12 -0
  171. data/spec/support/fixtures/12k.png +0 -0
  172. data/spec/support/fixtures/50x50.png +0 -0
  173. data/spec/support/fixtures/5k.png +0 -0
  174. data/spec/support/fixtures/animated +0 -0
  175. data/spec/support/fixtures/animated.gif +0 -0
  176. data/spec/support/fixtures/animated.unknown +0 -0
  177. data/spec/support/fixtures/bad.png +1 -0
  178. data/spec/support/fixtures/empty.html +1 -0
  179. data/spec/support/fixtures/empty.xlsx +0 -0
  180. data/spec/support/fixtures/fog.yml +8 -0
  181. data/spec/support/fixtures/rotated.jpg +0 -0
  182. data/spec/support/fixtures/s3.yml +8 -0
  183. data/spec/support/fixtures/spaced file.jpg +0 -0
  184. data/spec/support/fixtures/spaced file.png +0 -0
  185. data/spec/support/fixtures/text.txt +1 -0
  186. data/spec/support/fixtures/twopage.pdf +0 -0
  187. data/spec/support/fixtures/uppercase.PNG +0 -0
  188. data/spec/support/matchers/accept.rb +5 -0
  189. data/spec/support/matchers/exist.rb +5 -0
  190. data/spec/support/matchers/have_column.rb +23 -0
  191. data/spec/support/mock_attachment.rb +22 -0
  192. data/spec/support/mock_interpolator.rb +24 -0
  193. data/spec/support/mock_url_generator_builder.rb +27 -0
  194. data/spec/support/model_reconstruction.rb +60 -0
  195. data/spec/support/rails_helpers.rb +7 -0
  196. data/spec/support/test_data.rb +13 -0
  197. data/spec/support/version_helper.rb +9 -0
  198. metadata +648 -0
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .hound.yml
data/.travis.yml ADDED
@@ -0,0 +1,23 @@
1
+ rvm:
2
+ - 2.0
3
+ - 2.1
4
+ - 2.2.2
5
+ - jruby-19mode
6
+ - rbx-2
7
+ - 2.7
8
+
9
+ script: "bundle exec rake clean spec cucumber"
10
+
11
+ gemfile:
12
+ - gemfiles/3.2.gemfile
13
+ - gemfiles/4.1.gemfile
14
+ - gemfiles/4.2.gemfile
15
+
16
+ matrix:
17
+ fast_finish: true
18
+ allow_failures:
19
+ - rvm: jruby-19mode
20
+ - rvm: rbx-2
21
+
22
+ sudo: false
23
+ cache: bundler
data/Appraisals ADDED
@@ -0,0 +1,11 @@
1
+ appraise "3.2" do
2
+ gem "rails", "~> 3.2.0"
3
+ end
4
+
5
+ appraise "4.1" do
6
+ gem "rails", "~> 4.1.0"
7
+ end
8
+
9
+ appraise "4.2" do
10
+ gem "rails", "~> 4.2.0"
11
+ end
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,75 @@
1
+ Contributing
2
+ ============
3
+
4
+ We love pull requests. Here's a quick guide:
5
+
6
+ 1. Fork the repo.
7
+
8
+ 2. Run the tests. We only take pull requests with passing tests, and it's great
9
+ to know that you have a clean slate: `bundle && bundle exec rake`
10
+
11
+ 3. Add a test for your change. Only refactoring and documentation changes
12
+ require no new tests. If you are adding functionality or fixing a bug, we need
13
+ a test!
14
+
15
+ 4. Make the test pass.
16
+
17
+ 5. Push to your fork and submit a pull request.
18
+
19
+ At this point you're waiting on us. We like to at least comment on, if not
20
+ accept, pull requests within seven business days (most of the work on Paperclip
21
+ gets done on Fridays). We may suggest some changes or improvements or
22
+ alternatives.
23
+
24
+ Some things that will increase the chance that your pull request is accepted,
25
+ taken straight from the Ruby on Rails guide:
26
+
27
+ * Use Rails idioms and helpers
28
+ * Include tests that fail without your code, and pass with it
29
+ * Update the documentation, the surrounding one, examples elsewhere, guides,
30
+ whatever is affected by your contribution
31
+
32
+ Running Tests
33
+ -------------
34
+
35
+ Paperclip uses [Appraisal](https://github.com/thoughtbot/appraisal) to aid
36
+ testing against multiple version of Ruby on Rails. This helps us to make sure
37
+ that Paperclip performs correctly with them.
38
+
39
+ Paperclip also uses [RSpec](http://rspec.info) for its unit tests. If you submit
40
+ tests that are not written for Cucumber or RSpec without a very good reason, you
41
+ will be asked to rewrite them before we'll accept.
42
+
43
+ ### Bootstrapping your test suite:
44
+
45
+ bundle install
46
+ bundle exec appraisal install
47
+
48
+ This will install all the required gems that requires to test against each
49
+ version of Rails, which defined in `gemfiles/*.gemfile`.
50
+
51
+ ### To run a full test suite:
52
+
53
+ bundle exec appraisal rake
54
+
55
+ This will run RSpec and Cucumber against all version of Rails
56
+
57
+ ### To run single Test::Unit or Cucumber test
58
+
59
+ You need to specify a `BUNDLE_GEMFILE` pointing to the gemfile before running
60
+ the normal test command:
61
+
62
+ BUNDLE_GEMFILE=gemfiles/4.1.gemfile rspec spec/paperclip/attachment_spec.rb
63
+ BUNDLE_GEMFILE=gemfiles/4.1.gemfile cucumber features/basic_integration.feature
64
+
65
+ Syntax
66
+ ------
67
+
68
+ * Two spaces, no tabs.
69
+ * No trailing whitespace. Blank lines should not have any space.
70
+ * Prefer &&/|| over and/or.
71
+ * MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
72
+ * a = b and not a=b.
73
+ * Follow the conventions you see used in the source already.
74
+
75
+ And in case we didn't emphasize it enough: we love tests!
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'sqlite3', '~> 1.3.8', :platforms => :ruby
6
+
7
+ gem 'jruby-openssl', :platforms => :jruby
8
+ gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
9
+
10
+ gem 'rubysl', :platforms => :rbx
11
+ gem 'racc', :platforms => :rbx
12
+
13
+ gem 'pry'
14
+
15
+ # Hinting at development dependencies
16
+ # Prevents bundler from taking a long-time to resolve
17
+ group :development, :test do
18
+ gem 'mime-types', '~> 1.16'
19
+ gem 'builder'
20
+ gem 'rubocop', require: false
21
+ end
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+
2
+ LICENSE
3
+
4
+ The MIT License
5
+
6
+ Copyright (c) 2008-2015 Jon Yurek and thoughtbot, inc.
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
data/NEWS ADDED
@@ -0,0 +1,420 @@
1
+ 4.3.7 (7/1/2016):
2
+
3
+ * Add deprecation warnings
4
+ * Improvement: Add `fog_options` configuration to send options to fog when storing files.
5
+ * Improvement: the `URI adapter` now uses the content-disposition header to name the downloaded file.
6
+
7
+ 4.3.6 (3/13/2016):
8
+
9
+ * Bug Fix: When a spoofed media type is detected, megabytes of mime-types info are added to logs. See https://cwe.mitre.org/data/definitions/779.html.
10
+
11
+ 4.3.5 (2/8/2016):
12
+
13
+ * Bug Fix: Remove deprecation warnings for v5.0 for now. Will re-add once the version has landed.
14
+
15
+ 4.3.4 (2/2/2016):
16
+
17
+ * Bug Fix: Fix incompatible change from v4.3.3.
18
+
19
+ 4.3.3 (1/29/2016):
20
+
21
+ * Improvement: Add deprecation warnings in preparation for release of v5.0
22
+
23
+ 4.3.2 (11/18/2015):
24
+
25
+ * Performance: Reduce memory allocations (#2056)
26
+
27
+ 4.3.1 (9/9/2015):
28
+
29
+ * Backport of bugfix to `remove_column`, so it works in Rails 3 and 4
30
+ c740fb171fe2f88c60b999d2a1c2122f2b8f43e9
31
+ * Fix GeometryParser regex for usage of '@>' flag
32
+ * `url` on a unpersisted record returns default_url
33
+ * spec deprecation warnings and failures
34
+ * README adjustments
35
+
36
+ 4.3.0 (6/18/2015):
37
+
38
+ * Improvement: Update aws-sdk and cucumber gem versions.
39
+ * Improvement: Add `length` alias for `size` method in AbstractAdapter.
40
+ * Improvement: Removed some cruft
41
+ * Improvement: deep_merge! Attachment definitions
42
+ * Improvement: Switch to mimemagic gem for content-type detection
43
+ * Improvement: Allows multiple content types for spoof detector
44
+ * Bug Fix: Don't assume we have Rails.env if we have Rails
45
+ * Performance: Decrease Memory footprint
46
+ * Ruby Versioning: Drop support for 1.9.3 (EOL'ed)
47
+ * Rails Versioning: Drop support for 4.0.0 (EOL'ed)
48
+
49
+ 4.2.4:
50
+
51
+ * Rollback backwards incompatible change, allowing paperclip to run on
52
+ Ruby >= 1.9.2.
53
+
54
+ 4.2.3:
55
+
56
+ * Fix dependency specifications (didn't work with Rails 4.1)
57
+ * Fix paperclip tests in CI
58
+
59
+ 4.2.2:
60
+
61
+ * Security fix: Fix a potential security issue with spoofing
62
+
63
+ 4.2.1:
64
+
65
+ * Improvement: Added `validate_media_type` options to allow/bypass spoof check
66
+ * Improvement: Added incremental backoff when AWS gives us a SlowDown error.
67
+ * Improvement: Stream downloads when usign aws-sdk.
68
+ * Improvement: Documentation fixes, includes Windows instructions.
69
+ * Improvement: Added pt-BR, zh-HK, zh-CN, zh-TW, and ja-JP locales.
70
+ * Improvement: Better escaping for characters in URLs
71
+ * Improvement: Honor `fog_credentials[:scheme]`
72
+ * Improvement: Also look for custom processors in lib/paperclip
73
+ * Improvement: id partitioning for string IDs works like integer id
74
+ * Improvement: Can pass options to DB adapters in migrations
75
+ * Improvement: Update expiring_url creation for later versions of fog
76
+ * Improvement: `path` can be a Proc in S3 attachments
77
+ * Test Fix: Improves speed and reliability of the specs
78
+ * Bug Fix: #original_filename= does not error when passed `nil`
79
+
80
+ 4.2.0:
81
+
82
+ * Improvement: Converted test suite from test/unit to RSpec
83
+ * Improvement: Refactored Paperclip::Attachment#assign
84
+ * Improvement: Added Spanish and German locales
85
+ * Improvement: Required Validators accept validator subclasses
86
+ * Improvement: EXIF orientation checking can be turned off for performance
87
+ * Improvement: Documentation updates
88
+ * Improvement: Better #human_size method for AttachmentSizeValidators
89
+ * Bug Fix: Allow MIME-types with dots in them
90
+ * Improvement: Travis CI updates
91
+ * Improvement: Validators can take multiple messages
92
+ * Improvement: Per-style options for S3 storage
93
+ * Improvement: Allow `nil` geometry strings
94
+ * Improvement: Use `eager_load!`
95
+
96
+ 4.1.1:
97
+
98
+ * Improvement: Add default translations for spoof validation
99
+ * Bug Fix: Don't check for spoofs if the file hasn't changed
100
+ * Bug Fix: Callback chain terminator is different in Rails 4.1, remove warnings
101
+ * Improvement: Fixed various Ruby warnings
102
+ * Bug Fix: Give bundler a hint, so it doesn't run forever on a fresh bundle
103
+ * Improvement: Documentation fixes
104
+ * Improvement: Allow travis-ci to finish-fast
105
+
106
+
107
+ 4.1.0:
108
+
109
+ * Improvement: Add :content_type_mappings to correct for missing spoof types
110
+ * Improvement: Credit Egor Homakov with discovering the content_type spoof bug
111
+ * Improvement: Memoize calls to identify in the thumbnail processor
112
+ * Improvement: Make MIME type optional for Data URIs.
113
+ * Improvement: Add default format for styles
114
+
115
+ 4.0.0:
116
+
117
+ * Security: Attachments are checked to make sure they're not pulling a fast one.
118
+ * Security: It is now *enforced* that every attachment has a file/mime validation.
119
+ * Bug Fix: Removed a call to IOAdapter#close that was causing issues.
120
+ * Improvement: Added bullets to the 3.5.3 list of changes. Very important.
121
+ * Improvement: Updated the copyright to 2014
122
+
123
+ 3.5.3:
124
+
125
+ * Improvement: After three long, hard years... we know how to upgrade
126
+ * Bug Fix: #expiring_url returns 'missing' urls if nothing is attached
127
+ * Improvement: Lots of documentation fixes
128
+ * Improvement: Lots of fixes for Ruby warnings
129
+ * Improvement: Test the most appropriate Ruby/Rails comobinations on Travis
130
+ * Improvement: Delegate more IO methods through IOAdapters
131
+ * Improvement: Remove Rails 4 deprecations
132
+ * Improvement: Both S3's and Fog's #expiring_url can take a Time or Int
133
+ * Bug Fix: Both S3's and Fog's expiring_url respect style when missing the file
134
+ * Bug Fix: Timefiles will have a reasonable-length name. They're all MD5 hashes now
135
+ * Bug Fix: Don't delete files off S3 when reprocessing due to AWS inconsistencies
136
+ * Bug Fix: "swallow_stream" isn't thread dafe. Use :swallow_stderr
137
+ * Improvement: Regexps use \A and \Z instead of ^ and $
138
+ * Improvement: :s3_credentials can take a lambda as an argument
139
+ * Improvement: Search up the class heirarchy for attachments
140
+ * Improvement: deep_merge options instead of regular merge
141
+ * Bug Fix: Prevent file deletion on transaction rollback
142
+ * Test Improvement: Ensure more files are properly closed during tests
143
+ * Test Bug Fix: Return the gemfile's syntax to normal
144
+
145
+ 3.5.2:
146
+
147
+ * Security: Force cocaine to at least 0.5.3 to include a security fix
148
+ * Improvement: Fixed some README exmaples
149
+ * Feature: Added HTTP URL Proxy Adapter, can assign string URLs as attachments
150
+ * Improvement: Put validation errors on the base attribute and the sub-attribute
151
+
152
+ 3.5.1:
153
+
154
+ * Bug Fix: Returned the class-level `attachment_definitions` method for compatability.
155
+ * Improvement: Ensured compatability with Rails 4
156
+ * Improvement: Added Rails 4 to the Appraisals
157
+ * Bug Fix: #1296, where validations were generating errors
158
+ * Improvement: Specify MIT license in the gemspec
159
+
160
+ 3.5.0:
161
+
162
+ * Feature: Handle Base64-encoded data URIs as uploads
163
+ * Feature: Add a FilenameCleaner class to allow custom filename sanitation
164
+ * Improvement: Satisfied Mocha deprecation warnings
165
+ * Bug Fix: Allow empty string to be submitted and ignored, as some forms do this
166
+ * Improvement: Make #expiring_url behavior consistent with #url
167
+ * Bug Fix: "Validate" attachments without invoking AR's validations
168
+ * Improvement: Various refactorings for a cleaner codebase
169
+ * Improvement: Be agnostic, use ActiveModel when appropriate
170
+ * Improvement: Add validation errors to the base attachment attribute
171
+ * Improvement: Handle errors in rake tasks
172
+ * Improvement: Largely refactor has_attached_file into a new class
173
+ * Improvement: Added Ruby 2.0.0 as a supported platform and removed 1.8.7
174
+ * Improvement: Fixed some incompatabilities in the test suite
175
+
176
+ 3.4.2:
177
+
178
+ * Improvement: Use https for Gemfile urls
179
+ * Improvement: Updated and more correct documentation
180
+ * Improvement: Use the -optimize flag on animated GIFs
181
+ * Improvement: Remove the Gemfile.lock
182
+ * Improvement: Add #expiring_url as an alias for #url until the storage defines it
183
+ * Improvement: Remove path clash checking, as it's unnecessary
184
+ * Bug Fix: Do not rely on checking version numbers for aws-sdk
185
+
186
+ 3.4.1:
187
+
188
+ * Improvement: Various documentation fixes and improvements
189
+ * Bug Fix: Clearing an attachment with `preserve_files` on should still clear the attachment
190
+ * Bug Fix: Instances are #changed? when a new file is assigned
191
+ * Bug Fix: Correctly deal with S3 styles when using a lambda
192
+ * Improvement: Accept and pass :credential_provider option to AWS-SDK
193
+ * Bug Fix: Sanitize original_filename more correctly in IO Adapters
194
+ * Improvement: s3_host_name can be a lambda
195
+ * Improvement: Cache some interpolations for speed
196
+ * Improvement: Update to latest cocaine
197
+ * Improvement: Update copyrights, various typos
198
+
199
+ 3.4.0:
200
+
201
+ * Bug Fix: Allow UploadedFileAdapter to force the use of `file`
202
+ * Bug Fix: Close the file handle when dealing with URIs
203
+ * Bug Fix: Ensure files are closed for writing when we're done.
204
+ * Bug Fix: Fixed 'type' being nil on Windows 7 error.
205
+ * Bug Fix: Fixed nil access when no s3 headers are defined
206
+ * Bug Fix: Fixes auto_orientation
207
+ * Bug Fix: Prevent a missing method error when switching from aws_sdk to fog
208
+ * Bug Fix: Properly fail to process invalid attachments
209
+ * Bug Fix: Server-side encryption is specified correctly
210
+ * Bug Fix: fog_public returned to true by default
211
+ * Bug Fix: Check attachment paths for duplicates, not URLs
212
+ * Feature: Add Attachment#blank?
213
+ * Feature: Add support for blacklisting certain content_types
214
+ * Feature: Add support for style-specific s3 headers and meta data
215
+ * Feature: Allow only_process to be a lambda
216
+ * Feature: Allow setting of escape url as a default option
217
+ * Feature: Create :override_file_permissions option for filesystem attachments
218
+ * Improvement: Add Attachment#as_json
219
+ * Improvement: Evaluate lambdas for fog_file properties
220
+ * Improvement: Extract geometry parsing into factories
221
+ * Improvement: Fixed various typos
222
+ * Improvement: Refactored some tests
223
+ * Improvement: Reuse S3 connections
224
+
225
+ New In 3.3.1:
226
+
227
+ * Bug Fix: Moved Filesystem's copy_to_local_file to the right place.
228
+
229
+ 3.3.0:
230
+
231
+ * Improvement: Upgrade cocaine to 0.4
232
+
233
+ 3.2.0:
234
+
235
+ * Bug Fix: Use the new correct Amazon S3 encryption header.
236
+ * Bug Fix: The rake task respects the updated_at column.
237
+ * Bug Fix: Strip newline from content type.
238
+ * Feature: Fog file visibility can be specified per style.
239
+ * Feature: Automatically rotate images.
240
+ * Feature: Reduce class-oriented programming of the attachment definitions.
241
+
242
+ 3.1.4:
243
+
244
+ * Bug Fix: Allow user to be able to set path without `:style` attribute and not raising an error.
245
+ This is a regression introduced in 3.1.3, and that feature will be postponed to another minor
246
+ release instead.
247
+ * Feature: Allow for URI Adapter as an optional paperclip io adapter.
248
+
249
+ 3.1.3:
250
+
251
+ * Bug Fix: Copy empty attachment between instances is now working.
252
+ * Bug Fix: Correctly rescue Fog error.
253
+ * Bug Fix: Using default path and url options in Fog storage now work as expected.
254
+ * Bug Fix: `Attachment#s3_protocol` now returns a protocol without colon suffix.
255
+ * Feature: Paperclip will now raise an error if multiple styles are defined but no `:style`
256
+ interpolation exists in `:path`.
257
+ * Feature: Add support for `#{attachment}_created_at` field
258
+ * Bug Fix: Paperclip now gracefully handles msising file command.
259
+ * Bug Fix: `StringIOAdapter` now accepts content type.
260
+
261
+ 3.1.2:
262
+
263
+ * Bug Fix: #remove_attachment on 3.1.0 and 3.1.1 mistakenly trying to remove the column that has
264
+ the same name as data type (such as :string, :datetime, :interger.) You're advised to update to
265
+ Paperclip 3.1.2 as soon as possible.
266
+
267
+ 3.1.1:
268
+
269
+ * Bug Fix: Paperclip will only load Paperclip::Schema only when Active Record is available.
270
+
271
+ 3.1.0:
272
+
273
+ * Feature: Paperclip now support new migration syntax (sexy migration) that reads better:
274
+
275
+ class AddAttachmentToUsers < ActiveRecord::Migration
276
+ def self.up
277
+ create_table :users do |t|
278
+ t.attachment :avatar
279
+ end
280
+ end
281
+ end
282
+
283
+ Also, schema-definition level syntax has been added:
284
+
285
+ add_attachment :users, :avatar
286
+ remove_attachment :users, :avatar
287
+
288
+ * Feature: Migration now support Rails 3.2+ `change` method.
289
+ * API CHANGE: Old `t.has_attached_file` and `drop_attached_file` are now deprecated. You're advised
290
+ to update your migration file before the next MAJOR version.
291
+ * Bug Fix: Tempfile now rewinded before generating fingerprint
292
+ * API CHANGE: Tempfiles are now unlinked after `after_flush_writes`
293
+
294
+ If you need to interact with the generated tempfiles, please define an `after_flush_writes` method
295
+ in your model. You'll be able to access files via `@queue_for_write` instance variable.
296
+
297
+ * Bug Fix: `:s3_protocol` can now be defined as either String or Symbol
298
+ * Bug Fix: Tempfiles are now rewinded before get passed into `after_flush_writes`
299
+ * Feature: Added expiring_url method to Fog Storage
300
+ * API CHANGE: Paperclip now tested against AWS::SDK 1.5.2 onward
301
+ * Bug Fix: Improved the output of the content_type validator so the actual failure is displayed
302
+ * Feature: Animated formats now identified using ImageMagick.
303
+ * Feature: AttachmentAdapter now support fetching attachment with specific style.
304
+ * Feature: Paperclip default options can now be configured in Rails.configuration.
305
+ * Feature: add Geometry#resize_to to calculate dimensions of new source.
306
+ * Bug Fix: Fixed a bug whereby a file type with multiple mime types but no official type would cause
307
+ the best_content_type to throw an error on trying nil.content_type.
308
+ * Bug Fix: Fix problem when the gem cannot be installed on the system that has Asepsis installed.
309
+
310
+ 3.0.4:
311
+
312
+ * Feature: Adds support for S3 scheme-less URL generation.
313
+
314
+ 3.0.3:
315
+
316
+ * Bug Fix: ThumbnailProcessor now correctly detects and preserve animated GIF.
317
+ * Bug Fix: File extension is now preserved in generated Tempfile from adapter.
318
+ * Bug Fix: Uploading file with unicode file name now won't raise an error when
319
+ logging in the AWS is turned on.
320
+ * Bug Fix: Task "paperclip:refresh:missing_styles" now work correctly.
321
+ * Bug Fix: Handle the case when :restricted_characters is nil.
322
+ * Bug Fix: Don't delete all the existing styles if we reprocess.
323
+ * Bug Fix: Content type is now ensured to not having a new line character.
324
+ * API CHANGE: Non-Rails usage should include Paperclip::Glue directly.
325
+
326
+ `Paperclip::Railtie` was intended to be used with Ruby on Rails only. If you're
327
+ using Paperclip without Rails, you should include `Paperclip::Glue` into
328
+ `ActiveRecord::Base` instead of requiring `paperclip/railtie`:
329
+
330
+ ActiveRecord::Base.send :include, Paperclip::Glue
331
+
332
+ * Bug Fix: AttachmentContentTypeValidator now allow you to specify :allow_blank/:allow_nil
333
+ * Bug Fix: Make sure content type always a String.
334
+ * Bug Fix: Fix attachment.reprocess! when using storage providers fog and s3.
335
+ * Bug Fix: Fix a problem with incorrect content_type detected with 'file' command for an empty file on Mac.
336
+
337
+ 3.0.2:
338
+
339
+ * API CHANGE: Generated migration class name is now plural (AddAttachmentToUsers instead of AddAttachmentToUser)
340
+ * API CHANGE: Remove Rails plugin initialization code.
341
+ * API CHANGE: Explicitly require Ruby 1.9.2 in the Gemfile.
342
+ * Bug Fix: Fixes AWS::S3::Errors::RequestTimeout on Model#save.
343
+ * Bug Fix: Fix a problem when there's no logger specified.
344
+ * Bug Fix: Fix a problem when attaching Rack::Test::UploadedFile instance.
345
+
346
+ 3.0.1:
347
+
348
+ * Feature: Introduce Paperlip IO adapter.
349
+ * Bug Fix: Regression in AttachmentContentTypeValidator has been fixed.
350
+ * API CHANGE: #to_file has been removed. Use the #copy_to_local_file method instead.
351
+
352
+ 3.0.0:
353
+
354
+ * API CHANGE: Paperclip now requires at least Ruby on Rails version 3.0.0
355
+ * API CHANGE: The default :url and :path have changed. The new scheme avoids
356
+ filesystem conflicts and scales to handle larger numbers of uploads.
357
+
358
+ The easiest way to upgrade is to add an explicit :url and :path to your
359
+ has_attached_file calls:
360
+
361
+ has_attached_file :avatar,
362
+ :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
363
+ :url => "/system/:attachment/:id/:style/:filename"
364
+
365
+ * Feature: Adding Rails 3 style validators, and adding `validates_attachment` method as a shorthand.
366
+ * Bug Fix: Paperclip's rake tasks now loading records in batch.
367
+ * Bug Fix: Attachment style name with leading number now not raising an error.
368
+ * Bug Fix: File given to S3 and Fog storage will now be rewinded after flush_write.
369
+ * Feature: You can now pass addional parameter to S3 expiring URL, such as :content_type.
370
+
371
+ 2.7.0:
372
+
373
+ * Bug Fix: Checking the existence of a file on S3 handles all AWS errors.
374
+ * Bug Fix: Clear the fingerprint when removing an attachment.
375
+ * Bug Fix: Attachment size validation message reads more nicely now.
376
+ * Feature: Style names can be either symbols or strings.
377
+ * Compatibility: Support for ActiveSupport < 2.3.12.
378
+ * Compatibility: Support for Rails 3.2.
379
+
380
+ 2.6.0:
381
+
382
+ * Bug Fix: Files are re-wound after reading.
383
+ * Feature: Remove Rails dependency from specs that need Paperclip.
384
+ * Feature: Validation matchers support conditionals.
385
+
386
+ 2.5.2:
387
+
388
+ * Bug Fix: Can be installed on Windows.
389
+ * Feature: The Fog bucket name, authentication, and host can be determined at runtime via Proc.
390
+ * Feature: Special characters are replaced with underscores in #url and #path.
391
+
392
+ 2.5.1:
393
+
394
+ * Feature: After we've computed the content type, pass it to Fog.
395
+ * Feature: S3 encryption with the new :s3_server_side_encryption option.
396
+ * Feature: Works without ActiveRecord, allowing for e.g. mongo backends.
397
+
398
+ 2.5.0:
399
+
400
+ * Performance: Only connect to S3 when absolutely needed.
401
+ * Bug Fix: STI with cached classes respect new options.
402
+ * Bug Fix: conditional validations broke, and now work again.
403
+ * Feature: URL generation is now parameterized and can be changed with plugins or custom code.
404
+ * Feature: :convert_options and :source_file_options to control the ImageMagick processing.
405
+ * Performance: String geometry specifications now parse more quickly.
406
+ * Bug Fix: Handle files with question marks in the filename.
407
+ * Bug Fix: Don't raise an error when generating an expiring URL on an unassigned attachment.
408
+ * Bug Fix: The rake task runs over all instances of an ActiveRecord model, ignoring default scopes.
409
+ * Feature: DB migration has_attached_file and drop_attached_file methods.
410
+ * Bug Fix: Switch from AWS::S3 to AWS::SDK for the S3 backend.
411
+ * Bug Fix: URL generator uses '?' in the URL unless it already appears and there is no prior '='.
412
+ * Bug Fix: Always convert the content type to a string before stripping blanks.
413
+ * Feature: The :keep_old_files option preserves the files in storage even when the attachment is cleared or changed.
414
+ * Performance: Optimize Fog's public_url access by avoiding it when possible.
415
+ * Bug Fix: Avoid a runtime error when generating the ID partition for an unsaved attachment.
416
+ * Performance: Do not calculate the fingerprint if it is never persisted.
417
+ * Bug Fix: Process the :original style before all others, in case of a dependency.
418
+ * Feature: S3 headers can be set at runtime by passing a proc object as the value.
419
+ * Bug Fix: Generating missing attachment styles for a model which has had its attachment changed should not raise.
420
+ * Bug Fix: Do not collide with the built-in Ruby hashing method.