bookfile 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a928057be65f405714ba6ee80aeff05aae4765a4
4
- data.tar.gz: 10cd05c26987d7d491155fd12b3deb8d9e8bd7c4
3
+ metadata.gz: 9e627081c49ba840795a25e2b2aeda693727563a
4
+ data.tar.gz: 9fa61a19d841748e24db5b8ae1184f2b32254b3f
5
5
  SHA512:
6
- metadata.gz: 0f1edc8b43ad2085ccd643d878e4af7ca9c2786d8c8fb9c816caea339a2b81a53aacfbea3437e00cc6bc7684da3c10032fcbd2026e44c67ec01a1dbf40d6856b
7
- data.tar.gz: bd4135d45d9ae176190864561b092eb50c9bddd71a780d0cc6d77ffb37fcb2c86c7820f67dbb2969b6f198ce0ae891d5547eaaa5c5b84057682b7bdda5e53c2b
6
+ metadata.gz: 7f90ddbe193fab0612db0c3e8450a8615a6e188f8165dfeeb6c22a29191187af7c67bbd8db7adb6f0bb9956f1f2633c383bf0f24dfb0597ad0aacde99243b6b6
7
+ data.tar.gz: 32cab29944e3f8da39666f205c8c7918c4b0f05479a44aabcabf4be7d1a7806b262842644266f0353103f6f8a65fa6132ebe9f66b6e89127667c42145b43fb1c
data/.gemtest ADDED
File without changes
data/Manifest.txt CHANGED
@@ -3,4 +3,16 @@ Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
5
  lib/bookfile.rb
6
+ lib/bookfile/book/book.rb
7
+ lib/bookfile/book/config.rb
8
+ lib/bookfile/bookfile.rb
9
+ lib/bookfile/builder.rb
10
+ lib/bookfile/database/database.rb
11
+ lib/bookfile/helpers/markdown.rb
12
+ lib/bookfile/helpers/misc.rb
13
+ lib/bookfile/package/package.rb
6
14
  lib/bookfile/version.rb
15
+ test/bookfile/world.rb
16
+ test/helper.rb
17
+ test/test_world.rb
18
+ test/test_world_templates.rb
data/Rakefile CHANGED
@@ -23,6 +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
+ ['fetcher'], ## todo: check if included in ??
28
+ ['hybook'] ## todo: check if included in ??
26
29
  ]
27
30
 
