fog-local 0.2.1 → 0.3.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 +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Rakefile +2 -0
- data/lib/fog/local/version.rb +1 -1
- data/lib/fog/storage/local/models/file.rb +12 -6
- data/lib/fog/storage/local/models/files.rb +9 -8
- metadata +5 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6de6094d73b2a0014751ef203cc33a8d590ce990
         | 
| 4 | 
            +
              data.tar.gz: cfa04eef4ac8c4a770416c898c06ac16878b9dca
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 06ab581be51ec5b35aaf9490b8009875adb9144e984969f7ae2847523ad34b3a9e174779cf7471a6c5610ba7f6c41da84223c6c0b907abe4f6e11babd612e153
         | 
| 7 | 
            +
              data.tar.gz: f2df07d4bb2ff57f19eed3663560050fd864c56eb443414f0ad20ba76bc7b58e96a943ed62c3860ff32be8870875106a98a07b0a011ba81a9eb34fb00bd4ed58
         | 
    
        data/.ruby-gemset
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            fog-local
         | 
    
        data/.ruby-version
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            2.2.0
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/fog/local/version.rb
    CHANGED
    
    
| @@ -98,15 +98,12 @@ module Fog | |
| 98 98 | 
             
                          raise unless ::File.directory?(dir_path)
         | 
| 99 99 | 
             
                        end
         | 
| 100 100 | 
             
                      end
         | 
| 101 | 
            -
                       | 
| 102 | 
            -
                      if body.is_a?(String)
         | 
| 103 | 
            -
                        file.write(body)
         | 
| 104 | 
            -
                      elsif body.kind_of? ::File and ::File.exist?(body.path)
         | 
| 101 | 
            +
                      if body.kind_of? ::File and ::File.exist?(body.path)
         | 
| 105 102 | 
             
                        FileUtils.cp(body.path, path)
         | 
| 106 103 | 
             
                      else
         | 
| 107 | 
            -
                         | 
| 104 | 
            +
                        write_file(path, body)
         | 
| 108 105 | 
             
                      end
         | 
| 109 | 
            -
             | 
| 106 | 
            +
             | 
| 110 107 | 
             
                      merge_attributes(
         | 
| 111 108 | 
             
                        :content_length => Fog::Storage.get_body_size(body),
         | 
| 112 109 | 
             
                        :last_modified  => ::File.mtime(path)
         | 
| @@ -123,6 +120,15 @@ module Fog | |
| 123 120 | 
             
                    def path
         | 
| 124 121 | 
             
                      service.path_to(::File.join(directory.key, key))
         | 
| 125 122 | 
             
                    end
         | 
| 123 | 
            +
             | 
| 124 | 
            +
                    def write_file(path, content)
         | 
| 125 | 
            +
                      input_io = StringIO.new(content) if content.is_a?(String)
         | 
| 126 | 
            +
                      input_io ||= content
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                      ::File.open(path, 'wb') do |file|
         | 
| 129 | 
            +
                        IO.copy_stream(input_io, file)
         | 
| 130 | 
            +
                      end
         | 
| 131 | 
            +
                    end
         | 
| 126 132 | 
             
                  end
         | 
| 127 133 | 
             
                end
         | 
| 128 134 | 
             
              end
         | 
| @@ -37,15 +37,16 @@ module Fog | |
| 37 37 | 
             
                          :key            => key,
         | 
| 38 38 | 
             
                          :last_modified  => ::File.mtime(path)
         | 
| 39 39 | 
             
                        }
         | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
                          file. | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
                          body = ::File.read(path)
         | 
| 47 | 
            -
                          new(data.merge!(:body => body))
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                        body = ""
         | 
| 42 | 
            +
                        ::File.open(path) do |file|
         | 
| 43 | 
            +
                          while (chunk = file.read(Excon::CHUNK_SIZE)) && (!block_given? || (block_given? && yield(chunk)))
         | 
| 44 | 
            +
                            body << chunk
         | 
| 45 | 
            +
                          end
         | 
| 48 46 | 
             
                        end
         | 
| 47 | 
            +
                        data.merge!(:body => body) if !block_given?
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                        new(data)
         | 
| 49 50 | 
             
                      else
         | 
| 50 51 | 
             
                        nil
         | 
| 51 52 | 
             
                      end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: fog-local
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Wesley Beary
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2016-03-03 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: bundler
         | 
| @@ -78,6 +78,8 @@ extensions: [] | |
| 78 78 | 
             
            extra_rdoc_files: []
         | 
| 79 79 | 
             
            files:
         | 
| 80 80 | 
             
            - ".gitignore"
         | 
| 81 | 
            +
            - ".ruby-gemset"
         | 
| 82 | 
            +
            - ".ruby-version"
         | 
| 81 83 | 
             
            - ".travis.yml"
         | 
| 82 84 | 
             
            - CONTRIBUTING.md
         | 
| 83 85 | 
             
            - CONTRIBUTORS.md
         | 
| @@ -128,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 128 130 | 
             
                  version: '0'
         | 
| 129 131 | 
             
            requirements: []
         | 
| 130 132 | 
             
            rubyforge_project: 
         | 
| 131 | 
            -
            rubygems_version: 2.4. | 
| 133 | 
            +
            rubygems_version: 2.4.6
         | 
| 132 134 | 
             
            signing_key: 
         | 
| 133 135 | 
             
            specification_version: 4
         | 
| 134 136 | 
             
            summary: Module for the 'fog' gem to support local filesystem storage.
         |