Module: Minestrone::Configuration::Actions::Inspect
- Included in:
- Minestrone::Configuration
- Defined in:
- lib/minestrone/configuration/actions/inspect.rb
Instance Method Summary collapse
-
#capture(command, options = {}) ⇒ Object
Executes the given command on the first server targetted by the current task, collects it’s stdout into a string, and returns the string.
-
#stream(command, options = {}) ⇒ Object
Streams the result of the command from the configured server.
Instance Method Details
#capture(command, options = {}) ⇒ Object
Executes the given command on the first server targetted by the current task, collects it’s stdout into a string, and returns the string. The command is invoked via #invoke_command.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/minestrone/configuration/actions/inspect.rb', line 31 def capture(command, = {}) output = "".dup invoke_command(command, .merge(:once => true, :eof => !command.include?(sudo))) do |ch, stream, data| case stream when :out then output << data when :err then warn "[err :: #{ch[:server]}] #{data}" end end output end |
#stream(command, options = {}) ⇒ Object
Streams the result of the command from the configured server. The command is invoked via #invoke_command.
Usage:
desc "Run a tail on multiple log files at the same time"
task :tail_fcgi do
stream "tail -f #{shared_path}/log/fastcgi.crash.log"
end
20 21 22 23 24 25 |
# File 'lib/minestrone/configuration/actions/inspect.rb', line 20 def stream(command, = {}) invoke_command(command, .merge(:eof => !command.include?(sudo))) do |ch, stream, out| puts out if stream == :out warn "[err :: #{ch[:server]}] #{out}" if stream == :err end end |