saviour 0.6.4 → 0.6.5
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 +4 -4
- data/.travis.yml +1 -3
- data/README.md +4 -4
- data/gemfiles/5.1.gemfile +0 -2
- data/gemfiles/5.2.gemfile +0 -2
- data/gemfiles/6.0.gemfile +7 -0
- data/lib/saviour/db_helpers.rb +6 -0
- data/lib/saviour/integrator.rb +16 -0
- data/lib/saviour/version.rb +1 -1
- data/saviour.gemspec +1 -2
- data/spec/feature/concurrency_spec.rb +3 -3
- data/spec/feature/crud_workflows_spec.rb +16 -16
- data/spec/feature/dirty_spec.rb +1 -1
- data/spec/feature/halt_processor_spec.rb +1 -1
- data/spec/feature/memory_usage_spec.rb +8 -10
- data/spec/feature/persisted_path_spec.rb +2 -2
- data/spec/feature/processors_api_spec.rb +1 -1
- data/spec/feature/reload_model_spec.rb +1 -1
- data/spec/feature/remove_attachment_spec.rb +1 -1
- data/spec/feature/stash_spec.rb +8 -8
- data/spec/feature/transactional_behavior_spec.rb +3 -3
- metadata +4 -18
- data/Appraisals +0 -19
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8bca4d3cff0e6279633cfffc29a4d773766027a10cdf78476779184d9f280d00
         | 
| 4 | 
            +
              data.tar.gz: d386ff08897ea1241edad2f320e9c37e6384150a0f784cad9094156393f8722c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d1488dfc1fc68bc7039d8bc37157002e0fb55e1f5acac50cdfa0f3f3c4abd02b56b06fd0688e1c7c686e949929a1c86878742698dc27c3dc4925d37aa3c37a83
         | 
| 7 | 
            +
              data.tar.gz: 79612867403b5856c642fdd69297f31e13006b08d9f998480b8f006e64d36f7555b699f44baaf0fc360fb811ff507157b08ca6ae2644c0b7571a2c92fafa442e
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -593,7 +593,7 @@ Now, both attachments are independent: | |
| 593 593 |  | 
| 594 594 | 
             
            ```ruby
         | 
| 595 595 | 
             
            # `image_thumb` can be changed independently
         | 
| 596 | 
            -
            a. | 
| 596 | 
            +
            a.update! image_thumb: File.open("/path/another_file.png")
         | 
| 597 597 |  | 
| 598 598 | 
             
            # or removed
         | 
| 599 599 | 
             
            a.remove_file_thumb!
         | 
| @@ -714,7 +714,7 @@ class ImageUploader < Saviour::BaseUploader | |
| 714 714 | 
             
              end
         | 
| 715 715 |  | 
| 716 716 | 
             
              after_upload do |stash|
         | 
| 717 | 
            -
                model. | 
| 717 | 
            +
                model.update!(size: stash[:size], width: stash[:width], height: stash[:height])
         | 
| 718 718 | 
             
              end
         | 
| 719 719 | 
             
            end
         | 
| 720 720 | 
             
            ```
         | 
| @@ -1132,7 +1132,7 @@ Then it can be used as: | |
| 1132 1132 | 
             
            a = Post.find(42)
         | 
| 1133 1133 |  | 
| 1134 1134 | 
             
            # Params received from a form
         | 
| 1135 | 
            -
            a. | 
| 1135 | 
            +
            a.update(remove_image: "t")
         | 
| 1136 1136 | 
             
            ```
         | 
| 1137 1137 |  | 
| 1138 1138 |  | 
| @@ -1172,7 +1172,7 @@ The job then should take the model and the attachment to process and run the pro | |
| 1172 1172 | 
             
            a = Post.find(42)
         | 
| 1173 1173 | 
             
            a.image.with_copy do |f|
         | 
| 1174 1174 | 
             
              # manipulate f as desired
         | 
| 1175 | 
            -
              a. | 
| 1175 | 
            +
              a.update! image: f
         | 
| 1176 1176 | 
             
            end
         | 
| 1177 1177 | 
             
            ```
         | 
| 1178 1178 |  | 
    
        data/gemfiles/5.1.gemfile
    CHANGED
    
    
    
        data/gemfiles/5.2.gemfile
    CHANGED
    
    
    
        data/lib/saviour/db_helpers.rb
    CHANGED
    
    | @@ -22,6 +22,9 @@ module Saviour | |
| 22 22 | 
             
                  def committed!(*)
         | 
| 23 23 | 
             
                    @block.call
         | 
| 24 24 | 
             
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  def trigger_transactional_callbacks?(*)
         | 
| 27 | 
            +
                  end
         | 
| 25 28 | 
             
                end
         | 
| 26 29 |  | 
| 27 30 | 
             
                class RollbackDummy
         | 
| @@ -42,6 +45,9 @@ module Saviour | |
| 42 45 |  | 
| 43 46 | 
             
                  def committed!(*)
         | 
| 44 47 | 
             
                  end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                  def trigger_transactional_callbacks?(*)
         | 
| 50 | 
            +
                  end
         | 
| 45 51 | 
             
                end
         | 
| 46 52 |  | 
| 47 53 |  | 
    
        data/lib/saviour/integrator.rb
    CHANGED
    
    | @@ -84,6 +84,22 @@ module Saviour | |
| 84 84 | 
             
                        end
         | 
| 85 85 | 
             
                      end
         | 
| 86 86 |  | 
| 87 | 
            +
                      define_method(:changed) do
         | 
| 88 | 
            +
                        if ActiveRecord::VERSION::MAJOR == 6 && send("#{attach_as}_changed?")
         | 
| 89 | 
            +
                          super() + [attach_as.to_s]
         | 
| 90 | 
            +
                        else
         | 
| 91 | 
            +
                          super()
         | 
| 92 | 
            +
                        end
         | 
| 93 | 
            +
                      end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
                      define_method(:changed?) do
         | 
| 96 | 
            +
                        if ActiveRecord::VERSION::MAJOR == 6
         | 
| 97 | 
            +
                          send("#{attach_as}_changed?") || super()
         | 
| 98 | 
            +
                        else
         | 
| 99 | 
            +
                          super()
         | 
| 100 | 
            +
                        end
         | 
| 101 | 
            +
                      end
         | 
| 102 | 
            +
             | 
| 87 103 | 
             
                      define_method("#{attach_as}_change") do
         | 
| 88 104 | 
             
                        [send("#{attach_as}_was"), send(attach_as)]
         | 
| 89 105 | 
             
                      end
         | 
    
        data/lib/saviour/version.rb
    CHANGED
    
    
    
        data/saviour.gemspec
    CHANGED
    
    | @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| | |
| 13 13 | 
             
              spec.files         = `git ls-files`.split($/)
         | 
| 14 14 | 
             
              spec.require_paths = ["lib"]
         | 
| 15 15 |  | 
| 16 | 
            -
              spec.required_ruby_version = ">= 2. | 
| 16 | 
            +
              spec.required_ruby_version = ">= 2.5.0"
         | 
| 17 17 |  | 
| 18 18 | 
             
              spec.add_dependency "activerecord", ">= 5.1"
         | 
| 19 19 | 
             
              spec.add_dependency "activesupport", ">= 5.1"
         | 
| @@ -23,7 +23,6 @@ Gem::Specification.new do |spec| | |
| 23 23 | 
             
              spec.add_development_dependency "rspec"
         | 
| 24 24 | 
             
              spec.add_development_dependency "rake"
         | 
| 25 25 | 
             
              spec.add_development_dependency "sqlite3"
         | 
| 26 | 
            -
              spec.add_development_dependency "appraisal"
         | 
| 27 26 | 
             
              spec.add_development_dependency "aws-sdk-s3"
         | 
| 28 27 | 
             
              spec.add_development_dependency "mime-types"
         | 
| 29 28 | 
             
              spec.add_development_dependency "get_process_mem"
         | 
| @@ -52,7 +52,7 @@ describe "concurrency on operations" do | |
| 52 52 |  | 
| 53 53 | 
             
                  Saviour::Config.concurrent_workers = 4
         | 
| 54 54 |  | 
| 55 | 
            -
                  a. | 
| 55 | 
            +
                  a.update! file: Saviour::StringSource.new("contents", "file.txt"),
         | 
| 56 56 | 
             
                                       file_thumb: Saviour::StringSource.new("contents", "file_2.txt"),
         | 
| 57 57 | 
             
                                       file_thumb_2: Saviour::StringSource.new("contents", "file_3.txt"),
         | 
| 58 58 | 
             
                                       file_thumb_3: Saviour::StringSource.new("contents", "file_4.txt")
         | 
