VERSION | = | Version.to_s |
VERSION | = | Version.to_s |
Create an instance of the commandline application of launchy
# File lib/launchy.rb, line 47 47: def command_line 48: Launchy::CommandLine.new 49: end
Create an instance of the commandline application of launchy
# File lib/launchy.rb, line 47 47: def command_line 48: Launchy::CommandLine.new 49: end
Setting the LAUNCHY_DEBUG environment variable to ‘true’ will spew debug information to $stderr
# File lib/launchy.rb, line 40 40: def log(msg) 41: if ENV['LAUNCHY_DEBUG'] == 'true' then 42: $stderr.puts "LAUNCHY_DEBUG: #{msg}" 43: end 44: end
Setting the LAUNCHY_DEBUG environment variable to ‘true’ will spew debug information to $stderr
# File lib/launchy.rb, line 40 40: def log(msg) 41: if ENV['LAUNCHY_DEBUG'] == 'true' then 42: $stderr.puts "LAUNCHY_DEBUG: #{msg}" 43: end 44: end
Convenience method to launch an item
# File lib/launchy.rb, line 21 21: def open(*params) 22: begin 23: klass = Launchy::Application.find_application_class_for(*params) 24: if klass then 25: klass.run(*params) 26: else 27: msg = "Unable to launch #{params.join(' ')}" 28: Launchy.log "#{self.name} : #{msg}" 29: $stderr.puts msg 30: end 31: rescue Exception => e 32: msg = "Failure in opening #{params.join(' ')} : #{e}" 33: Launchy.log "#{self.name} : #{msg}" 34: $stderr.puts msg 35: end 36: end
Convenience method to launch an item
# File lib/launchy.rb, line 21 21: def open(*params) 22: begin 23: klass = Launchy::Application.find_application_class_for(*params) 24: if klass then 25: klass.run(*params) 26: else 27: msg = "Unable to launch #{params.join(' ')}" 28: Launchy.log "#{self.name} : #{msg}" 29: $stderr.puts msg 30: end 31: rescue Exception => e 32: msg = "Failure in opening #{params.join(' ')} : #{e}" 33: Launchy.log "#{self.name} : #{msg}" 34: $stderr.puts msg 35: end 36: end
Utility method to require all files ending in .rb in the directory with the same name as this file minus .rb
# File lib/launchy.rb, line 6 6: def self.require_all_libs_relative_to(fname) 7: prepend = File.basename(fname,".rb") 8: search_me = File.join(File.dirname(fname),prepend) 9: 10: Dir.entries(search_me).each do |rb| 11: if File.extname(rb) == ".rb" then 12: require "#{prepend}/#{File.basename(rb,".rb")}" 13: end 14: end 15: end
Utility method to require all files ending in .rb in the directory with the same name as this file minus .rb
# File lib/launchy.rb, line 6 6: def self.require_all_libs_relative_to(fname) 7: prepend = File.basename(fname,".rb") 8: search_me = File.join(File.dirname(fname),prepend) 9: 10: Dir.entries(search_me).each do |rb| 11: if File.extname(rb) == ".rb" then 12: require "#{prepend}/#{File.basename(rb,".rb")}" 13: end 14: end 15: end