From: Ben Beltran Date: Sat, 6 Oct 2012 04:28:43 +0000 (-0500) Subject: Gemification, Basically works. X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/commitdiff_plain/823e558b5cd2ec219d0fc7226c54f2ee7ad807d2?ds=inline Gemification, Basically works. Only with arguments though. Neither the iTunes nor the rdio sources have been implemented --- diff --git a/.yardoc/checksums b/.yardoc/checksums new file mode 100644 index 0000000..1167f83 --- /dev/null +++ b/.yardoc/checksums @@ -0,0 +1,9 @@ +lib/lyricli.rb 086e293fec4488ede35adbb911723c47205cdd42 +lib/lyricli/util.rb 069f80245171b855a8df437f114e6fd14a750623 +lib/lyricli/sources/rdio.rb 1a689bcee864f3f558bb4d5ee29e6a4bdb449991 +lib/lyricli/lyrics_engine.rb aa9de79d61c208533999db8604123e31f6f99b70 +lib/lyricli/configuration.rb ceebe35a6098aa48fe1f3d788f40350fcc9bf3ed +lib/lyricli/sources/itunes.rb da39a3ee5e6b4b0d3255bfef95601890afd80709 +lib/lyricli/source_manager.rb c3d4c5bb7fec881e4edbcef97d863f1f5974e183 +lib/lyricli/sources/arguments.rb de3b31f05d118cf00fccb41e47fd35979da9eb14 +lib/lyricli/lyricli.rb 8a5db180cd047b932626c7eea51a71715c689c1f diff --git a/.yardoc/object_types b/.yardoc/object_types new file mode 100644 index 0000000..04c3b69 Binary files /dev/null and b/.yardoc/object_types differ diff --git a/.yardoc/objects/root.dat b/.yardoc/objects/root.dat new file mode 100644 index 0000000..13c77bb Binary files /dev/null and b/.yardoc/objects/root.dat differ diff --git a/.yardoc/proxy_types b/.yardoc/proxy_types new file mode 100644 index 0000000..ac416fe --- /dev/null +++ b/.yardoc/proxy_types @@ -0,0 +1,2 @@ +{I" Object:EF: +class \ No newline at end of file diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 997d654..0000000 --- a/Gemfile +++ /dev/null @@ -1,8 +0,0 @@ -source :rubygems - -gem 'nokogiri', "~> 1.5.5" -gem 'multi_json', "~> 1.3.6" -gem 'rdio', "~> 0.1.0" -gem "launchy", "~> 2.1.2" - -gem 'ruby-debug19', "~> 0.11.6" diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index ea915f8..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,37 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - addressable (2.3.2) - archive-tar-minitar (0.5.2) - columnize (0.3.6) - json (1.7.5) - launchy (2.1.2) - addressable (~> 2.3) - linecache19 (0.5.12) - ruby_core_source (>= 0.1.4) - multi_json (1.3.6) - nokogiri (1.5.5) - oauth (0.4.7) - rdio (0.1.0) - json - oauth (>= 0.3.0) - ruby-debug-base19 (0.11.25) - columnize (>= 0.3.1) - linecache19 (>= 0.5.11) - ruby_core_source (>= 0.1.4) - ruby-debug19 (0.11.6) - columnize (>= 0.3.1) - linecache19 (>= 0.5.11) - ruby-debug-base19 (>= 0.11.19) - ruby_core_source (0.1.5) - archive-tar-minitar (>= 0.5.2) - -PLATFORMS - ruby - -DEPENDENCIES - launchy (~> 2.1.2) - multi_json (~> 1.3.6) - nokogiri (~> 1.5.5) - rdio (~> 0.1.0) - ruby-debug19 (~> 0.11.6) diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/bin/lrc b/bin/lrc old mode 100644 new mode 100755 index e69de29..52926e3 --- a/bin/lrc +++ b/bin/lrc @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby -w + +require 'lyricli' +puts Lyricli.lyrics diff --git a/doc/Lyricli.html b/doc/Lyricli.html new file mode 100644 index 0000000..8c0685a --- /dev/null +++ b/doc/Lyricli.html @@ -0,0 +1,190 @@ + + + + + + Module: Lyricli + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Module: Lyricli + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/lyricli.rb,
+ lib/lyricli/util.rb,
lib/lyricli/sources/rdio.rb,
lib/lyricli/lyrics_engine.rb,
lib/lyricli/configuration.rb,
lib/lyricli/source_manager.rb,
lib/lyricli/sources/arguments.rb
+
+ +
+
+ +

Defined Under Namespace

+

+ + + Modules: Sources, Util + + + + Classes: Configuration, Lyricli, LyricsEngine, SourceManager + + +

+ + + + + + + + +

+ Class Method Summary + (collapse) +

+ + + + + + +
+

Class Method Details

+ + +
+

+ + + (Object) execute + + + + + +

+ + + + +
+
+
+
+29
+30
+31
+32
+
+
# File 'lib/lyricli.rb', line 29
+
+def self.execute
+  @lyricli = Lyricli.new
+  @lyricli.get_lyrics
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Lyricli/Configuration.html b/doc/Lyricli/Configuration.html new file mode 100644 index 0000000..7ca3571 --- /dev/null +++ b/doc/Lyricli/Configuration.html @@ -0,0 +1,401 @@ + + + + + + Class: Lyricli::Configuration + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Class: Lyricli::Configuration + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/lyricli/configuration.rb
+ +
+
+ + +

Constant Summary

+ +
+ +
@@instance = + +
+
Configuration.new
+ +
+ + + + + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Configuration) initialize + + + + + +

