]> git.r.bdr.sh - rbdr/lyricli.rb/commitdiff
Finish first wave of documentation.
authorBen Beltran <redacted>
Sat, 6 Oct 2012 07:35:48 +0000 (02:35 -0500)
committerBen Beltran <redacted>
Sat, 6 Oct 2012 07:35:48 +0000 (02:35 -0500)
Also adds some stuff to the git ignore file

27 files changed:
.gitignore [new file with mode: 0644]
.yardoc/checksums
.yardoc/object_types
.yardoc/objects/root.dat
doc/Lyricli.html
doc/Lyricli/Configuration.html
doc/Lyricli/Exceptions.html [new file with mode: 0644]
doc/Lyricli/Lyricli.html
doc/Lyricli/LyricsEngine.html
doc/Lyricli/SourceManager.html
doc/Lyricli/Sources.html
doc/Lyricli/Sources/Arguments.html
doc/Lyricli/Sources/Itunes.html [new file with mode: 0644]
doc/Lyricli/Sources/Rdio.html
doc/Lyricli/Util.html
doc/_index.html
doc/class_list.html
doc/file.README.html [new file with mode: 0644]
doc/index.html
doc/top-level-namespace.html
lib/lyricli/exceptions.rb [new file with mode: 0644]
lib/lyricli/lyrics_engine.rb
lib/lyricli/source_manager.rb
lib/lyricli/sources.rb [new file with mode: 0644]
lib/lyricli/sources/arguments.rb
lib/lyricli/sources/itunes.rb
lib/lyricli/sources/rdio.rb

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..eb76b24
--- /dev/null
@@ -0,0 +1,18 @@
+*.gem
+*.rbc
+.bundle
+.config
+coverage
+InstalledFiles
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
+
+# YARD artifacts
+.yardoc
+_yardoc
+doc/
\ No newline at end of file
index 475fe5adc652dc98b5e48365c069fd40fd76187d..b2fe954df51d6255906ebec4796daa62b4d927f7 100644 (file)
@@ -1,9 +1,11 @@
 lib/lyricli.rb 51e33086d1cbac6ccd601dd481a3b455376efb46
 lib/lyricli/util.rb 26284bcf3521994d5f81c5f10a750dad8fda1593
-lib/lyricli/lyricli.rb 067ba6355bce4ce18cc5552580b91b4e266250a2
-lib/lyricli/sources/rdio.rb affae043fecd57d068a54a710718d19933d53b81
-lib/lyricli/lyrics_engine.rb be6feb81f3c3c040420d1fb33df4d1282a959d15
-lib/lyricli/configuration.rb eab80327c885fe827811de01de1e9e64c312b0c0
-lib/lyricli/sources/itunes.rb 8f0b1201051be95df66f8a94554e393681795eb7
-lib/lyricli/source_manager.rb fd571d1c1a169f86efed5c886b40f912fb5ad01f
-lib/lyricli/sources/arguments.rb de3b31f05d118cf00fccb41e47fd35979da9eb14
+lib/lyricli/lyricli.rb 5a966a6402b5646b2c755cf79c3f7006b4a6d818
+lib/lyricli/sources.rb 69d670f2d008827b861dcd543caad3986ccc323e
+lib/lyricli/exceptions.rb 943e408e869981dded31cd236da1da937e6b0574
+lib/lyricli/sources/rdio.rb 8936e4de676719c26fe6b8fcf2396b85d5723996
+lib/lyricli/lyrics_engine.rb 9ebc53647e5be739ce8a0fe1e7d10fbce02d7083
+lib/lyricli/configuration.rb f08b1caf4dffacccf888c5b22e4a8e3107f004d6
+lib/lyricli/sources/itunes.rb aadca88a9ad0d0b4c918d86874f403d10ec3add7
+lib/lyricli/source_manager.rb d16a3e3592f48dbda8adbef1b1cfe49a9dc42617
+lib/lyricli/sources/arguments.rb fa19b956453041cf5df0402142cbe073f2c9e686
index dbe4c580b94dc9d9962fe3b1b63fb0ff608de2c4..1ed18b423b52766d4defee4da46faaed86c94057 100644 (file)
Binary files a/.yardoc/object_types and b/.yardoc/object_types differ
index 9c9498085c28d7b9352faab9a87ddcfa7f0334b5..8522ce3313c63418f420cb8b075572f14feaaadf 100644 (file)
Binary files a/.yardoc/objects/root.dat and b/.yardoc/objects/root.dat differ
index 8a09e7fc3178d8a66fff421e8021ccb799410310..d757eacdc926304fe67c5f093d4c03625a9e9cc9 100644 (file)
@@ -80,7 +80,7 @@
   
     <dt class="r1 last">Defined in:</dt>
     <dd class="r1 last">lib/lyricli.rb<span class="defines">,<br />
-  lib/lyricli/util.rb,<br /> lib/lyricli/lyricli.rb,<br /> lib/lyricli/sources/rdio.rb,<br /> lib/lyricli/lyrics_engine.rb,<br /> lib/lyricli/configuration.rb,<br /> lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/source_manager.rb,<br /> lib/lyricli/sources/arguments.rb</span>
+  lib/lyricli/util.rb,<br /> lib/lyricli/lyricli.rb,<br /> lib/lyricli/sources.rb,<br /> lib/lyricli/exceptions.rb,<br /> lib/lyricli/sources/rdio.rb,<br /> lib/lyricli/lyrics_engine.rb,<br /> lib/lyricli/configuration.rb,<br /> lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/source_manager.rb,<br /> lib/lyricli/sources/arguments.rb</span>
 </dd>
   
 </dl>
@@ -103,7 +103,7 @@ song and artist data from diverse sources.
 <p class="children">
   
     
-      <strong class="modules">Modules:</strong> <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span>, <span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span>
+      <strong class="modules">Modules:</strong> <span class='object_link'><a href="Lyricli/Exceptions.html" title="Lyricli::Exceptions (module)">Exceptions</a></span>, <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span>, <span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span>
     
   
     
@@ -611,7 +611,7 @@ the version
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index 77112a3280b9e5a1cf64137ff093aec492949dcd..f2fa54d8b901a5ef3cea26ecdcc35ca4ecf29174 100644 (file)
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+This class handles the configuration of Lyricli
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
 
+</div>
   <h2>Constant Summary</h2>
   
     <dl class="constants">
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Ensure this is only called once.
+</p>
+</div></span>
   
 </li>
 
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Object) <strong>[]</strong>(key) </a>
+      <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (String, ...) <strong>[]</strong>(key) </a>
     
 
     
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Access configuration properties, loads config if needed beforehand.
+</p>
+</div></span>
   
 </li>
 
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Assigns a new value to a configuration key, loads config if needed and
+saves it after updating.
+</p>
+</div></span>
   
 </li>
 
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Deletes a key from the configuration, loads config if needed and saves it
+after deleting.
+</p>
+</div></span>
   
 </li>
 
 
   
     <span class="summary_desc"><div class='inline'><p>
