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.
configuration | [R] | The configuration instance employed by this shell |
configuration | [R] | The configuration instance employed by this shell |
# 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
# 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
Start the shell running. This method will block until the shell terminates.
# 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
Start the shell running. This method will block until the shell terminates.
# 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