paperclip 5.2.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/issue_template.md +3 -0
- data/MIGRATING-ES.md +317 -0
- data/MIGRATING.md +375 -0
- data/NEWS +36 -0
- data/README.md +52 -18
- data/UPGRADING +3 -3
- data/features/step_definitions/attachment_steps.rb +10 -10
- data/features/step_definitions/rails_steps.rb +1 -1
- data/lib/generators/paperclip/paperclip_generator.rb +9 -1
- data/lib/generators/paperclip/templates/paperclip_migration.rb.erb +1 -1
- data/lib/paperclip/attachment.rb +19 -6
- data/lib/paperclip/file_command_content_type_detector.rb +1 -1
- data/lib/paperclip/filename_cleaner.rb +0 -1
- data/lib/paperclip/geometry_detector_factory.rb +3 -3
- data/lib/paperclip/helpers.rb +3 -3
- data/lib/paperclip/interpolations.rb +6 -1
- data/lib/paperclip/io_adapters/abstract_adapter.rb +11 -6
- data/lib/paperclip/io_adapters/attachment_adapter.rb +7 -1
- data/lib/paperclip/io_adapters/http_url_proxy_adapter.rb +2 -1
- data/lib/paperclip/io_adapters/uri_adapter.rb +8 -6
- data/lib/paperclip/logger.rb +1 -1
- data/lib/paperclip/media_type_spoof_detector.rb +11 -7
- data/lib/paperclip/processor.rb +10 -2
- data/lib/paperclip/schema.rb +1 -1
- data/lib/paperclip/storage/fog.rb +3 -2
- data/lib/paperclip/storage/s3.rb +8 -16
- data/lib/paperclip/style.rb +0 -1
- data/lib/paperclip/thumbnail.rb +8 -5
- data/lib/paperclip/url_generator.rb +1 -0
- data/lib/paperclip/validators/media_type_spoof_detection_validator.rb +4 -0
- data/lib/paperclip/version.rb +1 -1
- data/lib/paperclip.rb +2 -1
- data/paperclip.gemspec +2 -2
- data/spec/paperclip/attachment_processing_spec.rb +0 -1
- data/spec/paperclip/attachment_spec.rb +17 -2
- data/spec/paperclip/content_type_detector_spec.rb +1 -1
- data/spec/paperclip/file_command_content_type_detector_spec.rb +15 -1
- data/spec/paperclip/filename_cleaner_spec.rb +0 -1
- data/spec/paperclip/integration_spec.rb +41 -5
- data/spec/paperclip/interpolations_spec.rb +9 -0
- data/spec/paperclip/io_adapters/abstract_adapter_spec.rb +59 -0
- data/spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb +33 -16
- data/spec/paperclip/io_adapters/uri_adapter_spec.rb +56 -8
- data/spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb +1 -1
- data/spec/paperclip/media_type_spoof_detector_spec.rb +41 -0
- data/spec/paperclip/paperclip_spec.rb +13 -13
- data/spec/paperclip/processor_spec.rb +4 -4
- data/spec/paperclip/schema_spec.rb +46 -46
- data/spec/paperclip/storage/fog_spec.rb +5 -0
- data/spec/paperclip/storage/s3_spec.rb +6 -6
- data/spec/paperclip/style_spec.rb +0 -1
- data/spec/paperclip/thumbnail_spec.rb +8 -6
- data/spec/paperclip/url_generator_spec.rb +0 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/support/model_reconstruction.rb +2 -2
- metadata +120 -20
- data/spec/support/conditional_filter_helper.rb +0 -5
| @@ -58,6 +58,32 @@ describe Paperclip::MediaTypeSpoofDetector do | |
| 58 58 | 
             
                end
         | 
| 59 59 | 
             
              end
         | 
| 60 60 |  | 
| 61 | 
            +
              context "GIF file named without extension, but we're told GIF" do
         | 
| 62 | 
            +
                let(:file) { File.open(fixture_file("animated")) }
         | 
| 63 | 
            +
                let(:spoofed?) do
         | 
| 64 | 
            +
                  Paperclip::MediaTypeSpoofDetector.
         | 
| 65 | 
            +
                    using(file, "animated", "image/gif").
         | 
| 66 | 
            +
                    spoofed?
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                it "accepts the file" do
         | 
| 70 | 
            +
                  assert !spoofed?
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
              end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
              context "GIF file named without extension, but we're told HTML" do
         | 
| 75 | 
            +
                let(:file) { File.open(fixture_file("animated")) }
         | 
| 76 | 
            +
                let(:spoofed?) do
         | 
| 77 | 
            +
                  Paperclip::MediaTypeSpoofDetector.
         | 
| 78 | 
            +
                    using(file, "animated", "text/html").
         | 
| 79 | 
            +
                    spoofed?
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                it "rejects the file" do
         | 
| 83 | 
            +
                  assert spoofed?
         | 
| 84 | 
            +
                end
         | 
| 85 | 
            +
              end
         | 
| 86 | 
            +
             | 
| 61 87 | 
             
              it "does not reject if content_type is empty but otherwise checks out" do
         | 
| 62 88 | 
             
                file = File.open(fixture_file("empty.html"))
         | 
| 63 89 | 
             
                assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "").spoofed?
         | 
| @@ -76,4 +102,19 @@ describe Paperclip::MediaTypeSpoofDetector do | |
| 76 102 | 
             
                  Paperclip.options[:content_type_mappings] = {}
         | 
| 77 103 | 
             
                end
         | 
| 78 104 | 
             
              end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
              context "#type_from_file_command" do
         | 
| 107 | 
            +
                let(:file) { File.new(fixture_file("empty.html")) }
         | 
| 108 | 
            +
                let(:detector) { Paperclip::MediaTypeSpoofDetector.new(file, "html", "") }
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                it "does work with the output of old versions of file" do
         | 
