bookfile 0.1.3 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c81694a303dcd835d8789dce463ec4a639e6d512
4
- data.tar.gz: dbefc7253f83fbfcfecaad2a8b1c200e1151e001
3
+ metadata.gz: b57f3bd63c77b842f19479c0eb1827009595fb40
4
+ data.tar.gz: bd04e02d0a9155dba182c274d084539bccbafa9c
5
5
  SHA512:
6
- metadata.gz: f3ae2203cec27d8afc9c768d1fba699771e98f50ed87b08b36b15e627b8d72bcc96d60f9f02187ad5e104907c7b0bc1175b1b3ca52c9bf6fe9829ed8d30b91c4
7
- data.tar.gz: 80f11909f3b6de0848bfbd42779c453ac6334bbae57cbb67314e2bcd65d88e0dd9909469543a7cb5fc437733741ce933af7a52fef9c729e33a4f489c2df26402
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
- ['hybook'] ## todo: check if included in ??
27
+ ['rubyzip'], ## todo: check if included in ??
28
+ ### ['hybook'] ## avoid circular dependency - do NOT include
29
29
  ]
30
30
 
31
31
  self.spec_extras = {
@@ -9,6 +9,11 @@
9
9
  ## opts[:inline] == true ???? - why, why not???
10
10
 
11
11
 
12
+ module HybookHelper
13
+ ## note: "quickfix" - find a better way to forward declare (lives in hybook)???
14
+ end
15
+
16
+
12
17
  module Bookfile
13
18
 
14
19
 
@@ -1,10 +1,17 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Bookfile
4
- VERSION = '0.1.3'
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
- require 'logutils' # uses Logging etc.
13
- require 'textutils' # uses File.read_utf8
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
- require 'hybook' # todo/fix: check if hybook required/needed for now??
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
@@ -4,6 +4,10 @@
4
4
  require 'minitest/autorun'
5
5
 
6
6
 
7
+ require 'textutils'
8
+
7
9
  ## our own code
8
10
  require 'bookfile'
9
11
 
12
+ ## more 3rd party/lib code
13
+ ## require 'hybook'
@@ -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.1.3
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-03-27 00:00:00.000000000 Z
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: hybook
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