Sha256: 6695e5844a57fdd2c7a77b99c269434a3aeec515495b78e46f98d739f651a966

Contents?: true

Size: 1.08 KB

Versions: 23

Compression:

Stored size: 1.08 KB

Contents

module Fog
  module Local
    class Storage < Fog::Service

      requires :local_root

      model_path 'fog/local/models/storage'
      collection  :directories
      model       :directory
      model       :file
      collection  :files

      class Mock

        def self.data
          @data ||= Hash.new do |hash, key|
            hash[key] = {}
          end
        end

        def self.reset_data(keys=data.keys)
          for key in [*keys]
            data.delete(key)
          end
        end

        def initialize(options={})
          @local_root = ::File.expand_path(options[:local_root])
          @data       = self.class.data[@local_root]
        end

        def local_root
          @local_root
        end

        def path(partial)
          partial
        end
      end

      class Real

        def initialize(options={})
          @local_root = ::File.expand_path(options[:local_root])
        end

        def local_root
          @local_root
        end

        def path_to(partial)
          ::File.join(@local_root, partial)
        end
      end

    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
fog-0.3.29 lib/fog/local/storage.rb
fog-0.3.28 lib/fog/local/storage.rb
fog-0.3.27 lib/fog/local/storage.rb
fog-0.3.26 lib/fog/local/storage.rb
fog-0.3.25 lib/fog/local/storage.rb
fog-0.3.24 lib/fog/local/storage.rb
bbcloud-0.8.1 lib/bbcloud/vendor/fog-0.3.23/lib/fog/local/storage.rb
fog-0.3.23 lib/fog/local/storage.rb
fog-0.3.22 lib/fog/local/storage.rb
fog-0.3.21 lib/fog/local/storage.rb
fog-0.3.20 lib/fog/local/storage.rb
fog-0.3.19 lib/fog/local/storage.rb
fog-0.3.18 lib/fog/local/storage.rb
fog-0.3.17 lib/fog/local/storage.rb
fog-0.3.16 lib/fog/local/storage.rb
fog-0.3.15 lib/fog/local/storage.rb
fog-0.3.14 lib/fog/local/storage.rb
fog-0.3.13 lib/fog/local/storage.rb
fog-0.3.12 lib/fog/local/storage.rb
fog-0.3.11 lib/fog/local/storage.rb