scriptures 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scriptures.gemspec
4
+ gemspec
5
+
6
+ gem 'rspec'
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Luke Holder
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Scriptures
2
+
3
+ This is a self contained copy of the LDS standard works as a ruby gem.
4
+
5
+ ## Why?
6
+
7
+ Because I can.
8
+ Thinking about making a scriptures REST services out of it.
9
+ Maybe I am looking for a job at tech.lds.org? HAHA.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'scriptures'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install scriptures
24
+
25
+ ## Dependancies
26
+
27
+ Needs sqlite engine installed. My preference on OSX is to install through homebrew with:
28
+
29
+ $ brew install sqlite
30
+
31
+ ## Usage
32
+
33
+ TODO: API is still in progress
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => :spec
@@ -0,0 +1,19 @@
1
+ module Scriptures
2
+ class Book
3
+ include DataMapper::Resource
4
+
5
+ storage_names[:default] = 'books'
6
+
7
+ property :id, Integer, :key => true
8
+ property :volume_id, Integer
9
+ property :title, String
10
+ property :proper_title, String
11
+ property :subtitle, String
12
+ property :abbreviation, String
13
+ property :idx, String
14
+ property :jst, String
15
+
16
+ has n, :chapters
17
+ belongs_to :volume
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ module Scriptures
2
+ class Chapter
3
+ include DataMapper::Resource
4
+
5
+ storage_names[:default] = 'chapters'
6
+
7
+ property :id, Integer, :key => true
8
+ property :book_id, Integer
9
+ property :chapter, Integer
10
+
11
+ has n, :verses
12
+ belongs_to :book
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module Scriptures
2
+ class Verse
3
+ include DataMapper::Resource
4
+
5
+ storage_names[:default] = 'verses'
6
+
7
+ property :id, Integer, :key => true
8
+ property :chapter_id, Integer
9
+ property :verse, Integer
10
+ property :scripture, Text
11
+ property :pilcrow, Boolean
12
+
13
+ belongs_to :chapter
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module Scriptures
2
+ class Volume
3
+ include DataMapper::Resource
4
+
5
+ storage_names[:default] = 'volumes'
6
+
7
+ property :id, Integer, :key => true
8
+ property :title, String
9
+ property :proper_title, String
10
+ property :subtitle, String
11
+ property :abbreviation, String
12
+ property :idx, String
13
+
14
+ has n, :books
15
+ end
16
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ module Scriptures
2
+ module Config
3
+ DataMapper.setup(:default, "sqlite3:///#{File.expand_path(File.dirname(__FILE__))}/../scriptures.db")
4
+ end
5
+ end
6
+
@@ -0,0 +1,3 @@
1
+ module Scriptures
2
+ VERSION = "0.0.1"
3
+ end
data/lib/scriptures.db ADDED
Binary file
data/lib/scriptures.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "data_mapper"
2
+
3
+ require "scriptures/version"
4
+ require "scriptures/setup"
5
+
6
+ require "scriptures/models/volume"
7
+ require "scriptures/models/book"
8
+ require "scriptures/models/chapter"
9
+ require "scriptures/models/verse"
10
+
11
+ module Scriptures
12
+
13
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/scriptures/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Luke Holder"]
6
+ gem.email = ["lukemh@gmail.com"]
7
+ gem.description = %q{The Standard Works of The Church of Jesus Christ of Latter-day Saints}
8
+ gem.summary = %q{The Scriptures}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "scriptures"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Scriptures::VERSION
17
+
18
+ gem.add_dependency('dm-sqlite-adapter')
19
+ gem.add_dependency('data_mapper')
20
+
21
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ describe Scriptures::Volume do
4
+ it "should connect to the data source and return a volume's abbreviation" do
5
+ Scriptures::Volume.first.abbreviation.should eq("OT")
6
+ end
7
+ it "should return total number of books in a volume" do
8
+ volume = Scriptures::Volume.first(:abbreviation => 'BoM')
9
+ volume.books.count.should eql(15)
10
+ end
11
+ end
12
+
13
+ describe Scriptures::Book do
14
+ it "should connect to the data source and return a book proper_title" do
15
+ Scriptures::Book.first.proper_title.should eq("The First Book of Moses called Genesis")
16
+ end
17
+
18
+ it "should return the total number of chapters given any book" do
19
+ genesis = Scriptures::Book.first
20
+ genesis.chapters.count.should eql(50)
21
+ exodus = Scriptures::Book.get!(2)
22
+ exodus.chapters.count.should eql(40)
23
+ end
24
+ end
25
+
26
+ describe Scriptures::Chapter do
27
+ it "should connect to the data source and return a chapters id" do
28
+ Scriptures::Chapter.first.id.should eq(1)
29
+ end
30
+
31
+ it "should return the total number of verses in a chapter" do
32
+ volume = Scriptures::Volume.first(:abbreviation => 'BoM')
33
+ book = volume.books.first
34
+ chapter = book.chapters.first
35
+ chapter.verses.count.should eql(20)
36
+ end
37
+ end
38
+
39
+
40
+ describe Scriptures::Verse do
41
+ it "should connect to the data source and return a verse" do
42
+ Scriptures::Verse.first.scripture.should eq("IN the beginning God created the heaven and the earth.")
43
+ end
44
+
45
+ it "knows what chapter, book, and volume it belongs to" do
46
+ volume = Scriptures::Volume.first(:abbreviation => 'BoM')
47
+ book = volume.books.first
48
+ chapter = book.chapters.first
49
+ verse = chapter.verses.first
50
+ verse.scripture.should == "I, Nephi, having been born of goodly parents, therefore I was taught somewhat in all the learning of my father; and having seen many afflictions in the course of my days, nevertheless, having been highly favored of the Lord in all my days; yea, having had a great knowledge of the goodness and the mysteries of God, therefore I make a record of my proceedings in my days."
51
+ verse.chapter.id == "1190"
52
+ verse.chapter.book.title.should == "1 Nephi"
53
+ verse.chapter.book.volume.abbreviation.should == "BoM"
54
+ end
55
+
56
+ end
57
+
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'scriptures' # and any other gems you need
5
+
6
+ RSpec.configure do |config|
7
+ # some (optional) config here
8
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scriptures
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Luke Holder
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: dm-sqlite-adapter
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: data_mapper
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: The Standard Works of The Church of Jesus Christ of Latter-day Saints
47
+ email:
48
+ - lukemh@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE
56
+ - README.md
57
+ - Rakefile
58
+ - lib/scriptures.db
59
+ - lib/scriptures.rb
60
+ - lib/scriptures/models/book.rb
61
+ - lib/scriptures/models/chapter.rb
62
+ - lib/scriptures/models/verse.rb
63
+ - lib/scriptures/models/volume.rb
64
+ - lib/scriptures/scriptures.db
65
+ - lib/scriptures/setup.rb
66
+ - lib/scriptures/version.rb
67
+ - scriptures.gemspec
68
+ - spec/database_spec.rb
69
+ - spec/spec_helper.rb
70
+ homepage: ''
71
+ licenses: []
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 1.8.24
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: The Scriptures
94
+ test_files:
95
+ - spec/database_spec.rb
96
+ - spec/spec_helper.rb
97
+ has_rdoc: