Module: RobotArmy

Defined in:
lib/robot-army.rb,
lib/robot-army/messenger.rb,
lib/robot-army/task_master.rb,
lib/robot-army/dependency_loader.rb

Defined Under Namespace

Classes: AtExit, Connection, ConnectionNotOpen, DependencyError, DependencyLoader, EvalBuilder, EvalCommand, Exit, GateKeeper, HostArityError, IO, InvalidPassword, Keychain, Loader, Messenger, Officer, OfficerConnection, OfficerLoader, Proxy, RemoteEvaler, ShellCommandError, Soldier, TaskMaster, Warning

Constant Summary collapse

CHARACTERS =
%w[a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9]

Class Method Summary collapse

Class Method Details

.ask_for_password(host, data = {}) ⇒ Object



72
73
74
75
# File 'lib/robot-army.rb', line 72

def self.ask_for_password(host, data={})
  require 'highline'
  HighLine.new.ask("[sudo] password for #{data[:user]}@#{host}: ") {|q| q.echo = false}
end

.random_string(length = 16) ⇒ String

Generates a random string of lowercase letters and numbers.

Parameters:

  • length (Fixnum) (defaults to: 16)

    The length of the string to generate.

Returns:

  • (String)

    The random string.



68
69
70
# File 'lib/robot-army.rb', line 68

def self.random_string(length=16)
  (0...length).map{ CHARACTERS[rand(CHARACTERS.size)] }.join
end

.upstreamRobotArmy::Messenger

Gets the upstream messenger.

Returns:



21
22
23
# File 'lib/robot-army.rb', line 21

def self.upstream
  @upstream
end

.upstream=(messenger) ⇒ Object

Sets the upstream messenger.

Parameters:



30
31
32
# File 'lib/robot-army.rb', line 30

def self.upstream=(messenger)
  @upstream = messenger
end