#!/usr/bin/env ruby -w
+require 'optparse'
require 'lyricli'
+
+
+options = {}
+OptionParser.new do |opts|
+ opts.banner = %{Usage:
+ lrc [options]
+ lrc artist song
+ lrc You must enable other sources for this
+
+Options:
+}
+
+ opts.on("-e", "--enable SOURCE", "Enable SOURCE") do |source|
+ puts "Enabling sources is not yet implemented"
+ exit
+ end
+
+ opts.on("-l", "--list-sources", "List all available Sources") do
+ puts Lyricli.sources
+ exit
+ end
+
+ opts.on("-d", "--disable SOURCE", "Disable SOURCE") do |source|
+ puts "Disabling sources is not yet implemented"
+ exit
+ end
+
+ opts.on("-r", "--reset SOURCE", "Reset the configuration of SOURCE") do |source|
+ puts "Resetting sources is not yet implemented"
+ exit
+ end
+
+ opts.on("-h", "--help", "Shows this message") do
+ puts opts
+ exit
+ end
+
+ opts.on("-v", "--version", "Show version") do
+ puts Lyricli.version
+ exit
+ end
+end.parse!
+
+
puts Lyricli.lyrics
@lyricli = Lyricli.new
@lyricli.get_lyrics
end
+
+ def self.version
+ Gem.loaded_specs["lyricli"].version
+ end
+
+ def self.sources
+ source_manager = SourceManager.new
+ source_manager.available_sources.join(", ")
+ end
+
+ def self.enable
+
+ end
+
+ def self.disable
+
+ end
+
+ def self.reset
+
+ end
end
end
track
end
+
+ def available_sources
+ path_root = File.expand_path(File.dirname(__FILE__))
+ sources = Dir[path_root+"/sources/*"].map{ |s|
+ s.split("/").last.gsub(/\.rb/, "")
+ }
+
+ # Remove arguments (Hack?) We don't want anybody to touch tihs one.
+ sources.delete("arguments")
+ sources
+ end
end
end
s.files += Dir['[A-Z]*'] + Dir['spec/**/*']
s.files += Dir['lib/**/*.json']
+ s.executables << 'lrc'
+
# Runtime Dependencies
s.add_runtime_dependency 'nokogiri', '~> 1.5.5'
s.add_runtime_dependency 'multi_json', '~> 1.3.6'