+
+

+A new instance of Configuration +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+4
+5
+6
+7
+
+
# File 'lib/lyricli/configuration.rb', line 4
+
+def initialize
+  @config_path = "~/.lyricli.conf"
+  @defaults_path = "defaults.json"
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) instance + + + + + +

+ + + + +
+
+
+
+11
+12
+13
+
+
# File 'lib/lyricli/configuration.rb', line 11
+
+def self.instance
+  @@instance
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Object) [](key) + + + + + +

+ + + + +
+
+
+
+15
+16
+17
+18
+
+
# File 'lib/lyricli/configuration.rb', line 15
+
+def [](key)
+  load_config unless @config
+  @config[key]
+end
+
+
+ +
+

+ + - (Object) []=(key, value) + + + + + +

+ + + + +
+
+
+
+20
+21
+22
+23
+24
+
+
# File 'lib/lyricli/configuration.rb', line 20
+
+def []=(key, value)
+  load_config unless @config
+  @config[key] = value
+  save_config
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Lyricli/Lyricli.html b/doc/Lyricli/Lyricli.html new file mode 100644 index 0000000..6d8ed13 --- /dev/null +++ b/doc/Lyricli/Lyricli.html @@ -0,0 +1,438 @@ + + + + + + Class: Lyricli::Lyricli + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Class: Lyricli::Lyricli + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/lyricli.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Lyricli) initialize + + + + + +

+
+

+A new instance of Lyricli +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+36
+37
+38
+
+
# File 'lib/lyricli.rb', line 36
+
+def initialize
+  @source_manager = SourceManager.new
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) check_params + + + + + +

+ + + + +
+
+
+
+61
+62
+63
+64
+
+
# File 'lib/lyricli.rb', line 61
+
+def check_params
+  self.exit_with_error if @current_track[:artist].nil? or @current_track[:artist].empty?
+  self.exit_with_error if @current_track[:song].nil? or @current_track[:song].empty?
+end
+
+
+ +
+

+ + - (Object) exit_with_error + + + + + +

+ + + + +
+
+
+
+40
+41
+42
+
+
# File 'lib/lyricli.rb', line 40
+
+def exit_with_error
+  abort "Usage: #{$0} artist song"
+end
+
+
+ +
+

+ + - (Object) get_lyrics + + + + + +

