Sha256: b12e31b20d431049673990e215f6ba568824f11e716a144b369139254c43971e
Contents?: true
Size: 1.28 KB
Versions: 4
Compression:
Stored size: 1.28 KB
Contents
require 'mattock/command-task' module Mattock module Rake class RemoteCommandTask < CommandTask setting(:remote_server, nested{ setting :address setting :port, 22 setting :user, nil }) setting(:ssh_options, []) setting(:verbose, 0) nil_fields(:id_file, :free_arguments) def ssh_option(name, value) ssh_options << "\"#{name}=#{value}\"" end def decorated(command_on_remote) fail "Need remote server for #{self.class.name}" unless remote_server.address raise "Empty remote command" if command_on_remote.nil? cmd("ssh") do |cmd| cmd.options << "-i #{id_file}" if id_file cmd.options << "-l #{remote_server.user}" unless remote_server.user.nil? cmd.options << remote_server.address cmd.options << "-p #{remote_server.port}" #ok cmd.options << "-n" cmd.options << "-#{'v'*verbose}" if verbose > 0 unless ssh_options.empty? ssh_options.each do |opt| cmd.options << "-o #{opt}" end end cmd - escaped_command(command_on_remote) end end end end class RemoteCommandTask < DeprecatedTaskAPI def target_class; Rake::RemoteCommandTask; end end end
Version data entries
4 entries across 4 versions & 1 rubygems