| 111 | 
            +
                  Paperclip.stubs(:run).returns("text/html charset=us-ascii")
         | 
| 112 | 
            +
                  expect(detector.send(:type_from_file_command)).to eq("text/html")
         | 
| 113 | 
            +
                end
         | 
| 114 | 
            +
             | 
| 115 | 
            +
                it "does work with the output of new versions of file" do
         | 
| 116 | 
            +
                  Paperclip.stubs(:run).returns("text/html; charset=us-ascii")
         | 
| 117 | 
            +
                  expect(detector.send(:type_from_file_command)).to eq("text/html")
         | 
| 118 | 
            +
                end
         | 
| 119 | 
            +
              end
         | 
| 79 120 | 
             
            end
         | 
| @@ -4,40 +4,40 @@ describe Paperclip do | |
| 4 4 | 
             
              context ".run" do
         | 
| 5 5 | 
             
                before do
         | 
| 6 6 | 
             
                  Paperclip.options[:log_command] = false
         | 
| 7 | 
            -
                   | 
| 8 | 
            -
                  @original_command_line_path =  | 
| 7 | 
            +
                  Terrapin::CommandLine.expects(:new).with("convert", "stuff", {}).returns(stub(:run))
         | 
| 8 | 
            +
                  @original_command_line_path = Terrapin::CommandLine.path
         | 
| 9 9 | 
             
                end
         | 
| 10 10 |  | 
| 11 11 | 
             
                after do
         | 
| 12 12 | 
             
                  Paperclip.options[:log_command] = true
         | 
| 13 | 
            -
                   | 
| 13 | 
            +
                  Terrapin::CommandLine.path = @original_command_line_path
         | 
| 14 14 | 
             
                end
         | 
| 15 15 |  | 
| 16 | 
            -
                it "runs the command with  | 
| 16 | 
            +
                it "runs the command with Terrapin" do
         | 
| 17 17 | 
             
                  Paperclip.run("convert", "stuff")
         | 
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 | 
            -
                it "saves  | 
| 21 | 
            -
                   | 
| 20 | 
            +
                it "saves Terrapin::CommandLine.path that set before" do
         | 
| 21 | 
            +
                  Terrapin::CommandLine.path = "/opt/my_app/bin"
         | 
| 22 22 | 
             
                  Paperclip.run("convert", "stuff")
         | 
