Module: Snatch

Defined in:
lib/snatch.rb,
lib/snatch/handler.rb,
lib/snatch/session.rb,
lib/snatch/version.rb

Defined Under Namespace

Classes: CredentialsError, NoDatabaseError, NoServiceError, Session, TransferHandler

Constant Summary collapse

VERSION =
'1.0.2'

Class Method Summary collapse

Class Method Details

.rootObject



10
11
12
# File 'lib/snatch.rb', line 10

def self.root
  File.join(ENV['HOME'], '.snatch')
end

.run(config) ⇒ Object



14
15
16
17
# File 'lib/snatch.rb', line 14

def self.run(config)
  s = Snatch::Session.new(config)
  s.run!
end

.valid_config?(path) ⇒ Boolean

Returns true if snatch config is valid

Returns:

  • (Boolean)


20
21
22
23
24
25
26
27
# File 'lib/snatch.rb', line 20

def self.valid_config?(path)
  data = YAML.load_file(path)
  if data.kind_of?(Hash)
    (data.keys & ['host']).size == 1
  else
    false
  end
end