Module: Shells

Defined in:
lib/shells.rb,
lib/shells/errors.rb,
lib/shells/version.rb,
lib/shells/ssh_shell.rb,
lib/shells/shell_base.rb,
lib/shells/bash_common.rb,
lib/shells/serial_shell.rb,
lib/shells/shell_base/run.rb,
lib/shells/ssh_bash_shell.rb,
lib/shells/pf_sense_common.rb,
lib/shells/shell_base/exec.rb,
lib/shells/shell_base/sync.rb,
lib/shells/pf_shell_wrapper.rb,
lib/shells/shell_base/debug.rb,
lib/shells/shell_base/hooks.rb,
lib/shells/shell_base/input.rb,
lib/shells/serial_bash_shell.rb,
lib/shells/shell_base/output.rb,
lib/shells/shell_base/prompt.rb,
lib/shells/shell_base/options.rb,
lib/shells/ssh_pf_sense_shell.rb,
lib/shells/shell_base/interface.rb,
lib/shells/serial_pf_sense_shell.rb,
lib/shells/shell_base/regex_escape.rb

Overview

A set of basic shell classes.

Defined Under Namespace

Modules: BashCommon, PfSenseCommon Classes: AlreadyRunning, CommandTimeout, FailedToSetPrompt, InvalidOption, NonZeroExitCode, NotRunning, PfShellWrapper, QuitNow, SerialBashShell, SerialPfSenseShell, SerialShell, ShellBase, ShellError, ShellTimeout, SilenceTimeout, SshBashShell, SshPfSenseShell, SshShell

Constant Summary collapse

VERSION =
"0.2.2"

Class Method Summary collapse

Class Method Details

.method_missing(m, *args, &block) ⇒ Object

Provides the ability for the Shells module to allow sessions to be instantiated without calling new.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/shells.rb', line 19

def self.method_missing(m, *args, &block)  #:nodoc:

  is_const =
      if m.to_s =~ /^[A-Z][a-zA-Z0-9_]*$/ # must start with uppercase and contain only letters, numbers, and underscores.
        begin
          const_defined?(m)
        rescue NameError  # if for some reason we still get a NameError, it's obviously not a constant.
          false
        end
      else
        false
      end

  if is_const
    val = const_get(m)
    if val.is_a?(Class) && Shells::ShellBase > val
      return val.new(*args, &block)
    end
  end

  super
end