Class: Grifork::Config
- Inherits:
-
Object
show all
- Defined in:
- lib/grifork/config.rb
Defined Under Namespace
Classes: Grifork, Log, Rsync, SSH
Instance Method Summary
collapse
Constructor Details
#initialize(args) ⇒ Config
Returns a new instance of Config.
9
10
11
12
13
|
# File 'lib/grifork/config.rb', line 9
def initialize(args)
args.each do |key, val|
instance_variable_set("@#{key}", val)
end
end
|
Instance Method Details
#dry_run? ⇒ Boolean
23
24
25
|
# File 'lib/grifork/config.rb', line 23
def dry_run?
@dry_run ? true : false
end
|
#mode ⇒ Object
15
16
17
|
# File 'lib/grifork/config.rb', line 15
def mode
@mode || :standalone
end
|
#parallel ⇒ Object
19
20
21
|
# File 'lib/grifork/config.rb', line 19
def parallel
@parallel || :in_threads
end
|
#rsync_opts ⇒ Array<String>
Build rsync command-line options from @rsync and @ssh objects
35
36
37
38
39
40
41
42
|
# File 'lib/grifork/config.rb', line 35
def rsync_opts
@rsync ||= Rsync.new
opts = @rsync.options
if opts.grep(/^(-e|--rsh)$/).size.zero?
opts.concat(['--rsh', ssh.command_for_rsync])
end
opts
end
|
#ssh ⇒ Object
27
28
29
|
# File 'lib/grifork/config.rb', line 27
def ssh
@ssh || SSH.new
end
|