28
31
  self.spec_extras = {
data/lib/bookfile.rb CHANGED
@@ -1,7 +1,34 @@
1
+ # encoding: utf-8
1
2
 
3
+ #############
4
+ # stdlibs
5
+
6
+ require 'pp'
7
+ require 'ostruct'
8
+
9
+ ##############
10
+ # 3rd party gems
11
+
12
+ require 'fetcher'
13
+ require 'zip' # use $ gem install rubyzip
14
+ require 'hybook' # todo/fix: check if hybook required/needed for now??
2
15
 
3
16
  ####################
4
17
  # our own code
5
18
 
6
19
  require 'bookfile/version' # let it always go first
7
20
 
21
+ ###
22
+ # helpers
23
+ # todo/fix: move helpers to hybook
24
+ require 'bookfile/helpers/markdown' ## module HybookHelper
25
+ require 'bookfile/helpers/misc' ## module HybookHelper
26
+
27
+
28
+ require 'bookfile/database/database'
29
+ require 'bookfile/package/package'
30
+ require 'bookfile/book/config'
31
+ require 'bookfile/book/book'
32
+ require 'bookfile/bookfile'
33
+ require 'bookfile/builder'
34
+
@@ -0,0 +1,103 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ ## todo/fix:
5
+ ## render - auto-include/merge (global) book opts ???
6
+ ## build book twice (std, and inline:true)
7
+ ##
8
+ ## use global inline? helper instead of passing along
9
+ ## opts[:inline] == true ???? - why, why not???
10
+
11
+
12
+ module Bookfile
13
+
14
+
15
+ class PageCtx ## page context for evaluate
16
+
17
+ include HybookHelper
18
+
19
+ def initialize( config ) ## BookConfig
20
+ ## pass in templates_dir here
21
+ ## ## TEMPLATES_DIR = ?? -- passed in as config
22
+ ## or pass in class to help find templates???
23
+ ## TemplateMan( ??? )
24
+ @config = config
25
+ end
26
+
27
+ def write( text )
28
+ puts "*** write:"
29
+ puts " #{text}"
30
+ end
31
+
32
+ def render( name, opts={}, locals={} ) ## possible? - make opts required ??
33
+ puts "*** render #{name}:"
34
+
35
+ tmpl = File.read_utf8( "#{@config.templates_dir}/#{name}.md" ) ## name e.g. includes/_city
36
+
37
+ ### if any locals defined; add "header/preamble w/ shortcuts" to template
38
+ # e.g. country = locals[:country] etc.
39
+ unless locals.empty?
40
+ tmpl = _locals_code( locals ) + tmpl
41
+ end
42
+
43
+ text = TextUtils::PageTemplate.new( tmpl ).render( binding )
44
+
45
+ puts " #{text}"
46
+ text
47
+ end
48
+
49
+
50
+ def _locals_code( locals )
51
+ ## convert locals hash to erb snippet with shortcuts
52
+ ## e.g. country = locals[:country]
53
+ ## and so on
54
+
55
+ buf = "<%\n"
56
+ locals.each do |k,v|
57
+ puts " add local '#{k}' #{k.class.name} - #{v.class.name}"
58
+
59
+ buf << "#{k} = locals[:#{k}];\n"
60
+ end
61
+ buf << "%>\n"
62
+ buf
63
+ end
64
+
65
+ end # class PageCtx
66
+
67
+
68
+
69
+ class BookCtx
70
+
71
+ def initialize( config )
72
+ @config = config
73
+ end
74
+
75
+ def page( name, opts={} ) ## &block
76
+ puts "[BookCtx#page] #{name} opts:#{opts.inspect}"
77
+
78
+ puts "[BookCtx#page] before yield"
79
+ ctx = PageCtx.new( @config ) ## pass along book configs
80
+ yield( ctx ) ## same as - ctx.instance_eval( &block )
81
+ puts "[BookCtx#page] after yield"
82
+ end
83
+
84
+ end # class BootCtx
85
+
86
+
87
+ class BookDef
88
+ def initialize( opts={}, proc )
89
+ @opts = opts
90
+ @proc = proc ## use name block (why,why not??)
91
+ ## @block = block ## save block as proc ?? ??
92
+ end
93
+
94
+ def build( unzip_dir )
95
+ config = BookConfig.new( templates_dir: "#{unzip_dir}/_templates" )
96
+ ctx = BookCtx.new( config )
97
+ @proc.call( ctx ) ## same as - ctx.instance_eval( &@codeblock ) -- use instance_eval - why, why not??
98
+ end
99
+ end # class BookDef
100
+
101
+
102
+ end # module Bookfile
103
+
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ module Bookfile
4
+
5
+
6
+ class BookConfig
7
+ def initialize( hash={} )
8
+ @hash = hash
9
+ end
10
+
11
+ def templates_dir
12
+ @hash[:templates_dir]
13
+ end
14
+ end
15
+
16
+
17
+ end # module Bookfile
@@ -0,0 +1,88 @@
1
+ # encoding: utf-8
2
+
3
+ module Bookfile
4
+
5
+ class Bookfile
6
+
7
+ ## include LogUtils::Logging
8
+
9
+ attr_reader :packages
10
+ attr_reader :databases
11
+ attr_reader :books
12
+
13
+ def initialize
14
+ @packages = [] # only allow single package - why, why not??
15
+ @databases = [] # only allow single database - why, why not??
16
+ @books = [] # only allow single book - why, why not??
17
+ end
18
+
19
+
20
+ def download
21
+ puts "[bookfile] dowload book packages"
22
+ @packages.each do |package|
23
+ package.download
24
+ end
25
+ end
26
+
27
+ ###
28
+ ## todo/fix - add unzip_dir as an option/config to constructor - why, why not??
29
+ ## location needs to get (re)used in prepare too
30
+ ## for now pass along unzip_dir again ???
31
+ def unzip( unzip_dir )
32
+ puts "[bookfile] unzip book packages"
33
+ ### fix: for multiple packages use a number?? - how to make path unique
34
+ ## for now is ./book
35
+ @packages.each do |package|
36
+ package.unzip( unzip_dir )
37
+ end
38
+ end
39
+
40
+
41
+ =begin
42
+ def setup
43
+ puts "[bookfile] setup database connections n models"
44
+ @databases.each do |database|
45
+ database.setup
46
+ end
47
+ end
48
+ =end
49
+
50
+ def connect
51
+ puts "[bookfile] connect to database(s)"
52
+ @databases.each do |database|
53
+ database.connect
54
+ end
55
+ end
56
+
57
+
58
+ def prepare( unzip_dir )
59
+ @databases.each do |database|
60
+ database.prepare ## require models and include in builder/page ctx
61
+ end
62
+ @packages.each do |package|
63
+ package.prepare( unzip_dir ) ## require helpers and include in builder/page ctx
64
+ end
65
+ end
66
+
67
+
68
+ def build( unzip_dir )
69
+ puts "[bookfile] build books"
70
+ @books.each do |book|
71
+ book.build( unzip_dir )
72
+ end
73
+ end
74
+
75
+
76
+
77
+ def dump
78
+ ## ## for debugging dump datasets (note: will/might also check if zip exits)
79
+ ## logger.info( "[datafile] dump datasets (for debugging)" )
80
+ ## @datasets.each do |dataset|
81
+ ## dataset.dump()
82
+ ## end
83
+ end
84
+
85
+
86
+ end # class Bookfile
87
+ end # module Bookfile
88
+
@@ -0,0 +1,48 @@
1
+ #encoding: utf-8
2
+
3
+
4
+ module Bookfile
5
+
6
+ class Builder
7
+
8
+ ## include LogUtils::Logging
9
+
10
+ def self.load_file( path )
11
+ code = File.read( path )
12
+ self.load( code )
13
+ end
14
+
15
+ def self.load( code )
16
+ builder = Builder.new
17
+ builder.instance_eval( code )
18
+ builder
19
+ end
20
+
21
+
22
+ attr_reader :bookfile
23
+
24
+ def initialize
25
+ puts "starting new bookfile; lets go"
26
+ @bookfile = Bookfile.new
27
+ end
28
+
29
+
30
+ def package( name, opts={} )
31
+ puts "package '#{name}'"
32
+ @bookfile.packages << BookPackage.new( name, opts )
33
+ end
34
+
35
+ def world( opts={} )
36
+ puts "world opts: #{opts.inspect}"
37
+ @bookfile.databases << World.new( opts )
38
+ end
39
+
40
+ def book( opts={}, &block )
41
+ puts "book opts: #{opts.inspect}"
42
+ @bookfile.books << BookDef.new( opts, block )
43
+ end
44
+
45
+ end # class Builder
46
+
47
+ end # module Bookfile
48
+
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ module Bookfile
5
+
6
+ class Database
7
+ def initialize( db_config )
8
+ @db_config = db_config
9
+ end
10
+ end
11
+
12
+
13
+ class World < Database ## change to WorldDatabase or DatabaseWorld - why, why not???
14
+ def initialize( db_config ) ## check - if it works by default (no initialze specfied)
15
+ super
16
+ end
17
+
18
+ def prepare ## change to require - why, why not??
19
+ puts "setup world: #{@db_config.inspect}"
20
+
21
+ res = require 'worlddb/models'
22
+ if res
23
+ puts " include WorldDb::Models"
24
+
25
+ ### check/fix: include as globals/top-level!!! how? possible???
26
+ Builder.send :include, WorldDb::Models
27
+ PageCtx.send :include, WorldDb::Models
28
+ HybookHelper.send :include, WorldDb::Models ## constants not accesible (include in module too)
29
+ ## BookCtx.send :include, WorldDb::Models -- needed for Book context too?? why, why not??
30
+
31
+ ## also add to xxxx ???
32
+ ## (possible to include as globals ???? how - Object.send :include ???) or
33
+ ## Module.send :include ??
34
+ else
35
+ ## find a better check - check for constants defined??? if not define???
36
+ ## or use constant_missing handler???
37
+ puts " assume WorldDb::Models already included ??"
38
+ end
39
+ end
40
+
41
+ def connect
42
+ print " connecting..."
43
+ ActiveRecord::Base.establish_connection( @db_config )
44
+ puts "OK"
45
+ end
46
+
47
+ def setup ## use connect/prepare - why, why not??
48
+ prepare # step 1: prepare - require and include models
49
+ connect # step 2: connect
50
+ end
51
+ end # class World
52
+
53
+ end # module Bookfile
@@ -0,0 +1,42 @@
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
+ columns = opts[:columns] || 2
23
+
24
+ buf = ''
25
+ buf << "\n"
26
+ buf << "<div class='columns#{columns}' markdown='1'>\n"
27
+ buf << "\n"
28
+ buf
29
+ end
30
+
31
+ def columns_end
32
+ buf = ''
33
+ buf << "\n"
34
+ buf << "</div>\n"
35
+ buf << "\n"
36
+ buf
37
+ end
38
+
39
+ ### todo: check if we can use columns simply w/ yield for body ??
40
+
41
+
42
+ end # module HybookHelper
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,151 @@
1
+ # encoding: utf-8
2
+
3
+
4
+ module Bookfile
5
+
6
+ class BookPackage ## change to BookTemplates/BookTheme/BookPack/BookClass/BookStyle ???
7
+ def initialize( name, opts={} )
8
+ @name = name
9
+ @opts = opts
10
+ end
11
+
12
+
13
+ def remote_zip_url # remote zip url
14
+ ### note: use http:// for now - lets us use (personal proxy NOT working w/ https) for now
15
+ ## "https://github.com/#{@name}/archive/gh-pages.zip"
16
+ "http://github.com/#{@name}/archive/gh-pages.zip"
17
+ end
18
+
19
+ def local_zip_name
20
+ ### note: replace / in name w/ --I--
21
+ ## e.g. flatten the filename, that is, do NOT include any folders
22
+ @name.gsub('/', '--I--') # note: will NOT include/return .zip extension
23
+ end
24
+
25
+ def local_zip_dir
26
+ "./tmp"
27
+ end
28
+
29
+ def local_zip_path # local zip path
30
+ "#{local_zip_dir}/#{local_zip_name}.zip"
31
+ end
32
+
33
+
34
+ =begin
35
+ def local_unzip_dir() "./book"; end
36
+
37
+ def local_scripts_dir
38
+ ## fix: just use _scripts -- remove helpers in repo!!!
39
+ "#{local_unzip_dir}/_scripts"
40
+ end
41
+ =end
42
+
43
+
44
+ def download
45
+ ## logger.info( "download book package '#{@name}'" )
46
+ ## logger.info( " from '#{remote_zip_url}'" )
47
+ ## logger.info( " to '#{local_zip_path}'..." )
48
+
49
+ ## note: lets use http:// instead of https:// for now - lets us use person proxy (NOT working w/ https for now)
50
+ src = remote_zip_url
51
+ dest_zip = local_zip_path
52
+
53
+ ## make sure dest folder exists
54
+ FileUtils.mkdir_p( local_zip_dir ) unless Dir.exists?( local_zip_dir )
55
+
56
+ fetch_book_templates( src, dest_zip )
57
+ end
58
+
59
+
60
+ def unzip( unzip_dir )
61
+ src = local_zip_path
62
+ dest_unzip = unzip_dir ## local_unzip_dir
63
+
64
+ ## check if folders exists? if not create folder in path
65
+ FileUtils.mkdir_p( dest_unzip ) unless Dir.exists?( dest_unzip )
66
+
67
+ unzip_book_templates( src, dest_unzip )
68
+ end
69
+
70
+
71
+ def prepare( unzip_dir ) ## change to require - why, why not??
72
+ puts "auto-require/include book scripts in '#{unzip_dir}/_scripts'"
73
+
74
+ files = Dir["#{unzip_dir}/_scripts/**/*.rb"]
75
+ pp files
76
+
77
+ files.each_with_index do |file,idx|
78
+ ## todo/check: check for exceptions???
79
+ puts " [#{idx+1}/#{files.count}] try auto-require '#{file}'..."
80
+ require file
81
+ end
82
+
83
+ ## include Hytext::Helper or use HytextHelper ??
84
+ ## include Bookfile::Helper or use BookfileHelper ??
85
+ ## check Rails example names for helper modules
86
+ ## get Helper module name from book template name ???
87
+
88
+ =begin
89
+ res = require 'worlddb/models'
90
+ if res
91
+ puts " include WorldDb::Models"
92
+
93
+ Builder.send :include, WorldDb::Models
94
+ ## PageCtx.send :include, WorldDb::Models
95
+ ## BookCtx.send :include, WorldDb::Models
96
+
97
+ ## also add to xxxx ???
98
+ ## (possible to include as globals ???? how - Object.send :include ???) or
99
+ ## Module.send :include ??
100
+ else
101
+ ## find a better check - check for constants defined??? if not define???
102
+ ## or use constant_missing handler???
103
+ puts " assume WorldDb::Models already included ??"
104
+ end
105
+ =end
106
+ end
107
+
108
+
109
+ private
110
+
111
+ def fetch_book_templates( src, dest )
112
+ ## step 1 - fetch archive
113
+ worker = Fetcher::Worker.new
114
+ worker.copy( src, dest )
115
+ ### fix: add src.sha5
116
+ ### inside folder
117
+ ### lets us check if current HEAD version is in place across datafiles etc.
118
+ ## - try HTTP HEAD ?? to check?
119
+ end
120
+
121
+
122
+ ######
123
+ # fix/todo:
124
+ # exclude _pages folder for now
125
+ # lets us include working live sample pages in template pack
126
+
127
+ def unzip_book_templates( src, dest, opts={} )
128
+ ### todo/fix: rename or remove root folder -- use opts { root: false or something??}
129
+ # e.g
130
+ # !/beer-gh-pages/_templates/ becomes
131
+ # !/_templates/ etc.
132
+
133
+ Zip::File.open( src ) do |zipfile|
134
+ zipfile.each do |file|
135
+ if file.directory?
136
+ puts " skip directory zip entry - #{file.name}"
137
+ else
138
+ name = file.name[ file.name.index('/')+1..-1] ## cut-off root/first path entry
139
+ path = File.join( dest, name)
140
+ puts " unzip file zip entry - #{file.name} to #{path}"
141
+ FileUtils.mkdir_p( File.dirname( path) )
142
+ zipfile.extract(file, path) unless File.exist?(path)
143
+ end
144
+ end
145
+ end
146
+ end
147
+
148
+ end # class BookPackage
149
+
150
+ end # module Bookfile
151
+
@@ -1,10 +1,10 @@
1
+ # encoding: utf-8
1
2
 
2
-
3
- module BookFile
4
- VERSION = '0.0.1'
3
+ module Bookfile
4
+ VERSION = '0.1.0'
5
5
  end
6
6
 
7
7
  ## add module alias
8
8
 
9
- Bookfile = BookFile
9
+ BookFile = Bookfile
10
10
 
@@ -0,0 +1,77 @@
1
+
2
+ package 'book-templates/world'
3
+ ## use package or templates or theme (instead of ???)
4
+ ## will auto-include all helpers etc. from _scripts/ folder (hierachy/tree)
5
+
6
+
7
+ world adapter: 'sqlite3', database: './world.db'
8
+ ## will connect to database;
9
+ ## will require all libs
10
+ ## will include all models
11
+
12
+
13
+ ## page 'index', title: 'Contents',
14
+ ## id: 'index' do |p|
15
+ ## p.write render_toc() ## render_toc( opts )
16
+ ## ## render :toc -- auto includes opts???
17
+ ## end
18
+
19
+ =begin
20
+ book do |b|
21
+
22
+ puts "before first page"
23
+
24
+ b.page 'index', title: 'Contents',
25
+ id: 'index' do |p|
26
+ puts "enter index"
27
+ puts "leave index"
28
+ end
29
+ end
30
+ =end
31
+
32
+
33
+ puts "self.class.name (in top level): #{self.class.name}"
34
+
35
+
36
+ book do |b|
37
+
38
+ puts "before first page"
39
+ puts "self.class.name (in book block): #{self.class.name}"
40
+
41
+ b.page 'index', title: 'Contents',
42
+ id: 'index' do |p|
43
+ puts "enter index"
44
+ p.write "render_toc()" ## render_toc() ## render_toc( opts )
45
+ p.write "render_toc() 2x"
46
+ p.write "render_toc() 3x"
47
+
48
+ p.render_toc( {} )
49
+ ## render :toc -- auto includes opts???
50
+
51
+ puts "self.class.name (in page block): #{self.class.name}"
52
+ p.write "continent.count: #{Continent.count}"
53
+ puts "leave index"
54
+
55
+ puts "continent.count: #{Continent.count}"
56
+ end
57
+
58
+
59
+ ### generate pages for countries
60
+ # note: use same order as table of contents
61
+
62
+ Continent.order(:id).each do |continent|
63
+ continent.countries.order(:name).limit(1).each do |country|
64
+
65
+ puts "build country page #{country.key}..."
66
+ path = country.to_path
67
+ puts "path=#{path}"
68
+
69
+ b.page path, title: "#{country.name} (#{country.code})",
70
+ id: country.key do |p|
71
+ p.write "render_country(#{country.name})" ## render_country( country ) ## render_country( country, opts )
72
+ p.render_country( country, {} ) ### fix: auto-include opts in render - how??
73
+ end
74
+ end
75
+ end
76
+ end
77
+
data/test/helper.rb ADDED
@@ -0,0 +1,9 @@
1
+ #encoding: utf-8
2
+
3
+ ## minitest setup
4
+ require 'minitest/autorun'
5
+
6
+
7
+ ## our own code
8
+ require 'bookfile'
9
+
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_world.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+ class TestWorld < MiniTest::Test
11
+
12
+ def test_world
13
+ book_templates_unzip_dir = './tmp/book'
14
+
15
+ builder = Bookfile::Builder.load_file( './test/bookfile/world.rb' )
16
+ bookfile = builder.bookfile
17
+
18
+ # bookfile.download # download book packages (templates n scripts)
19
+ # bookfile.unzip( book_templates_unzip_dir )
20
+
21
+ bookfile.prepare( book_templates_unzip_dir )
22
+ bookfile.connect
23
+
24
+ bookfile.build( book_templates_unzip_dir )
25
+
26
+ assert true # if we get here - test success
27
+ end
28
+
29
+ end # class TestWorld
30
+
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_world_templates.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+ class TestWorldTemplates < MiniTest::Test
11
+
12
+ def test_unzip
13
+ builder = Bookfile::Builder.load_file( './test/bookfile/world.rb' )
14
+ bookfile = builder.bookfile
15
+
16
+ bookfile.download # download book packages (templates n scripts)
17
+ bookfile.unzip # unzip book packages (template)
18
+
19
+ bookfile.prepare # require models n helpers
20
+
21
+ # bookfile.connect
22
+ # bookfile.build
23
+
24
+ assert true # if we get here - test success
25
+ end
26
+
27
+ end # class TestWorldTemplates
28
+
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.0.1
4
+ version: 0.1.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-03 00:00:00.000000000 Z
11
+ date: 2015-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: props
@@ -52,6 +52,48 @@ 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
+ - !ruby/object:Gem::Dependency
70
+ name: fetcher
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: hybook
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
55
97
  - !ruby/object:Gem::Dependency
56
98
  name: rdoc
57
99
  requirement: !ruby/object:Gem::Requirement
@@ -89,12 +131,25 @@ extra_rdoc_files:
89
131
  - Manifest.txt
90
132
  - README.md
91
133
  files:
134
+ - ".gemtest"
92
135
  - HISTORY.md
93
136
  - Manifest.txt
94
137
  - README.md
95
138
  - Rakefile
96
139
  - lib/bookfile.rb
140
+ - lib/bookfile/book/book.rb
141
+ - lib/bookfile/book/config.rb
142
+ - lib/bookfile/bookfile.rb
143
+ - lib/bookfile/builder.rb
144
+ - lib/bookfile/database/database.rb
145
+ - lib/bookfile/helpers/markdown.rb
146
+ - lib/bookfile/helpers/misc.rb
147
+ - lib/bookfile/package/package.rb
97
148
  - lib/bookfile/version.rb
149
+ - test/bookfile/world.rb
150
+ - test/helper.rb
151
+ - test/test_world.rb
152
+ - test/test_world_templates.rb
98
153
  homepage: https://github.com/hybook/bookfile
99
154
  licenses:
100
155
  - Public Domain
@@ -121,4 +176,6 @@ rubygems_version: 2.4.2
121
176
  signing_key:
122
177
  specification_version: 4
123
178
  summary: bookfile - builder for books
124
- test_files: []
179
+ test_files:
180
+ - test/test_world.rb
181
+ - test/test_world_templates.rb