paperclip 4.3.7 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of paperclip might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +13 -9
- data/Appraisals +22 -6
- data/CONTRIBUTING.md +6 -1
- data/Gemfile +2 -8
- data/LICENSE +1 -1
- data/NEWS +28 -37
- data/README.md +81 -63
- data/UPGRADING +9 -9
- data/features/basic_integration.feature +1 -0
- data/features/step_definitions/s3_steps.rb +6 -2
- data/gemfiles/{4.1.gemfile → 4.2.awsv2.0.gemfile} +4 -6
- data/gemfiles/4.2.awsv2.1.gemfile +17 -0
- data/gemfiles/{4.2.gemfile → 4.2.awsv2.gemfile} +1 -0
- data/gemfiles/5.0.awsv2.0.gemfile +17 -0
- data/gemfiles/5.0.awsv2.1.gemfile +17 -0
- data/gemfiles/{3.2.gemfile → 5.0.awsv2.gemfile} +7 -1
- data/lib/paperclip.rb +0 -2
- data/lib/paperclip/attachment.rb +9 -8
- data/lib/paperclip/attachment_registry.rb +2 -1
- data/lib/paperclip/callbacks.rb +8 -6
- data/lib/paperclip/glue.rb +1 -1
- data/lib/paperclip/has_attached_file.rb +7 -1
- data/lib/paperclip/io_adapters/uri_adapter.rb +11 -30
- data/lib/paperclip/schema.rb +1 -2
- data/lib/paperclip/storage/s3.rb +59 -35
- data/lib/paperclip/version.rb +1 -1
- data/paperclip.gemspec +11 -7
- data/spec/paperclip/attachment_registry_spec.rb +28 -0
- data/spec/paperclip/attachment_spec.rb +32 -6
- data/spec/paperclip/has_attached_file_spec.rb +24 -8
- data/spec/paperclip/integration_spec.rb +4 -3
- data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +5 -8
- data/spec/paperclip/io_adapters/uri_adapter_spec.rb +6 -31
- data/spec/paperclip/media_type_spoof_detector_spec.rb +3 -12
- data/spec/paperclip/paperclip_spec.rb +0 -32
- data/spec/paperclip/storage/s3_live_spec.rb +8 -4
- data/spec/paperclip/storage/s3_spec.rb +345 -165
- data/spec/paperclip/validators_spec.rb +2 -3
- data/spec/spec_helper.rb +3 -1
- data/spec/support/assertions.rb +7 -0
- data/spec/support/model_reconstruction.rb +9 -1
- data/spec/support/reporting.rb +11 -0
- metadata +45 -40
- data/lib/paperclip/deprecations.rb +0 -42
- data/lib/paperclip/locales/de.yml +0 -18
- data/lib/paperclip/locales/es.yml +0 -18
- data/lib/paperclip/locales/ja.yml +0 -18
- data/lib/paperclip/locales/pt-BR.yml +0 -18
- data/lib/paperclip/locales/zh-CN.yml +0 -18
- data/lib/paperclip/locales/zh-HK.yml +0 -18
- data/lib/paperclip/locales/zh-TW.yml +0 -18
- data/spec/paperclip/deprecations_spec.rb +0 -65
- data/spec/support/deprecations.rb +0 -9
- data/spec/support/rails_helpers.rb +0 -7
@@ -64,12 +64,11 @@ describe Paperclip::Validators do
|
|
64
64
|
assert_raises(RuntimeError){ dummy.valid? }
|
65
65
|
end
|
66
66
|
|
67
|
-
it 'allows you to attach a file that does not
|
67
|
+
it 'allows you to attach a file that does not violate these validations' do
|
68
68
|
dummy = Dummy.new(avatar: File.new(fixture_file('rotated.jpg')))
|
69
|
-
expect(dummy.errors.
|
69
|
+
expect(dummy.errors.full_messages).to be_empty
|
70
70
|
assert dummy.valid?
|
71
71
|
end
|
72
|
-
|
73
72
|
end
|
74
73
|
|
75
74
|
context "using the helper with a conditional" do
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,8 @@ require 'active_support/core_ext'
|
|
7
7
|
require 'mocha/api'
|
8
8
|
require 'bourne'
|
9
9
|
require 'ostruct'
|
10
|
+
require 'pathname'
|
11
|
+
require 'activerecord-import'
|
10
12
|
|
11
13
|
ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..')))
|
12
14
|
|
@@ -34,8 +36,8 @@ RSpec.configure do |config|
|
|
34
36
|
config.include Assertions
|
35
37
|
config.include ModelReconstruction
|
36
38
|
config.include TestData
|
39
|
+
config.include Reporting
|
37
40
|
config.extend VersionHelper
|
38
|
-
config.extend RailsHelpers::ClassMethods
|
39
41
|
config.mock_framework = :mocha
|
40
42
|
config.before(:all) do
|
41
43
|
rebuild_model
|
data/spec/support/assertions.rb
CHANGED
@@ -61,6 +61,13 @@ module Assertions
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
def assert_forbidden_response(url)
|
65
|
+
Net::HTTP.get_response(URI.parse(url)) do |response|
|
66
|
+
assert_equal "403", response.code,
|
67
|
+
"Expected HTTP response code 403, got #{response.code}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
64
71
|
def assert_frame_dimensions(range, frames)
|
65
72
|
frames.each_with_index do |frame, frame_index|
|
66
73
|
frame.split('x').each_with_index do |dimension, dimension_index |
|
@@ -10,7 +10,15 @@ module ModelReconstruction
|
|
10
10
|
|
11
11
|
klass.reset_column_information
|
12
12
|
klass.connection_pool.clear_table_cache!(klass.table_name) if klass.connection_pool.respond_to?(:clear_table_cache!)
|
13
|
-
|
13
|
+
|
14
|
+
if klass.connection.respond_to?(:schema_cache)
|
15
|
+
if ActiveRecord::VERSION::STRING >= "5.0"
|
16
|
+
klass.connection.schema_cache.clear_data_source_cache!(klass.table_name)
|
17
|
+
else
|
18
|
+
klass.connection.schema_cache.clear_table_cache!(klass.table_name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
14
22
|
klass
|
15
23
|
end
|
16
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Yurek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cocaine
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,14 +70,14 @@ dependencies:
|
|
70
70
|
name: mimemagic
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.3.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.3.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 4.2.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 4.2.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: shoulda
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,20 +156,20 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
160
|
-
- - "
|
159
|
+
version: 2.0.33
|
160
|
+
- - "<"
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: '
|
162
|
+
version: '3.0'
|
163
163
|
type: :development
|
164
164
|
prerelease: false
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version:
|
170
|
-
- - "
|
169
|
+
version: 2.0.33
|
170
|
+
- - "<"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '
|
172
|
+
version: '3.0'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
174
|
name: bourne
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -344,14 +344,14 @@ dependencies:
|
|
344
344
|
requirements:
|
345
345
|
- - ">="
|
346
346
|
- !ruby/object:Gem::Version
|
347
|
-
version:
|
347
|
+
version: 4.2.0
|
348
348
|
type: :development
|
349
349
|
prerelease: false
|
350
350
|
version_requirements: !ruby/object:Gem::Requirement
|
351
351
|
requirements:
|
352
352
|
- - ">="
|
353
353
|
- !ruby/object:Gem::Version
|
354
|
-
version:
|
354
|
+
version: 4.2.0
|
355
355
|
- !ruby/object:Gem::Dependency
|
356
356
|
name: generator_spec
|
357
357
|
requirement: !ruby/object:Gem::Requirement
|
@@ -418,9 +418,12 @@ files:
|
|
418
418
|
- features/support/paths.rb
|
419
419
|
- features/support/rails.rb
|
420
420
|
- features/support/selectors.rb
|
421
|
-
- gemfiles/
|
422
|
-
- gemfiles/4.1.gemfile
|
423
|
-
- gemfiles/4.2.gemfile
|
421
|
+
- gemfiles/4.2.awsv2.0.gemfile
|
422
|
+
- gemfiles/4.2.awsv2.1.gemfile
|
423
|
+
- gemfiles/4.2.awsv2.gemfile
|
424
|
+
- gemfiles/5.0.awsv2.0.gemfile
|
425
|
+
- gemfiles/5.0.awsv2.1.gemfile
|
426
|
+
- gemfiles/5.0.awsv2.gemfile
|
424
427
|
- lib/generators/paperclip/USAGE
|
425
428
|
- lib/generators/paperclip/paperclip_generator.rb
|
426
429
|
- lib/generators/paperclip/templates/paperclip_migration.rb.erb
|
@@ -429,7 +432,6 @@ files:
|
|
429
432
|
- lib/paperclip/attachment_registry.rb
|
430
433
|
- lib/paperclip/callbacks.rb
|
431
434
|
- lib/paperclip/content_type_detector.rb
|
432
|
-
- lib/paperclip/deprecations.rb
|
433
435
|
- lib/paperclip/errors.rb
|
434
436
|
- lib/paperclip/file_command_content_type_detector.rb
|
435
437
|
- lib/paperclip/filename_cleaner.rb
|
@@ -453,14 +455,7 @@ files:
|
|
453
455
|
- lib/paperclip/io_adapters/stringio_adapter.rb
|
454
456
|
- lib/paperclip/io_adapters/uploaded_file_adapter.rb
|
455
457
|
- lib/paperclip/io_adapters/uri_adapter.rb
|
456
|
-
- lib/paperclip/locales/de.yml
|
457
458
|
- lib/paperclip/locales/en.yml
|
458
|
-
- lib/paperclip/locales/es.yml
|
459
|
-
- lib/paperclip/locales/ja.yml
|
460
|
-
- lib/paperclip/locales/pt-BR.yml
|
461
|
-
- lib/paperclip/locales/zh-CN.yml
|
462
|
-
- lib/paperclip/locales/zh-HK.yml
|
463
|
-
- lib/paperclip/locales/zh-TW.yml
|
464
459
|
- lib/paperclip/logger.rb
|
465
460
|
- lib/paperclip/matchers.rb
|
466
461
|
- lib/paperclip/matchers/have_attached_file_matcher.rb
|
@@ -500,7 +495,6 @@ files:
|
|
500
495
|
- spec/paperclip/attachment_registry_spec.rb
|
501
496
|
- spec/paperclip/attachment_spec.rb
|
502
497
|
- spec/paperclip/content_type_detector_spec.rb
|
503
|
-
- spec/paperclip/deprecations_spec.rb
|
504
498
|
- spec/paperclip/file_command_content_type_detector_spec.rb
|
505
499
|
- spec/paperclip/filename_cleaner_spec.rb
|
506
500
|
- spec/paperclip/geometry_detector_spec.rb
|
@@ -552,7 +546,6 @@ files:
|
|
552
546
|
- spec/paperclip/validators_spec.rb
|
553
547
|
- spec/spec_helper.rb
|
554
548
|
- spec/support/assertions.rb
|
555
|
-
- spec/support/deprecations.rb
|
556
549
|
- spec/support/fake_model.rb
|
557
550
|
- spec/support/fake_rails.rb
|
558
551
|
- spec/support/fixtures/12k.png
|
@@ -579,14 +572,28 @@ files:
|
|
579
572
|
- spec/support/mock_interpolator.rb
|
580
573
|
- spec/support/mock_url_generator_builder.rb
|
581
574
|
- spec/support/model_reconstruction.rb
|
582
|
-
- spec/support/
|
575
|
+
- spec/support/reporting.rb
|
583
576
|
- spec/support/test_data.rb
|
584
577
|
- spec/support/version_helper.rb
|
585
578
|
homepage: https://github.com/thoughtbot/paperclip
|
586
579
|
licenses:
|
587
580
|
- MIT
|
588
581
|
metadata: {}
|
589
|
-
post_install_message:
|
582
|
+
post_install_message: |
|
583
|
+
##################################################
|
584
|
+
# NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER #
|
585
|
+
##################################################
|
586
|
+
|
587
|
+
Paperclip is now compatible with aws-sdk >= 2.0.0.
|
588
|
+
|
589
|
+
If you are using S3 storage, aws-sdk >= 2.0.0 requires you to make a few small
|
590
|
+
changes:
|
591
|
+
|
592
|
+
* You must set the `s3_region`
|
593
|
+
* If you are explicitly setting permissions anywhere, such as in an initializer,
|
594
|
+
note that the format of the permissions changed from using an underscore to
|
595
|
+
using a hyphen. For example, `:public_read` needs to be changed to
|
596
|
+
`public-read`.
|
590
597
|
rdoc_options: []
|
591
598
|
require_paths:
|
592
599
|
- lib
|
@@ -594,16 +601,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
594
601
|
requirements:
|
595
602
|
- - ">="
|
596
603
|
- !ruby/object:Gem::Version
|
597
|
-
version: 1.
|
604
|
+
version: 2.1.0
|
598
605
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
599
606
|
requirements:
|
600
|
-
- - "
|
607
|
+
- - ">"
|
601
608
|
- !ruby/object:Gem::Version
|
602
|
-
version:
|
609
|
+
version: 1.3.1
|
603
610
|
requirements:
|
604
611
|
- ImageMagick
|
605
612
|
rubyforge_project:
|
606
|
-
rubygems_version: 2.
|
613
|
+
rubygems_version: 2.5.1
|
607
614
|
signing_key:
|
608
615
|
specification_version: 4
|
609
616
|
summary: File attachments as attributes for ActiveRecord
|
@@ -631,7 +638,6 @@ test_files:
|
|
631
638
|
- spec/paperclip/attachment_registry_spec.rb
|
632
639
|
- spec/paperclip/attachment_spec.rb
|
633
640
|
- spec/paperclip/content_type_detector_spec.rb
|
634
|
-
- spec/paperclip/deprecations_spec.rb
|
635
641
|
- spec/paperclip/file_command_content_type_detector_spec.rb
|
636
642
|
- spec/paperclip/filename_cleaner_spec.rb
|
637
643
|
- spec/paperclip/geometry_detector_spec.rb
|
@@ -683,7 +689,6 @@ test_files:
|
|
683
689
|
- spec/paperclip/validators_spec.rb
|
684
690
|
- spec/spec_helper.rb
|
685
691
|
- spec/support/assertions.rb
|
686
|
-
- spec/support/deprecations.rb
|
687
692
|
- spec/support/fake_model.rb
|
688
693
|
- spec/support/fake_rails.rb
|
689
694
|
- spec/support/fixtures/12k.png
|
@@ -710,6 +715,6 @@ test_files:
|
|
710
715
|
- spec/support/mock_interpolator.rb
|
711
716
|
- spec/support/mock_url_generator_builder.rb
|
712
717
|
- spec/support/model_reconstruction.rb
|
713
|
-
- spec/support/
|
718
|
+
- spec/support/reporting.rb
|
714
719
|
- spec/support/test_data.rb
|
715
720
|
- spec/support/version_helper.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require "active_support/deprecation"
|
2
|
-
|
3
|
-
module Paperclip
|
4
|
-
class Deprecations
|
5
|
-
class << self
|
6
|
-
def check
|
7
|
-
warn_aws_sdk_v1 if aws_sdk_v1?
|
8
|
-
warn_outdated_rails if active_model_version < "4.2"
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def active_model_version
|
14
|
-
::ActiveModel::VERSION::STRING
|
15
|
-
end
|
16
|
-
|
17
|
-
def aws_sdk_v1?
|
18
|
-
defined?(::AWS) && aws_sdk_version < "2"
|
19
|
-
end
|
20
|
-
|
21
|
-
def warn_aws_sdk_v1
|
22
|
-
warn "[paperclip] [deprecation] AWS SDK v1 has been deprecated in " \
|
23
|
-
"paperclip 5. Please consider upgrading to AWS 2 before " \
|
24
|
-
"upgrading paperclip."
|
25
|
-
end
|
26
|
-
|
27
|
-
def warn_outdated_rails
|
28
|
-
warn "[paperclip] [deprecation] Rails 3.2 and 4.1 are unsupported as " \
|
29
|
-
"of Rails 5 release. Please upgrade to Rails 4.2 before " \
|
30
|
-
"upgrading paperclip."
|
31
|
-
end
|
32
|
-
|
33
|
-
def aws_sdk_version
|
34
|
-
::AWS::VERSION
|
35
|
-
end
|
36
|
-
|
37
|
-
def warn(message)
|
38
|
-
ActiveSupport::Deprecation.warn(message)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
de:
|
2
|
-
errors:
|
3
|
-
messages:
|
4
|
-
in_between: "muss zwischen %{min} und %{max} sein"
|
5
|
-
spoofed_media_type: "trägt eine Dateiendung, die nicht mit dem Inhalt der Datei übereinstimmt"
|
6
|
-
|
7
|
-
number:
|
8
|
-
human:
|
9
|
-
storage_units:
|
10
|
-
format: "%n %u"
|
11
|
-
units:
|
12
|
-
byte:
|
13
|
-
one: "Byte"
|
14
|
-
other: "Bytes"
|
15
|
-
kb: "KB"
|
16
|
-
mb: "MB"
|
17
|
-
gb: "GB"
|
18
|
-
tb: "TB"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
es:
|
2
|
-
errors:
|
3
|
-
messages:
|
4
|
-
in_between: "debe estar entre %{min} y %{max}"
|
5
|
-
spoofed_media_type: "tiene una extensión que no coincide con su contenido"
|
6
|
-
|
7
|
-
number:
|
8
|
-
human:
|
9
|
-
storage_units:
|
10
|
-
format: "%n %u"
|
11
|
-
units:
|
12
|
-
byte:
|
13
|
-
one: "Byte"
|
14
|
-
other: "Bytes"
|
15
|
-
kb: "KB"
|
16
|
-
mb: "MB"
|
17
|
-
gb: "GB"
|
18
|
-
tb: "TB"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
ja:
|
2
|
-
errors:
|
3
|
-
messages:
|
4
|
-
in_between: "の容量は%{min}以上%{max}以下にしてください。"
|
5
|
-
spoofed_media_type: "の拡張子と内容が一致していません。"
|
6
|
-
|
7
|
-
number:
|
8
|
-
human:
|
9
|
-
storage_units:
|
10
|
-
format: "%n %u"
|
11
|
-
units:
|
12
|
-
byte:
|
13
|
-
one: "Byte"
|
14
|
-
other: "Bytes"
|
15
|
-
kb: "KB"
|
16
|
-
mb: "MB"
|
17
|
-
gb: "GB"
|
18
|
-
tb: "TB"
|
@@ -1,18 +0,0 @@
|
|
1
|
-
pt-BR:
|
2
|
-
errors:
|
3
|
-
messages:
|
4
|
-
in_between: "deve ter entre %{min} e %{max}"
|
5
|
-
spoofed_media_type: "tem uma extensão que não corresponde ao seu conteúdo"
|
6
|
-
|
7
|
-
number:
|
8
|
-
human:
|
9
|
-
storage_units:
|
10
|
-
format: "%n %u"
|
11
|
-
units:
|
12
|
-
byte:
|
13
|
-
one: "Byte"
|
14
|
-
other: "Bytes"
|
15
|
-
kb: "KB"
|
16
|
-
mb: "MB"
|
17
|
-
gb: "GB"
|
18
|
-
tb: "TB"
|