-A new instance of Configuration.
+Defines the paths to the default and user configuration files.
 </p>
 </div></span>
   
@@ -268,7 +294,8 @@ A new instance of Configuration.
 
   
     <span class="summary_desc"><div class='inline'><p>
-TODO: Apart from this, load a default yml that will be used for this.
+Loads the configuration from the user file, attempts to create it from
+defaults if it&#8217;s not present.
 </p>
 </div></span>
   
@@ -292,7 +319,10 @@ TODO: Apart from this, load a default yml that will be used for this.
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Serializes the `@config` Hash to JSON and saves it to a file.
+</p>
+</div></span>
   
 </li>
 
@@ -315,7 +345,7 @@ TODO: Apart from this, load a default yml that will be used for this.
 </h3><div class="docstring">
   <div class="discussion">
     <p>
-A new instance of Configuration
+Defines the paths to the default and user configuration files
 </p>
 
 
@@ -330,14 +360,14 @@ A new instance of Configuration
       <pre class="lines">
 
 
-4
-5
-6
 7
-8</pre>
+8
+9
+10
+11</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 4</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 7</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='ivar'>@config_path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>~/.lyricli.conf</span><span class='tstring_end'>&quot;</span></span>
@@ -365,18 +395,31 @@ A new instance of Configuration
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Ensure this is only called once. Only use the instance class variable to
+access this method, as its constructor is private.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-12
-13
-14</pre>
+17
+18
+19</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 12</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 17</span>
 
 <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
   <span class='cvar'>@@instance</span>
@@ -395,25 +438,77 @@ A new instance of Configuration
       <div class="method_details first">
   <h3 class="signature first" id="[]-instance_method">
   
-    - (<tt>Object</tt>) <strong>[]</strong>(key) 
+    - (<tt>String</tt>, ...) <strong>[]</strong>(key) 
+  
+
   
 
   
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Access configuration properties, loads config if needed beforehand.
+</p>
+
 
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
   
-</h3><table class="source_code">
+    <li>
+      
+        <span class='name'>key</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the configuration key to access
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>String</tt>, <tt>Hash</tt>, <tt>Array</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the value of the configuration key.
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-16
-17
-18
-19</pre>
+25
+26
+27
+28</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 16</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 25</span>
 
 <span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
@@ -433,20 +528,72 @@ A new instance of Configuration
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Assigns a new value to a configuration key, loads config if needed and
+saves it after updating.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>key</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the configuration key to set
+</p>
+</div>
+      
+    </li>
+  
+    <li>
+      
+        <span class='name'>value</span>
+      
+      
+        <span class='type'>(<tt>Object</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the value for the configuration key, can be any object as long as it can be
+converted to JSON
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-21
-22
-23
-24
-25</pre>
+36
+37
+38
+39
+40</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 21</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 36</span>
 
 <span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
@@ -467,20 +614,54 @@ A new instance of Configuration
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Deletes a key from the configuration, loads config if needed and saves it
+after deleting.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>key</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the key to delete
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-27
-28
-29
-30
-31</pre>
+46
+47
+48
+49
+50</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 27</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 46</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
@@ -504,8 +685,8 @@ A new instance of Configuration
 </h3><div class="docstring">
   <div class="discussion">
     <p>
-TODO: Apart from this, load a default yml that will be used for this. And
-just extend everything from the user&#8217;s config.
+Loads the configuration from the user file, attempts to create it from
+defaults if it&#8217;s not present. sets the `@config` instance variable.
 </p>
 
 
@@ -520,19 +701,19 @@ just extend everything from the user&#8217;s config.
       <pre class="lines">
 
 
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46</pre>
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 37</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 56</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_load_config'>load_config</span>
   <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='ivar'>@config_path</span><span class='rparen'>)</span>
@@ -558,21 +739,33 @@ just extend everything from the user&#8217;s config.
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Serializes the `@config` Hash to JSON and saves it to a file.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-48
-49
-50
-51
-52
-53</pre>
+68
+69
+70
+71
+72
+73</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 48</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 68</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_save_config'>save_config</span>
   <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='ivar'>@config_path</span><span class='rparen'>)</span>
@@ -590,7 +783,7 @@ just extend everything from the user&#8217;s config.
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
diff --git a/doc/Lyricli/Exceptions.html b/doc/Lyricli/Exceptions.html
new file mode 100644 (file)
index 0000000..f6acefd
--- /dev/null
@@ -0,0 +1,117 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+  Module: Lyricli::Exceptions
+  
+    &mdash; Documentation by YARD 0.8.2.1
+  
+</title>
+
+  <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+  <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+  hasFrames = window.top.frames.main ? true : false;
+  relpath = '../';
+  framesUrl = "../frames.html#!" + escape(window.location.href);
+</script>
+
+
+  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+
+  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
+
+
+  </head>
+  <body>
+    <div id="header">
+      <div id="menu">
+  
+    <a href="../_index.html">Index (E)</a> &raquo;
+    <span class='title'><span class='object_link'><a href="../Lyricli.html" title="Lyricli (module)">Lyricli</a></span></span>
+     &raquo; 
+    <span class="title">Exceptions</span>
+  
+
+  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+      <div id="search">
+  
+    <a class="full_list_link" id="class_list_link"
+        href="../class_list.html">
+      Class List
+    </a>
+  
+    <a class="full_list_link" id="method_list_link"
+        href="../method_list.html">
+      Method List
+    </a>
+  
+    <a class="full_list_link" id="file_list_link"
+        href="../file_list.html">
+      File List
+    </a>
+  
+</div>
+      <div class="clear"></div>
+    </div>
+
+    <iframe id="search_frame"></iframe>
+
+    <div id="content"><h1>Module: Lyricli::Exceptions
+  
+  
+  
+</h1>
+
+<dl class="box">
+  
+  
+    
+  
+    
+  
+  
+  
+    <dt class="r1 last">Defined in:</dt>
+    <dd class="r1 last">lib/lyricli/exceptions.rb</dd>
+  
+</dl>
+<div class="clear"></div>
+
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+The namespace for all exceptions in Lyricli. Has no functionality by itself
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div>
+
+
+
+
+
+
+
+
+</div>
+
+    <div id="footer">
+  Generated on Sat Oct  6 02:34:27 2012 by
+  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+  0.8.2.1 (ruby-1.9.2).
+</div>
+
+  </body>
+</html>
\ No newline at end of file
index 090262df1448196e4748953a0c5f206cf2739867..60c3a9487d2b5bbc02a5124a4af60647b104ae42 100644 (file)
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+This class has the basic logic for extracting the lyrics and controlling
+the application
+</p>
 
 
+  </div>
+</div>
+<div class="tags">
+  
+
+</div>
+
 
 
 
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Exits with error when there is an empty field from the current track.
+</p>
+</div></span>
   
 </li>
 
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Raises an InvalidLyricsException which means we did not get any valid
+artist/song from any of the sources.
+</p>
+</div></span>
   
 </li>
 
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (Object) <strong>get_lyrics</strong> </a>
+      <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (String) <strong>get_lyrics</strong> </a>
     
 
     
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Extracts the current track, validates it and requests the lyrics from our
+LyricsEngine.
+</p>
+</div></span>
   
 </li>
 
 
   
     <span class="summary_desc"><div class='inline'><p>
