Sha256: 41710ec6c75f2c7485a016a285514532fce67c0d10046f543056722b062331e0
Contents?: true
Size: 1018 Bytes
Versions: 6
Compression:
Stored size: 1018 Bytes
Contents
require 'escape' module Wordmove class LocalHost attr_reader :options attr_reader :logger attr_reader :ssh_extras def initialize(options = {}) @options = Hashie::Mash.new(options) @logger = @options[:logger] @ssh_extras = {} [ :port, :password ].each do |p| @ssh_extras.merge!( { p => @options.ssh[p] } ) if @options.ssh and @options.ssh[p] end puts "SSH options: #{@ssh_extras.inspect}" end def run(*args) command = shell_command(*args) logger.verbose "Executing locally #{command}" unless system(command) raise Thor::Error, "Error executing \"#{command}\"" end end def close end protected def shell_command(*args) options = args.extract_options! command = Escape.shell_command(args) if options[:stdin] command += " < #{options[:stdin]}" end if options[:stdout] command += " > #{options[:stdout]}" end command end end end
Version data entries
6 entries across 6 versions & 1 rubygems