rapgenius 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Tim Rogers
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -3,10 +3,15 @@ module RapGenius
3
3
  class Song
4
4
  include RapGenius::Scraper
5
5
 
6
+ def self.find(path)
7
+ self.new(path)
8
+ end
9
+
6
10
  def initialize(path)
7
11
  self.url = path
8
12
  end
9
13
 
14
+
10
15
  def artist
11
16
  document.css('.song_title a').text
12
17
  end
@@ -1,3 +1,3 @@
1
1
  module RapGenius
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
Binary file
data/spec/song_spec.rb CHANGED
@@ -8,7 +8,22 @@ describe RapGenius::Song do
8
8
  RapGenius::Song.any_instance.stubs(:fetch).
9
9
  returns(File.read(File.expand_path("../support/song.html", __FILE__)))
10
10
  end
11
-
11
+
12
+ describe ".find" do
13
+ subject { described_class.find("Tim-rogers-swag-lyrics") }
14
+
15
+ its(:url) { should eq "http://rapgenius.com/Tim-rogers-swag-lyrics"}
16
+
17
+ it "should fetch the document to get song's details" do
18
+ subject.expects(:fetch).once.returns(
19
+ File.read(File.expand_path("../support/annotation.html", __FILE__))
20
+ )
21
+
22
+ subject.title
23
+ end
24
+ end
25
+
26
+
12
27
  its(:url) { should eq "http://rapgenius.com/foobar" }
13
28
  its(:title) { should eq "Control" }
14
29
  its(:artist) { should eq "Big Sean" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapgenius
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -86,6 +86,7 @@ extra_rdoc_files: []
86
86
  files:
87
87
  - Gemfile
88
88
  - Gemfile.lock
89
+ - LICENSE
89
90
  - Rakefile
90
91
  - lib/rapgenius.rb
91
92
  - lib/rapgenius/annotation.rb
@@ -93,6 +94,7 @@ files:
93
94
  - lib/rapgenius/scraper.rb
94
95
  - lib/rapgenius/song.rb
95
96
  - lib/rapgenius/version.rb
97
+ - pkg/rapgenius-0.0.1.gem
96
98
  - rapgenius.gemspec
97
99
  - spec/annotation_spec.rb
98
100
  - spec/scraper_spec.rb