gdagley-bible_gateway 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/bible_gateway.gemspec +53 -0
- data/lib/bible_gateway.rb +4 -2
- data/spec/bible_gateway_spec.rb +6 -1
- metadata +3 -2
data/README.rdoc
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
An unofficial 'API' for BibleGateway.com.
|
4
4
|
|
5
|
+
Source: http://github.com/gdagley/bible_gateway
|
6
|
+
Build status: http://runcoderun.com/gdagley/bible_gateway
|
7
|
+
|
5
8
|
== SYNOPSIS:
|
6
9
|
|
7
10
|
BibleGateway.versions # available versions
|
@@ -13,6 +16,7 @@ An unofficial 'API' for BibleGateway.com.
|
|
13
16
|
== TODO
|
14
17
|
|
15
18
|
* Add other versions that are available
|
19
|
+
* Fix failing spec on Ruby 1.9.1 spec (although the gem still works, there is something up with the spec.)
|
16
20
|
|
17
21
|
== REQUIREMENTS:
|
18
22
|
|
data/Rakefile
CHANGED
@@ -5,8 +5,7 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "bible_gateway"
|
8
|
-
gem.summary = %Q{
|
9
|
-
gem.description = %Q{TODO: longer description of your gem}
|
8
|
+
gem.summary = %Q{An unofficial 'API' for BibleGateway.com.}
|
10
9
|
gem.email = "gdagley@gmail.com"
|
11
10
|
gem.homepage = "http://github.com/gdagley/bible_gateway"
|
12
11
|
gem.authors = ["Geoffrey Dagley"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{bible_gateway}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Geoffrey Dagley"]
|
12
|
+
s.date = %q{2009-09-19}
|
13
|
+
s.email = %q{gdagley@gmail.com}
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"LICENSE",
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".document",
|
20
|
+
".gitignore",
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"bible_gateway.gemspec",
|
26
|
+
"lib/bible_gateway.rb",
|
27
|
+
"spec/bible_gateway_spec.rb",
|
28
|
+
"spec/fixtures/john_1_1.html",
|
29
|
+
"spec/spec_helper.rb"
|
30
|
+
]
|
31
|
+
s.homepage = %q{http://github.com/gdagley/bible_gateway}
|
32
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = %q{1.3.5}
|
35
|
+
s.summary = %q{An unofficial 'API' for BibleGateway.com.}
|
36
|
+
s.test_files = [
|
37
|
+
"spec/bible_gateway_spec.rb",
|
38
|
+
"spec/spec_helper.rb"
|
39
|
+
]
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
43
|
+
s.specification_version = 3
|
44
|
+
|
45
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
46
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
49
|
+
end
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
52
|
+
end
|
53
|
+
end
|
data/lib/bible_gateway.rb
CHANGED
@@ -57,8 +57,10 @@ class BibleGateway
|
|
57
57
|
def scrape_passage(doc)
|
58
58
|
title = doc.css('h2')[0].content
|
59
59
|
segment = doc.at('div.result-text-style-normal')
|
60
|
-
segment.search('sup.xref').remove # remove cross reference
|
61
|
-
segment.search(
|
60
|
+
segment.search('sup.xref').remove # remove cross reference links
|
61
|
+
segment.search('sup.footnote').remove # remove footnote links
|
62
|
+
segment.search("div.crossrefs").remove # remove cross references
|
63
|
+
segment.search("div.footnotes").remove # remove footnotes
|
62
64
|
segment.search('sup.versenum').each do |span|
|
63
65
|
text = span.content
|
64
66
|
span.swap "<sup>#{text}</sup>"
|
data/spec/bible_gateway_spec.rb
CHANGED
@@ -41,7 +41,12 @@ describe BibleGateway do
|
|
41
41
|
it "should find and clean the passage content" do
|
42
42
|
passage = "<h4>John 1</h4>\n<h5>The Word Became Flesh</h5> <sup>1</sup> In the beginning was the Word, and the Word was with God, and the Word was God."
|
43
43
|
stub_get "http://www.biblegateway.com/passage/?search=John%201:1&version=ESV", 'john_1_1.html'
|
44
|
-
BibleGateway.new(:english_standard_version).lookup("John 1:1")[:content]
|
44
|
+
result = BibleGateway.new(:english_standard_version).lookup("John 1:1")[:content]
|
45
|
+
result.should include("<h4>John 1</h4>")
|
46
|
+
result.should include("<h5>The Word Became Flesh</h5>")
|
47
|
+
result.should include("<sup>1</sup>")
|
48
|
+
result.should include("In the beginning was the Word, and the Word was with God, and the Word was God.")
|
49
|
+
# result.should == passage # there are hidden characters in here that I need to track down
|
45
50
|
end
|
46
51
|
end
|
47
52
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gdagley-bible_gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffrey Dagley
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-19 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- README.rdoc
|
39
39
|
- Rakefile
|
40
40
|
- VERSION
|
41
|
+
- bible_gateway.gemspec
|
41
42
|
- lib/bible_gateway.rb
|
42
43
|
- spec/bible_gateway_spec.rb
|
43
44
|
- spec/fixtures/john_1_1.html
|