-A new instance of Lyricli.
+Constructor, initializes `@source_manager`.
 </p>
 </div></span>
   
@@ -224,7 +248,11 @@ A new instance of Lyricli.
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Set the `@current_track` instance variable by asking the SourceManager for
+its current track.
+</p>
+</div></span>
   
 </li>
 
@@ -247,7 +275,7 @@ A new instance of Lyricli.
 </h3><div class="docstring">
   <div class="discussion">
     <p>
-A new instance of Lyricli
+Constructor, initializes `@source_manager`
 </p>
 
 
@@ -262,12 +290,12 @@ A new instance of Lyricli
       <pre class="lines">
 
 
-4
-5
-6</pre>
+8
+9
+10</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 4</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 8</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='ivar'>@source_manager</span> <span class='op'>=</span> <span class='const'>SourceManager</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
@@ -293,19 +321,31 @@ A new instance of Lyricli
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Exits with error when there is an empty field from the current track.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-29
-30
-31
-32</pre>
+44
+45
+46
+47</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 29</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 44</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_check_params'>check_params</span>
   <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>if</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
@@ -327,7 +367,11 @@ A new instance of Lyricli
   
 </h3><div class="docstring">
   <div class="discussion">
-    
+    <p>
+Raises an InvalidLyricsException which means we did not get any valid
+artist/song from any of the sources
+</p>
+
 
   </div>
 </div>
@@ -339,9 +383,15 @@ A new instance of Lyricli
     <li>
       
       
-        <span class='type'>(<tt>InvalidLyrics</tt>)</span>
+        <span class='type'>(<tt>Lyricli::InvalidLyricsException</tt>)</span>
+      
       
       
+        &mdash;
+        <div class='inline'><p>
+because we found nothing
+</p>
+</div>
       
     </li>
   
@@ -353,15 +403,15 @@ A new instance of Lyricli
       <pre class="lines">
 
 
-8
-9
-10</pre>
+16
+17
+18</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 8</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 16</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_exit_with_error'>exit_with_error</span>
-  <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidLyrics</span>
+  <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidLyricsException</span>
 <span class='kw'>end</span></pre>
     </td>
   </tr>
@@ -371,33 +421,65 @@ A new instance of Lyricli
       <div class="method_details ">
   <h3 class="signature " id="get_lyrics-instance_method">
   
-    - (<tt>Object</tt>) <strong>get_lyrics</strong> 
+    - (<tt>String</tt>) <strong>get_lyrics</strong> 
   
 
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Extracts the current track, validates it and requests the lyrics from our
+LyricsEngine
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the found lyrics, or a string indicating none were found
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23</pre>
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 12</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 24</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
   <span class='id identifier rubyid_set_current_track'>set_current_track</span>
@@ -425,18 +507,31 @@ A new instance of Lyricli
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Set the `@current_track` instance variable by asking the SourceManager for
+its current track
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-25
-26
-27</pre>
+39
+40
+41</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 25</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 39</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_set_current_track'>set_current_track</span>
   <span class='ivar'>@current_track</span> <span class='op'>=</span> <span class='ivar'>@source_manager</span><span class='period'>.</span><span class='id identifier rubyid_current_track'>current_track</span>
@@ -451,7 +546,7 @@ A new instance of Lyricli
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index 23a5f7318340d4634e292ba739e13b70cb50f5ec..0efd283fa3a47e68025fec833636616ca31c4bc9 100644 (file)
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+This class gets the lyrics according to a given artist and song name.
+</p>
 
 
+  </div>
+</div>
+<div class="tags">
+  
+
+</div>
+
 
 
 
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (Object) <strong>get_lyrics</strong> </a>
+      <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (String) <strong>get_lyrics</strong> </a>
     
 
     
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Asks Lyrics Wiki for the lyrics, also cleans up the output a little.
+</p>
+</div></span>
   
 </li>
 
 
   
     <span class="summary_desc"><div class='inline'><p>
-A new instance of LyricsEngine.
+Starts a new instance of LyricsEngine.
 </p>
 </div></span>
   
@@ -196,14 +211,52 @@ A new instance of LyricsEngine.
 </h3><div class="docstring">
   <div class="discussion">
     <p>
-A new instance of LyricsEngine
+Starts a new instance of LyricsEngine
 </p>
 
 
   </div>
 </div>
 <div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>artist</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the artist
+</p>
+</div>
+      
+    </li>
+  
+    <li>
+      
+        <span class='name'>song</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the song to look for
+</p>
+</div>
+      
+    </li>
   
+</ul>
+
 
 </div><table class="source_code">
   <tr>
@@ -211,12 +264,12 @@ A new instance of LyricsEngine
       <pre class="lines">
 
 
-6
-7
-8</pre>
+12
+13
+14</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/lyrics_engine.rb', line 6</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyrics_engine.rb', line 12</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_artist'>artist</span><span class='comma'>,</span> <span class='id identifier rubyid_song'>song</span><span class='rparen'>)</span>
   <span class='ivar'>@provider</span> <span class='op'>=</span> <span class='const'>URI</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>http://lyrics.wikia.com/api.php?artist=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sanitize_param'>sanitize_param</span> <span class='id identifier rubyid_artist'>artist</span><span class='rbrace'>}</span><span class='tstring_content'>&amp;song=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sanitize_param'>sanitize_param</span> <span class='id identifier rubyid_song'>song</span><span class='rbrace'>}</span><span class='tstring_content'>&amp;fmt=realjson</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
@@ -236,27 +289,49 @@ A new instance of LyricsEngine
       <div class="method_details first">
   <h3 class="signature first" id="get_lyrics-instance_method">
   
-    - (<tt>Object</tt>) <strong>get_lyrics</strong> 
+    - (<tt>String</tt>) <strong>get_lyrics</strong> 
   
 
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Asks Lyrics Wiki for the lyrics, also cleans up the output a little.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the lyrics
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-10
-11
-12
-13
-14
-15
-16
-17
-18
 19
 20
 21
@@ -268,10 +343,19 @@ A new instance of LyricsEngine
 27
 28
 29
-30</pre>
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/lyrics_engine.rb', line 10</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyrics_engine.rb', line 19</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
   <span class='kw'>begin</span>
