Class: SSHKit::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sshkit/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#backendObject



42
43
44
# File 'lib/sshkit/configuration.rb', line 42

def backend
  @backend ||= SSHKit::Backend::Netssh
end

#default_envObject



24
25
26
# File 'lib/sshkit/configuration.rb', line 24

def default_env
  @default_env ||= {}
end

#default_runnerObject



28
29
30
# File 'lib/sshkit/configuration.rb', line 28

def default_runner
  @default_runner ||= :parallel
end

#outputObject



8
9
10
# File 'lib/sshkit/configuration.rb', line 8

def output
  @output ||= use_format(:pretty)
end

#umaskObject

Returns the value of attribute umask.



5
6
7
# File 'lib/sshkit/configuration.rb', line 5

def umask
  @umask
end

Instance Method Details

#command_mapObject



79
80
81
# File 'lib/sshkit/configuration.rb', line 79

def command_map
  @command_map ||= SSHKit::CommandMap.new
end

#command_map=(value) ⇒ Object



83
84
85
# File 'lib/sshkit/configuration.rb', line 83

def command_map=(value)
  @command_map = SSHKit::CommandMap.new(value)
end

#default_runner_configObject



32
33
34
# File 'lib/sshkit/configuration.rb', line 32

def default_runner_config
  @default_runner_config ||= { in: default_runner }
end

#default_runner_config=(config_hash) ⇒ Object



36
37
38
39
40
# File 'lib/sshkit/configuration.rb', line 36

def default_runner_config=(config_hash)
  config = config_hash.dup
  SSHKit.config.default_runner = config.delete(:in) if config[:in]
  @default_runner_config = config.merge(in: SSHKit.config.default_runner)
end

#deprecation_loggerObject



12
13
14
15
16
17
18
# File 'lib/sshkit/configuration.rb', line 12

def deprecation_logger
  unless defined? @deprecation_logger
    self.deprecation_output = $stderr
  end

  @deprecation_logger
end

#deprecation_output=(out) ⇒ Object



20
21
22
# File 'lib/sshkit/configuration.rb', line 20

def deprecation_output=(out)
  @deprecation_logger = DeprecationLogger.new(out)
end

#format=(format) ⇒ Object

TODO: deprecate in favor of ‘use_format`



55
56
57
# File 'lib/sshkit/configuration.rb', line 55

def format=(format)
  use_format(format)
end

#output_verbosityObject



46
47
48
# File 'lib/sshkit/configuration.rb', line 46

def output_verbosity
  @output_verbosity ||= logger(:info)
end

#output_verbosity=(verbosity) ⇒ Object



50
51
52
# File 'lib/sshkit/configuration.rb', line 50

def output_verbosity=(verbosity)
  @output_verbosity = logger(verbosity)
end

#use_format(formatter, *args) ⇒ Object

Tell SSHKit to use the specified ‘formatter` for stdout. The formatter can be the name of a built-in SSHKit formatter, like `:pretty`, a formatter class, like `SSHKit::Formatter::Pretty`, or a custom formatter class you’ve written yourself.

Additional arguments will be passed to the formatter’s constructor.

Example:

config.use_format(:pretty)

Is equivalent to:

config.output = SSHKit::Formatter::Pretty.new($stdout)


74
75
76
77
# File 'lib/sshkit/configuration.rb', line 74

def use_format(formatter, *args)
  klass = formatter.is_a?(Class) ? formatter : formatter_class(formatter)
  self.output = klass.new($stdout, *args)
end