boo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/boo.rb CHANGED
@@ -65,7 +65,7 @@ module BOO
65
65
  require 'yaml'
66
66
  require "madeleine"
67
67
 
68
- $madeleine = Madeleine::SnapshotMadeleine.new("bible-en"){ Bible.new }
68
+ $madeleine = Madeleine::SnapshotMadeleine.new("#{File.dirname(__FILE__)}/../bible-en"){ Bible.new }
69
69
 
70
70
  $bible = $madeleine.system
71
71
 
@@ -2,7 +2,7 @@ module Boo
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # load bible from html files:
4
+ # I get this files from iPhone EBooks.
5
+ # if you have an iPhone you can reload this bible object using scp on command line:
6
+ # scp -r root@192.168.1.102:/var/mobile/Media/EBooks/King\ James\ Version/*T ./
7
+ # run on console.
8
+
9
+ @bible = BOO::Bible.new
10
+ @bible.testaments = {}
11
+ @bible.testaments["NT"] = @bible.testaments["OT"] = {}
12
+
13
+ match_chapter_number = /chapter_(\d+)\.html/
14
+
15
+ %w(OT NT).each do |testament_dir|
16
+ testament = Dir.entries("#{testament_dir}")
17
+ testament.each do |books_dir|
18
+ number, book_name = books_dir.split("_")
19
+ next if books_dir =~ /^\..?$/ || books_dir.nil?
20
+ chapters = Dir.entries("#{testament_dir}/#{books_dir}")
21
+
22
+ next if chapters.empty?
23
+
24
+ @bible[testament_dir] = BOO::Book.new(book_name, number)
25
+ chapters.each do |chapter_file|
26
+
27
+ next unless chapter_file =~ match_chapter_number
28
+
29
+ chapter = BOO::Chapter.new($1)
30
+ @bible[testament_dir][book_name] << chapter
31
+
32
+ File.readlines("#{testament_dir}/#{books_dir}/#{chapter_file}").each do |line|
33
+ next if line !~ /^<sup>(\d)<\/sup> (.*)$/
34
+ verse = $2
35
+ @bible[testament_dir][book_name][chapter.number] << verse
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ require "madeleine"
42
+
43
+ madeleine = Madeleine::SnapshotMadeleine.new("bible-en"){ @bible }
44
+
45
+ madeleine.take_snapshot
46
+
@@ -43,7 +43,7 @@
43
43
  New and Old testament book&#8217;s is loaded
44
44
  when gem is required.
45
45
  It&#8217;s a good example of objects prevalence
46
- using madeleine. The snapshot is load from
46
+ using <a href="http://madeleine.rubyforge.org/">madeleine</a>. The snapshot is load from
47
47
  file bible-en/00&#8230;001.snapshot (1,5MB),
48
48
  running with 10 MB of <span class="caps">RAM</span>.</p>
49
49
 
@@ -81,7 +81,7 @@
81
81
 
82
82
  <p>Comments are welcome. Send an email to <a href="mailto:jonatasdp@gmail.com">Jônatas Davi Paganini</a>.</p>
83
83
  <p class="coda">
84
- <a href="FIXME email">FIXME full name</a>, 1st July 2008<br>
84
+ <a href="mailto:jonatasdp@gmail.com">Jônatas Davi Paganini</a>, 1st July 2008<br>
85
85
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
86
86
  </p>
87
87
  </div>
@@ -7,7 +7,7 @@ The bible object oriented is easy way to
7
7
  New and Old testament book's is loaded
8
8
  when gem is required.
9
9
  It's a good example of objects prevalence
10
- using madeleine. The snapshot is load from
10
+ using <a href="http://madeleine.rubyforge.org/">madeleine</a>. The snapshot is load from
11
11
  file bible-en/00...001.snapshot (1,5MB),
12
12
  running with 10 MB of RAM.
13
13
 
@@ -37,7 +37,7 @@
37
37
  </div>
38
38
  <%= body %>
39
39
  <p class="coda">
40
- <a href="FIXME email">FIXME full name</a>, <%= modified.pretty %><br>
40
+ <a href="mailto:jonatasdp@gmail.com">Jônatas Davi Paganini</a>, <%= modified.pretty %><br>
41
41
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
42
42
  </p>
43
43
  </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ""
6
6
  authors:
7
7
  - "J\xC3\xB4natas Davi Paganini"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-01 00:00:00 -03:00
12
+ date: 2008-07-02 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -34,6 +34,7 @@ files:
34
34
  - PostInstall.txt
35
35
  - README.txt
36
36
  - Rakefile
37
+ - bible-en/000000000000000000001.snapshot
37
38
  - config/hoe.rb
38
39
  - config/requirements.rb
39
40
  - lib/boo.rb
@@ -41,6 +42,7 @@ files:
41
42
  - script/console
42
43
  - script/destroy
43
44
  - script/generate
45
+ - script/load
44
46
  - script/txt2html
45
47
  - setup.rb
46
48
  - tasks/deployment.rake