Class: Capistrano::Shell

### Home Classes Methods

### In Files

- lib/capistrano/shell.rb

### Parent

Object

### Methods

- ::new
- ::run
- #read_and_execute
- #run!

### Included Modules

- Capistrano::Processable

### Files

- help.txt

### Class/Module Index

Quicksearch

- Capistrano
- Capistrano::CLI
- Capistrano::CLI::Execute
- Capistrano::CLI::Execute::ClassMethods
- Capistrano::CLI::Help
- Capistrano::CLI::Options
- Capistrano::CLI::Options::ClassMethods
- Capistrano::CLI::UI
- Capistrano::CLI::UI::ClassMethods
- Capistrano::Callback
- Capistrano::Command
- Capistrano::Command::Tree
- Capistrano::Command::Tree::Branch
- Capistrano::Command::Tree::ConditionBranch
- Capistrano::Command::Tree::ConditionBranch::Evaluator
- Capistrano::Command::Tree::ElseBranch
- Capistrano::Configuration
- Capistrano::Configuration::Actions
- Capistrano::Configuration::Actions::FileTransfer
- Capistrano::Configuration::Actions::Inspect
- Capistrano::Configuration::Actions::Invocation
- Capistrano::Configuration::Actions::Invocation::ClassMethods
- Capistrano::Configuration::AliasTask
- Capistrano::Configuration::Callbacks
- Capistrano::Configuration::Connections
- Capistrano::Configuration::Execution
- Capistrano::Configuration::Loading
- Capistrano::Configuration::Loading::ClassMethods
- Capistrano::Configuration::LogFormatters
- Capistrano::Configuration::Namespaces
- Capistrano::Configuration::Namespaces::Namespace
- Capistrano::Configuration::Roles
- Capistrano::Configuration::Servers
- Capistrano::Configuration::Variables
- Capistrano::Deploy
- Capistrano::Deploy::Dependencies
- Capistrano::Deploy::LocalDependency
- Capistrano::Deploy::RemoteDependency
- Capistrano::Deploy::SCM
- Capistrano::Deploy::SCM::Accurev
- Capistrano::Deploy::SCM::Accurev::InternalRevision
- Capistrano::Deploy::SCM::Base
- Capistrano::Deploy::SCM::Base::LocalProxy
- Capistrano::Deploy::SCM::Bzr
- Capistrano::Deploy::SCM::Cvs
- Capistrano::Deploy::SCM::Darcs
- Capistrano::Deploy::SCM::Git
- Capistrano::Deploy::SCM::Mercurial
- Capistrano::Deploy::SCM::None
- Capistrano::Deploy::SCM::Perforce
- Capistrano::Deploy::SCM::Subversion
- Capistrano::Deploy::Strategy
- Capistrano::Deploy::Strategy::Base
- Capistrano::Deploy::Strategy::Checkout
- Capistrano::Deploy::Strategy::Copy
- Capistrano::Deploy::Strategy::Export
- Capistrano::Deploy::Strategy::Remote
- Capistrano::Deploy::Strategy::RemoteCache
- Capistrano::Deploy::Strategy::UnsharedRemoteCache
- Capistrano::ProcCallback
- Capistrano::Processable
- Capistrano::Processable::SessionAssociation
- Capistrano::RemoteError
- Capistrano::Role
- Capistrano::Role::DynamicServerList
- Capistrano::SSH
- Capistrano::ServerDefinition
- Capistrano::Shell
- Capistrano::TaskCallback
- Capistrano::TaskDefinition
- Capistrano::Transfer
- Capistrano::Transfer::SFTPTransferWrapper
- Capistrano::Version
- Kernel
- Object
- String

No matching classes.

# Capistrano::Shell

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.

### Attributes

configuration[R]

The configuration instance employed by this shell

### Public Class Methods

new(config) click to toggle source

Instantiate a new shell

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

run(config) click to toggle source

Instantiate a new shell and begin executing it immediately.

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

### Public Instance Methods

read_and_execute() click to toggle source

    # File lib/capistrano/shell.rb, line 57
    def read_and_execute
      command = read_line

      case command
        when "?", "help" then help
        when "quit", "exit" then
          puts "exiting"
          return false
        when /^set -(\w)\s*(\S+)/
          set_option($1, $2)
        when /^set :(.*)\s+(.*)/
          configuration.set($1.to_sym, $2)
          puts "updated :#{$1} to #{$2}"
        when /^(?:(with|on)\s*(\S+))?\s*(\S.*)?/
          process_command($1, $2, $3)
        else
          raise "eh?"
      end

      return true
    end

run!() click to toggle source

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

    # File lib/capistrano/shell.rb, line 39
    def run!
      setup

      puts ====================================================================Welcome to the interactive Capistrano shell! This is an experimentalfeature, and is liable to change in future releases. Type 'help' fora summary of how to use the shell.--------------------------------------------------------------------

      loop do
        break if !read_and_execute
      end

      @bgthread.kill
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.