+ + + + +
+
+
+
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+
+
# File 'lib/lyricli.rb', line 44
+
+def get_lyrics
+  set_current_track
+  check_params
+
+  engine = LyricsEngine.new(@current_track[:artist], @current_track[:song])
+
+  begin
+    engine.get_lyrics
+  rescue LyricsNotFoundException
+    "Lyrics not found :("
+  end
+end
+
+
+ +
+

+ + - (Object) set_current_track + + + + + +

+ + + + +
+
+
+
+57
+58
+59
+
+
# File 'lib/lyricli.rb', line 57
+
+def set_current_track
+  @current_track = @source_manager.current_track
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Lyricli/LyricsEngine.html b/doc/Lyricli/LyricsEngine.html new file mode 100644 index 0000000..5cca795 --- /dev/null +++ b/doc/Lyricli/LyricsEngine.html @@ -0,0 +1,313 @@ + + + + + + Class: Lyricli::LyricsEngine + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Class: Lyricli::LyricsEngine + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + +
Includes:
+
Util
+ + + + + +
Defined in:
+
lib/lyricli/lyrics_engine.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + + +

Methods included from Util

+

#camelize, #parse_class, #sanitize_param

+
+

Constructor Details

+ +
+

+ + - (LyricsEngine) initialize(artist, song) + + + + + +

+
+

+A new instance of LyricsEngine +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+6
+7
+8
+
+
# File 'lib/lyricli/lyrics_engine.rb', line 6
+
+def initialize(artist, song)
+  @provider = URI("http://lyrics.wikia.com/api.php?artist=#{sanitize_param artist}&song=#{sanitize_param song}&fmt=realjson")
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) get_lyrics + + + + + +

+ + + + +
+
+
+
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+
+
# File 'lib/lyricli/lyrics_engine.rb', line 10
+
+def get_lyrics
+  begin
+    response = Net::HTTP.get(@provider)
+    response = MultiJson.decode(response)
+
+    doc = Nokogiri::HTML(open(response['url']))
+    node = doc.search(".lyricbox").first
+  rescue
+    raise Lyricli::LyricsNotFoundException
+  end
+
+  node.search(".rtMatcher").each do |n|
+    n.remove
+  end
+
+  node.search("br").each do |br|
+    br.replace "\n"
+  end
+
+  node.inner_text
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Lyricli/SourceManager.html b/doc/Lyricli/SourceManager.html new file mode 100644 index 0000000..399b337 --- /dev/null +++ b/doc/Lyricli/SourceManager.html @@ -0,0 +1,497 @@ + + + + + + Class: Lyricli::SourceManager + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Class: Lyricli::SourceManager + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + +
Includes:
+
Util
+ + + + + +
Defined in:
+
lib/lyricli/source_manager.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + + + + + + + + +

Methods included from Util

+

#camelize, #parse_class, #sanitize_param

+
+

Constructor Details

+ +
+

+ + - (SourceManager) initialize + + + + + +

+
+

+A new instance of SourceManager +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+
+
# File 'lib/lyricli/source_manager.rb', line 6
+
+def initialize
+  @enabled_sources = []
+  @config = Configuration.instance
+  @config["enabled_sources"].each do |source|
+    if klass = parse_class(camelize(source))
+      current_source = klass.new
+      @enabled_sources << current_source
+    else
+      raise StartSourceException
+    end
+  end
+end
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) current_track + + + + + +

+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+
+
# File 'lib/lyricli/source_manager.rb', line 46
+
+def current_track
+  track = nil
+  @enabled_sources.each do |source|
+    begin
+      track ||= source.current_track
+    rescue
+      fail "Source #{source.name} has failed to start. Please reset the source by running `#{$0} source reset #{source.name}.`"
+    end
+  end
+  track
+end
+
+
+ +
+

+ + - (Object) disable(source_name) + + + + + +