| @@ -66,7 +66,7 @@ describe "concurrency on operations" do | |
| 66 66 |  | 
| 67 67 | 
             
                  Saviour::Config.concurrent_workers = 1
         | 
| 68 68 |  | 
| 69 | 
            -
                  a. | 
| 69 | 
            +
                  a.update! file: Saviour::StringSource.new("contents", "file.txt"),
         | 
| 70 70 | 
             
                                       file_thumb: Saviour::StringSource.new("contents", "file_2.txt"),
         | 
| 71 71 | 
             
                                       file_thumb_2: Saviour::StringSource.new("contents", "file_3.txt"),
         | 
| 72 72 | 
             
                                       file_thumb_3: Saviour::StringSource.new("contents", "file_4.txt")
         | 
| @@ -80,7 +80,7 @@ describe "concurrency on operations" do | |
| 80 80 |  | 
| 81 81 | 
             
                  Saviour::Config.concurrent_workers = 2
         | 
| 82 82 |  | 
| 83 | 
            -
                  a. | 
| 83 | 
            +
                  a.update! file: Saviour::StringSource.new("contents", "file.txt"),
         | 
| 84 84 | 
             
                                       file_thumb: Saviour::StringSource.new("contents", "file_2.txt"),
         | 
| 85 85 | 
             
                                       file_thumb_2: Saviour::StringSource.new("contents", "file_3.txt"),
         | 
| 86 86 | 
             
                                       file_thumb_3: Saviour::StringSource.new("contents", "file_4.txt")
         | 
| @@ -19,14 +19,14 @@ describe "CRUD" do | |
| 19 19 | 
             
                it do
         | 
| 20 20 | 
             
                  with_test_file("example.xml") do |example|
         | 
| 21 21 | 
             
                    a = klass.create!
         | 
