Module: Honk

Defined in:
lib/honk.rb,
lib/honk/tasks.rb

Defined Under Namespace

Classes: Task

Constant Summary collapse

HONK =
File.expand_path('honk.aiff', __dir__)

Class Method Summary collapse

Class Method Details

.callObject



6
7
8
9
10
11
12
13
14
# File 'lib/honk.rb', line 6

def call
  if run_quietly('which afplay')
    run_quietly("afplay #{HONK}")
  elsif run_quietly('which mplayer')
    run_quietly("mplayer #{HONK}")
  else
    raise "No `afplay` or `mplayer` executable"
  end
end

.run_quietly(command) ⇒ Object



16
17
18
# File 'lib/honk.rb', line 16

def run_quietly(command)
  system(command, out: '/dev/null', err: '/dev/null')
end