Module: DeploySounds
- Defined in:
- lib/deploy_sounds.rb
Overview
This module inspired by github.com/nodanaonlyzuul/Paul-Dix–Thundergod
Constant Summary collapse
- AUDIO_PLAY_COMMANDS =
%w(afplay play)
Class Method Summary collapse
Class Method Details
.play ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/deploy_sounds.rb', line 5 def self.play AUDIO_PLAY_COMMANDS.each do |command| random_file = Dir.glob("#{ENV['HOME']}/.deploy_sounds/*").sample unless random_file puts "[deploy_sounds] You don't have a ~/.deploy_sounds or it's empty." break end if system("which #{command}") `#{command} #{random_file} &` break end end end |