Module: SSHake

Defined in:
lib/sshake/error.rb,
lib/sshake/klogger.rb,
lib/sshake/session.rb,
lib/sshake/version.rb,
lib/sshake/recorder.rb,
lib/sshake/response.rb,
lib/sshake/recording.rb,
lib/sshake/base_session.rb,
lib/sshake/mock/command.rb,
lib/sshake/mock/session.rb,
lib/sshake/mock/command_set.rb,
lib/sshake/mock/environment.rb,
lib/sshake/recorded_session.rb,
lib/sshake/execution_options.rb,
lib/sshake/execution_options_dsl.rb,
lib/sshake/mock/executed_command.rb,
lib/sshake/mock/unsupported_command_error.rb

Defined Under Namespace

Modules: Mock Classes: BaseSession, Error, ExecutionError, ExecutionOptions, ExecutionOptionsDSL, NestedRecordingsUnsupportedError, RecordedSession, Recorder, Response, Session

Constant Summary collapse

VERSION =
'2.0.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.kloggerObject



7
8
9
# File 'lib/sshake/klogger.rb', line 7

def klogger
  @klogger ||= Klogger.new(:ssh, destination: $stdout, formatter: :go)
end

Class Method Details

.record(name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sshake/recording.rb', line 14

def record(name)
  if Thread.current[:sshake_recorder]
    raise NestedRecordingsUnsupportedError, 'You cannot nest SSHake.record blocks'
  end

  recorder = Recorder.new(name)
  recorder.load
  Thread.current[:sshake_recorder] = recorder
  yield
ensure
  Thread.current[:sshake_recorder] = nil
end