Class: CircleCI::CLI::Command::BuildWatcher

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build, verbose: false) ⇒ BuildWatcher

Returns a new instance of BuildWatcher.



9
10
11
12
13
14
# File 'lib/circleci/cli/command/watch_command/build_watcher.rb', line 9

def initialize(build, verbose: false)
  @client = Networking::CircleCIPusherClient.new.tap(&:connect)
  @build = build
  @verbose = verbose
  @messages = Hash.new { |h, k| h[k] = [] }
end

Instance Attribute Details

#buildObject (readonly)

Returns the value of attribute build.



7
8
9
# File 'lib/circleci/cli/command/watch_command/build_watcher.rb', line 7

def build
  @build
end

Instance Method Details

#startObject



16
17
18
19
# File 'lib/circleci/cli/command/watch_command/build_watcher.rb', line 16

def start
  bind_event_handling @build.channel_name
  notify_started
end

#stop(status) ⇒ Object



21
22
23
24
# File 'lib/circleci/cli/command/watch_command/build_watcher.rb', line 21

def stop(status)
  @client.unsubscribe(@build.channel_name + '@0')
  notify_stopped(status)
end