Class: Rutty::Runner

Inherits:
Object
  • Object
show all
Includes:
Actions, Consts, Helpers
Defined in:
lib/rutty/runner.rb

Overview

The Rutty::Runner class includes mixins from the other modules. All end-user interaction should be done through this class.

Author:

  • Josh Lindsey

Since:

  • 2.0.0

Constant Summary

Constants included from Consts

Consts::CONF_DIR, Consts::DEFAULT_OUTPUT_FORMAT, Consts::GENERAL_CONF, Consts::GENERAL_CONF_FILE, Consts::NODES_CONF, Consts::NODES_CONF_FILE, Consts::OUTPUT_FORMATS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Actions

#add_node, #connect_to_nodes, #dsh, #generate_output, #init, #list_nodes, #scp

Methods included from Helpers

#check_installed!, get_version, #seconds_in_words

Constructor Details

#initialize(config_dir = nil) ⇒ Runner

Initialize a new Rutty::Runner instance

Parameters:

  • config_dir (String) (defaults to: nil)

    Optional parameter specifying the directory RuTTY has been init’d into

Since:

  • 2.0.0



30
31
32
# File 'lib/rutty/runner.rb', line 30

def initialize config_dir = nil
  self.config_dir = config_dir
end

Instance Attribute Details

#configRutty::Config (readonly)

Lazy-load the Config object for this instance, based on the config_dir param passed to #initialize.

Returns:

Since:

  • 2.0.0



39
40
41
# File 'lib/rutty/runner.rb', line 39

def config
  @config
end

#config_dirString

The user-specified config directory, falling back to the default on nil. Used by Nodes.load_config and Config.load_config to determine where to look for config files.

Returns:

  • (String)

    The user-specified config directory, falling back to the default on nil.

See Also:

Since:

  • 2.0.0



59
60
61
# File 'lib/rutty/runner.rb', line 59

def config_dir
  (@config_dir.nil? && Rutty::Consts::CONF_DIR) || @config_dir
end

#nodesRutty::Nodes (readonly)

Lazy-load the Nodes object containing the user-defined nodes’ connection info. Loads from the config_dir param passed to #initialize

Returns:

Since:

  • 2.0.0



48
49
50
# File 'lib/rutty/runner.rb', line 48

def nodes
  @nodes
end

#output_formatString

The tool’s output format, passed by the user via the rutty bin’s flag. Must be one of the elements of Consts::OUTPUT_FORMATS. Defaults to Consts::DEFAULT_OUTPUT_FORMAT

Returns:

  • (String)

    The configured output format

See Also:

Since:

  • 2.0.0



71
72
73
# File 'lib/rutty/runner.rb', line 71

def output_format
  @output_format
end