Sha256: 5d28b6e1334f4cd5bd55467c34ac7960393445c22c2f9e87dc7ca5e247ae60f7

Contents?: true

Size: 1.85 KB

Versions: 5

Compression:

Stored size: 1.85 KB

Contents

module Fog
  module Local
    class Storage < Fog::Service

      requires :local_root
      recognizes :provider # remove post deprecation

      model_path 'fog/storage/models/local'
      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={})
          Fog::Mock.not_implemented

          unless options.delete(:provider)
            location = caller.first
            warning = "[yellow][WARN] Fog::Local::Storage.new is deprecated, use Fog::Storage.new(:provider => 'Local') instead[/]"
            warning << " [light_black](" << location << ")[/] "
            Formatador.display_line(warning)
          end

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

        def local_root
          @local_root
        end

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

      class Real

        def initialize(options={})
          unless options.delete(:provider)
            location = caller.first
            warning = "[yellow][WARN] Fog::Local::Storage.new is deprecated, use Fog::Storage.new(:provider => 'Local') instead[/]"
            warning << " [light_black](" << location << ")[/] "
            Formatador.display_line(warning)
          end

          @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

5 entries across 5 versions & 2 rubygems

Version Path
phpfog-fog-0.4.1.3 lib/fog/storage/local.rb
phpfog-fog-0.4.1.2 lib/fog/storage/local.rb
phpfog-fog-0.4.1.1 lib/fog/storage/local.rb
phpfog-fog-0.4.1 lib/fog/storage/local.rb
fog-0.4.1 lib/fog/storage/local.rb