| 23 | 
            -
                  expect( | 
| 23 | 
            +
                  expect(Terrapin::CommandLine.path).to match("/opt/my_app/bin")
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| 26 | 
            -
                it "does not duplicate  | 
| 27 | 
            -
                   | 
| 28 | 
            -
                   | 
| 26 | 
            +
                it "does not duplicate Terrapin::CommandLine.path on multiple runs" do
         | 
| 27 | 
            +
                  Terrapin::CommandLine.expects(:new).with("convert", "more_stuff", {}).returns(stub(:run))
         | 
| 28 | 
            +
                  Terrapin::CommandLine.path = nil
         | 
| 29 29 | 
             
                  Paperclip.options[:command_path] = "/opt/my_app/bin"
         | 
| 30 30 | 
             
                  Paperclip.run("convert", "stuff")
         | 
| 31 31 | 
             
                  Paperclip.run("convert", "more_stuff")
         | 
| 32 32 |  | 
| 33 33 | 
             
                  cmd_path = Paperclip.options[:command_path]
         | 
| 34 | 
            -
                  assert_equal 1,  | 
| 34 | 
            +
                  assert_equal 1, Terrapin::CommandLine.path.scan(cmd_path).count
         | 
| 35 35 | 
             
                end
         | 
| 36 36 | 
             
              end
         | 
| 37 37 |  | 
| 38 38 | 
             
              it 'does not raise errors when doing a lot of running' do
         | 
| 39 39 | 
             
                Paperclip.options[:command_path] = ["/usr/local/bin"] * 1024
         | 
| 40 | 
            -
                 | 
| 40 | 
            +
                Terrapin::CommandLine.path = "/something/else"
         | 
| 41 41 | 
             
                100.times do |x|
         | 
| 42 42 | 
             
                  Paperclip.run("echo", x.to_s)
         | 
| 43 43 | 
             
                end
         | 
| @@ -63,7 +63,7 @@ describe Paperclip do | |
| 63 63 | 
             
              context "Calling Paperclip.run with a logger" do
         | 
| 64 64 | 
             
                it "passes the defined logger if :log_command is set" do
         | 
| 65 65 | 
             
                  Paperclip.options[:log_command] = true
         | 
| 66 | 
            -
                   | 
| 66 | 
            +
                  Terrapin::CommandLine.expects(:new).with("convert", "stuff", logger: Paperclip.logger).returns(stub(:run))
         | 
| 67 67 | 
             
                  Paperclip.run("convert", "stuff")
         | 
| 68 68 | 
             
                end
         | 
| 69 69 | 
             
              end
         | 
| @@ -9,17 +9,17 @@ describe Paperclip::Processor do | |
| 9 9 | 
             
              end
         | 
| 10 10 |  | 
| 11 11 | 
             
              context "Calling #convert" do
         | 
| 12 | 
            -
                it "runs the convert command with  | 
| 12 | 
            +
                it "runs the convert command with Terrapin" do
         | 
| 13 13 | 
             
                  Paperclip.options[:log_command] = false
         | 
| 14 | 
            -
                   | 
| 14 | 
            +
                  Terrapin::CommandLine.expects(:new).with("convert", "stuff", {}).returns(stub(:run))
         | 
| 15 15 | 
             
                  Paperclip::Processor.new('filename').convert("stuff")
         | 
| 16 16 | 
             
                end
         | 
| 17 17 | 
             
              end
         | 
| 18 18 |  | 
| 19 19 | 
             
              context "Calling #identify" do
         | 
| 20 | 
            -
                it "runs the identify command with  | 
| 20 | 
            +
                it "runs the identify command with Terrapin" do
         | 
| 21 21 | 
             
                  Paperclip.options[:log_command] = false
         | 
| 22 | 
            -
                   | 
| 22 | 
            +
                  Terrapin::CommandLine.expects(:new).with("identify", "stuff", {}).returns(stub(:run))
         | 
| 23 23 | 
             
                  Paperclip::Processor.new('filename').identify("stuff")
         | 
| 24 24 | 
             
                end
         | 
| 25 25 | 
             
              end
         | 
| @@ -25,12 +25,12 @@ describe Paperclip::Schema do | |
| 25 25 | 
             
                      end
         | 
| 26 26 | 
             
                    end
         | 
| 27 27 |  | 
| 28 | 
            -
                    columns = Dummy.columns.map{ |column| [column.name, column. | 
| 28 | 
            +
                    columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
         | 
| 29 29 |  | 
| 30 | 
            -
                    expect(columns).to include(['avatar_file_name',  | 
| 31 | 
            -
                    expect(columns).to include(['avatar_content_type',  | 
| 32 | 
            -
                    expect(columns).to include(['avatar_file_size',  | 
| 33 | 
            -
                    expect(columns).to include(['avatar_updated_at',  | 
| 30 | 
            +
                    expect(columns).to include(['avatar_file_name', "varchar"])
         | 
| 31 | 
            +
                    expect(columns).to include(['avatar_content_type', "varchar"])
         | 
| 32 | 
            +
                    expect(columns).to include(['avatar_file_size', "bigint"])
         | 
| 33 | 
            +
                    expect(columns).to include(['avatar_updated_at', "datetime"])
         | 
| 34 34 | 
             
                  end
         | 
| 35 35 |  | 
| 36 36 | 
             
                  it "displays deprecation warning" do
         | 
| @@ -50,12 +50,12 @@ describe Paperclip::Schema do | |
| 50 50 | 
             
                  end
         | 
| 51 51 |  | 
| 52 52 | 
             
                  it "creates attachment columns" do
         | 
| 53 | 
            -
                    columns = Dummy.columns.map{ |column| [column.name, column. | 
| 53 | 
            +
                    columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
         | 
| 54 54 |  | 
| 55 | 
            -
                    expect(columns).to include(['avatar_file_name',  | 
| 56 | 
            -
                    expect(columns).to include(['avatar_content_type',  | 
| 57 | 
            -
                    expect(columns).to include(['avatar_file_size',  | 
| 58 | 
            -
                    expect(columns).to include(['avatar_updated_at',  | 
| 55 | 
            +
                    expect(columns).to include(['avatar_file_name', "varchar"])
         | 
| 56 | 
            +
                    expect(columns).to include(['avatar_content_type', "varchar"])
         | 
| 57 | 
            +
                    expect(columns).to include(['avatar_file_size', "bigint"])
         | 
| 58 | 
            +
                    expect(columns).to include(['avatar_updated_at', "datetime"])
         | 
| 59 59 | 
             
                  end
         | 
| 60 60 | 
             
                end
         | 
| 61 61 |  | 
| @@ -89,12 +89,12 @@ describe Paperclip::Schema do | |
| 89 89 | 
             
                    end
         | 
| 90 90 |  | 
| 91 91 | 
             
                    it "creates attachment columns" do
         | 
| 92 | 
            -
                      columns = Dummy.columns.map{ |column| [column.name, column. | 
| 92 | 
            +
                      columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
         | 
| 93 93 |  | 
| 94 | 
            -
                      expect(columns).to include(['avatar_file_name',  | 
| 95 | 
            -
                      expect(columns).to include(['avatar_content_type',  | 
| 96 | 
            -
                      expect(columns).to include(['avatar_file_size',  | 
| 97 | 
            -
                      expect(columns).to include(['avatar_updated_at',  | 
| 94 | 
            +
                      expect(columns).to include(['avatar_file_name', "varchar"])
         | 
| 95 | 
            +
                      expect(columns).to include(['avatar_content_type', "varchar"])
         | 
| 96 | 
            +
                      expect(columns).to include(['avatar_file_size', "bigint"])
         | 
| 97 | 
            +
                      expect(columns).to include(['avatar_updated_at', "datetime"])
         | 
| 98 98 | 
             
                    end
         | 
| 99 99 | 
             
                  end
         | 
| 100 100 |  | 
| @@ -119,16 +119,16 @@ describe Paperclip::Schema do | |
| 119 119 | 
             
                    end
         | 
| 120 120 |  | 
| 121 121 | 
             
                    it "creates attachment columns" do
         | 
| 122 | 
            -
                      columns = Dummy.columns.map{ |column| [column.name, column. | 
| 122 | 
            +
                      columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
         | 
| 123 123 |  | 
| 124 | 
            -
                      expect(columns).to include(['avatar_file_name',  | 
| 125 | 
            -
                      expect(columns).to include(['avatar_content_type',  | 
| 126 | 
            -
                      expect(columns).to include(['avatar_file_size',  | 
| 127 | 
            -
                      expect(columns).to include(['avatar_updated_at',  | 
| 128 | 
            -
                      expect(columns).to include(['photo_file_name',  | 
| 129 | 
            -
                      expect(columns).to include(['photo_content_type',  | 
| 130 | 
            -
                      expect(columns).to include(['photo_file_size',  | 
| 131 | 
            -
                      expect(columns).to include(['photo_updated_at',  | 
| 124 | 
            +
                      expect(columns).to include(['avatar_file_name', "varchar"])
         | 
| 125 | 
            +
                      expect(columns).to include(['avatar_content_type', "varchar"])
         | 
| 126 | 
            +
                      expect(columns).to include(['avatar_file_size', "bigint"])
         | 
| 127 | 
            +
                      expect(columns).to include(['avatar_updated_at', "datetime"])
         | 
| 128 | 
            +
                      expect(columns).to include(['photo_file_name', "varchar"])
         | 
| 129 | 
            +
                      expect(columns).to include(['photo_content_type', "varchar"])
         | 
| 130 | 
            +
                      expect(columns).to include(['photo_file_size', "bigint"])
         | 
| 131 | 
            +
                      expect(columns).to include(['photo_updated_at', "datetime"])
         | 
| 132 132 | 
             
                    end
         | 
| 133 133 | 
             
                  end
         | 
| 134 134 |  | 
| @@ -164,7 +164,7 @@ describe Paperclip::Schema do | |
| 164 164 | 
             
                    Dummy.connection.change_table :dummies do |t|
         | 
| 165 165 | 
             
                      t.column :avatar_file_name, :string
         | 
| 166 166 | 
             
                      t.column :avatar_content_type, :string
         | 
| 167 | 
            -
                      t.column :avatar_file_size, : | 
| 167 | 
            +
                      t.column :avatar_file_size, :bigint
         | 
| 168 168 | 
             
                      t.column :avatar_updated_at, :datetime
         | 
| 169 169 | 
             
                    end
         | 
| 170 170 | 
             
                  end
         | 
| @@ -178,12 +178,12 @@ describe Paperclip::Schema do | |
| 178 178 | 
             
                        Dummy.connection.drop_attached_file :dummies, :avatar
         | 
| 179 179 | 
             
                      end
         | 
| 180 180 |  | 
| 181 | 
            -
                      columns = Dummy.columns.map{ |column| [column.name, column. | 
| 181 | 
            +
                      columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
         | 
| 182 182 |  | 
| 183 | 
            -
                      expect(columns).to_not include(['avatar_file_name',  | 
| 184 | 
            -
                      expect(columns).to_not include(['avatar_content_type',  | 
| 185 | 
            -
                      expect(columns).to_not include(['avatar_file_size',  | 
| 186 | 
            -
                      expect(columns).to_not include(['avatar_updated_at',  | 
| 183 | 
            +
                      expect(columns).to_not include(['avatar_file_name', "varchar"])
         | 
| 184 | 
            +
                      expect(columns).to_not include(['avatar_content_type', "varchar"])
         | 
| 185 | 
            +
                      expect(columns).to_not include(['avatar_file_size', "bigint"])
         | 
| 186 | 
            +
                      expect(columns).to_not include(['avatar_updated_at', "datetime"])
         | 
| 187 187 | 
             
                    end
         | 
| 188 188 |  | 
| 189 189 | 
             
                    it "displays a deprecation warning" do
         | 
| @@ -200,12 +200,12 @@ describe Paperclip::Schema do | |
| 200 200 | 
             
                      end
         | 
| 201 201 |  | 
| 202 202 | 
             
                      it "removes the attachment columns" do
         | 
| 203 | 
            -
                        columns = Dummy.columns.map{ |column| [column.name, column. | 
| 203 | 
            +
                        columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
         | 
| 204 204 |  | 
| 205 | 
            -
                        expect(columns).to_not include(['avatar_file_name',  | 
| 206 | 
            -
                        expect(columns).to_not include(['avatar_content_type',  | 
| 207 | 
            -
                        expect(columns).to_not include(['avatar_file_size',  | 
| 208 | 
            -
                        expect(columns).to_not include(['avatar_updated_at',  | 
| 205 | 
            +
                        expect(columns).to_not include(['avatar_file_name', "varchar"])
         | 
| 206 | 
            +
                        expect(columns).to_not include(['avatar_content_type', "varchar"])
         | 
| 207 | 
            +
                        expect(columns).to_not include(['avatar_file_size', "bigint"])
         | 
| 208 | 
            +
                        expect(columns).to_not include(['avatar_updated_at', "datetime"])
         | 
| 209 209 | 
             
                      end
         | 
| 210 210 | 
             
                    end
         | 
| 211 211 |  | 
| @@ -214,7 +214,7 @@ describe Paperclip::Schema do | |
| 214 214 | 
             
                        Dummy.connection.change_table :dummies do |t|
         | 
| 215 215 | 
             
                          t.column :photo_file_name, :string
         | 
| 216 216 | 
             
                          t.column :photo_content_type, :string
         | 
| 217 | 
            -
                          t.column :photo_file_size, : | 
| 217 | 
            +
                          t.column :photo_file_size, :bigint
         | 
| 218 218 | 
             
                          t.column :photo_updated_at, :datetime
         | 
| 219 219 | 
             
                        end
         | 
| 220 220 |  | 
| @@ -222,16 +222,16 @@ describe Paperclip::Schema do | |
| 222 222 | 
             
                      end
         | 
| 223 223 |  | 
| 224 224 | 
             
                      it "removes the attachment columns" do
         | 
| 225 | 
            -
                        columns = Dummy.columns.map{ |column| [column.name, column. | 
| 226 | 
            -
             | 
| 227 | 
            -
                        expect(columns).to_not include(['avatar_file_name',  | 
| 228 | 
            -
                        expect(columns).to_not include(['avatar_content_type',  | 
| 229 | 
            -
                        expect(columns).to_not include(['avatar_file_size',  | 
| 230 | 
            -
                        expect(columns).to_not include(['avatar_updated_at',  | 
| 231 | 
            -
                        expect(columns).to_not include(['photo_file_name',  | 
| 232 | 
            -
                        expect(columns).to_not include(['photo_content_type',  | 
| 233 | 
            -
                        expect(columns).to_not include(['photo_file_size',  | 
| 234 | 
            -
                        expect(columns).to_not include(['photo_updated_at',  | 
| 225 | 
            +
                        columns = Dummy.columns.map{ |column| [column.name, column.sql_type] }
         | 
| 226 | 
            +
             | 
| 227 | 
            +
                        expect(columns).to_not include(['avatar_file_name', "varchar"])
         | 
| 228 | 
            +
                        expect(columns).to_not include(['avatar_content_type', "varchar"])
         | 
| 229 | 
            +
                        expect(columns).to_not include(['avatar_file_size', "bigint"])
         | 
| 230 | 
            +
                        expect(columns).to_not include(['avatar_updated_at', "datetime"])
         | 
| 231 | 
            +
                        expect(columns).to_not include(['photo_file_name', "varchar"])
         | 
| 232 | 
            +
                        expect(columns).to_not include(['photo_content_type', "varchar"])
         | 
| 233 | 
            +
                        expect(columns).to_not include(['photo_file_size', "bigint"])
         | 
| 234 | 
            +
                        expect(columns).to_not include(['photo_updated_at', "datetime"])
         | 
| 235 235 | 
             
                      end
         | 
| 236 236 | 
             
                    end
         | 
| 237 237 |  | 
| @@ -206,6 +206,11 @@ describe Paperclip::Storage::Fog do | |
| 206 206 | 
             
                      assert @dummy.save
         | 
| 207 207 | 
             
                      assert @connection.directories.get(@fog_directory)
         | 
| 208 208 | 
             
                    end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
                    it "sucessfully rewinds the file during bucket creation" do
         | 
| 211 | 
            +
                      assert @dummy.save
         | 
| 212 | 
            +
                      expect(Paperclip.io_adapters.for(@dummy.avatar).read.length).to be > 0
         | 
| 213 | 
            +
                    end
         | 
| 209 214 | 
             
                  end
         | 
| 210 215 |  | 
| 211 216 | 
             
                  context "with a bucket" do
         | 
| @@ -1,5 +1,5 @@ | |
| 1 | 
            -
            require  | 
| 2 | 
            -
            require  | 
| 1 | 
            +
            require "spec_helper"
         | 
| 2 | 
            +
            require "aws-sdk-s3"
         | 
| 3 3 |  | 
| 4 4 | 
             
            describe Paperclip::Storage::S3 do
         | 
| 5 5 | 
             
              before do
         | 
| @@ -237,7 +237,7 @@ describe Paperclip::Storage::S3 do | |
| 237 237 | 
             
                end
         | 
| 238 238 | 
             
              end
         | 
| 239 239 |  | 
| 240 | 
            -
              #  | 
| 240 | 
            +
              # the s3_host_name will be defined by the s3_region
         | 
| 241 241 | 
             
              context "s3_host_name" do
         | 
| 242 242 | 
             
                before do
         | 
| 243 243 | 
             
                  rebuild_model storage: :s3,
         | 
| @@ -282,7 +282,7 @@ describe Paperclip::Storage::S3 do | |
| 282 282 | 
             
                end
         | 
| 283 283 | 
             
              end
         | 
| 284 284 |  | 
| 285 | 
            -
              context "use_accelerate_endpoint" | 
| 285 | 
            +
              context "use_accelerate_endpoint" do
         | 
| 286 286 | 
             
                context "defaults to false" do
         | 
| 287 287 | 
             
                  before do
         | 
| 288 288 | 
             
                    rebuild_model(
         | 
| @@ -308,7 +308,7 @@ describe Paperclip::Storage::S3 do | |
| 308 308 | 
             
                  end
         | 
| 309 309 | 
             
                end
         | 
| 310 310 |  | 
| 311 | 
            -
                context "set to true" | 
| 311 | 
            +
                context "set to true" do
         | 
| 312 312 | 
             
                  before do
         | 
| 313 313 | 
             
                    rebuild_model(
         | 
| 314 314 | 
             
                      storage: :s3,
         | 
| @@ -793,7 +793,7 @@ describe Paperclip::Storage::S3 do | |
| 793 793 | 
             
                end
         | 
| 794 794 | 
             
              end
         | 
| 795 795 |  | 
| 796 | 
            -
              #  | 
| 796 | 
            +
              # the bucket.name is determined by the :s3_region
         | 
| 797 797 | 
             
              context "Parsing S3 credentials with a s3_host_name in them" do
         | 
| 798 798 | 
             
                before do
         | 
| 799 799 | 
             
                  rebuild_model storage: :s3,
         | 
| @@ -48,7 +48,7 @@ describe Paperclip::Thumbnail do | |
| 48 48 | 
             
                  it "lets us know when a command isn't found versus a processing error" do
         | 
| 49 49 | 
             
                    old_path = ENV['PATH']
         | 
| 50 50 | 
             
                    begin
         | 
| 51 | 
            -
                       | 
| 51 | 
            +
                      Terrapin::CommandLine.path = ''
         | 
| 52 52 | 
             
                      Paperclip.options[:command_path] = ''
         | 
| 53 53 | 
             
                      ENV['PATH'] = ''
         | 
| 54 54 | 
             
                      assert_raises(Paperclip::Errors::CommandNotFoundError) do
         | 
| @@ -102,7 +102,7 @@ describe Paperclip::Thumbnail do | |
| 102 102 |  | 
| 103 103 | 
             
                  output_file = thumb.make
         | 
| 104 104 |  | 
| 105 | 
            -
                  command =  | 
| 105 | 
            +
                  command = Terrapin::CommandLine.new("identify", "-format %wx%h :file")
         | 
| 106 106 | 
             
                  assert_equal "50x50", command.run(file: output_file.path).strip
         | 
| 107 107 | 
             
                end
         | 
| 108 108 |  | 
| @@ -179,17 +179,19 @@ describe Paperclip::Thumbnail do | |
| 179 179 | 
             
                    end
         | 
| 180 180 |  | 
| 181 181 | 
             
                    it "errors when trying to create the thumbnail" do
         | 
| 182 | 
            -
                       | 
| 183 | 
            -
                         | 
| 182 | 
            +
                      silence_stream(STDERR) do
         | 
| 183 | 
            +
                        expect {
         | 
| 184 184 | 
             
                          @thumb.make
         | 
| 185 | 
            -
                         | 
| 185 | 
            +
                        }.to raise_error(
         | 
| 186 | 
            +
                          Paperclip::Error, /unrecognized option `-this-aint-no-option'/
         | 
| 187 | 
            +
                        )
         | 
| 186 188 | 
             
                      end
         | 
| 187 189 | 
             
                    end
         | 
| 188 190 |  | 
| 189 191 | 
             
                    it "lets us know when a command isn't found versus a processing error" do
         | 
| 190 192 | 
             
                      old_path = ENV['PATH']
         | 
| 191 193 | 
             
                      begin
         | 
| 192 | 
            -
                         | 
| 194 | 
            +
                        Terrapin::CommandLine.path = ''
         | 
| 193 195 | 
             
                        Paperclip.options[:command_path] = ''
         | 
| 194 196 | 
             
                        ENV['PATH'] = ''
         | 
| 195 197 | 
             
                        assert_raises(Paperclip::Errors::CommandNotFoundError) do
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
| @@ -27,7 +27,7 @@ module ModelReconstruction | |
| 27 27 | 
             
                ActiveRecord::Base.connection.create_table :dummies, {force: true}, &block
         | 
| 28 28 | 
             
              end
         | 
| 29 29 |  | 
| 30 | 
            -
              def modify_table  | 
| 30 | 
            +
              def modify_table &block
         | 
| 31 31 | 
             
                ActiveRecord::Base.connection.change_table :dummies, &block
         | 
| 32 32 | 
             
              end
         | 
| 33 33 |  | 
| @@ -37,7 +37,7 @@ module ModelReconstruction | |
| 37 37 | 
             
                  table.column :other, :string
         | 
| 38 38 | 
             
                  table.column :avatar_file_name, :string
         | 
| 39 39 | 
             
                  table.column :avatar_content_type, :string
         | 
| 40 | 
            -
                  table.column :avatar_file_size, : | 
| 40 | 
            +
                  table.column :avatar_file_size, :bigint
         | 
| 41 41 | 
             
                  table.column :avatar_updated_at, :datetime
         | 
| 42 42 | 
             
                  table.column :avatar_fingerprint, :string
         | 
| 43 43 | 
             
                end
         | 
    
        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: 6.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jon Yurek
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-07-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activemodel
         | 
| @@ -39,19 +39,19 @@ dependencies: | |
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: 4.2.0
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name:  | 
| 42 | 
            +
              name: terrapin
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 45 | 
             
                - - "~>"
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: 0. | 
| 47 | 
            +
                    version: 0.6.0
         | 
| 48 48 | 
             
              type: :runtime
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 52 | 
             
                - - "~>"
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: 0. | 
| 54 | 
            +
                    version: 0.6.0
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: mime-types
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -151,25 +151,19 @@ dependencies: | |
| 151 151 | 
             
                  - !ruby/object:Gem::Version
         | 
| 152 152 | 
             
                    version: '0'
         | 
| 153 153 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 154 | 
            -
              name: aws-sdk
         | 
| 154 | 
            +
              name: aws-sdk-s3
         | 
| 155 155 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 156 156 | 
             
                requirements:
         | 
| 157 157 | 
             
                - - ">="
         | 
| 158 158 | 
             
                  - !ruby/object:Gem::Version
         | 
| 159 | 
            -
                    version:  | 
| 160 | 
            -
                - - "<"
         | 
| 161 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 162 | 
            -
                    version: '3.0'
         | 
| 159 | 
            +
                    version: '0'
         | 
| 163 160 | 
             
              type: :development
         | 
| 164 161 | 
             
              prerelease: false
         | 
| 165 162 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 166 163 | 
             
                requirements:
         | 
| 167 164 | 
             
                - - ">="
         | 
| 168 165 | 
             
                  - !ruby/object:Gem::Version
         | 
| 169 | 
            -
                    version:  | 
| 170 | 
            -
                - - "<"
         | 
| 171 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 172 | 
            -
                    version: '3.0'
         | 
| 166 | 
            +
                    version: '0'
         | 
| 173 167 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 174 168 | 
             
              name: bourne
         | 
| 175 169 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -388,6 +382,7 @@ extensions: [] | |
| 388 382 | 
             
            extra_rdoc_files: []
         | 
| 389 383 | 
             
            files:
         | 
| 390 384 | 
             
            - ".codeclimate.yml"
         | 
| 385 | 
            +
            - ".github/issue_template.md"
         | 
| 391 386 | 
             
            - ".gitignore"
         | 
| 392 387 | 
             
            - ".hound.yml"
         | 
| 393 388 | 
             
            - ".rubocop.yml"
         | 
| @@ -396,6 +391,8 @@ files: | |
| 396 391 | 
             
            - CONTRIBUTING.md
         | 
| 397 392 | 
             
            - Gemfile
         | 
| 398 393 | 
             
            - LICENSE
         | 
| 394 | 
            +
            - MIGRATING-ES.md
         | 
| 395 | 
            +
            - MIGRATING.md
         | 
| 399 396 | 
             
            - NEWS
         | 
| 400 397 | 
             
            - README.md
         | 
| 401 398 | 
             
            - RELEASING.md
         | 
| @@ -543,7 +540,6 @@ files: | |
| 543 540 | 
             
            - spec/paperclip/validators_spec.rb
         | 
| 544 541 | 
             
            - spec/spec_helper.rb
         | 
| 545 542 | 
             
            - spec/support/assertions.rb
         | 
| 546 | 
            -
            - spec/support/conditional_filter_helper.rb
         | 
| 547 543 | 
             
            - spec/support/fake_model.rb
         | 
| 548 544 | 
             
            - spec/support/fake_rails.rb
         | 
| 549 545 | 
             
            - spec/support/fixtures/12k.png
         | 
| @@ -582,9 +578,9 @@ post_install_message: | | |
| 582 578 | 
             
              #  NOTE FOR UPGRADING FROM 4.3.0 OR EARLIER      #
         | 
| 583 579 | 
             
              ##################################################
         | 
| 584 580 |  | 
| 585 | 
            -
              Paperclip is now compatible with aws-sdk | 
| 581 | 
            +
              Paperclip is now compatible with aws-sdk-s3.
         | 
| 586 582 |  | 
| 587 | 
            -
              If you are using S3 storage, aws-sdk  | 
| 583 | 
            +
              If you are using S3 storage, aws-sdk-s3 requires you to make a few small
         | 
| 588 584 | 
             
              changes:
         | 
| 589 585 |  | 
| 590 586 | 
             
              * You must set the `s3_region`
         | 
| @@ -593,7 +589,7 @@ post_install_message: | | |
| 593 589 | 
             
                using a hyphen. For example, `:public_read` needs to be changed to
         | 
| 594 590 | 
             
                `public-read`.
         | 
| 595 591 |  | 
| 596 | 
            -
              For a walkthrough of upgrading from 4 to 5 and aws-sdk >= 2.0 you can watch
         | 
| 592 | 
            +
              For a walkthrough of upgrading from 4 to *5* (not 6) and aws-sdk >= 2.0 you can watch
         | 
| 597 593 | 
             
              http://rubythursday.com/episodes/ruby-snack-27-upgrade-paperclip-and-aws-sdk-in-prep-for-rails-5
         | 
| 598 594 | 
             
            rdoc_options: []
         | 
| 599 595 | 
             
            require_paths:
         | 
| @@ -611,8 +607,112 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 611 607 | 
             
            requirements:
         | 
| 612 608 | 
             
            - ImageMagick
         | 
| 613 609 | 
             
            rubyforge_project: 
         | 
| 614 | 
            -
            rubygems_version: 2. | 
| 610 | 
            +
            rubygems_version: 2.7.4
         | 
| 615 611 | 
             
            signing_key: 
         | 
| 616 612 | 
             
            specification_version: 4
         | 
| 617 613 | 
             
            summary: File attachments as attributes for ActiveRecord
         | 
| 618 | 
            -
            test_files: | 
| 614 | 
            +
            test_files:
         | 
| 615 | 
            +
            - features/basic_integration.feature
         | 
| 616 | 
            +
            - features/migration.feature
         | 
| 617 | 
            +
            - features/rake_tasks.feature
         | 
| 618 | 
            +
            - features/step_definitions/attachment_steps.rb
         | 
| 619 | 
            +
            - features/step_definitions/html_steps.rb
         | 
| 620 | 
            +
            - features/step_definitions/rails_steps.rb
         | 
| 621 | 
            +
            - features/step_definitions/s3_steps.rb
         | 
| 622 | 
            +
            - features/step_definitions/web_steps.rb
         | 
| 623 | 
            +
            - features/support/env.rb
         | 
| 624 | 
            +
            - features/support/fakeweb.rb
         | 
| 625 | 
            +
            - features/support/file_helpers.rb
         | 
| 626 | 
            +
            - features/support/fixtures/boot_config.txt
         | 
| 627 | 
            +
            - features/support/fixtures/gemfile.txt
         | 
| 628 | 
            +
            - features/support/fixtures/preinitializer.txt
         | 
| 629 | 
            +
            - features/support/paths.rb
         | 
| 630 | 
            +
            - features/support/rails.rb
         | 
| 631 | 
            +
            - features/support/selectors.rb
         | 
| 632 | 
            +
            - spec/database.yml
         | 
| 633 | 
            +
            - spec/paperclip/attachment_definitions_spec.rb
         | 
| 634 | 
            +
            - spec/paperclip/attachment_processing_spec.rb
         | 
| 635 | 
            +
            - spec/paperclip/attachment_registry_spec.rb
         | 
| 636 | 
            +
            - spec/paperclip/attachment_spec.rb
         | 
| 637 | 
            +
            - spec/paperclip/content_type_detector_spec.rb
         | 
| 638 | 
            +
            - spec/paperclip/file_command_content_type_detector_spec.rb
         | 
| 639 | 
            +
            - spec/paperclip/filename_cleaner_spec.rb
         | 
| 640 | 
            +
            - spec/paperclip/geometry_detector_spec.rb
         | 
| 641 | 
            +
            - spec/paperclip/geometry_parser_spec.rb
         | 
| 642 | 
            +
            - spec/paperclip/geometry_spec.rb
         | 
| 643 | 
            +
            - spec/paperclip/glue_spec.rb
         | 
| 644 | 
            +
            - spec/paperclip/has_attached_file_spec.rb
         | 
| 645 | 
            +
            - spec/paperclip/integration_spec.rb
         | 
| 646 | 
            +
            - spec/paperclip/interpolations_spec.rb
         | 
| 647 | 
            +
            - spec/paperclip/io_adapters/abstract_adapter_spec.rb
         | 
| 648 | 
            +
            - spec/paperclip/io_adapters/attachment_adapter_spec.rb
         | 
| 649 | 
            +
            - spec/paperclip/io_adapters/data_uri_adapter_spec.rb
         | 
| 650 | 
            +
            - spec/paperclip/io_adapters/empty_string_adapter_spec.rb
         | 
| 651 | 
            +
            - spec/paperclip/io_adapters/file_adapter_spec.rb
         | 
| 652 | 
            +
            - spec/paperclip/io_adapters/http_url_proxy_adapter_spec.rb
         | 
| 653 | 
            +
            - spec/paperclip/io_adapters/identity_adapter_spec.rb
         | 
| 654 | 
            +
            - spec/paperclip/io_adapters/nil_adapter_spec.rb
         | 
| 655 | 
            +
            - spec/paperclip/io_adapters/registry_spec.rb
         | 
| 656 | 
            +
            - spec/paperclip/io_adapters/stringio_adapter_spec.rb
         | 
| 657 | 
            +
            - spec/paperclip/io_adapters/uploaded_file_adapter_spec.rb
         | 
| 658 | 
            +
            - spec/paperclip/io_adapters/uri_adapter_spec.rb
         | 
| 659 | 
            +
            - spec/paperclip/matchers/have_attached_file_matcher_spec.rb
         | 
| 660 | 
            +
            - spec/paperclip/matchers/validate_attachment_content_type_matcher_spec.rb
         | 
| 661 | 
            +
            - spec/paperclip/matchers/validate_attachment_presence_matcher_spec.rb
         | 
| 662 | 
            +
            - spec/paperclip/matchers/validate_attachment_size_matcher_spec.rb
         | 
| 663 | 
            +
            - spec/paperclip/media_type_spoof_detector_spec.rb
         | 
| 664 | 
            +
            - spec/paperclip/meta_class_spec.rb
         | 
| 665 | 
            +
            - spec/paperclip/paperclip_missing_attachment_styles_spec.rb
         | 
| 666 | 
            +
            - spec/paperclip/paperclip_spec.rb
         | 
| 667 | 
            +
            - spec/paperclip/plural_cache_spec.rb
         | 
| 668 | 
            +
            - spec/paperclip/processor_helpers_spec.rb
         | 
| 669 | 
            +
            - spec/paperclip/processor_spec.rb
         | 
| 670 | 
            +
            - spec/paperclip/rails_environment_spec.rb
         | 
| 671 | 
            +
            - spec/paperclip/rake_spec.rb
         | 
| 672 | 
            +
            - spec/paperclip/schema_spec.rb
         | 
| 673 | 
            +
            - spec/paperclip/storage/filesystem_spec.rb
         | 
| 674 | 
            +
            - spec/paperclip/storage/fog_spec.rb
         | 
| 675 | 
            +
            - spec/paperclip/storage/s3_live_spec.rb
         | 
| 676 | 
            +
            - spec/paperclip/storage/s3_spec.rb
         | 
| 677 | 
            +
            - spec/paperclip/style_spec.rb
         | 
| 678 | 
            +
            - spec/paperclip/tempfile_factory_spec.rb
         | 
| 679 | 
            +
            - spec/paperclip/tempfile_spec.rb
         | 
| 680 | 
            +
            - spec/paperclip/thumbnail_spec.rb
         | 
| 681 | 
            +
            - spec/paperclip/url_generator_spec.rb
         | 
| 682 | 
            +
            - spec/paperclip/validators/attachment_content_type_validator_spec.rb
         | 
| 683 | 
            +
            - spec/paperclip/validators/attachment_file_name_validator_spec.rb
         | 
| 684 | 
            +
            - spec/paperclip/validators/attachment_presence_validator_spec.rb
         | 
| 685 | 
            +
            - spec/paperclip/validators/attachment_size_validator_spec.rb
         | 
| 686 | 
            +
            - spec/paperclip/validators/media_type_spoof_detection_validator_spec.rb
         | 
| 687 | 
            +
            - spec/paperclip/validators_spec.rb
         | 
| 688 | 
            +
            - spec/spec_helper.rb
         | 
| 689 | 
            +
            - spec/support/assertions.rb
         | 
| 690 | 
            +
            - spec/support/fake_model.rb
         | 
| 691 | 
            +
            - spec/support/fake_rails.rb
         | 
| 692 | 
            +
            - spec/support/fixtures/12k.png
         | 
| 693 | 
            +
            - spec/support/fixtures/50x50.png
         | 
| 694 | 
            +
            - spec/support/fixtures/5k.png
         | 
| 695 | 
            +
            - spec/support/fixtures/animated
         | 
| 696 | 
            +
            - spec/support/fixtures/animated.gif
         | 
| 697 | 
            +
            - spec/support/fixtures/animated.unknown
         | 
| 698 | 
            +
            - spec/support/fixtures/bad.png
         | 
| 699 | 
            +
            - spec/support/fixtures/empty.html
         | 
| 700 | 
            +
            - spec/support/fixtures/empty.xlsx
         | 
| 701 | 
            +
            - spec/support/fixtures/fog.yml
         | 
| 702 | 
            +
            - spec/support/fixtures/rotated.jpg
         | 
| 703 | 
            +
            - spec/support/fixtures/s3.yml
         | 
| 704 | 
            +
            - spec/support/fixtures/spaced file.jpg
         | 
| 705 | 
            +
            - spec/support/fixtures/spaced file.png
         | 
| 706 | 
            +
            - spec/support/fixtures/text.txt
         | 
| 707 | 
            +
            - spec/support/fixtures/twopage.pdf
         | 
| 708 | 
            +
            - spec/support/fixtures/uppercase.PNG
         | 
| 709 | 
            +
            - spec/support/matchers/accept.rb
         | 
| 710 | 
            +
            - spec/support/matchers/exist.rb
         | 
| 711 | 
            +
            - spec/support/matchers/have_column.rb
         | 
| 712 | 
            +
            - spec/support/mock_attachment.rb
         | 
| 713 | 
            +
            - spec/support/mock_interpolator.rb
         | 
| 714 | 
            +
            - spec/support/mock_url_generator_builder.rb
         | 
| 715 | 
            +
            - spec/support/model_reconstruction.rb
         | 
| 716 | 
            +
            - spec/support/reporting.rb
         | 
| 717 | 
            +
            - spec/support/test_data.rb
         | 
| 718 | 
            +
            - spec/support/version_helper.rb
         |