class Object
Public Instance Methods
find_exact_song(artist,album,song)
click to toggle source
skip the nuisance of escaping manually
# File lib/wrappers/itunes_play.rb, line 8 def find_exact_song(artist,album,song) itunes_location = Routinized.config['itunes_play']['directory'] Dir.chdir(itunes_location) matched_artist = Dir.glob("*#{artist}*").first Dir.chdir(matched_artist) matched_album = Dir.glob("*#{album}*").first Dir.chdir(matched_album) matched_song = Dir.glob("*#{song}*").first return "#{itunes_location}/#{matched_artist}/#{matched_album}/#{matched_song}" end
itunes_play(artist,album,song)
click to toggle source
# File lib/wrappers/itunes_play.rb, line 1 def itunes_play(artist,album,song) bin = Routinized.config['itunes_play']['bin'] full_path = find_exact_song(artist,album,song) return "#{bin} \"#{full_path}\" &" end
osx_notify(title,message = nil)
click to toggle source
# File lib/wrappers/osx_notify.rb, line 1 def osx_notify(title,message = nil) terminal_notifier = Routinized.config['osx_notify']['bin'] if message return "#{terminal_notifier} -title \"#{title}\" -message \"#{message}\" " else #piped version return "#{terminal_notifier} -title \"#{title}\" -message" end end
pipe()
click to toggle source
# File lib/wrappers/pipe.rb, line 1 def pipe " | parallel " end
r(command,args)
click to toggle source
# File lib/wrappers/r.rb, line 1 def r(command,args) return "/usr/bin/env routinized command #{command} #{args}" end
say(message = nil)
click to toggle source
# File lib/wrappers/say.rb, line 1 def say(message = nil) bin = Routinized.config['say']['bin'] if message return "#{bin} '#{message}'" else return "#{bin}" end end
sleep(seconds)
click to toggle source
# File lib/wrappers/sleep.rb, line 1 def sleep(seconds) "#{Routinized.config['sleep']['bin']} #{seconds} && " end
top(number)
click to toggle source
# File lib/wrappers/top.rb, line 1 def top(number) " | head -n #{number} " end