@@ -304,7 +388,7 @@ A new instance of LyricsEngine
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index 2f48f972d38fae8f4f4bc6869713f58249dda320..3a37bc4f2c57819a79b3c74e6989072f55a29e5b 100644 (file)
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+Manages the different sources. SourceManager is in charge of enabling and
+disabling them, as well as getting the current track.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
 
+</div>
 
 
 
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#available_sources-instance_method" title="#available_sources (instance method)">- (Object) <strong>available_sources</strong>(format = false) </a>
+      <a href="#available_sources-instance_method" title="#available_sources (instance method)">- (Array) <strong>available_sources</strong>(format = false) </a>
     
 
     
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Returns an array with the available sources.
+</p>
+</div></span>
   
 </li>
 
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#current_track-instance_method" title="#current_track (instance method)">- (Object) <strong>current_track</strong> </a>
+      <a href="#current_track-instance_method" title="#current_track (instance method)">- (Hash) <strong>current_track</strong> </a>
     
 
     
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Iterates over every source to attempt to retrieve the current song.
+</p>
+</div></span>
   
 </li>
 
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Disables a source.
+</p>
+</div></span>
   
 </li>
 
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Enables a source.
+</p>
+</div></span>
   
 </li>
 
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#format_sources-instance_method" title="#format_sources (instance method)">- (Object) <strong>format_sources</strong>(sources) </a>
+      <a href="#format_sources-instance_method" title="#format_sources (instance method)">- (Array) <strong>format_sources</strong>(sources) </a>
     
 
     
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Adds a star to all members of the array that correspond to an active
+source.
+</p>
+</div></span>
   
 </li>
 
 
   
     <span class="summary_desc"><div class='inline'><p>
-A new instance of SourceManager.
+Creates a new instance of SourceManager.
 </p>
 </div></span>
   
@@ -272,7 +301,10 @@ A new instance of SourceManager.
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Resets a source.
+</p>
+</div></span>
   
 </li>
 
@@ -306,7 +338,7 @@ A new instance of SourceManager.
 </h3><div class="docstring">
   <div class="discussion">
     <p>
-A new instance of SourceManager
+Creates a new instance of SourceManager
 </p>
 
 
@@ -321,10 +353,6 @@ A new instance of SourceManager
       <pre class="lines">
 
 
-6
-7
-8
-9
 10
 11
 12
@@ -332,10 +360,14 @@ A new instance of SourceManager
 14
 15
 16
-17</pre>
+17
+18
+19
+20
+21</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 6</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 10</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='ivar'>@enabled_sources</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -364,52 +396,105 @@ A new instance of SourceManager
       <div class="method_details first">
   <h3 class="signature first" id="available_sources-instance_method">
   
-    - (<tt>Object</tt>) <strong>available_sources</strong>(format = false) 
+    - (<tt>Array</tt>) <strong>available_sources</strong>(format = false) 
+  
+
   
 
   
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Returns an array with the available sources. Optionally formats the result
+so active sources are identified by an appended *
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>format</span>
+      
+      
+        <span class='type'>(<tt>Boolean</tt>)</span>
+      
+      
+        <em class="default">(defaults to: <tt>false</tt>)</em>
+      
+      
+        &mdash;
+        <div class='inline'><p>
+whether or not to render the stars for active sources.
+</p>
+</div>
+      
+    </li>
+  
+</ul>
 
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>Array</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the names of the currently available sources.
+</p>
+</div>
+      
+    </li>
   
