Module | Rye |
In: |
lib/rye/key.rb
lib/rye/rap.rb lib/rye/set.rb lib/rye/cmd.rb lib/rye/box.rb lib/rye/hop.rb lib/rye.rb |
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’)
DEBUG | = | false unless defined?(Rye::DEBUG) |
DEBUG | = | false unless defined?(Rye::DEBUG) |
VERSION | = | "0.9.7".freeze unless defined?(VERSION) |
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.
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).
Execute a local system command (via the shell, not SSH)
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.
i l o 1 0
An all ruby implementation of unix "which" command.
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.