lbp 0.0.2 → 0.1.0
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.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/bin/lbp +33 -2
- data/lbp.gemspec +3 -4
- data/lib/lbp.rb +15 -5
- data/lib/lbp/expression.rb +163 -0
- data/lib/lbp/file.rb +173 -0
- data/lib/lbp/file_part.rb +120 -0
- data/lib/lbp/functions.rb +11 -2
- data/lib/lbp/manifestation.rb +36 -0
- data/lib/lbp/paragraph_image.rb +39 -0
- data/lib/lbp/query.rb +181 -0
- data/lib/lbp/resource.rb +72 -0
- data/lib/lbp/transcription.rb +27 -243
- data/lib/lbp/version.rb +1 -1
- data/spec/config_globals.rb +28 -13
- data/spec/expression_spec.rb +96 -0
- data/spec/file_part_spec.rb +55 -0
- data/spec/file_spec.rb +130 -0
- data/spec/paragraph_image_spec.rb +46 -0
- data/spec/query_spec.rb +27 -0
- data/spec/resource_spec.rb +78 -0
- data/spec/transcription_spec.rb +21 -111
- metadata +40 -19
- data/lib/lbp/collection.rb +0 -131
- data/lib/lbp/item.rb +0 -153
- data/lib/lbp/item_group.rb +0 -52
- data/lib/lbp/paragraph.rb +0 -87
- data/spec/collection_spec.rb +0 -60
- data/spec/item_group_spec.rb +0 -39
- data/spec/item_spec.rb +0 -74
- data/spec/paragraph_spec.rb +0 -37
data/spec/item_group_spec.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'lbp'
|
3
|
-
require 'pry'
|
4
|
-
require 'nokogiri'
|
5
|
-
|
6
|
-
describe 'item group object' do
|
7
|
-
|
8
|
-
require_relative "config_globals"
|
9
|
-
|
10
|
-
$itemgroup = Lbp::ItemGroup.new($projectfile, "deFide")
|
11
|
-
|
12
|
-
it 'should return the item group id input at initialization' do
|
13
|
-
result = $itemgroup.igid
|
14
|
-
expect(result).to be_kind_of(String)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should return an array of Item objects from with the Item group' do
|
18
|
-
result = $itemgroup.items
|
19
|
-
expect(result).to be_kind_of(Array)
|
20
|
-
end
|
21
|
-
it 'should return an specific item object when a specific item group id is given' do
|
22
|
-
result = $itemgroup.item('lectio1')
|
23
|
-
expect(result).to be_kind_of(Lbp::Item)
|
24
|
-
end
|
25
|
-
it 'should return the title of the item group' do
|
26
|
-
result = $itemgroup.title
|
27
|
-
expect(result).to be_kind_of(String)
|
28
|
-
end
|
29
|
-
it 'should return return true if the group has sub-groups and false if it does not' do
|
30
|
-
result = $itemgroup.has_sub_group?
|
31
|
-
# not ideal because I would prefer the test to pass if the result is either false or true
|
32
|
-
expect(result).to be false
|
33
|
-
end
|
34
|
-
it 'should return return true if the group has sub-groups and false if it does not' do
|
35
|
-
result = $itemgroup.has_parent_group?
|
36
|
-
# not ideal because I would prefer the test to pass if the result is either false or true
|
37
|
-
expect(result).to be false
|
38
|
-
end
|
39
|
-
end
|
data/spec/item_spec.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'lbp'
|
3
|
-
require 'pry'
|
4
|
-
require 'nokogiri'
|
5
|
-
|
6
|
-
describe 'item object' do
|
7
|
-
|
8
|
-
require_relative "config_globals"
|
9
|
-
|
10
|
-
$itemobject = Lbp::Item.new($projectfile, 'lectio1')
|
11
|
-
|
12
|
-
it 'should return the filestem given at construction' do
|
13
|
-
result = $itemobject.fs
|
14
|
-
expect(result).to be_kind_of(String)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should return the full directory path of file' do
|
18
|
-
result = $itemobject.file_dir
|
19
|
-
expect(result).to be_kind_of(String)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'should retrieve the item name from the TEI xml file' do
|
23
|
-
result = $itemobject.title
|
24
|
-
expect(result).to be_kind_of(String)
|
25
|
-
end
|
26
|
-
it 'should return true when file is part of a git directory' do
|
27
|
-
result = $itemobject.is_git_dir
|
28
|
-
result.should == true
|
29
|
-
end
|
30
|
-
it 'should return an array of branches' do
|
31
|
-
result = $itemobject.git_branches
|
32
|
-
expect(result).to be_instance_of(Array)
|
33
|
-
expect(result).to include("master")
|
34
|
-
end
|
35
|
-
it 'should return an array of tags' do
|
36
|
-
result = $itemobject.git_tags
|
37
|
-
expect(result).to be_instance_of(Array)
|
38
|
-
expect(result).to include("2011.10")
|
39
|
-
end
|
40
|
-
it 'should return the current branch' do
|
41
|
-
result = $itemobject.git_current_branch
|
42
|
-
expect(result).to be_instance_of(String)
|
43
|
-
#expect(result).to eq("master")
|
44
|
-
end
|
45
|
-
it 'should return the sequence number of the item' do
|
46
|
-
result = $itemobject.order_number
|
47
|
-
expect(result).to be_kind_of(Integer)
|
48
|
-
end
|
49
|
-
it 'should return an item of object of the previous item' do
|
50
|
-
result = $itemobject.previous
|
51
|
-
expect(result).to be_instance_of(Lbp::Item)
|
52
|
-
end
|
53
|
-
it 'should return an item of object of the next item' do
|
54
|
-
result = $itemobject.next
|
55
|
-
expect(result).to be_instance_of(Lbp::Item)
|
56
|
-
end
|
57
|
-
it 'should return a transcription object' do
|
58
|
-
result = $itemobject.transcription
|
59
|
-
expect(result).to be_instance_of(Lbp::Transcription)
|
60
|
-
end
|
61
|
-
it 'should return a file path for a specified transcription' do
|
62
|
-
result = $itemobject.file_path
|
63
|
-
expect(result).to be_kind_of(String)
|
64
|
-
end
|
65
|
-
it 'should return a filehash' do
|
66
|
-
result = $itemobject.file_hash
|
67
|
-
expect(result).to be_kind_of(Hash)
|
68
|
-
end
|
69
|
-
it 'should return an array of Transcriptions objects when transcriptions method is called' do
|
70
|
-
result = $itemobject.transcriptions
|
71
|
-
expect(result).to be_kind_of(Array)
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
data/spec/paragraph_spec.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'lbp'
|
3
|
-
require 'pry'
|
4
|
-
require 'nokogiri'
|
5
|
-
|
6
|
-
describe 'paragraph object' do
|
7
|
-
|
8
|
-
require_relative "config_globals"
|
9
|
-
paragraph1 = "l1-cpspfs"
|
10
|
-
paragraph3 = "l1-shoatd"
|
11
|
-
$paragraph = Lbp::Paragraph.new($projectfile, $filehash, paragraph1)
|
12
|
-
|
13
|
-
it 'should return the pid for the Paragraph object' do
|
14
|
-
result = $paragraph.pid
|
15
|
-
|
16
|
-
expect(result).to be_kind_of(String)
|
17
|
-
end
|
18
|
-
it 'should return the number of the paragraph number' do
|
19
|
-
result = $paragraph.number
|
20
|
-
expect(result).to be_kind_of(Integer)
|
21
|
-
end
|
22
|
-
it 'should return the next paragraph object or nil if there are no more paragraphs' do
|
23
|
-
result = $paragraph.next
|
24
|
-
expect(result).to be_kind_of(Lbp::Paragraph)
|
25
|
-
end
|
26
|
-
it 'should return the previous paragraph object or nil if there are no more paragraphs' do
|
27
|
-
result = $paragraph.previous
|
28
|
-
#this test works but I don't know how to write a test matching object or nil
|
29
|
-
#expect(result).to be(Lbp::Paragraph || nil)
|
30
|
-
end
|
31
|
-
it 'should return the plain text of the paragraph as a nokogiri object' do
|
32
|
-
|
33
|
-
result = $paragraph.transform_plain_text
|
34
|
-
expect(result).to be_instance_of(Nokogiri::XML::NodeSet)
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|