Sha256: 2ad703c1f169702897fa4558b52e8ffb055ca2a5da272d207c280a86e547cdde

Contents?: true

Size: 720 Bytes

Versions: 3

Compression:

Stored size: 720 Bytes

Contents

require 'escape'
require 'tempfile'
require 'logger'

module Photocopier

  class Adapter
    attr_accessor :logger

    def get(remote_path, file_path = nil); end

    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 delete(remote_path); end

    def get_directory(remote_path, local_path); end
    def put_directory(local_path, remote_path); end

    protected

    def run(*args)
      system Escape.shell_command(args)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
photocopier-0.0.3 lib/photocopier/adapter.rb
photocopier-0.0.2 lib/photocopier/adapter.rb
photocopier-0.0.1 lib/photocopier/adapter.rb