lib/con_ssh.rb in con_ssh-0.0.2 vs lib/con_ssh.rb in con_ssh-0.0.3

- old
+ new

@@ -67,11 +67,11 @@ msg = "Skipping knock! The connection configuration has ports knock set but you don`t have 'knock' installed on your system. Please install: 'apt-get install knockd', 'brew install knock', ...".strip_text warn msg return - end + end run_cmd "knock #{ host } #{ ports.join ' ' }", false end # Conf @@ -86,11 +86,11 @@ end def add_connection line return if skip_line? line - values = line.split /\s+/ + values = line.split(/\s+/) conn_conf = OpenStruct.new CONF_LINE_FIELDS.each_with_index do |field, idx| conn_conf[field.to_sym] = values[idx] end @@ -115,11 +115,11 @@ c.conn_desc && c.host end def adjust_conn_conf c - c.knock = c.knock.split ',' if c.knock + c.knock = c.knock.split ',' if c.knock c.unknock = c.unknock.split ',' if c.unknock if c.host =~ /^(.*?)@(.*?)$/ c.host = $2 c.user ||= $1 @@ -165,12 +165,12 @@ puts "Usage: con <shortcut>|setup [knock|unknock]".strip_text end def run_cmd cmd, print = true puts "run: #{cmd}" if print - output = `#{cmd} 2>&1` - exit_status = $?.to_i - unless exit_status == 0 + output = `#{cmd} 2>&1` + exit_status = $?.to_i + unless exit_status == 0 warn "Non-zero output: #{output}" end [exit_status, output] end end