Sha256: b1b176e99e0da8a3f66d865d8a55452cae9e444ac7e836ac593610e1e11a2bc9

Contents?: true

Size: 485 Bytes

Versions: 5

Compression:

Stored size: 485 Bytes

Contents

class PgExport
  class FtpService
    def initialize(params)
      connection = Connection.new(params)
      @ftp = connection.ftp
      ObjectSpace.define_finalizer(self, proc { connection.close })
    end

    def list(regexp)
      ftp.list(regexp).map { |item| item.split(' ').last }.sort.reverse
    end

    def delete(filename)
      ftp.delete(filename)
    end

    def upload_file(path)
      ftp.putbinaryfile(path.to_s)
    end

    private

    attr_reader :ftp
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pg_export-0.2.0 lib/pg_export/ftp_service.rb
pg_export-0.1.3 lib/pg_export/ftp_service.rb
pg_export-0.1.2 lib/pg_export/ftp_service.rb
pg_export-0.1.1 lib/pg_export/ftp_service.rb
pg_export-0.1.0 lib/pg_export/ftp_service.rb