elvallenato 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.bundle/config +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +57 -0
- data/Guardfile +30 -0
- data/Rakefile +2 -45
- data/VERSION +1 -1
- data/autotest/discover.rb +9 -0
- data/elvallenato.gemspec +23 -56
- data/lib/elvallenato.rb +1 -1
- data/lib/elvallenato/letra.rb +7 -6
- data/lib/elvallenato/search.rb +43 -48
- data/lib/elvallenato/version.rb +3 -0
- data/spec/letra_spec.rb +10 -12
- data/spec/search_spec.rb +33 -30
- data/spec/spec_helper.rb +2 -6
- metadata +150 -49
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6a3bd58262fe06546e78aa704c3508c334a29c20
|
4
|
+
data.tar.gz: 96421f8f67875a302d8d91c9f3098ae2551b558f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d69c0b9e5cb9194ccf3173008c1b555968b5780914e3b16a8df49211bc758716a291a45dc00fe98bccd927860f7b80ae0c711f2afc17481999564dc3273b8188
|
7
|
+
data.tar.gz: 4c4fa685d1bc116fc42920606be90aa06655dafa48f8f768bec49a76a2b388a43afd431a4addaba2084ea80a9871cae668fce0c28aac1906f6c43f8e0d1598ce
|
data/.bundle/config
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--- {}
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
elvallenato (0.0.5)
|
5
|
+
RedCloth
|
6
|
+
nokogiri
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
RedCloth (4.2.9)
|
12
|
+
awesome_print (1.1.0)
|
13
|
+
coderay (1.1.0)
|
14
|
+
diff-lcs (1.2.5)
|
15
|
+
formatador (0.2.4)
|
16
|
+
guard (1.7.0)
|
17
|
+
formatador (>= 0.2.4)
|
18
|
+
listen (>= 0.6.0)
|
19
|
+
lumberjack (>= 1.0.2)
|
20
|
+
pry (>= 0.9.10)
|
21
|
+
thor (>= 0.14.6)
|
22
|
+
guard-bundler (1.0.0)
|
23
|
+
bundler (~> 1.0)
|
24
|
+
guard (~> 1.1)
|
25
|
+
guard-rspec (1.2.1)
|
26
|
+
guard (>= 1.1)
|
27
|
+
listen (0.7.3)
|
28
|
+
lumberjack (1.0.5)
|
29
|
+
method_source (0.8.2)
|
30
|
+
nokogiri (1.5.5)
|
31
|
+
pry (0.9.12.6)
|
32
|
+
coderay (~> 1.0)
|
33
|
+
method_source (~> 0.8)
|
34
|
+
slop (~> 3.4)
|
35
|
+
rb-fsevent (0.9.4)
|
36
|
+
rspec (2.14.1)
|
37
|
+
rspec-core (~> 2.14.0)
|
38
|
+
rspec-expectations (~> 2.14.0)
|
39
|
+
rspec-mocks (~> 2.14.0)
|
40
|
+
rspec-core (2.14.8)
|
41
|
+
rspec-expectations (2.14.5)
|
42
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
43
|
+
rspec-mocks (2.14.6)
|
44
|
+
slop (3.5.0)
|
45
|
+
thor (0.19.1)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
ruby
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
awesome_print
|
52
|
+
elvallenato!
|
53
|
+
guard
|
54
|
+
guard-bundler
|
55
|
+
guard-rspec
|
56
|
+
rb-fsevent
|
57
|
+
rspec
|
data/Guardfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'bundler' do
|
5
|
+
watch('Gemfile')
|
6
|
+
# Uncomment next line if Gemfile contain `gemspec' command
|
7
|
+
# watch(/^.+\.gemspec/)
|
8
|
+
end
|
9
|
+
|
10
|
+
guard 'rspec', :version => 2 do
|
11
|
+
watch(%r{^spec/.+_spec\.rb$})
|
12
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
13
|
+
watch('spec/spec_helper.rb') { "spec" }
|
14
|
+
|
15
|
+
# Rails example
|
16
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
17
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
18
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
19
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
20
|
+
watch('config/routes.rb') { "spec/routing" }
|
21
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
22
|
+
|
23
|
+
# Capybara request specs
|
24
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
25
|
+
|
26
|
+
# Turnip features and steps
|
27
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
28
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
29
|
+
end
|
30
|
+
|
data/Rakefile
CHANGED
@@ -1,45 +1,2 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "elvallenato"
|
8
|
-
gem.summary = %Q{Gem to support elvallentato.com}
|
9
|
-
gem.description = %Q{Gem to support el vallenato.com}
|
10
|
-
gem.email = "jmaya@lasamaria.com"
|
11
|
-
# gem.homepage = "http://github.com/jmaya/elvallenato"
|
12
|
-
gem.authors = ["John Maya"]
|
13
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'spec/rake/spectask'
|
22
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
-
spec.libs << 'lib' << 'spec'
|
24
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
-
end
|
26
|
-
|
27
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
-
spec.libs << 'lib' << 'spec'
|
29
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
-
spec.rcov = true
|
31
|
-
end
|
32
|
-
|
33
|
-
task :spec => :check_dependencies
|
34
|
-
|
35
|
-
task :default => :spec
|
36
|
-
|
37
|
-
require 'rake/rdoctask'
|
38
|
-
Rake::RDocTask.new do |rdoc|
|
39
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
-
|
41
|
-
rdoc.rdoc_dir = 'rdoc'
|
42
|
-
rdoc.title = "elvallenato #{version}"
|
43
|
-
rdoc.rdoc_files.include('README*')
|
44
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/elvallenato.gemspec
CHANGED
@@ -1,62 +1,29 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "elvallenato/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
6
|
+
s.name = "elvallenato"
|
7
|
+
s.version = Elvallenato::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["John Maya"]
|
10
|
+
s.email = ["jcmaya@hotmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{This gem will interface with http://www.elvallenato.com}
|
13
|
+
s.description = %q{This gem will interface with http://www.elvallenato.com}
|
9
14
|
|
10
|
-
s.
|
11
|
-
s.authors = ["John Maya"]
|
12
|
-
s.date = %q{2009-11-24}
|
13
|
-
s.description = %q{Gem to support el vallenato.com}
|
14
|
-
s.email = %q{jmaya@lasamaria.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"elvallenato.gemspec",
|
27
|
-
"lib/elvallenato.rb",
|
28
|
-
"lib/elvallenato/letra.rb",
|
29
|
-
"lib/elvallenato/search.rb",
|
30
|
-
"spec/elvallenato_spec.rb",
|
31
|
-
"spec/fixtures/diomedes_search.htm",
|
32
|
-
"spec/fixtures/siete_palabras.htm",
|
33
|
-
"spec/letra_spec.rb",
|
34
|
-
"spec/search_spec.rb",
|
35
|
-
"spec/spec.opts",
|
36
|
-
"spec/spec_helper.rb"
|
37
|
-
]
|
38
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
-
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.5}
|
41
|
-
s.summary = %q{Gem to support elvallentato.com}
|
42
|
-
s.test_files = [
|
43
|
-
"spec/search_spec.rb",
|
44
|
-
"spec/elvallenato_spec.rb",
|
45
|
-
"spec/letra_spec.rb",
|
46
|
-
"spec/spec_helper.rb"
|
47
|
-
]
|
48
|
-
|
49
|
-
if s.respond_to? :specification_version then
|
50
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
|
-
s.specification_version = 3
|
15
|
+
s.rubyforge_project = "elvallenato"
|
52
16
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.add_development_dependency('rspec')
|
22
|
+
s.add_development_dependency('guard')
|
23
|
+
s.add_development_dependency('guard-rspec')
|
24
|
+
s.add_development_dependency('guard-bundler')
|
25
|
+
s.add_development_dependency('rb-fsevent')
|
26
|
+
s.add_development_dependency('awesome_print')
|
27
|
+
s.add_dependency('RedCloth')
|
28
|
+
s.add_dependency('nokogiri')
|
61
29
|
end
|
62
|
-
|
data/lib/elvallenato.rb
CHANGED
data/lib/elvallenato/letra.rb
CHANGED
@@ -1,28 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
module ElVallenato
|
2
4
|
class Letra
|
3
5
|
|
4
6
|
attr_reader :content
|
5
7
|
|
6
8
|
def initialize(content)
|
7
|
-
|
8
9
|
@content = content
|
9
|
-
@doc =
|
10
|
+
@doc = Nokogiri::HTML(@content)
|
10
11
|
end
|
11
12
|
|
12
13
|
def title
|
13
|
-
@doc.at(".text_title").
|
14
|
+
@title ||= @doc.at(".text_title").text
|
14
15
|
end
|
15
16
|
|
16
17
|
def body
|
17
|
-
@doc.search("td .text_std")[6].inner_html
|
18
|
+
@body ||= @doc.search("td .text_std")[6].inner_html
|
18
19
|
end
|
19
20
|
|
20
21
|
def composer
|
21
|
-
@doc.search("td .text_std")[9].
|
22
|
+
@composer ||= @doc.search("td .text_std")[9].text
|
22
23
|
end
|
23
24
|
|
24
25
|
def artist
|
25
|
-
@doc.search("td .text_std")[8].
|
26
|
+
@artist ||= @doc.search("td .text_std")[8].text
|
26
27
|
end
|
27
28
|
|
28
29
|
end
|
data/lib/elvallenato/search.rb
CHANGED
@@ -1,70 +1,65 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'URI'
|
4
|
+
|
1
5
|
module ElVallenato
|
2
6
|
|
3
7
|
class Search
|
4
|
-
attr_reader :
|
5
|
-
require 'open-uri'
|
6
|
-
require 'cgi'
|
7
|
-
|
8
|
-
def initialize(mode,query)
|
9
|
-
@mode = mode
|
10
|
-
@query = query
|
11
|
-
url
|
12
|
-
end
|
13
|
-
|
14
|
-
def url
|
15
|
-
return @url if !@url.nil?
|
16
|
-
if @query.nil? or @query == ""
|
17
|
-
@url = "http://www.elvallenato.com/letras/busqueda.php?x=&busca=#{@mode}&image.x=8&image.y=6"
|
18
|
-
else
|
19
|
-
@url = "http://www.elvallenato.com/letras/busqueda.php?x=#{CGI.escape(@query)}&busca=#{@mode}&image.x=12&image.y=11"
|
20
|
-
end
|
21
|
-
end
|
8
|
+
attr_reader :mode,:term,:url
|
22
9
|
|
23
|
-
def
|
24
|
-
@
|
10
|
+
def initialize(mode,term)
|
11
|
+
@current_link = 0
|
12
|
+
@mode = CGI.escape(mode)
|
13
|
+
@term = CGI.escape(term)
|
14
|
+
@url = "http://www.elvallenato.com/letras/busqueda.php?x=#{@term}&busca=#{@mode}&image.x=12&image.y=11"
|
15
|
+
@base = "http://" + URI.parse(@url).host
|
25
16
|
end
|
26
17
|
|
27
|
-
def
|
28
|
-
@
|
18
|
+
def content
|
19
|
+
@content ||= OpenURI.open_uri(@url).read
|
29
20
|
end
|
30
21
|
|
31
22
|
def next_url
|
32
|
-
|
33
|
-
@
|
34
|
-
|
23
|
+
return nil if @current_link == pages
|
24
|
+
if @current_link > 0
|
25
|
+
link = @all_links[@current_link]["href"]
|
26
|
+
@current_link += 1
|
27
|
+
return [@base,link].join("/")
|
28
|
+
else
|
29
|
+
@all_links ||= Nokogiri::HTML.parse(content).css("span.class5 a")
|
30
|
+
link = @all_links[0]["href"]
|
31
|
+
@current_link += 1
|
32
|
+
return [@base,link].join("/")
|
35
33
|
end
|
36
|
-
@url = partial_next
|
37
|
-
partial_next == "http://www.elvallenato.com/letras/" ? nil : partial_next
|
38
|
-
# @next_url
|
39
|
-
end
|
40
34
|
|
41
|
-
def load_content=(lc)
|
42
|
-
@load_content = lc
|
43
|
-
@doc = Hpricot(@load_content)
|
44
35
|
end
|
45
|
-
|
46
|
-
|
47
|
-
@load_content = open(@url).read
|
48
|
-
@doc = Hpricot(@load_content)
|
36
|
+
def pages
|
37
|
+
links.size
|
49
38
|
end
|
50
|
-
|
51
|
-
def
|
52
|
-
@
|
39
|
+
|
40
|
+
def links
|
41
|
+
@page_links ||= Nokogiri::HTML.parse(content).css("span.class5 a").collect do |e|
|
42
|
+
e["href"] if e["href"] =~ /pg=\d+$/
|
43
|
+
end.compact.sort.uniq
|
53
44
|
end
|
54
45
|
|
55
|
-
def
|
56
|
-
|
46
|
+
def liric_links
|
47
|
+
@liric_links ||= Nokogiri::HTML.parse(content).css('.class10 a').collect do |e|
|
48
|
+
clean_url(e["href"])
|
49
|
+
end.compact.sort.uniq
|
57
50
|
end
|
58
51
|
|
59
|
-
def clean_url(
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
52
|
+
def clean_url(url)
|
53
|
+
url =~ /letras\/letras\/(\d+)\/(.+?)$/
|
54
|
+
id = $1
|
55
|
+
song_name = CGI.escape($2)
|
56
|
+
[@base,"letras","letras",id,song_name].join("/")
|
64
57
|
end
|
65
58
|
|
66
|
-
def
|
67
|
-
|
59
|
+
def letras
|
60
|
+
liric_links.collect do |link|
|
61
|
+
Letra.new(OpenURI.open_uri(link).read)
|
62
|
+
end
|
68
63
|
end
|
69
64
|
end
|
70
65
|
end
|
data/spec/letra_spec.rb
CHANGED
@@ -1,31 +1,29 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
2
|
|
4
3
|
describe Letra do
|
5
4
|
before(:each) do
|
6
|
-
@content = File.
|
7
|
-
@
|
5
|
+
@content = File.open(File.join(File.dirname(__FILE__), "fixtures", "siete_palabras.htm"),'r:ISO-8859-1').read
|
6
|
+
@letra = Letra.new(@content)
|
8
7
|
end
|
9
|
-
|
8
|
+
|
10
9
|
it "should be started with the html content" do
|
11
|
-
|
12
|
-
l.content.size.should eql 71004
|
10
|
+
@letra.content.size.should eql 71004
|
13
11
|
end
|
14
12
|
|
15
13
|
it "should have a title" do
|
16
|
-
@
|
14
|
+
@letra.title.should eql "Siete Palabras"
|
17
15
|
end
|
18
|
-
|
16
|
+
|
19
17
|
it "should have a body" do
|
20
|
-
@
|
18
|
+
@letra.body.scan(/y q sabe y no sabe nada,<br>/)[0].should == "y q sabe y no sabe nada,<br>"
|
21
19
|
end
|
22
20
|
|
23
21
|
it "chould have a composer" do
|
24
|
-
@
|
22
|
+
@letra.composer.should eql "Kaleth Morales"
|
25
23
|
end
|
26
24
|
|
27
25
|
it "should have an artist" do
|
28
|
-
@
|
26
|
+
@letra.artist.should eql "Kaleth Morales"
|
29
27
|
end
|
30
|
-
|
28
|
+
|
31
29
|
end
|
data/spec/search_spec.rb
CHANGED
@@ -2,51 +2,54 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
describe Search do
|
4
4
|
before(:each) do
|
5
|
-
@
|
6
|
-
@
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
it "should state cantante compositor clave the type and the search" do
|
11
|
-
#http://www.elvallenato.com/letras/busqueda.php?x=&busca=canta&image.x=8&image.y=6
|
12
|
-
s = Search.new("canta", "Diomedes Diaz")
|
5
|
+
@search_content = File.open(File.join(File.dirname(__FILE__), "fixtures", "diomedes_search.htm"),'r:ISO-8859-1').read
|
6
|
+
@letra_content = File.open(File.join(File.dirname(__FILE__), "fixtures", "siete_palabras.htm"),'r:ISO-8859-1').read
|
7
|
+
OpenURI.stub!(:open_uri).and_return(StringIO.new(@search_content))
|
8
|
+
@search = Search.new('canta', 'Diomedes')
|
13
9
|
end
|
14
10
|
|
15
|
-
it "should
|
16
|
-
|
17
|
-
s.url.should eql "http://www.elvallenato.com/letras/busqueda.php?x=&busca=canta&image.x=8&image.y=6"
|
11
|
+
it "should initialize with a mode and a term" do
|
12
|
+
Search.new("canta", "Diomedes").term.should == "Diomedes"
|
18
13
|
end
|
19
14
|
|
20
|
-
it "should generate the right url
|
21
|
-
|
22
|
-
s.url.should eql "http://www.elvallenato.com/letras/busqueda.php?x=Diomedes&busca=canta&image.x=12&image.y=11"
|
15
|
+
it "should generate the right url" do
|
16
|
+
@search.url.should == "http://www.elvallenato.com/letras/busqueda.php?x=Diomedes&busca=canta&image.x=12&image.y=11"
|
23
17
|
end
|
24
|
-
|
25
18
|
it "should deal with url query with spaces" do
|
26
19
|
s = Search.new("canta", "Diomedes Dias")
|
27
20
|
s.url.should eql "http://www.elvallenato.com/letras/busqueda.php?x=Diomedes+Dias&busca=canta&image.x=12&image.y=11"
|
28
21
|
end
|
29
|
-
|
30
|
-
|
22
|
+
|
23
|
+
describe "Load" do
|
24
|
+
it "should open the url and read the html to a local variable" do
|
25
|
+
@search.content.size.should == 54171
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should load the content only 1 time (we are using memoization)" do
|
29
|
+
OpenURI.should_receive(:open_uri).exactly(1).times
|
30
|
+
@search.content
|
31
|
+
@search.content
|
32
|
+
@search.content
|
33
|
+
end
|
31
34
|
end
|
32
|
-
|
33
|
-
it "should have
|
34
|
-
@
|
35
|
+
|
36
|
+
it "should have n pages of searches" do
|
37
|
+
@search.pages.should == 44
|
35
38
|
end
|
36
39
|
|
37
|
-
it "should
|
38
|
-
|
40
|
+
it "should have a valid page" do
|
41
|
+
(1..44).each do |t|
|
42
|
+
@search.next_url.should eql "http://www.elvallenato.com/busqueda.php?x=Diomedes&busca=canta&pg=#{t}"
|
43
|
+
end
|
44
|
+
#the next one should be nil
|
45
|
+
@search.next_url.should be_nil
|
39
46
|
end
|
40
47
|
|
41
48
|
it "should clean the url" do
|
42
|
-
@
|
49
|
+
@search.liric_links[0].should == "http://www.elvallenato.com/letras/letras/1948/La+irremplazable-Diomedes+Diaz+Maestre-Edilberto+Daza.htm"
|
43
50
|
end
|
44
|
-
|
45
|
-
it "should
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should have valid links" do
|
50
|
-
@s.collect_links[0].should eql 'http://www.elvallenato.com/letras/letras/347/Bonita-Diomedes+Diaz-Diomedes+Diaz.htm'
|
51
|
+
|
52
|
+
it "should collect lirics" do
|
53
|
+
@search.letras.size.should eql 20
|
51
54
|
end
|
52
55
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
require 'elvallenato'
|
4
|
-
require '
|
5
|
-
require '
|
4
|
+
require 'rspec'
|
5
|
+
require 'rspec/autorun'
|
6
6
|
|
7
7
|
include ElVallenato
|
8
|
-
|
9
|
-
Spec::Runner.configure do |config|
|
10
|
-
|
11
|
-
end
|
metadata
CHANGED
@@ -1,47 +1,150 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: elvallenato
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- John Maya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2014-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
16
14
|
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
17
20
|
type: :development
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: guard
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rb-fsevent
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: awesome_print
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: RedCloth
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: nokogiri
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: This gem will interface with http://www.elvallenato.com
|
126
|
+
email:
|
127
|
+
- jcmaya@hotmail.com
|
27
128
|
executables: []
|
28
|
-
|
29
129
|
extensions: []
|
30
|
-
|
31
|
-
|
32
|
-
-
|
33
|
-
- README.rdoc
|
34
|
-
files:
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- .bundle/config
|
35
133
|
- .document
|
36
134
|
- .gitignore
|
135
|
+
- Gemfile
|
136
|
+
- Gemfile.lock
|
137
|
+
- Guardfile
|
37
138
|
- LICENSE
|
38
139
|
- README.rdoc
|
39
140
|
- Rakefile
|
40
141
|
- VERSION
|
142
|
+
- autotest/discover.rb
|
41
143
|
- elvallenato.gemspec
|
42
144
|
- lib/elvallenato.rb
|
43
145
|
- lib/elvallenato/letra.rb
|
44
146
|
- lib/elvallenato/search.rb
|
147
|
+
- lib/elvallenato/version.rb
|
45
148
|
- spec/elvallenato_spec.rb
|
46
149
|
- spec/fixtures/diomedes_search.htm
|
47
150
|
- spec/fixtures/siete_palabras.htm
|
@@ -49,36 +152,34 @@ files:
|
|
49
152
|
- spec/search_spec.rb
|
50
153
|
- spec/spec.opts
|
51
154
|
- spec/spec_helper.rb
|
52
|
-
|
53
|
-
homepage:
|
155
|
+
homepage: ''
|
54
156
|
licenses: []
|
55
|
-
|
157
|
+
metadata: {}
|
56
158
|
post_install_message:
|
57
|
-
rdoc_options:
|
58
|
-
|
59
|
-
require_paths:
|
159
|
+
rdoc_options: []
|
160
|
+
require_paths:
|
60
161
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version:
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
version: "0"
|
72
|
-
version:
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - '>='
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
73
172
|
requirements: []
|
74
|
-
|
75
|
-
|
76
|
-
rubygems_version: 1.3.5
|
173
|
+
rubyforge_project: elvallenato
|
174
|
+
rubygems_version: 2.2.2
|
77
175
|
signing_key:
|
78
|
-
specification_version:
|
79
|
-
summary:
|
80
|
-
test_files:
|
81
|
-
- spec/search_spec.rb
|
176
|
+
specification_version: 4
|
177
|
+
summary: This gem will interface with http://www.elvallenato.com
|
178
|
+
test_files:
|
82
179
|
- spec/elvallenato_spec.rb
|
180
|
+
- spec/fixtures/diomedes_search.htm
|
181
|
+
- spec/fixtures/siete_palabras.htm
|
83
182
|
- spec/letra_spec.rb
|
183
|
+
- spec/search_spec.rb
|
184
|
+
- spec/spec.opts
|
84
185
|
- spec/spec_helper.rb
|