Sha256: bf52c1c399cd251767a91614c7dfab31a021df772ce5ff5f6d96e82a3726f37b

Contents?: true

Size: 793 Bytes

Versions: 15

Compression:

Stored size: 793 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"
      else
	case to.scheme
	when 'http', 'https'
	  case from.scheme
	  when 'file', 'pipe'
	    if http_authentication?
	      return proposal 
	    else
	      unsupported_transfer
	    end
	  end
	end
	debug "#{self.class.name}: not appropriate"
      end
      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

15 entries across 15 versions & 1 rubygems

Version Path
uricp-0.0.15 lib/uricp/strategy/remote_put.rb
uricp-0.0.14 lib/uricp/strategy/remote_put.rb
uricp-0.0.13 lib/uricp/strategy/remote_put.rb
uricp-0.0.12 lib/uricp/strategy/remote_put.rb
uricp-0.0.11 lib/uricp/strategy/remote_put.rb
uricp-0.0.10 lib/uricp/strategy/remote_put.rb
uricp-0.0.9 lib/uricp/strategy/remote_put.rb
uricp-0.0.8 lib/uricp/strategy/remote_put.rb
uricp-0.0.7 lib/uricp/strategy/remote_put.rb
uricp-0.0.6 lib/uricp/strategy/remote_put.rb
uricp-0.0.5 lib/uricp/strategy/remote_put.rb
uricp-0.0.4 lib/uricp/strategy/remote_put.rb
uricp-0.0.3 lib/uricp/strategy/remote_put.rb
uricp-0.0.2 lib/uricp/strategy/remote_put.rb
uricp-0.0.1 lib/uricp/strategy/remote_put.rb