Module: Checksum::Tools

Defined in:
lib/checksum-tools.rb,
lib/checksum-tools/local.rb,
lib/checksum-tools/remote.rb

Defined Under Namespace

Classes: Base, ConfigurationError, Exception, Local, Remote

Constant Summary collapse

VERSION =
"1.2.0"
CHUNK_SIZE =

1M blocks

1048576
DEFAULT_OPTS =
{ :overwrite => false, :recursive => false, :exclude => [], :extension => '.digest' }

Class Method Summary collapse

Class Method Details

.new(path_info, *args) ⇒ Object


15
16
17
18
19
20
21
22
# File 'lib/checksum-tools.rb', line 15

def new(path_info, *args)
  remote = path_info[:remote]
  if remote.nil? or remote[:host].nil?
    Local.new(*args)
  else
    Remote.new(remote[:host],remote[:user],*args)
  end
end

.parse_path(path) ⇒ Object


24
25
26
27
28
29
# File 'lib/checksum-tools.rb', line 24

def parse_path(path)
  user,host,dir = path.to_s.scan(/^(?:(.+)@)?(?:(.+):)?(?:(.+))?$/).flatten
  dir ||= '.'
  result = { :remote => { :user => user, :host => host }, :dir => dir }
  return result
end