Module: Nutshell

Defined in:
lib/nutshell.rb,
lib/nutshell/shell.rb,
lib/nutshell/remote_shell.rb

Defined Under Namespace

Classes: CmdError, ConnectionError, RemoteShell, Shell, TimeoutError

Constant Summary collapse

VERSION =
"1.0.1"
TMP_DIR =

Temp directory used by various nutshell classes for uploads, checkouts, etc…

File.join Dir.tmpdir, "nutshell_#{$$}"
DEFAULT_CONFIG =
{
  :timeout => 300,
  :interactive => true,
  :tty_state_freq => 0.1
}

Class Method Summary collapse

Class Method Details

.configObject

Set the config.



34
35
36
# File 'lib/nutshell.rb', line 34

def self.config
  @config ||= DEFAULT_CONFIG.dup
end

.interactive?Boolean

Defines if process should fail when user interaction is required. Defaults to true. Reads config.

Returns:

  • (Boolean)


52
53
54
# File 'lib/nutshell.rb', line 52

def self.interactive?
  config[:interactive]
end

.timeoutObject

How long to wait with no data coming in before timing out. Reads config.



43
44
45
# File 'lib/nutshell.rb', line 43

def self.timeout
  config[:timeout]
end

.tty_state_freqObject

How often to check the state of the tty in seconds. Used for detecting prompts. Defaults to 0.1. Reads config.



62
63
64
# File 'lib/nutshell.rb', line 62

def self.tty_state_freq
  config[:tty_state_freq]
end