+ + + + +
+
+
+
+29
+30
+31
+32
+33
+34
+35
+
+
# File 'lib/lyricli/source_manager.rb', line 29
+
+def disable(source_name)
+  if klass = parse_class(camelize(source_name))
+    @config["enabled_sources"].delete(klass.name)
+  else
+    raise DisableSourceException
+  end
+end
+
+
+ +
+

+ + - (Object) enable(source_name) + + + + + +

+ + + + +
+
+
+
+19
+20
+21
+22
+23
+24
+25
+26
+27
+
+
# File 'lib/lyricli/source_manager.rb', line 19
+
+def enable(source_name)
+  if klass = parse_class(camelize(source_name))
+    klass.enable
+    @config["enabled_sources"] << klass.name
+    @config["enabled_sources"].uniq!
+  else
+    raise EnableSourceException
+  end
+end
+
+
+ +
+

+ + - (Object) reset(source_name) + + + + + +

+ + + + +
+
+
+
+37
+38
+39
+40
+41
+42
+43
+44
+
+
# File 'lib/lyricli/source_manager.rb', line 37
+
+def reset(source_name)
+  if klass = parse_class(camelize(source_name))
+    klass.reset
+    disable(source_name)
+  else
+    raise ResetSourceException
+  end
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Lyricli/Sources.html b/doc/Lyricli/Sources.html new file mode 100644 index 0000000..f2b0712 --- /dev/null +++ b/doc/Lyricli/Sources.html @@ -0,0 +1,117 @@ + + + + + + Module: Lyricli::Sources + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Module: Lyricli::Sources + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/lyricli/sources/rdio.rb,
+ lib/lyricli/sources/arguments.rb
+
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: Arguments, Rdio + + +

+ + + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/doc/Lyricli/Sources/Arguments.html b/doc/Lyricli/Sources/Arguments.html new file mode 100644 index 0000000..da2f0a1 --- /dev/null +++ b/doc/Lyricli/Sources/Arguments.html @@ -0,0 +1,536 @@ + + + + + + Class: Lyricli::Sources::Arguments + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Class: Lyricli::Sources::Arguments + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/lyricli/sources/arguments.rb
+ +
+
+ + + + + +

Class Attribute Summary (collapse)

+ + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Arguments) initialize + + + + + +

+
+

+Instantiates everything it needs to run. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+18
+19
+20
+
+
# File 'lib/lyricli/sources/arguments.rb', line 18
+
+def initialize
+  # Nothing to do.
+end
+
+
+ +
+ +
+

Class Attribute Details

+ + + + +
+

+ + + (Object) name + + + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+6
+7
+8
+
+
# File 'lib/lyricli/sources/arguments.rb', line 6
+
+def name
+  @name
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) enable + + + + + +

+
+

+The enable method should run all of the tasks needed to validate the +source. In the case of Rdio it has to authenticate with OAuth. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+13
+14
+15
+
+
# File 'lib/lyricli/sources/arguments.rb', line 13
+
+def self.enable
+  # Nothing to do.
+end
+
+
+ +
+

+ + + (Object) reset + + + + + +

+
+

+The reset method resets any configurations it may have +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+32
+33
+34
+
+
# File 'lib/lyricli/sources/arguments.rb', line 32
+
+def self.reset
+  # Reset Code
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Hash) current_track + + + + + +

+
+

+The current_track method should return the name of the current artist and +song. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +

    +A hash containing the current `:song` and `:artist`. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+25
+26
+27
+28
+29
+
+
# File 'lib/lyricli/sources/arguments.rb', line 25
+
+def current_track
+  artist = ARGV[0]
+  song = ARGV[1]
+  {artist: artist, song: song}
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Lyricli/Sources/Rdio.html b/doc/Lyricli/Sources/Rdio.html new file mode 100644 index 0000000..e99af89 --- /dev/null +++ b/doc/Lyricli/Sources/Rdio.html @@ -0,0 +1,649 @@ + + + + + + Class: Lyricli::Sources::Rdio + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Class: Lyricli::Sources::Rdio + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/lyricli/sources/rdio.rb
+ +
+
+ + + + + +

Class Attribute Summary (collapse)

