Sha256: 2746c7c8c7c4e6ab53c6d74a7dd2a7baff98d3819ed47373f95fb9dc9f250176

Contents?: true

Size: 518 Bytes

Versions: 8

Compression:

Stored size: 518 Bytes

Contents

require 'fog'

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-0.1.2 lib/adhoq/storage/local_file.rb
adhoq-0.1.1 lib/adhoq/storage/local_file.rb
adhoq-0.1.0 lib/adhoq/storage/local_file.rb
adhoq-0.0.7 lib/adhoq/storage/local_file.rb
adhoq-0.0.6 lib/adhoq/storage/local_file.rb
adhoq-0.0.5 lib/adhoq/storage/local_file.rb
adhoq-0.0.4 lib/adhoq/storage/local_file.rb
adhoq-0.0.3 lib/adhoq/storage/local_file.rb