| 22 | 
            -
                    expect(a. | 
| 22 | 
            +
                    expect(a.update(file: example)).to be_truthy
         | 
| 23 23 | 
             
                  end
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| 26 26 | 
             
                it do
         | 
| 27 27 | 
             
                  with_test_file("example.xml") do |example|
         | 
| 28 28 | 
             
                    a = klass.create!
         | 
| 29 | 
            -
                    a. | 
| 29 | 
            +
                    a.update(file: example)
         | 
| 30 30 |  | 
| 31 31 | 
             
                    expect(Saviour::Config.storage.exists?(a[:file])).to be_truthy
         | 
| 32 32 | 
             
                  end
         | 
| @@ -35,7 +35,7 @@ describe "CRUD" do | |
| 35 35 | 
             
                it do
         | 
| 36 36 | 
             
                  with_test_file("example.xml") do |example, real_filename|
         | 
| 37 37 | 
             
                    a = klass.create!
         | 
| 38 | 
            -
                    a. | 
| 38 | 
            +
                    a.update(file: example)
         | 
| 39 39 | 
             
                    expect(a[:file]).to eq "/store/dir/#{real_filename}"
         | 
| 40 40 | 
             
                  end
         | 
| 41 41 | 
             
                end
         | 
| @@ -43,7 +43,7 @@ describe "CRUD" do | |
| 43 43 | 
             
                it do
         | 
| 44 44 | 
             
                  with_test_file("example.xml") do |example|
         | 
| 45 45 | 
             
                    a = klass.create!
         | 
| 46 | 
            -
                    a. | 
| 46 | 
            +
                    a.update(file: example)
         | 
| 47 47 |  | 
| 48 48 | 
             
                    example.rewind
         | 
| 49 49 | 
             
                    expect(a.file.read).to eq example.read
         | 
| @@ -53,7 +53,7 @@ describe "CRUD" do | |
| 53 53 | 
             
                it do
         | 
| 54 54 | 
             
                  with_test_file("example.xml") do |example|
         | 
| 55 55 | 
             
                    a = klass.create!
         | 
| 56 | 
            -
                    a. | 
| 56 | 
            +
                    a.update(file: example)
         | 
| 57 57 |  | 
| 58 58 | 
             
                    expect(a.file.exists?).to be_truthy
         | 
| 59 59 | 
             
                  end
         | 
| @@ -62,7 +62,7 @@ describe "CRUD" do | |
| 62 62 | 
             
                it do
         | 
| 63 63 | 
             
                  with_test_file("example.xml") do |example, real_filename|
         | 
| 64 64 | 
             
                    a = klass.create!
         | 
| 65 | 
            -
                    a. | 
| 65 | 
            +
                    a.update(file: example)
         | 
| 66 66 |  | 
| 67 67 | 
             
                    expect(a.file.filename).to eq real_filename
         | 
| 68 68 | 
             
                  end
         | 
| @@ -71,7 +71,7 @@ describe "CRUD" do | |
| 71 71 | 
             
                it do
         | 
| 72 72 | 
             
                  with_test_file("example.xml") do |example, real_filename|
         | 
| 73 73 | 
             
                    a = klass.create!
         | 
| 74 | 
            -
                    a. | 
| 74 | 
            +
                    a.update(file: example)
         | 
| 75 75 |  | 
| 76 76 | 
             
                    expect(a.file.url).to eq "http://domain.com/store/dir/#{real_filename}"
         | 
| 77 77 | 
             
                    expect(a.file.public_url).to eq a.file.url
         | 
| @@ -137,7 +137,7 @@ describe "CRUD" do | |
| 137 137 | 
             
                it do
         | 
| 138 138 | 
             
                  with_test_file("example.xml") do |example|
         | 
| 139 139 | 
             
                    a = klass.create!
         | 
| 140 | 
            -
                    a. | 
| 140 | 
            +
                    a.update(file: example)
         | 
| 141 141 | 
             
                    expect(a.file.exists?).to be_truthy
         | 
| 142 142 | 
             
                    expect(a.destroy).to be_truthy
         | 
| 143 143 |  | 
| @@ -150,13 +150,13 @@ describe "CRUD" do | |
| 150 150 | 
             
                it do
         | 
| 151 151 | 
             
                  with_test_file("example.xml") do |example|
         | 
| 152 152 | 
             
                    a = klass.create!
         | 
| 153 | 
            -
                    a. | 
| 153 | 
            +
                    a.update(file: example)
         | 
| 154 154 |  | 
| 155 155 | 
             
                    expect(Saviour::Config.storage.exists?(a[:file])).to be_truthy
         | 
| 156 156 | 
             
                    previous_location = a[:file]
         | 
| 157 157 |  | 
| 158 158 | 
             
                    with_test_file("camaloon.jpg") do |example_2|
         | 
| 159 | 
            -
                      a. | 
| 159 | 
            +
                      a.update(file: example_2)
         | 
| 160 160 | 
             
                      expect(Saviour::Config.storage.exists?(a[:file])).to be_truthy
         | 
| 161 161 |  | 
| 162 162 | 
             
                      expect(Saviour::Config.storage.exists?(previous_location)).to be_falsey
         | 
| @@ -167,7 +167,7 @@ describe "CRUD" do | |
| 167 167 | 
             
                it "does allow to update the same file to another contents in the same path" do
         | 
| 168 168 | 
             
                  a = klass.create! file: Saviour::StringSource.new("contents", "file.txt")
         | 
| 169 169 |  | 
| 170 | 
            -
                  a. | 
| 170 | 
            +
                  a.update! file: Saviour::StringSource.new("foo", "file.txt")
         | 
| 171 171 | 
             
                  expect(Saviour::Config.storage.read(a[:file])).to eq "foo"
         | 
| 172 172 | 
             
                end
         | 
| 173 173 |  | 
| @@ -175,7 +175,7 @@ describe "CRUD" do | |
| 175 175 | 
             
                  a = klass.create!
         | 
| 176 176 |  | 
| 177 177 | 
             
                  expect_to_yield_queries(count: 1) do
         | 
| 178 | 
            -
                    a. | 
| 178 | 
            +
                    a.update! file: Saviour::StringSource.new("foo", "file.txt")
         | 
| 179 179 | 
             
                  end
         | 
| 180 180 | 
             
                end
         | 
| 181 181 |  | 
| @@ -183,7 +183,7 @@ describe "CRUD" do | |
| 183 183 | 
             
                  a = klass.create!
         | 
| 184 184 |  | 
| 185 185 | 
             
                  expect_to_yield_queries(count: 2) do
         | 
| 186 | 
            -
                    a. | 
| 186 | 
            +
                    a.update! name: "Text",
         | 
| 187 187 | 
             
                                         file: Saviour::StringSource.new("foo", "file.txt")
         | 
| 188 188 | 
             
                  end
         | 
| 189 189 | 
             
                end
         | 
| @@ -192,7 +192,7 @@ describe "CRUD" do | |
| 192 192 | 
             
                  it "touches updated_at if the model has it" do
         | 
| 193 193 | 
             
                    time = Time.now - 4.years
         | 
| 194 194 | 
             
                    a = klass.create! updated_at: time
         | 
| 195 | 
            -
                    a. | 
| 195 | 
            +
                    a.update! file: Saviour::StringSource.new("foo", "file.txt")
         | 
| 196 196 |  | 
| 197 197 | 
             
                    expect(a.updated_at).to be > time + 2.years
         | 
| 198 198 | 
             
                  end
         | 
| @@ -207,7 +207,7 @@ describe "CRUD" do | |
| 207 207 | 
             
                    it "works with models that do not have updated_at" do
         | 
| 208 208 | 
             
                      a = klass.create!
         | 
| 209 209 | 
             
                      expect(a).not_to respond_to(:updated_at)
         | 
| 210 | 
            -
                      a. | 
| 210 | 
            +
                      a.update! file: Saviour::StringSource.new("foo", "file.txt")
         | 
| 211 211 | 
             
                      expect(a.file.read).to eq "foo"
         | 
| 212 212 | 
             
                    end
         | 
| 213 213 | 
             
                  end
         | 
| @@ -226,7 +226,7 @@ describe "CRUD" do | |
| 226 226 |  | 
| 227 227 | 
             
                    expected_query = %Q{UPDATE "tests" SET "file" = '/store/dir/file.txt', "file_thumb" = '/store/dir/file.txt'}
         | 
| 228 228 | 
             
                    expect_to_yield_queries(count: 1, including: [expected_query]) do
         | 
| 229 | 
            -
                      a. | 
| 229 | 
            +
                      a.update!(
         | 
| 230 230 | 
             
                          file: Saviour::StringSource.new("foo", "file.txt"),
         | 
| 231 231 | 
             
                          file_thumb: Saviour::StringSource.new("foo", "file.txt")
         | 
| 232 232 | 
             
                      )
         | 
    
        data/spec/feature/dirty_spec.rb
    CHANGED
    
    
| @@ -23,7 +23,7 @@ describe "halt processor behavior" do | |
| 23 23 |  | 
| 24 24 | 
             
                expect(Saviour::Config.storage).to_not receive(:write)
         | 
| 25 25 |  | 
| 26 | 
            -
                a. | 
| 26 | 
            +
                a.update! file: StringIO.new("contents")
         | 
| 27 27 | 
             
                expect(a.reload.read_attribute(:file)).to be_nil
         | 
| 28 28 | 
             
              end
         | 
| 29 29 |  | 
| @@ -9,8 +9,6 @@ describe "memory usage" do | |
| 9 9 | 
             
                a
         | 
| 10 10 | 
             
              }
         | 
