Class: CircleCI::CLI::Command::WatchCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/circleci/cli/command/watch_command.rb

Class Method Summary collapse

Methods inherited from BaseCommand

build_number, project_name, reponame, setup_token, should_be_pretty

Class Method Details

.run(options) ⇒ Object

rubocop:disable Metrics/MethodLength



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

def run(options) # rubocop:disable Metrics/MethodLength
  setup_token

  @options = options
  @repository = BuildRepository.new(*project_name(options).split('/'))
  @client = Networking::CircleCIPusherClient.new.tap(&:connect)
  @build_watcher = nil

  bind_status_event

  loop do
    stop_existing_watcher_if_needed
    start_watcher_if_needed
    sleep 1
  end
rescue Interrupt
  say 'Exited'
end