Class: Fyi

Inherits:
Object
  • Object
show all
Defined in:
lib/fyi.rb,
lib/fyi/config.rb,
lib/fyi/notifiers/log.rb,
lib/fyi/notifiers/email.rb

Overview

See /bin/fyi for documentation.

Defined Under Namespace

Classes: Config, Notifier

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Fyi

Returns a new instance of Fyi.



14
15
16
17
# File 'lib/fyi.rb', line 14

def initialize(command)
  @command = command
  @config = Config.new
end

Class Method Details

.run(command) ⇒ Object



10
11
12
# File 'lib/fyi.rb', line 10

def self.run(command)
  new(command).run
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/fyi.rb', line 19

def run
  # Borrowed from CI Joe.
  out, err, status = '', '', nil
  status = Open4.popen4(@command) do |@pid, stdin, stdout, stderr|
    err, out = stderr.read.strip, stdout.read.strip
  end
  status.exitstatus.to_i == 0 ? run_succeeded(out) : run_failed(out, err)
rescue Object => e
  run_failed('', e.to_s)
end