require 'uri'
+require 'cgi'
require 'net/http'
require 'multi_json'
require 'nokogiri'
require "lyricli/lyricli"
require "lyricli/lyrics_engine"
require "lyricli/source_manager"
+require "lyricli/sources"
require "lyricli/sources/arguments"
require "lyricli/sources/rdio"
require "lyricli/sources/itunes"
+require "lyricli/exceptions"
+require "lyricli/exceptions/disable_source_error"
+require "lyricli/exceptions/enable_source_error"
+require "lyricli/exceptions/invalid_lyrics_error"
+require "lyricli/exceptions/lyrics_not_found_error"
+require "lyricli/exceptions/reset_source_error"
+require "lyricli/exceptions/source_configuration_error"
+require "lyricli/exceptions/start_source_error"
+require "lyricli/exceptions/unknown_source_error"
# The Lyricli module allows you to easily search for lyrics by looking for
# song and artist data from diverse sources.
# 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