Sha256: f35fdc670e37408de3062643b4b8a27366028a30bb566e566fc0a2ad633045c4

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

module Photocopier

  class Adapter
    attr_accessor :logger

    def put(file_path_or_string, remote_path)
      if File.exists? file_path_or_string
        put_file(file_path_or_string, remote_path)
      else
        file = Tempfile.new('put')
        file.write file_path_or_string
        file.close
        put_file(file.path, remote_path)
        file.unlink
      end
    end

    def put_file(file_path, remote_path); end
    def put_directory(local_path, remote_path, exclude = []); end

    def get(remote_path, file_path = nil); end
    def get_directory(remote_path, local_path, exclude = []); end

    def delete(remote_path); end

    protected

    def run(command)
      if logger.present?
        logger.info command
      end
      system command
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
photocopier-1.0.0.pre2 lib/photocopier/adapter.rb
photocopier-1.0.0.pre lib/photocopier/adapter.rb