Sha256: 0412f0a8ff0ead1eeac12e42b3741cccf20934916bb079e0b64b43db25a790e4

Contents?: true

Size: 814 Bytes

Versions: 8

Compression:

Stored size: 814 Bytes

Contents

module Uricp::Strategy
  class RemotePut
    include Uricp::Strategy::Common

    def appropriate?
      if compression_required? || conversion_required?
        debug "#{self.class.name}: not ready to upload"
        return false
      end
      case to.scheme
      when 'http', 'https'
        case from.scheme
        when 'file', 'pipe'
          return proposal if http_authentication?

          unsupported_transfer
        end
      end
      debug "#{self.class.name}: not appropriate"
      false
    end

    def command
      curl_upload_from(curl_source)
    end

    def proposal
      @proposed_options = options.dup
      @proposed_options['from_uri'] = to
      self
    end

    def curl_source
      if from.scheme == 'pipe'
        '-'
      else
        from.path
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
uricp-0.0.24 lib/uricp/strategy/remote_put.rb
uricp-0.0.23 lib/uricp/strategy/remote_put.rb
uricp-0.0.22 lib/uricp/strategy/remote_put.rb
uricp-0.0.21 lib/uricp/strategy/remote_put.rb
uricp-0.0.20 lib/uricp/strategy/remote_put.rb
uricp-0.0.18 lib/uricp/strategy/remote_put.rb
uricp-0.0.17 lib/uricp/strategy/remote_put.rb
uricp-0.0.16 lib/uricp/strategy/remote_put.rb