Class: Skipper::Repl

Inherits:
Object
  • Object
show all
Defined in:
lib/skipper/repl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, cli) ⇒ Repl

Returns a new instance of Repl.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/skipper/repl.rb', line 7

def initialize(options, cli)
  @options = options
  @cli = cli

  if options.servers?
    @servers = Skipper::Servers::Basic.new(options)
  else
    @servers = Skipper::Servers::EC2.new(options)
  end

  @runner = Skipper::Runner.new(@servers, options, cli)
end

Instance Attribute Details

#cliObject

Returns the value of attribute cli.



5
6
7
# File 'lib/skipper/repl.rb', line 5

def cli
  @cli
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/skipper/repl.rb', line 5

def options
  @options
end

#runnerObject

Returns the value of attribute runner.



5
6
7
# File 'lib/skipper/repl.rb', line 5

def runner
  @runner
end

#serversObject

Returns the value of attribute servers.



5
6
7
# File 'lib/skipper/repl.rb', line 5

def servers
  @servers
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/skipper/repl.rb', line 20

def run
  loop do
    begin
      repl
    rescue SSHKit::Runner::ExecuteError => e
      cli.say e, :red
    rescue Interrupt
      puts ''
    end
  end
end