Sha256: 17cd47bff2212498ffe0f9d48003703d514a9caad247459bd5495e3fe1e1d712

Contents?: true

Size: 983 Bytes

Versions: 6

Compression:

Stored size: 983 Bytes

Contents

# Tasks for running commands on destination hosts.
#
# Tasks:
#  * command: interactively run commands on destination servers
#  * command_execute: run a single command on destination servers
#
namespace :fezzik do
  desc "interactively run commands on destination servers"
  task :command do
    loop do
      print "run command (or \"quit\"): "
      STDOUT.flush
      input = STDIN.gets
      # Exit gracefully on <C-D>
      if input.nil?
        puts
        break
      end
      command = input.chomp
      next if command.empty?
      if ["quit", "q", "exit"].include? command.downcase
        break
      else
        begin
          Rake::Task["fezzik:command_execute"].invoke command
        ensure
          Rake::Task["fezzik:command_execute"].reenable
        end
      end
    end
  end

  desc "run a single command on destination servers"
  host_task(:command_execute, :args => :command) do |t, args|
    run args[:command], :continue_on_failure => true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fezzik-0.8.4 tasks/command.rake
fezzik-0.8.3 tasks/command.rake
fezzik-0.8.2 tasks/command.rake
fezzik-0.8.1 tasks/command.rake
fezzik-0.8.0 tasks/command.rake
fezzik-0.8.0.beta3 tasks/command.rake