| 11 11 |  | 
| 12 | 
            -
              CHUNK = ("A" * 1024).freeze
         | 
| 13 | 
            -
             | 
| 14 12 | 
             
              let(:size_to_test) { 10 } # Test with 10Mb files
         | 
| 15 13 |  | 
| 16 14 | 
             
              def with_tempfile
         | 
| @@ -18,7 +16,7 @@ describe "memory usage" do | |
| 18 16 |  | 
| 19 17 | 
             
                size_to_test.times do
         | 
| 20 18 | 
             
                  1024.times do
         | 
| 21 | 
            -
                    f.write  | 
| 19 | 
            +
                    f.write SecureRandom.hex(512)
         | 
| 22 20 | 
             
                  end
         | 
| 23 21 | 
             
                end
         | 
| 24 22 | 
             
                f.flush
         | 
| @@ -56,7 +54,7 @@ describe "memory usage" do | |
| 56 54 | 
             
                    with_no_gc do
         | 
| 57 55 | 
             
                      base_line = GetProcessMem.new.mb
         | 
| 58 56 |  | 
| 59 | 
            -
                      a. | 
| 57 | 
            +
                      a.update! file: f
         | 
| 60 58 |  | 
| 61 59 | 
             
                      # Expect memory usage to grow below 10% of the file size
         | 
| 62 60 | 
             
                      expect(GetProcessMem.new.mb - base_line).to be < size_to_test / 10
         | 
| @@ -72,22 +70,22 @@ describe "memory usage" do | |
| 72 70 |  | 
| 73 71 | 
             
                    process do |contents, filename|
         | 
| 74 72 | 
             
                      digest = Digest::MD5.hexdigest(contents)
         | 
| 73 | 
            +
             | 
