Module Rye
In: lib/rye/set.rb
lib/rye/cmd.rb
lib/rye/box.rb
lib/rye/hop.rb
lib/rye/key.rb
lib/rye/rap.rb
lib/rye.rb

Rye

Safely run remote commands via SSH in Ruby.

Rye is similar to Rush but everything happens over SSH (no HTTP daemon) and the default settings are less dangerous (for safety). For example, file globs and the "rm" command are disabled so unless otherwise specified, you can‘t do this: rbox.rm(’/etc/**/*’).

However, you can do this:

rset = Rye::Set.new("dev-machines") rset.add_boxes(‘host1’, ‘host2’, ‘host3’, ‘host4’) rset.ps(‘aux’)

  • See +bin/try+ for a bunch of working examples.
  • See Rye::Box#initialize for info about disabling safe-mode.

Methods

Classes and Modules

Module Rye::Cmd
Class Rye::Box
Class Rye::CommandNotFound
Class Rye::Err
Class Rye::Hop
Class Rye::Key
Class Rye::NoBoxes
Class Rye::NoHost
Class Rye::NoPassword
Class Rye::NoPty
Class Rye::NotConnected
Class Rye::Rap
Class Rye::RyeError
Class Rye::Set
Class Rye::Tpl

Constants

DEBUG = false unless defined?(Rye::DEBUG)
DEBUG = false unless defined?(Rye::DEBUG)
VERSION = "0.9.7".freeze unless defined?(VERSION)

Public Class methods

Accessor for an instance of SystemInfo

Public Instance methods

Add one or more private keys to the SSH Agent.

  • keys one or more file paths to private keys used for passwordless logins.

Creates a string from cmd and args. If safe is true it will send them through Escape.shell_command otherwise it will return them joined by a space character.

Looks for private keys in path and returns and Array of paths to the files it finds. Raises an Exception if path does not exist. If path is a file rather than a directory, it will check whether that single file is a private key.

Returns an Array of info about the currently available SSH keys, as provided by the SSH Agent.

Returns: [[bits, finger-print, file-path], …]

Takes a command with arguments and returns it in a single String with escaped args and some other stuff.

  • cmd The shell command name or absolute path.
  • args an Array of command arguments.

The command is searched for in the local PATH (where Rye is running). An exception is raised if it‘s not found. NOTE: Because this happens locally, you won‘t want to use this method if the environment is quite different from the remote machine it will be executed on.

The command arguments are passed through Escape.shell_command (that means you can‘t use environment variables or asterisks).

Reload Rye dynamically. Useful with irb. NOTE: does not reload rye.rb.

Execute a local system command (via the shell, not SSH)

  • cmd the executable path (relative or absolute)
  • args Array of arguments to be sent to the command. Each element

is one argument:. i.e. [’-l’, ‘some/path’]

NOTE: shell is a bit paranoid so it escapes every argument. This means you can only use literal values. That means no asterisks too.

Returns a Rye::Rap object.

Generates a string of random alphanumeric characters.

  • len is the length, an Integer. Default: 8
  • safe in safe-mode, ambiguous characters are removed (default: true):
        i l o 1 0
    

Accessor for an instance of SystemInfo

An all ruby implementation of unix "which" command.

  • executable the name of the executable

Returns the absolute path if found in PATH otherwise nil.

Returns str with the leading indentation removed. Stolen from github.com/mynyml/unindent/ because it was better.

[Validate]