+ + + + + + +

+ Class Method Summary + (collapse) +

+ + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Rdio) initialize + + + + + +

+
+

+Instantiates everything it needs to run. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+23
+24
+25
+26
+27
+
+
# File 'lib/lyricli/sources/rdio.rb', line 23
+
+def initialize
+  @name = 'rdio'
+  @config = Lyricli::Configuration.instance
+  @rdio = Rdio::SimpleRdio.new([@config["rdio_key"], @config["rdio_secret"]], @config["rdio_auth_token"])
+end
+
+
+ +
+ +
+

Class Attribute Details

+ + + + +
+

+ + + (Object) name + + + + + +

+
+

+Returns the value of attribute name +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+6
+7
+8
+
+
# File 'lib/lyricli/sources/rdio.rb', line 6
+
+def name
+  @name
+end
+
+
+ +
+ + +
+

Class Method Details

+ + +
+

+ + + (Object) create_auth_token + + + + + +

+
+

+Signs in to rdio with our credentials and requests access for a new auth +token. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+
+
# File 'lib/lyricli/sources/rdio.rb', line 46
+
+def self.create_auth_token
+  @rdio = Rdio::SimpleRdio.new([@config["rdio_key"], @config["rdio_secret"]], @config["rdio_auth_token"])
+
+  # Request Authorization
+  puts "Follow this URL to authorize lyricli:"
+  auth_url = rdio.begin_authentication('oob')
+  puts auth_url
+  Launchy.open(auth_url)
+
+  # Request Code, Obtain Token
+  print "Please type the authorization code: "
+  auth_code = gets.chomp
+  token = rdio.complete_authentication(auth_code)
+
+  @config["rdio_auth_token"] = token
+  token
+end
+
+
+ +
+

+ + + (Object) enable + + + + + +

+
+

+The enable method should run all of the tasks needed to validate the +source. In the case of Rdio it has to authenticate with OAuth. +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+13
+14
+15
+16
+17
+18
+19
+20
+
+
# File 'lib/lyricli/sources/rdio.rb', line 13
+
+def self.enable
+  # Validation Code
+  @config = Lyricli::Configuration.instance
+  unless @config["rdio_auth_token"] && !@config["rdio_auth_token"].empty?
+    create_auth_token
+  end
+
+end
+
+
+ +
+

+ + + (Object) reset + + + + + +

+
+

+The reset method resets any configurations it may have +

+ + +
+
+
+ + +
+ + + + +
+
+
+
+40
+41
+42
+
+
# File 'lib/lyricli/sources/rdio.rb', line 40
+
+def self.reset
+  # Reset Code
+end
+
+
+ +
+ +
+

Instance Method Details

+ + +
+

+ + - (Hash) current_track + + + + + +

+
+

+The current_track method should return the name of the current artist and +song. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Hash) + + + + — +

    +A hash containing the current `:song` and `:artist`. +

    +
    + +
  • + +
+ +
+ + + + +
+
+
+
+32
+33
+34
+35
+36
+37
+
+
# File 'lib/lyricli/sources/rdio.rb', line 32
+
+def current_track
+  response = @rdio.call('currentUser', {'extras' => 'lastSongPlayed'})
+  artist = response["result"]["lastSongPlayed"]["artist"]
+  song = response["result"]["lastSongPlayed"]["name"]
+  {artist: artist, song: song}
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Lyricli/Util.html b/doc/Lyricli/Util.html new file mode 100644 index 0000000..71499bf --- /dev/null +++ b/doc/Lyricli/Util.html @@ -0,0 +1,292 @@ + + + + + + Module: Lyricli::Util + + — Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Module: Lyricli::Util + + + +

+ +
+ + + + + + + +
Included in:
+
LyricsEngine, SourceManager
+ + + +
Defined in:
+
lib/lyricli/util.rb
+ +
+
+ + + + + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + + + +
+

Instance Method Details

+ + +
+

+ + - (Object) camelize(str) + + + + + +