| 75 74 | 
             
                      [contents, "#{digest}-#{filename}"]
         | 
| 76 75 | 
             
                    end
         | 
| 77 76 | 
             
                  }
         | 
| 78 77 | 
             
                }
         | 
| 79 78 |  | 
| 80 79 | 
             
                it do
         | 
| 81 | 
            -
                  a = base_klass.create!
         | 
| 82 | 
            -
             | 
| 83 80 | 
             
                  with_tempfile do |f|
         | 
| 84 81 | 
             
                    with_no_gc do
         | 
| 85 | 
            -
                       | 
| 82 | 
            +
                      a = base_klass.create!
         | 
| 86 83 |  | 
| 87 | 
            -
                       | 
| 84 | 
            +
                      base_line = GetProcessMem.new.mb
         | 
| 88 85 |  | 
| 89 | 
            -
                       | 
| 90 | 
            -
                       | 
| 86 | 
            +
                      a.update! file: f
         | 
| 87 | 
            +
                      # Expect memory usage to grow at least half the file size
         | 
| 88 | 
            +
                      expect(GetProcessMem.new.mb - base_line).to be >= size_to_test / 2
         | 
| 91 89 | 
             
                    end
         | 
| 92 90 | 
             
                  end
         | 
| 93 91 | 
             
                end
         | 
| @@ -11,7 +11,7 @@ describe "persisted path" do | |
| 11 11 |  | 
| 12 12 | 
             
                  with_test_file("example.xml") do |example|
         | 
| 13 13 | 
             
                    a = klass.create!
         | 
| 14 | 
            -
                    expect(a. | 
| 14 | 
            +
                    expect(a.update(file: example)).to be_truthy
         | 
| 15 15 | 
             
                    expect(Saviour::Config.storage.exists?(a[:file])).to be_truthy
         | 
| 16 16 | 
             
                    expect(File.dirname(a[:file])).to eq "/store/dir"
         | 
| 17 17 |  | 
| @@ -20,7 +20,7 @@ describe "persisted path" do | |
| 20 20 |  | 
| 21 21 | 
             
                    with_test_file("camaloon.jpg") do |example_2|
         | 
| 22 22 | 
             
                      b = klass.create!
         | 
| 23 | 
            -
                      expect(b. | 
| 23 | 
            +
                      expect(b.update(file: example_2)).to be_truthy
         | 
| 24 24 |  | 
| 25 25 | 
             
                      expect(Saviour::Config.storage.exists?(b[:file])).to be_truthy
         | 
| 26 26 | 
             
                      expect(Saviour::Config.storage.exists?(a[:file])).to be_truthy
         | 
| @@ -88,7 +88,7 @@ describe "processor's API" do | |
| 88 88 | 
             
                  a = klass.create!
         | 
| 89 89 |  | 
| 90 90 | 
             
                  expect {
         | 
| 91 | 
            -
                    a. | 
| 91 | 
            +
                    a.update! file: Saviour::StringSource.new("contents", "filename.txt")
         | 
| 92 92 | 
             
                  }.to raise_error.with_message("custom problem!")
         | 
| 93 93 | 
             
                end
         | 
| 94 94 |  | 
| @@ -116,7 +116,7 @@ describe "remove attachment" do | |
| 116 116 | 
             
                    expect(Saviour::Config.storage.exists?(path)).to be_truthy
         | 
| 117 117 | 
             
                    expect(Saviour::Config.storage.read(path)).to eq "Some contents"
         | 
| 118 118 |  | 
| 119 | 
            -
                    a. | 
| 119 | 
            +
                    a.update!(file: Saviour::StringSource.new("Other contents", "filename.txt"))
         | 
| 120 120 | 
             
                    expect(a.file.persisted?).to be_truthy
         | 
| 121 121 | 
             
                    expect(a.file.read).to eq "Other contents"
         | 
| 122 122 | 
             
                    expect(Saviour::Config.storage.exists?(path)).to be_truthy
         | 
    
        data/spec/feature/stash_spec.rb
    CHANGED
    
    | @@ -14,7 +14,7 @@ describe "stash data on process" do | |
| 14 14 | 
             
                  end
         | 
| 15 15 |  | 
| 16 16 | 
             
                  after_upload do |stash|
         | 
| 17 | 
            -
                    model. | 
| 17 | 
            +
                    model.update!(file_size: stash[:file_size])
         | 
| 18 18 | 
             
                  end
         | 
| 19 19 | 
             
                }
         | 
| 20 20 |  | 
| @@ -23,7 +23,7 @@ describe "stash data on process" do | |
| 23 23 |  | 
| 24 24 | 
             
                a = klass.create!
         | 
| 25 25 |  | 
| 26 | 
            -
                a. | 
| 26 | 
            +
                a.update! file: Saviour::StringSource.new("a" * 74, "file.txt")
         | 
| 27 27 | 
             
                expect(a.file_size).to eq 74
         | 
| 28 28 | 
             
              end
         | 
| 29 29 |  | 
| @@ -38,7 +38,7 @@ describe "stash data on process" do | |
| 38 38 | 
             
                  end
         | 
| 39 39 |  | 
| 40 40 | 
             
                  after_upload do |stash|
         | 
| 41 | 
            -
                    model. | 
| 41 | 
            +
                    model.update!(file_size: stash[:file_size])
         | 
| 42 42 | 
             
                  end
         | 
| 43 43 | 
             
                }
         | 
