bookfile 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -2
- data/Rakefile +2 -2
- data/lib/bookfile/book/book.rb +5 -0
- data/lib/bookfile/version.rb +9 -2
- data/lib/bookfile.rb +19 -10
- data/test/helper.rb +4 -0
- data/test/test_basics.rb +20 -0
- metadata +5 -19
- data/lib/bookfile/helpers/markdown.rb +0 -35
- data/lib/bookfile/helpers/misc.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b57f3bd63c77b842f19479c0eb1827009595fb40
|
4
|
+
data.tar.gz: bd04e02d0a9155dba182c274d084539bccbafa9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47352f6d93dc15529d52e3eef9bc1ba552146dd33d3430fe328d3c4b016f1fd5b92142d23641974ccb82ecac2d70ca7acdac11cdb68d97e6254fd154c12582bc
|
7
|
+
data.tar.gz: ed82ef48aaba72732ddf9f4edaadde94df67b8aa420f2ea004d5e1822bae85c6a7baca930f0c3aa8d3b808bbe6cd0f41ffbf19c184fbe5d8c33c8eeaebaf0f7a
|
data/Manifest.txt
CHANGED
@@ -8,14 +8,13 @@ lib/bookfile/book/config.rb
|
|
8
8
|
lib/bookfile/bookfile.rb
|
9
9
|
lib/bookfile/builder.rb
|
10
10
|
lib/bookfile/database/database.rb
|
11
|
-
lib/bookfile/helpers/markdown.rb
|
12
|
-
lib/bookfile/helpers/misc.rb
|
13
11
|
lib/bookfile/package/package.rb
|
14
12
|
lib/bookfile/version.rb
|
15
13
|
test/bookfile/beer.rb
|
16
14
|
test/bookfile/football.rb
|
17
15
|
test/bookfile/world.rb
|
18
16
|
test/helper.rb
|
17
|
+
test/test_basics.rb
|
19
18
|
test/test_beer.rb
|
20
19
|
test/test_football.rb
|
21
20
|
test/test_world.rb
|
data/Rakefile
CHANGED
@@ -23,9 +23,9 @@ Hoe.spec 'bookfile' do
|
|
23
23
|
['props'], # settings / prop(ertie)s / env / INI
|
24
24
|
['logutils'], # logging
|
25
25
|
['textutils'], # e.g. >= 0.6 && <= 1.0 ## will include logutils, props
|
26
|
-
['rubyzip'], ## todo: check if included in ??
|
27
26
|
['fetcher'], ## todo: check if included in ??
|
28
|
-
['
|
27
|
+
['rubyzip'], ## todo: check if included in ??
|
28
|
+
### ['hybook'] ## avoid circular dependency - do NOT include
|
29
29
|
]
|
30
30
|
|
31
31
|
self.spec_extras = {
|
data/lib/bookfile/book/book.rb
CHANGED
data/lib/bookfile/version.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Bookfile
|
4
|
-
VERSION = '0.
|
4
|
+
VERSION = '0.2.0'
|
5
|
+
|
6
|
+
def self.banner
|
7
|
+
"bookfile/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.root
|
11
|
+
"#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
|
12
|
+
end
|
5
13
|
end
|
6
14
|
|
7
15
|
## add module alias
|
8
|
-
|
9
16
|
BookFile = Bookfile
|
10
17
|
|
data/lib/bookfile.rb
CHANGED
@@ -6,29 +6,34 @@
|
|
6
6
|
require 'pp'
|
7
7
|
require 'ostruct'
|
8
8
|
|
9
|
+
|
9
10
|
##############
|
10
11
|
# 3rd party gems
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
|
14
|
+
#########################################
|
15
|
+
# "standalone" version - pull in hybook
|
16
|
+
# - todo/check - possible to use bookfile w/o hybook?? why, why not??
|
17
|
+
|
18
|
+
=begin
|
19
|
+
unless defined?(Hybook)
|
20
|
+
require 'logutils' # uses Logging etc. -- todo: get required by hybook - remove??
|
21
|
+
require 'textutils' # uses File.read_utf8 -- todo: get required by hybook - remove??
|
22
|
+
require 'hybook' # todo/fix: check if hybook required/needed for now??
|
23
|
+
end
|
24
|
+
=end
|
25
|
+
## else assumes hybook gem aready required (avoid circular require)
|
14
26
|
|
15
27
|
|
16
28
|
require 'fetcher'
|
17
29
|
require 'zip' # use $ gem install rubyzip
|
18
|
-
|
30
|
+
|
19
31
|
|
20
32
|
####################
|
21
33
|
# our own code
|
22
34
|
|
23
35
|
require 'bookfile/version' # let it always go first
|
24
36
|
|
25
|
-
###
|
26
|
-
# helpers
|
27
|
-
# todo/fix: move helpers to hybook
|
28
|
-
require 'bookfile/helpers/markdown' ## module HybookHelper
|
29
|
-
require 'bookfile/helpers/misc' ## module HybookHelper
|
30
|
-
|
31
|
-
|
32
37
|
require 'bookfile/database/database'
|
33
38
|
require 'bookfile/package/package'
|
34
39
|
require 'bookfile/book/config'
|
@@ -36,3 +41,7 @@ require 'bookfile/book/book'
|
|
36
41
|
require 'bookfile/bookfile'
|
37
42
|
require 'bookfile/builder'
|
38
43
|
|
44
|
+
|
45
|
+
|
46
|
+
# say hello
|
47
|
+
puts Bookfile.banner if $DEBUG || (defined?($RUBYLIBS_DEBUG) && $RUBYLIBS_DEBUG)
|
data/test/helper.rb
CHANGED
data/test/test_basics.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_basics.rb
|
6
|
+
|
7
|
+
require 'helper'
|
8
|
+
|
9
|
+
class TestBasics < MiniTest::Test
|
10
|
+
|
11
|
+
def test_banner
|
12
|
+
|
13
|
+
banner = "bookfile/#{Bookfile::VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
14
|
+
|
15
|
+
assert_equal banner, Bookfile.banner
|
16
|
+
assert_equal banner, BookFile.banner ## check module alias
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end # class Basics
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bookfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: props
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubyzip
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: fetcher
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +67,7 @@ dependencies:
|
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: rubyzip
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - ">="
|
@@ -142,14 +128,13 @@ files:
|
|
142
128
|
- lib/bookfile/bookfile.rb
|
143
129
|
- lib/bookfile/builder.rb
|
144
130
|
- lib/bookfile/database/database.rb
|
145
|
-
- lib/bookfile/helpers/markdown.rb
|
146
|
-
- lib/bookfile/helpers/misc.rb
|
147
131
|
- lib/bookfile/package/package.rb
|
148
132
|
- lib/bookfile/version.rb
|
149
133
|
- test/bookfile/beer.rb
|
150
134
|
- test/bookfile/football.rb
|
151
135
|
- test/bookfile/world.rb
|
152
136
|
- test/helper.rb
|
137
|
+
- test/test_basics.rb
|
153
138
|
- test/test_beer.rb
|
154
139
|
- test/test_football.rb
|
155
140
|
- test/test_world.rb
|
@@ -184,4 +169,5 @@ test_files:
|
|
184
169
|
- test/test_football.rb
|
185
170
|
- test/test_beer.rb
|
186
171
|
- test/test_world.rb
|
172
|
+
- test/test_basics.rb
|
187
173
|
- test/test_world_templates.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module HybookHelper
|
4
|
-
|
5
|
-
###########################
|
6
|
-
# markdown helpers
|
7
|
-
|
8
|
-
###
|
9
|
-
# fix: move to Markdown gem
|
10
|
-
# add to new module
|
11
|
-
# MarkdownHelper or Markdown::Helper ???
|
12
|
-
|
13
|
-
|
14
|
-
def link_to( title, link )
|
15
|
-
"[#{title}](#{link})"
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
def columns_begin( opts={} )
|
20
|
-
# note: will add columns2 or columns3 etc. depending on columns option passed in
|
21
|
-
|
22
|
-
## note: default was 2 (columns) for world.db, 300 (px) for beer.db
|
23
|
-
columns = opts[:columns] || 300
|
24
|
-
|
25
|
-
"\n<div class='columns#{columns}' markdown='1'>\n\n"
|
26
|
-
end
|
27
|
-
|
28
|
-
def columns_end
|
29
|
-
"\n</div>\n\n"
|
30
|
-
end
|
31
|
-
|
32
|
-
### todo: check if we can use columns simply w/ yield for body ??
|
33
|
-
|
34
|
-
|
35
|
-
end # module HybookHelper
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module HybookHelper
|
4
|
-
|
5
|
-
### todo:
|
6
|
-
## add to textutils ?? why? why not??
|
7
|
-
def number_with_delimiter( num )
|
8
|
-
delimiter = '.'
|
9
|
-
num.to_s.reverse.gsub( /(\d{3})(?=\d)/, "\\1#{delimiter}").reverse
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
end # module HybookHelper
|