class Uricp::Strategy::PipedCacheConvert

Public Instance Methods

appropriate?() click to toggle source
# File lib/uricp/strategy/piped_cache_convert.rb, line 8
def appropriate?
  if conversion_required? && supported_source?
    case from.scheme
    when 'pipe'
      validate_cache! if cache_root
      return proposal
    end
    debug "#{self.class.name}: not appropriate"
  else
    debug "#{self.class.name}: no non-stream conversion detected"
  end
  false
end
command() click to toggle source
# File lib/uricp/strategy/piped_cache_convert.rb, line 22
def command
  "cp --sparse=always /dev/stdin #{proposed_path};"
end
proposal() click to toggle source
# File lib/uricp/strategy/piped_cache_convert.rb, line 26
def proposal
  @proposed_options = options.dup
  if cache_root
    @proposed_options['from_uri'] = temp_cache_uri
    @proposed_options['sweep'] = [temp_cache_file, cache_file]
    @proposed_options.delete('cache')
    @proposed_options.delete('cache_name')
  else
    @proposed_options['from_uri'] = temp_uri
    @proposed_options['clean'] ||= []
    @proposed_options['clean'] << proposed_path
  end
  self
end