paperclip_jk 5.0.0.beta2

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