X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/76e96cc0010b4db5159d3ebe360ce8e0e8729737..08a2ff7f2801498d5cf8f387e8c881ee1cda9a3c:/lib/lyricli.rb diff --git a/lib/lyricli.rb b/lib/lyricli.rb index 041959b..73c5811 100755 --- a/lib/lyricli.rb +++ b/lib/lyricli.rb @@ -1,4 +1,5 @@ require 'uri' +require 'cgi' require 'net/http' require 'multi_json' require 'nokogiri' @@ -59,18 +60,37 @@ module Lyricli # Enables a source via the Source Manager def self.enable(source_name) source_manager = SourceManager.new - source_manager.enable(source_name) + begin + source_manager.enable(source_name) + rescue Exceptions::UnknownSourceError + "There is no such Source" + end end # Disables a source via the Source Manager def self.disable(source_name) source_manager = SourceManager.new - source_manager.disable(source_name) + begin + source_manager.disable(source_name) + rescue Exceptions::UnknownSourceError + "There is no such Source" + end end # Resets all configuration for a source via the Source Manager def self.reset(source_name) source_manager = SourceManager.new - source_manager.reset(source_name) + begin + source_manager.reset(source_name) + rescue Exceptions::UnknownSourceError + "There is no such Source" + end + end + + # Returns the root of the Gem. + # + # @return [String] the root path for this gem + def self.root + File.expand_path('../..',__FILE__) end end