Class: Pallets::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/pallets/cli.rb

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



5
6
7
8
9
10
11
# File 'lib/pallets/cli.rb', line 5

def initialize
  parse_options
  setup_signal_handlers

  @manager = Manager.new
  @signal_queue = Queue.new
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pallets/cli.rb', line 13

def run
  Pallets.logger.info 'Starting the awesome Pallets <3'
  Pallets.logger.info "Running on #{RUBY_DESCRIPTION}"

  @manager.start

  loop do
    # This blocks until signals are received
    handle_signal(@signal_queue.pop)
  end
rescue Interrupt
  Pallets.logger.info 'Shutting down...'
  @manager.shutdown
  Pallets.logger.info 'Buh-bye!'
  exit
end