Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 58 lines (46 sloc) 1.694 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
# require 'net/ssh/telnet'

# module Lobot
# module Sobo
# class Server
# PROMPT_REGEX = /[$%#>] (\z|\e)/n

# attr_reader :ip, :key

# def initialize(ip, key)
# @ip = ip
# @key = key
# end

# def ssh_session
# @ssh_session ||= Net::SSH.start(ip, "ubuntu", :keys => [key])
# end

# def shell
# @shell ||= Net::SSH::Telnet.new('Session' => ssh_session, 'Prompt' => PROMPT_REGEX)
# end


# def upload(from, to, opts = "--exclude .git")
# system("rsync -avz --delete #{from} ubuntu@#{ip}:#{to} #{opts}")
# end

# def run(*command_fragments)
# command = command_fragments.join(' ')
# result = run_command(command)
# raise "Command failed: #{command}" unless run_command('echo $?', true) == '0'
# result
# end

# def run!(*command_fragments)
# run_command(command_fragments.join(' '))
# end

# def run?(*command_fragments)
# run_command(command_fragments.join(' '))
# run_command("echo $?") == '0'
# end

# def run_silently(*command_fragments)
# command = command_fragments.join(' ')
# result = run_command(command, true)
# raise "Command failed: <silenced>" unless run_command('echo $?', true) == '0'
# result
# end

# def run_command(command, silent=false)
# output = shell.cmd(command) {|data| print data.gsub(/(\r|\r\n|\n\r)+/, "\n") unless silent }
# command_regex = /#{Regexp.escape(command)}/
# output.split("\n").reject {|l| l.match(command_regex) || l.match(PROMPT_REGEX)}.join("\n")
# end
# end
# end
# end
Something went wrong with that request. Please try again.