| 44 44 |  | 
| @@ -61,7 +61,7 @@ describe "stash data on process" do | |
| 61 61 | 
             
                  end
         | 
| 62 62 |  | 
| 63 63 | 
             
                  after_upload do |stash|
         | 
| 64 | 
            -
                    model. | 
| 64 | 
            +
                    model.update!("size_#{attached_as}" => stash[:size])
         | 
| 65 65 | 
             
                  end
         | 
| 66 66 | 
             
                }
         | 
| 67 67 |  | 
| @@ -74,7 +74,7 @@ describe "stash data on process" do | |
| 74 74 | 
             
                # - 2 queries to update size
         | 
| 75 75 | 
             
                # - 1 query to assign stored paths
         | 
| 76 76 | 
             
                expect_to_yield_queries(count: 3) do
         | 
| 77 | 
            -
                  a. | 
| 77 | 
            +
                  a.update! file: Saviour::StringSource.new("a" * 74, "file.txt"),
         | 
| 78 78 | 
             
                                       file_thumb: Saviour::StringSource.new("a" * 31, "file_2.txt")
         | 
| 79 79 | 
             
                end
         | 
| 80 80 |  | 
| @@ -99,7 +99,7 @@ describe "stash data on process" do | |
| 99 99 | 
             
                  end
         | 
| 100 100 |  | 
| 101 101 | 
             
                  after_upload do |stash|
         | 
| 102 | 
            -
                    model. | 
| 102 | 
            +
                    model.update!(stash[:model])
         | 
| 103 103 | 
             
                  end
         | 
| 104 104 | 
             
                }
         | 
| 105 105 |  | 
| @@ -123,11 +123,11 @@ describe "stash data on process" do | |
| 123 123 | 
             
                  end
         | 
| 124 124 |  | 
| 125 125 | 
             
                  after_upload do |stash|
         | 
| 126 | 
            -
                    model. | 
| 126 | 
            +
                    model.update!(file_size: stash[:file_size])
         | 
| 127 127 | 
             
                  end
         | 
| 128 128 |  | 
| 129 129 | 
             
                  after_upload do |stash|
         | 
| 130 | 
            -
                    model. | 
| 130 | 
            +
                    model.update!(name: stash[:name])
         | 
| 131 131 | 
             
                  end
         | 
| 132 132 | 
             
                }
         | 
| 133 133 |  | 
| @@ -87,7 +87,7 @@ describe "transactional behavior" do | |
| 87 87 |  | 
| 88 88 | 
             
                    with_test_file("camaloon.jpg") do |file2|
         | 
| 89 89 | 
             
                      ActiveRecord::Base.transaction do
         | 
| 90 | 
            -
                        a. | 
| 90 | 
            +
                        a.update! file: file2
         | 
| 91 91 |  | 
| 92 92 | 
             
                        expect(Saviour::Config.storage.exists?(path1)).to be_truthy
         | 
| 93 93 | 
             
                        expect(Saviour::Config.storage.exists?(a[:file])).to be_truthy
         | 
| @@ -107,7 +107,7 @@ describe "transactional behavior" do | |
| 107 107 |  | 
| 108 108 | 
             
                    with_test_file("camaloon.jpg") do |file2|
         | 
| 109 109 | 
             
                      ActiveRecord::Base.transaction do
         | 
| 110 | 
            -
                        a. | 