+ + + + +
+
+
+
+3
+4
+5
+
+
# File 'lib/lyricli/util.rb', line 3
+
+def camelize(str)
+  str.split('_').map {|w| w.capitalize}.join
+end
+
+
+ +
+

+ + - (Object) parse_class(class_name) + + + + + +

+ + + + +
+
+
+
+7
+8
+9
+10
+11
+12
+13
+14
+
+
# File 'lib/lyricli/util.rb', line 7
+
+def parse_class(class_name)
+  begin
+    path = "Sources::#{class_name}"
+    return eval(path)
+  rescue NameError
+    return nil
+  end
+end
+
+
+ +
+

+ + - (Object) sanitize_param(p) + + + + + +

+ + + + +
+
+
+
+16
+17
+18
+
+
# File 'lib/lyricli/util.rb', line 16
+
+def sanitize_param(p)
+  URI.encode_www_form_component(p.gsub(/ /, "+")).gsub("%2B", "+")
+end
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/_index.html b/doc/_index.html new file mode 100644 index 0000000..7d92f25 --- /dev/null +++ b/doc/_index.html @@ -0,0 +1,197 @@ + + + + + + Documentation by YARD 0.8.1 + + + + + + + + + + + + + + + + + + + + + +

Documentation by YARD 0.8.1

+
+

Alphabetic Index

+ +
+

Namespace Listing A-Z

+ + + + + + + + +
+ + +
    +
  • A
  • +
      + +
    • + Arguments + + (Lyricli::Sources) + +
    • + +
    +
+ + + + + + + + +
    +
  • R
  • +
      + +
    • + Rdio + + (Lyricli::Sources) + +
    • + +
    +
+ + + + + +
    +
  • U
  • +
      + +
    • + Util + + (Lyricli) + +
    • + +
    +
+ +
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/class_list.html b/doc/class_list.html new file mode 100644 index 0000000..6652d8b --- /dev/null +++ b/doc/class_list.html @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + +
+

Class List

+ + + + +
+ + diff --git a/doc/css/common.css b/doc/css/common.css new file mode 100644 index 0000000..cf25c45 --- /dev/null +++ b/doc/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/doc/css/full_list.css b/doc/css/full_list.css new file mode 100644 index 0000000..c918cf1 --- /dev/null +++ b/doc/css/full_list.css @@ -0,0 +1,57 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; } +#full_list ul { padding: 0; } +#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } +#noresults { padding: 7px 12px; } +#content.insearch #noresults { margin-left: 7px; } +ul.collapsed ul, ul.collapsed li { display: none; } +ul.collapsed.search_uncollapsed { display: block; } +ul.collapsed.search_uncollapsed li { display: list-item; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } +li:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a:link, a:visited { text-decoration: none; color: #05a; } +li.clicked { background: #05a; color: #ccc; } +li.clicked a:link, li.clicked a:visited { color: #eee; } +li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; } +#nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; } +#nav a:link, #nav a:visited { color: #358; } +#nav a:hover { background: transparent; color: #5af; } +.frames #nav span:after { content: ' | '; } +.frames #nav span:last-child:after { content: ''; } + +.frames #content h1 { margin-top: 0; } +.frames li { white-space: nowrap; cursor: normal; } +.frames li small { display: block; font-size: 0.8em; } +.frames li small:before { content: ""; } +.frames li small:after { content: ""; } +.frames li small.search_info { display: none; } +.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +.frames #content.insearch #search { background-position: center right; } +.frames #search input { width: 110px; } +.frames #nav { display: block; } + +#full_list.insearch li { display: none; } +#full_list.insearch li.found { display: list-item; padding-left: 10px; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/doc/css/style.css b/doc/css/style.css new file mode 100644 index 0000000..ca54c2b --- /dev/null +++ b/doc/css/style.css @@ -0,0 +1,328 @@ +body { + padding: 0 20px; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; +} +body.frames { padding: 0 5px; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; +} +h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; } +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link, .docstring .object_link { font-family: monospace; } +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } + +/* style for