Sha256: d51cff9072568c12c081f152f6c4f32e9509312c224f21829fae7c3aafa80a8f

Contents?: true

Size: 524 Bytes

Versions: 8

Compression:

Stored size: 524 Bytes

Contents

require 'fog/local'

module Adhoq
  module Storage
    class LocalFile < FogStorage
      attr_reader :root

      def initialize(root_path)
        path = Pathname.new(root_path)

        @fog = Fog::Storage.new(provider: 'Local', local_root: path.parent)
        @dir = path.basename.to_s
      end

      def identifier
        "file://#{[@fog.local_root, @dir].join('/')}"
      end

      private

      def directory
        @fog.directories.get(@dir) || @fog.directories.create(key: @dir)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adhoq-1.0.2 lib/adhoq/storage/local_file.rb
adhoq-1.0.1 lib/adhoq/storage/local_file.rb
adhoq-1.0.0 lib/adhoq/storage/local_file.rb
adhoq-0.5.0 lib/adhoq/storage/local_file.rb
adhoq-0.5.0.beta1 lib/adhoq/storage/local_file.rb
adhoq-0.4.0 lib/adhoq/storage/local_file.rb
adhoq-0.3.0 lib/adhoq/storage/local_file.rb
adhoq-0.2.0 lib/adhoq/storage/local_file.rb