class Bookfile::Bookfile
Attributes
books[R]
databases[R]
packages[R]
Public Class Methods
load( code )
click to toggle source
another convenience method - use like Bookfile.load()
# File lib/bookfile/bookfile.rb, line 18 def self.load( code ) # Note: return datafile (of course, NOT the builder) # if you want a builder use Bookfile::Builder ;-) builder = Builder.load( code ) builder.bookfile end
load_file( path='./Bookfile' )
click to toggle source
convenience method - use like Bookfile.load_file()
# File lib/bookfile/bookfile.rb, line 10 def self.load_file( path='./Bookfile' ) # Note: return datafile (of course, NOT the builder) # if you want a builder use Bookfile::Builder ;-) builder = Builder.load_file( path ) builder.bookfile end
new()
click to toggle source
# File lib/bookfile/bookfile.rb, line 31 def initialize @packages = [] # only allow single package - why, why not?? @databases = [] # only allow single database - why, why not?? @books = [] # only allow single book - why, why not?? end
Public Instance Methods
build( unzip_dir )
click to toggle source
# File lib/bookfile/bookfile.rb, line 86 def build( unzip_dir ) puts "[bookfile] build books" @books.each do |book| book.build( unzip_dir ) end end
connect()
click to toggle source
download()
click to toggle source
# File lib/bookfile/bookfile.rb, line 38 def download puts "[bookfile] dowload book packages" @packages.each do |package| package.download end end
dump()
click to toggle source
# File lib/bookfile/bookfile.rb, line 95 def dump ## ## for debugging dump datasets (note: will/might also check if zip exits) ## logger.info( "[datafile] dump datasets (for debugging)" ) ## @datasets.each do |dataset| ## dataset.dump() ## end end
prepare( unzip_dir )
click to toggle source
# File lib/bookfile/bookfile.rb, line 76 def prepare( unzip_dir ) @databases.each do |database| database.prepare ## require models and include in builder/page ctx end @packages.each do |package| package.prepare( unzip_dir ) ## require helpers and include in builder/page ctx end end
unzip( unzip_dir )
click to toggle source
todo/fix - add unzip_dir as an option/config to constructor - why, why not??
location needs to get (re)used in prepare too for now pass along unzip_dir again ???
# File lib/bookfile/bookfile.rb, line 49 def unzip( unzip_dir ) puts "[bookfile] unzip book packages" ### fix: for multiple packages use a number?? - how to make path unique ## for now is ./book @packages.each do |package| package.unzip( unzip_dir ) end end