Class: Capistrano::Shell

Class | Capistrano::Shell
In: | lib/capistrano/shell.rb lib/capistrano/shell.rb
Parent: | Object

The Capistrano::Shell class is the guts of the "shell" task. It implements an interactive REPL interface that users can employ to execute tasks and commands. It makes for a GREAT way to monitor systems, and perform quick maintenance on one or more machines.

### Methods

new new read_and_execute read_and_execute run run run! run!

### Included Modules

Processable Processable

### Attributes

configuration | [R] | The configuration instance employed by this shell
configuration | [R] | The configuration instance employed by this shell

### Public Class methods

new(config)

Instantiate a new shell

[Source]

        # File lib/capistrano/shell.rb, line 33
    33:     def initialize(config)
    34:       @configuration = config
    35:     end

new(config)

Instantiate a new shell

[Source]

        # File lib/capistrano/shell.rb, line 33
    33:     def initialize(config)
    34:       @configuration = config
    35:     end

run(config)

Instantiate a new shell and begin executing it immediately.

[Source]

        # File lib/capistrano/shell.rb, line 28
    28:     def self.run(config)
    29:       new(config).run!
    30:     end

run(config)

Instantiate a new shell and begin executing it immediately.

[Source]

        # File lib/capistrano/shell.rb, line 28
    28:     def self.run(config)
    29:       new(config).run!
    30:     end

### Public Instance methods

read_and_execute()

[Source]

        # File lib/capistrano/shell.rb, line 58
    58:     def read_and_execute
    59:       command = read_line
    60:
    61:       case command
    62:         when "?", "help" then help
    63:         when "quit", "exit" then
    64:           puts "exiting"
    65:           return false
    66:         when /^set -(\w)\s*(\S+)/
    67:           set_option($1, $2)
    68:         when /^(?:(with|on)\s*(\S+))?\s*(\S.*)?/i
    69:           process_command($1, $2, $3)
    70:         else
    71:           raise "eh?"
    72:       end
    73:
    74:       return true
    75:     end

read_and_execute()

[Source]

        # File lib/capistrano/shell.rb, line 58
    58:     def read_and_execute
    59:       command = read_line
    60:
    61:       case command
    62:         when "?", "help" then help
    63:         when "quit", "exit" then
    64:           puts "exiting"
    65:           return false
    66:         when /^set -(\w)\s*(\S+)/
    67:           set_option($1, $2)
    68:         when /^(?:(with|on)\s*(\S+))?\s*(\S.*)?/i
    69:           process_command($1, $2, $3)
    70:         else
    71:           raise "eh?"
    72:       end
    73:
    74:       return true
    75:     end

run!()

Start the shell running. This method will block until the shell terminates.

[Source]

        # File lib/capistrano/shell.rb, line 39
    39:     def run!
    40:       setup
    41:
    42:       puts "====================================================================\nWelcome to the interactive Capistrano shell! This is an experimental\nfeature, and is liable to change in future releases. Type 'help' for\na summary of how to use the shell.\n--------------------------------------------------------------------\n"
    43:
    44:       loop do
    45:         break if !read_and_execute
    46:       end
    47:
    48:       @bgthread.kill
    49:     end

run!()

Start the shell running. This method will block until the shell terminates.

[Source]

        # File lib/capistrano/shell.rb, line 39
    39:     def run!
    40:       setup
    41:
    42:       puts "====================================================================\nWelcome to the interactive Capistrano shell! This is an experimental\nfeature, and is liable to change in future releases. Type 'help' for\na summary of how to use the shell.\n--------------------------------------------------------------------\n"
    43:
    44:       loop do
    45:         break if !read_and_execute
    46:       end
    47:
    48:       @bgthread.kill
    49:     end

[Validate]