-</h3><table class="source_code">
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97</pre>
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 81</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 107</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_path_root'>path_root</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_sources'>sources</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='lbracket'>[</span><span class='id identifier rubyid_path_root'>path_root</span><span class='op'>+</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/sources/*.rb</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
     <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.rb</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
-
-    <span class='comment'># Add a star to denote enabled sources
-</span>    <span class='id identifier rubyid_name'>name</span>
+    <span class='id identifier rubyid_name'>name</span>
   <span class='rbrace'>}</span>
 
   <span class='comment'># Remove arguments (Hack?) We don't want anybody to touch tihs one.
 </span>  <span class='id identifier rubyid_sources'>sources</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>arguments</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
   <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span>
-    <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span>
+    <span class='comment'># Add a star to denote enabled sources
+</span>    <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span>
   <span class='kw'>else</span>
     <span class='id identifier rubyid_sources'>sources</span>
   <span class='kw'>end</span>
@@ -422,41 +507,72 @@ A new instance of SourceManager
       <div class="method_details ">
   <h3 class="signature " id="current_track-instance_method">
   
-    - (<tt>Object</tt>) <strong>current_track</strong> 
+    - (<tt>Hash</tt>) <strong>current_track</strong> 
   
 
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Iterates over every source to attempt to retrieve the current song.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>Hash</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the current track, has an `:artist` and `:song` key.
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79</pre>
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 60</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 80</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
   <span class='id identifier rubyid_track'>track</span> <span class='op'>=</span> <span class='kw'>nil</span>
@@ -492,27 +608,61 @@ A new instance of SourceManager
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Disables a source. This only removes the source from the `enabled_sources`
+configuration key.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>source_name</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the name of the source to disable
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45</pre>
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 34</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 47</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_disable'>disable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
   <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
@@ -540,29 +690,64 @@ A new instance of SourceManager
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Enables a source. This runs the source&#8217;s enable method and adds it to
+the `enabled_sources` configuration key. It will only enable sources that
+are &#8220;available&#8221; (see #available_sources)
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>source_name</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the name of the source to enable
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-19
-20
-21
-22
-23
-24
-25
-26
-27
 28
 29
 30
 31
-32</pre>
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 19</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 28</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_enable'>enable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
   <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
@@ -586,27 +771,79 @@ A new instance of SourceManager
       <div class="method_details ">
   <h3 class="signature " id="format_sources-instance_method">
   
-    - (<tt>Object</tt>) <strong>format_sources</strong>(sources) 
+    - (<tt>Array</tt>) <strong>format_sources</strong>(sources) 
   
 
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Adds a star to all members of the array that correspond to an active source
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>sources</span>
+      
+      
+        <span class='type'>(<tt>Array</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the array of sources to format
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>Array</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the formatted array
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-99
-100
-101
-102
-103
-104</pre>
+129
+130
+131
+132
+133
+134</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 99</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 129</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span>
   <span class='id identifier rubyid_sources'>sources</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
@@ -628,27 +865,61 @@ A new instance of SourceManager
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Resets a source. This runs the source&#8217;s reset method. It will also
+disable them.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>source_name</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the name of the source to reset.
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58</pre>
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 47</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 64</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
   <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
@@ -672,7 +943,7 @@ A new instance of SourceManager
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index ad3a5a1d84cfabd2f769e5eb9b67097cc2f99eae..518014ab0d016c0f3773857e7a52f5e5eaf8fcac 100644 (file)
   
   
     <dt class="r1 last">Defined in:</dt>
-    <dd class="r1 last">lib/lyricli/sources/rdio.rb<span class="defines">,<br />
-  lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/sources/arguments.rb</span>
+    <dd class="r1 last">lib/lyricli/sources.rb<span class="defines">,<br />
+  lib/lyricli/sources/rdio.rb,<br /> lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/sources/arguments.rb</span>
 </dd>
   
 </dl>
 <div class="clear"></div>
 
-<h2>Defined Under Namespace</h2>
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+The namespace for all sources in Lyricli. Has no functionality by itself
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><h2>Defined Under Namespace</h2>
 <p class="children">
   
     
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index 6f0be6503aad4397d68b9f6fdb9b25262f27ae2a..934a4a7101fc7616ceda3e31445ece1953f7f2ef 100644 (file)
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+The arguments source. This one is special since it expects two arguments.
+It is treated specially by the SourceManager.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
 
+</div>
 
 
 
@@ -293,12 +306,12 @@ Instantiates everything it needs to run.
       <pre class="lines">
 
 
-18
-19
-20</pre>
+20
+21
+22</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 18</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 20</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='comment'># Nothing to do.
@@ -342,12 +355,12 @@ Returns the value of attribute name
       <pre class="lines">
 
 
-6
-7
-8</pre>
+8
+9
+10</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 6</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 8</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
   <span class='ivar'>@name</span>
@@ -392,12 +405,12 @@ source. In the case of Rdio it has to authenticate with OAuth.
       <pre class="lines">
 
 
-13
-14
-15</pre>
+15
+16
+17</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 13</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 15</span>
 
 <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
   <span class='comment'># Nothing to do.
@@ -434,12 +447,12 @@ The reset method resets any configurations it may have
       <pre class="lines">
 
 
-32
-33
-34</pre>
+34
+35
+36</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 32</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 34</span>
 
 <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
   <span class='comment'># Reset Code
@@ -502,14 +515,14 @@ A hash containing the current `:song` and `:artist`.
       <pre class="lines">
 
 
-25
-26
 27
 28
-29</pre>
+29
+30
+31</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 25</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/arguments.rb', line 27</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
   <span class='id identifier rubyid_artist'>artist</span> <span class='op'>=</span> <span class='const'>ARGV</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
@@ -526,7 +539,7 @@ A hash containing the current `:song` and `:artist`.
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
diff --git a/doc/Lyricli/Sources/Itunes.html b/doc/Lyricli/Sources/Itunes.html
new file mode 100644 (file)
index 0000000..349f118
--- /dev/null
@@ -0,0 +1,553 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+  Class: Lyricli::Sources::Itunes
+  
+    &mdash; Documentation by YARD 0.8.2.1
+  
+</title>
+
+  <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+  <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+  hasFrames = window.top.frames.main ? true : false;
+  relpath = '../../';
+  framesUrl = "../../frames.html#!" + escape(window.location.href);
+</script>
+
+
+  <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
+
+  <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
+
+
+  </head>
+  <body>
+    <div id="header">
+      <div id="menu">
+  
+    <a href="../../_index.html">Index (I)</a> &raquo;
+    <span class='title'><span class='object_link'><a href="../../Lyricli.html" title="Lyricli (module)">Lyricli</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Sources.html" title="Lyricli::Sources (module)">Sources</a></span></span>
+     &raquo; 
+    <span class="title">Itunes</span>
+  
+
+  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+      <div id="search">
+  
+    <a class="full_list_link" id="class_list_link"
+        href="../../class_list.html">
+      Class List
+    </a>
+  
+    <a class="full_list_link" id="method_list_link"
+        href="../../method_list.html">
+      Method List
+    </a>
+  
+    <a class="full_list_link" id="file_list_link"
+        href="../../file_list.html">
+      File List
+    </a>
+  
+</div>
+      <div class="clear"></div>
+    </div>
+
+    <iframe id="search_frame"></iframe>
+
+    <div id="content"><h1>Class: Lyricli::Sources::Itunes
+  
+  
+  
+</h1>
+
+<dl class="box">
+  
+    <dt class="r1">Inherits:</dt>
+    <dd class="r1">
+      <span class="inheritName">Object</span>
+      
+        <ul class="fullTree">
+          <li>Object</li>
+          
+            <li class="next">Lyricli::Sources::Itunes</li>
+          
+        </ul>
+        <a href="#" class="inheritanceTree">show all</a>
+      
+      </dd>
+    
+  
+  
+    
+  
+    
+  
+  
+  
+    <dt class="r2 last">Defined in:</dt>
+    <dd class="r2 last">lib/lyricli/sources/itunes.rb</dd>
+  
+</dl>
+<div class="clear"></div>
+
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+The source for iTunes
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div>
+
+
+
+  <h2>Class Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
+  <ul class="summary">
+    
+      <li class="public ">
+  <span class="summary_signature">
+    
+      <a href="#name-class_method" title="name (class method)">+ (Object) <strong>name</strong> </a>
+    
+
+    
+  </span>
+  
+  
+  
+    
+    
+  
+  
+  
+  
+  
+
+  
+    <span class="summary_desc"><div class='inline'><p>
+Returns the value of attribute name.
+</p>
+</div></span>
+  
+</li>
+
+    
+  </ul>
+
+
+
+
+  
+    <h2>
+      Class Method Summary
+      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+    </h2>
+
+    <ul class="summary">
+      
+        <li class="public ">
+  <span class="summary_signature">
+    
+      <a href="#enable-class_method" title="enable (class method)">+ (Object) <strong>enable</strong> </a>
+    
+
+    
+  </span>
+  
+  
+  
+  
+  
+  
+  
+
+  
+    <span class="summary_desc"><div class='inline'><p>
+The enable method should run all of the tasks needed to validate the
+source.
+</p>
+</div></span>
+  
+</li>
+
+      
+        <li class="public ">
+  <span class="summary_signature">
+    
+      <a href="#reset-class_method" title="reset (class method)">+ (Object) <strong>reset</strong> </a>
+    
+
+    
+  </span>
+  
+  
+  
+  
+  
+  
+  
+
+  
+    <span class="summary_desc"><div class='inline'><p>
+The reset method resets any configurations it may have.
+</p>
+</div></span>
+  
+</li>
+
+      
+    </ul>
+  
+    <h2>
+      Instance Method Summary
+      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+    </h2>
+
+    <ul class="summary">
+      
+        <li class="public ">
+  <span class="summary_signature">
+    
+      <a href="#current_track-instance_method" title="#current_track (instance method)">- (Hash) <strong>current_track</strong> </a>
+    
+
+    
+  </span>
+  
+  
+  
+  
+  
+  
+  
+
+  
+    <span class="summary_desc"><div class='inline'><p>
+The current_track method should return the name of the current artist and
+song.
+</p>
+</div></span>
+  
+</li>
+
+      
+        <li class="public ">
+  <span class="summary_signature">
+    
+      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Itunes) <strong>initialize</strong> </a>
+    
+
+    
+  </span>
+  
+  
+    <span class="note title constructor">constructor</span>
+  
+  
+  
+  
+  
+  
+
+  
+    <span class="summary_desc"><div class='inline'><p>
+Instantiates everything it needs to run.
+</p>
+</div></span>
+  
+</li>
+
+      
+    </ul>
+  
+
+<div id="constructor_details" class="method_details_list">
+  <h2>Constructor Details</h2>
+  
+    <div class="method_details first">
+  <h3 class="signature first" id="initialize-instance_method">
+  
+    - (<tt><span class='object_link'><a href="" title="Lyricli::Sources::Itunes (class)">Itunes</a></span></tt>) <strong>initialize</strong> 
+  
+
+  
+
+  
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Instantiates everything it needs to run.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
+  <tr>
+    <td>
+      <pre class="lines">
+
+
+19
+20
+21
+22</pre>
+    </td>
+    <td>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 19</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
+  <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
+  <span class='ivar'>@script</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>current_song.scpt</span><span class='tstring_end'>&quot;</span></span>
+<span class='kw'>end</span></pre>
+    </td>
+  </tr>
+</table>
+</div>
+  
+</div>
+
+  <div id="class_attr_details" class="attr_details">
+    <h2>Class Attribute Details</h2>
+    
+      
+      <span id="name=-class_method"></span>
+      <div class="method_details first">
+  <h3 class="signature first" id="name-class_method">
+  
+    + (<tt>Object</tt>) <strong>name</strong> 
+  
+
+  
+
+  
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Returns the value of attribute name
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
+  <tr>
+    <td>
+      <pre class="lines">
+
+
+7
+8
+9</pre>
+    </td>
+    <td>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 7</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
+  <span class='ivar'>@name</span>
+<span class='kw'>end</span></pre>
+    </td>
+  </tr>
+</table>
+</div>
+    
+  </div>
+
+
+  <div id="class_method_details" class="method_details_list">
+    <h2>Class Method Details</h2>
+
+    
+      <div class="method_details first">
+  <h3 class="signature first" id="enable-class_method">
+  
+    + (<tt>Object</tt>) <strong>enable</strong> 
+  
+
+  
+
+  
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+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.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
+  <tr>
+    <td>
+      <pre class="lines">
+
+
+14
+15
+16</pre>
+    </td>
+    <td>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 14</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
+  <span class='comment'># Nothing to do
+</span><span class='kw'>end</span></pre>
+    </td>
+  </tr>
+</table>
+</div>
+    
+      <div class="method_details ">
+  <h3 class="signature " id="reset-class_method">
+  
+    + (<tt>Object</tt>) <strong>reset</strong> 
+  
+
+  
+
+  
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+The reset method resets any configurations it may have
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
+  <tr>
+    <td>
+      <pre class="lines">
+
+
+36
+37
+38</pre>
+    </td>
+    <td>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 36</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
+  <span class='comment'># Nothing to do
+</span><span class='kw'>end</span></pre>
+    </td>
+  </tr>
+</table>
+</div>
+    
+  </div>
+
+  <div id="instance_method_details" class="method_details_list">
+    <h2>Instance Method Details</h2>
+
+    
+      <div class="method_details first">
+  <h3 class="signature first" id="current_track-instance_method">
+  
+    - (<tt>Hash</tt>) <strong>current_track</strong> 
+  
+
+  
+
+  
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+The current_track method should return the name of the current artist and
+song.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>Hash</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+A hash containing the current `:song` and `:artist`.
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
+  <tr>
+    <td>
+      <pre class="lines">
+
+
+27
+28
+29
+30
+31
+32
+33</pre>
+    </td>
+    <td>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/itunes.rb', line 27</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
+  <span class='id identifier rubyid_path_root'>path_root</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span>
+  <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_path_root'>path_root</span><span class='comma'>,</span> <span class='ivar'>@script</span><span class='rparen'>)</span>
+  <span class='id identifier rubyid_current'>current</span> <span class='op'>=</span> <span class='backtick'>`</span><span class='tstring_content'>osascript </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='rbrace'>}</span><span class='tstring_end'>`</span></span>
+  <span class='id identifier rubyid_current'>current</span> <span class='op'>=</span> <span class='id identifier rubyid_current'>current</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&lt;-SEP-&gt;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
+  <span class='lbrace'>{</span><span class='label'>artist:</span> <span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>song:</span> <span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
+<span class='kw'>end</span></pre>
+    </td>
+  </tr>
+</table>
+</div>
+    
+  </div>
+
+</div>
+
+    <div id="footer">
+  Generated on Sat Oct  6 02:34:27 2012 by
+  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+  0.8.2.1 (ruby-1.9.2).
+</div>
+
+  </body>
+</html>
\ No newline at end of file
index 51ce90917e32a690dfadac1ea2f2724a99bb7f9c..3336a24284fc731d320ad065c9a56409d902e89b 100644 (file)
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+This is the Source for rdio
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
 
+</div>
 
 
 
@@ -319,14 +331,14 @@ Instantiates everything it needs to run.
       <pre class="lines">
 
 
-27
-28
 29
 30
-31</pre>
+31
+32
+33</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 27</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 29</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='ivar'>@name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rdio</span><span class='tstring_end'>'</span></span>
@@ -372,12 +384,12 @@ Returns the value of attribute name
       <pre class="lines">
 
 
-6
-7
-8</pre>
+8
+9
+10</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 6</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 8</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
   <span class='ivar'>@name</span>
@@ -422,9 +434,6 @@ token.
       <pre class="lines">
 
 
-51
-52
-53
 54
 55
 56
@@ -438,10 +447,13 @@ token.
 64
 65
 66
-67</pre>
+67
+68
+69
+70</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 51</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 54</span>
 
 <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_auth_token'>create_auth_token</span>
   <span class='id identifier rubyid_rdio'>rdio</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Rdio</span><span class='op'>::</span><span class='const'>SimpleRdio</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>rdio_key</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>rdio_secret</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
@@ -493,8 +505,6 @@ source. In the case of Rdio it has to authenticate with OAuth.
       <pre class="lines">
 
 
-13
-14
 15
 16
 17
@@ -504,10 +514,12 @@ source. In the case of Rdio it has to authenticate with OAuth.
 21
 22
 23
-24</pre>
+24
+25
+26</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 13</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 15</span>
 
 <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
   <span class='comment'># Validation Code
@@ -553,13 +565,13 @@ The reset method resets any configurations it may have
       <pre class="lines">
 
 
-44
-45
-46
-47</pre>
+47
+48
+49
+50</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 44</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 47</span>
 
 <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
   <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
@@ -623,15 +635,15 @@ A hash containing the current `:song` and `:artist`.
       <pre class="lines">
 
 
-36
-37
-38
 39
 40
-41</pre>
+41
+42
+43
+44</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 36</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 39</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
   <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@rdio</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>currentUser</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>extras</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>lastSongPlayed</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='rparen'>)</span>
@@ -649,7 +661,7 @@ A hash containing the current `:song` and `:artist`.
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index b1a24d610355fe45dba669fccea9683fde543580..a126af59b4b20b763cd5d5e6372ca22f448fbf17 100644 (file)
@@ -464,7 +464,7 @@ the sanitized parameter
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:27 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index d505ea554095f8c71fedde545db10e6c2fc8bb57..681baf6d422d323dc8bbd6475216804a719c339a 100644 (file)
         </ul>
       
         
+        <ul id="alpha_E" class="alpha">
+          <li class="letter">E</li>
+          <ul>
+            
+              <li>
+                <span class='object_link'><a href="Lyricli/Exceptions.html" title="Lyricli::Exceptions (module)">Exceptions</a></span>
+                
+                  <small>(Lyricli)</small>
+                
+              </li>
+            
+          </ul>
+        </ul>
+      
+        
         <ul id="alpha_I" class="alpha">
           <li class="letter">I</li>
           <ul>
         </ul>
       
         
+          </td><td valign='top' width="33%">
+          
+        
         <ul id="alpha_U" class="alpha">
           <li class="letter">U</li>
           <ul>
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:50 2012 by
+  Generated on Sat Oct  6 02:34:26 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index ca6a9fe312e8f6d30d092f1282effa58fcfb65ae..598a4a4f27794b7fe85efd035ec76487817d2217 100644 (file)
@@ -45,7 +45,7 @@
 
       <ul id="full_list" class="class">
         <li><span class='object_link'><a href="top-level-namespace.html" title=" (root)">Top Level Namespace</a></span></li>
-<li><a class='toggle'></a> <span class='object_link'><a href="Lyricli.html" title="Lyricli (module)">Lyricli</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Lyricli/Configuration.html" title="Lyricli::Configuration (class)">Configuration</a></span> &lt; Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span> &lt; Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span> &lt; Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/SourceManager.html" title="Lyricli::SourceManager (class)">SourceManager</a></span> &lt; Object<small class='search_info'>Lyricli</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span><small class='search_info'>Lyricli</small></li><ul><li><span class='object_link'><a href="Lyricli/Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span> &lt; Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Itunes.html" title="Lyricli::Sources::Itunes (class)">Itunes</a></span> &lt; Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span> &lt; Object<small class='search_info'>Lyricli::Sources</small></li></ul><li><span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span><small class='search_info'>Lyricli</small></li></ul>
+<li><a class='toggle'></a> <span class='object_link'><a href="Lyricli.html" title="Lyricli (module)">Lyricli</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Lyricli/Configuration.html" title="Lyricli::Configuration (class)">Configuration</a></span> &lt; Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/Exceptions.html" title="Lyricli::Exceptions (module)">Exceptions</a></span><small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span> &lt; Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span> &lt; Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/SourceManager.html" title="Lyricli::SourceManager (class)">SourceManager</a></span> &lt; Object<small class='search_info'>Lyricli</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span><small class='search_info'>Lyricli</small></li><ul><li><span class='object_link'><a href="Lyricli/Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span> &lt; Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Itunes.html" title="Lyricli::Sources::Itunes (class)">Itunes</a></span> &lt; Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span> &lt; Object<small class='search_info'>Lyricli::Sources</small></li></ul><li><span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span><small class='search_info'>Lyricli</small></li></ul>
 
       </ul>
     </div>
diff --git a/doc/file.README.html b/doc/file.README.html
new file mode 100644 (file)
index 0000000..efaa475
--- /dev/null
@@ -0,0 +1,143 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>
+  File: README
+  
+    &mdash; Documentation by YARD 0.8.2.1
+  
+</title>
+
+  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+  hasFrames = window.top.frames.main ? true : false;
+  relpath = '';
+  framesUrl = "frames.html#!" + escape(window.location.href);
+</script>
+
+
+  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
+
+
+  </head>
+  <body>
+    <div id="header">
+      <div id="menu">
+  
+    <a href="_index.html">Index</a> &raquo; 
+    <span class="title">File: README</span>
+  
+
+  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+      <div id="search">
+  
+    <a class="full_list_link" id="class_list_link"
+        href="class_list.html">
+      Class List
+    </a>
+  
+    <a class="full_list_link" id="method_list_link"
+        href="method_list.html">
+      Method List
+    </a>
+  
+    <a class="full_list_link" id="file_list_link"
+        href="file_list.html">
+      File List
+    </a>
+  
+</div>
+      <div class="clear"></div>
+    </div>
+
+    <iframe id="search_frame"></iframe>
+
+    <div id="content"><div id='filecontents'><h1>Lyricli</h1>
+
+<h2>The command line client for lyrics</h2>
+
+<p>This is a quick introduction for Lyricli. Right now it&#39;s in really early
+stages of development, so it&#39;s lacking in a lot of stuff (mainly tests
+and documentation) ... But it generally works and here&#39;s a tutorial to
+see how to get it working.</p>
+
+<h3>Installing</h3>
+
+<ol>
+<li>Clone this Repo</li>
+<li><code>gem build lyricli.gemspec</code></li>
+<li><code>gem install lyricli-0.0.1.gem</code></li>
+<li>Voila!</li>
+</ol>
+
+<h3>Usage</h3>
+
+<p>Lyricli can be invoked with the command <code>lrc</code> and there are three basic
+ways of using it:</p>
+
+<p><code>lrc</code></p>
+
+<p>When you run it without arguments, it will look in the available sources
+to try to find a playing song and extract the lyrics.</p>
+
+<p><code>lrc artist song</code></p>
+
+<p>When you run it with arguments, it will use them to search for the
+lyrics. This won&#39;t work if you manually disable the arguments source in
+your configuration file.</p>
+
+<h4>Commands</h4>
+
+<p>The third way to use it is by passing it one of the following special
+commands:</p>
+
+<ul>
+<li><code>lrc -l</code> or <code>lrc --list-sources</code> lists the available sources.</li>
+<li><code>lrc -e</code> or <code>lrc --enable SOURCE</code> enable a source from the list.</li>
+<li><code>lrc -d</code> or <code>lrc --disable SOURCE</code> disable a source from the list.</li>
+<li><code>lrc -r</code> or <code>lrc --reset SOURCE</code> reset all configuration for a source.</li>
+<li><code>lrc -v</code> or <code>lrc --version</code> show the installed version of lyricli.</li>
+<li><code>lrc -h</code> or <code>lrc --help</code> display some help</li>
+</ul>
+
+<h3>Roadmap</h3>
+
+<p>There is not much defined right now as a roadmap, but this needs to be
+done:</p>
+
+<ul>
+<li>Specs for all the components</li>
+<li>YARD documentation for all the components</li>
+</ul>
+
+<p>And the first thing I want to work on after that is done is separating
+the Lyrics Engines so we can add/remove lyrics engines in a similar way to how
+we currently add/remove sources.</p>
+
+<h3>Leave Feedback Please!</h3>
+
+<p>If you decide to use or hack away at Lyricly, please don&#39;t forget to
+post any issues you find.</p>
+
+<h3>License</h3>
+
+<p>Licensed under 3-clause-BSD.</p>
+</div></div>
+
+    <div id="footer">
+  Generated on Sat Oct  6 02:34:26 2012 by
+  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+  0.8.2.1 (ruby-1.9.2).
+</div>
+
+  </body>
+</html>
\ No newline at end of file
index 87b6d5b70f114dc74b5db652b9087d4787017bde..efaa47535e7cc08ecbe302e3399a63cf7f9f5f4a 100644 (file)
@@ -134,7 +134,7 @@ post any issues you find.</p>
 </div></div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:50 2012 by
+  Generated on Sat Oct  6 02:34:26 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
index 9f9bf14f5ca508ff11cd15936afee0b311ece04b..c6184477449760897da12d65a8a60faa83e3c628 100644 (file)
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 02:34:26 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>
diff --git a/lib/lyricli/exceptions.rb b/lib/lyricli/exceptions.rb
new file mode 100644 (file)
index 0000000..508c36b
--- /dev/null
@@ -0,0 +1,7 @@
+module Lyricli
+  # The namespace for all exceptions in Lyricli. Has no functionality by
+  # itself
+  module Exceptions
+  end
+end
+
index 65e36dbf95d23786412225ee56a47f0f7f3509ec..beacd4610490d6c17af4dc94f9c035dff08fe027 100644 (file)
@@ -1,12 +1,21 @@
 module Lyricli
+
+  # This class gets the lyrics according to a given artist and song name.
   class LyricsEngine
 
     include Util
 
+    # Starts a new instance of LyricsEngine
+    #
+    # @param [String] artist the artist
+    # @param [String] song the song to look for
     def initialize(artist, song)
       @provider = URI("http://lyrics.wikia.com/api.php?artist=#{sanitize_param artist}&song=#{sanitize_param song}&fmt=realjson")
     end
 
+    # Asks Lyrics Wiki for the lyrics, also cleans up the output a little.
+    #
+    # @return [String] the lyrics
     def get_lyrics
       begin
         response = Net::HTTP.get(@provider)
@@ -28,6 +37,5 @@ module Lyricli
 
       node.inner_text
     end
-
   end
 end
index 3befbd2ab0b6037bd29b457c318d7e51a40b25a6..3514c3408579db0ef7cb41404ed4685c6ee17bcf 100644 (file)
@@ -1,8 +1,12 @@
 module Lyricli
+
+  # Manages the different sources. SourceManager is in charge of enabling and
+  # disabling them, as well as getting the current track.
   class SourceManager
 
     include Util
 
+    # Creates a new instance of SourceManager
     def initialize
       @enabled_sources = []
       @config = Configuration.instance
@@ -16,6 +20,11 @@ module Lyricli
       end
     end
 
+    # Enables a source. This runs the source's enable method and adds it to the
+    # `enabled_sources` configuration key. It will only enable sources that
+    # are "available" (see #available_sources)
+    #
+    # @param [String] source_name the name of the source to enable
     def enable(source_name)
       if available_sources.include?(source_name)
         if klass = parse_class(camelize(source_name))
@@ -31,6 +40,10 @@ module Lyricli
       end
     end
 
+    # Disables a source. This only removes the source from the `enabled_sources`
+    # configuration key.
+    #
+    # @param [String] source_name the name of the source to disable
     def disable(source_name)
       if available_sources.include?(source_name)
         if klass = parse_class(camelize(source_name))
@@ -44,6 +57,10 @@ module Lyricli
       end
     end
 
+    # Resets a source. This runs the source's reset method. It will also disable
+    # them.
+    #
+    # @param [String] source_name the name of the source to reset.
     def reset(source_name)
       if available_sources.include?(source_name)
         if klass = parse_class(camelize(source_name))
@@ -57,6 +74,9 @@ module Lyricli
       end
     end
 
+    # Iterates over every source to attempt to retrieve the current song.
+    #
+    # @return [Hash] the current track, has an `:artist` and `:song` key.
     def current_track
       track = nil
       lock = false
@@ -78,24 +98,34 @@ module Lyricli
       track
     end
 
+    # Returns an array with the available sources. Optionally formats the result
+    # so active sources are identified by an appended *
+    #
+    # @param [Boolean] format whether or not to render the stars for active
+    #                         sources.
+    # @return [Array] the names of the currently available sources.
     def available_sources(format = false)
       path_root = File.expand_path(File.dirname(__FILE__))
       sources = Dir[path_root+"/sources/*.rb"].map{ |s|
         name = s.split("/").last.gsub(/\.rb/, "")
-
-        # Add a star to denote enabled sources
         name
       }
 
       # Remove arguments (Hack?) We don't want anybody to touch tihs one.
       sources.delete("arguments")
       if format
+        # Add a star to denote enabled sources
         format_sources(sources)
       else
         sources
       end
     end
 
+    # Adds a star to all members of the array that correspond to an active
+    # source
+    #
+    # @param [Array] sources the array of sources to format
+    # @return [Array] the formatted array
     def format_sources(sources)
       sources.map{ |s|
         s << "*" if @config["enabled_sources"].include?(s)
diff --git a/lib/lyricli/sources.rb b/lib/lyricli/sources.rb
new file mode 100644 (file)
index 0000000..459ce1c
--- /dev/null
@@ -0,0 +1,6 @@
+module Lyricli
+  # The namespace for all sources in Lyricli. Has no functionality by
+  # itself
+  module Sources
+  end
+end
index 82a815712984cc5d08cd3dbe795b322f7a862c05..150c70a4adc4466f8cb996a381a7f2e298f57a17 100644 (file)
@@ -1,5 +1,7 @@
 module Lyricli
   module Sources
+    # The arguments source. This one is special since it expects two
+    # arguments. It is treated specially by the SourceManager.
     class Arguments
 
       class << self
index 2e647c88a94829b76c30e458f1b010378ae2f103..2bfe471f1c3e3ec291f9e29a35998b0f10e31f86 100644 (file)
@@ -1,5 +1,6 @@
 module Lyricli
   module Sources
+    # The source for iTunes
     class Itunes
 
       class << self
index 40884b7cb78e278e68a3fc79df2e31b32ae9cd80..d34795f512876d04b9c92641a7228f7278cb4c70 100644 (file)
@@ -1,5 +1,7 @@
 module Lyricli
   module Sources
+
+    # This is the Source for rdio
     class Rdio
 
       class << self
@@ -32,6 +34,7 @@ module Lyricli
 
       # The current_track method should return the name of the current
       # artist and song.
+      #
       # @return [Hash] A hash containing the current `:song` and `:artist`.
       def current_track
         response = @rdio.call('currentUser', {'extras' => 'lastSongPlayed'})