Class: Tagrity::Command::Stop

Inherits:
Object
  • Object
show all
Defined in:
lib/tagrity/commands/stop.rb

Class Method Summary collapse

Class Method Details

.call(dir) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tagrity/commands/stop.rb', line 9

def call(dir)
  pid_files = PidFile.alive_pid_files(dir: dir)
  if pid_files.empty?
    puts ::CLI::UI.fmt "{{red:#{"😕 tagrity doesn't seem to be watching #{dir}"}}}"
  else
    pid_files.each do |pid_file|
      pid_file.delete
      msg = "Successfully killed #{pid_file.pid} for dir #{dir}"
      puts ::CLI::UI.fmt "{{green:#{msg}}}"
      logger.info(msg)
    end
  end
end

.loggerObject



23
24
25
# File 'lib/tagrity/commands/stop.rb', line 23

def logger
  @logger ||= Provider.provide(:tlogger)
end