Sha256: 6749c450e9bee8a38db4e1d6dad8f57c074d16289ff58f9dc58a2342ac8a94cb

Contents?: true

Size: 986 Bytes

Versions: 15

Compression:

Stored size: 986 Bytes

Contents

require 'fileutils'

module Uricp::Strategy

  class PipedCacheConvert
    
    include Uricp::Strategy::Common
    include Uricp::Strategy::CacheCommon

    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

    def command
      "cp --sparse=always /dev/stdin #{proposed_path};"
    end

    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

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

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