| 110 | 
            +
                        a.update! file: file2
         | 
| 111 111 | 
             
                        path2 = a[:file]
         | 
| 112 112 |  | 
| 113 113 | 
             
                        expect(Saviour::Config.storage.exists?(path1)).to be_truthy
         | 
| @@ -135,7 +135,7 @@ describe "transactional behavior" do | |
| 135 135 | 
             
                  expect(Saviour::Config.storage.read(a[:file])).to eq "original content"
         | 
| 136 136 |  | 
| 137 137 | 
             
                  ActiveRecord::Base.transaction do
         | 
| 138 | 
            -
                    a. | 
| 138 | 
            +
                    a.update! file: Saviour::StringSource.new("new content", "file.txt")
         | 
| 139 139 | 
             
                    expect(Saviour::Config.storage.read(a[:file])).to eq "new content"
         | 
| 140 140 | 
             
                    raise ActiveRecord::Rollback
         | 
| 141 141 | 
             
                  end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: saviour
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.6. | 
| 4 | 
            +
              version: 0.6.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Roger Campos
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019- | 
| 11 | 
            +
            date: 2019-08-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activerecord
         | 
| @@ -108,20 +108,6 @@ dependencies: | |
| 108 108 | 
             
                - - ">="
         | 
| 109 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 110 | 
             
                    version: '0'
         | 
| 111 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 112 | 
            -
              name: appraisal
         | 
| 113 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 | 
            -
                requirements:
         | 
| 115 | 
            -
                - - ">="
         | 
| 116 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version: '0'
         | 
| 118 | 
            -
              type: :development
         | 
| 119 | 
            -
              prerelease: false
         | 
| 120 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            -
                requirements:
         | 
| 122 | 
            -
                - - ">="
         | 
| 123 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version: '0'
         | 
| 125 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 112 | 
             
              name: aws-sdk-s3
         | 
| 127 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -173,13 +159,13 @@ extra_rdoc_files: [] | |
| 173 159 | 
             
            files:
         | 
| 174 160 | 
             
            - ".gitignore"
         | 
| 175 161 | 
             
            - ".travis.yml"
         | 
| 176 | 
            -
            - Appraisals
         | 
| 177 162 | 
             
            - Gemfile
         | 
| 178 163 | 
             
            - LICENSE.txt
         | 
| 179 164 | 
             
            - README.md
         | 
| 180 165 | 
             
            - Rakefile
         | 
| 181 166 | 
             
            - gemfiles/5.1.gemfile
         | 
| 182 167 | 
             
            - gemfiles/5.2.gemfile
         | 
| 168 | 
            +
            - gemfiles/6.0.gemfile
         | 
| 183 169 | 
             
            - lib/saviour.rb
         | 
| 184 170 | 
             
            - lib/saviour/base_uploader.rb
         | 
| 185 171 | 
             
            - lib/saviour/config.rb
         | 
| @@ -248,7 +234,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 248 234 | 
             
              requirements:
         | 
| 249 235 | 
             
              - - ">="
         | 
| 250 236 | 
             
                - !ruby/object:Gem::Version
         | 
| 251 | 
            -
                  version: 2. | 
| 237 | 
            +
                  version: 2.5.0
         | 
| 252 238 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 253 239 | 
             
              requirements:
         | 
| 254 240 | 
             
              - - ">="
         | 
    
        data/Appraisals
    DELETED
    
    | @@ -1,19 +0,0 @@ | |
| 1 | 
            -
            appraise "4.0" do
         | 
| 2 | 
            -
              gem "activesupport", "~> 4.0.0"
         | 
| 3 | 
            -
              gem "activerecord", "~> 4.0.0"
         | 
| 4 | 
            -
            end
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            appraise "4.1" do
         | 
| 7 | 
            -
              gem "activesupport", "~> 4.1.0"
         | 
| 8 | 
            -
              gem "activerecord", "~> 4.1.0"
         | 
| 9 | 
            -
            end
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            appraise "4.2" do
         | 
| 12 | 
            -
              gem "activesupport", "~> 4.2.0"
         | 
| 13 | 
            -
              gem "activerecord", "~> 4.2.0"
         | 
| 14 | 
            -
            end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            appraise "5.0" do
         | 
| 17 | 
            -
              gem "activesupport", "~> 5.0.0"
         | 
| 18 | 
            -
              gem "activerecord", "~> 5.0.0"
         | 
| 19 | 
            -
            end
         |