Class: Rutty::Runner

Inherits:
Object
  • Object
show all
Includes:
Actions, Consts, Helpers
Defined in:
lib/rutty.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



37
38
39
# File 'lib/rutty.rb', line 37

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



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

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



66
67
68
# File 'lib/rutty.rb', line 66

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



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

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



78
79
80
# File 'lib/rutty.rb', line 78

def output_format
  @output_format
end