Module: Booky
- Defined in:
- lib/booky.rb,
lib/booky/version.rb,
lib/booky/exceptions.rb,
lib/booky/layout/base.rb
Defined Under Namespace
Modules: AST, Layout, PDF, Textile Classes: LoadError
Constant Summary collapse
- VERSION =
"0.0.6"
Class Method Summary collapse
-
.create ⇒ Object
create book.
-
.dispatch(argv) ⇒ Object
initial dispatch.
-
.examples ⇒ Object
examples.
-
.help ⇒ Object
help.
-
.layout ⇒ Object
book layout.
- .layout=(value) ⇒ Object
-
.name ⇒ Object
book name.
- .name=(value) ⇒ Object
- .root ⇒ Object
-
.source ⇒ Object
book source.
- .source=(value) ⇒ Object
-
.version ⇒ Object
version.
Class Method Details
.create ⇒ Object
create book
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/booky.rb', line 36 def self.create # setup puts "\nStarting Booky...\n" # create ast = Booky::AST.create Booky::PDF.create(ast) # open Booky::PDF.open # clear #Booky.clear end |
.dispatch(argv) ⇒ Object
initial dispatch
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/booky.rb', line 23 def self.dispatch argv # help self.help if argv.empty? return if argv.empty? # dispatch self.setup(argv) self.send(argv[0].to_sym) end |
.examples ⇒ Object
examples
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/booky.rb', line 89 def self.examples examples = ['formatting', 'cover', 'chapters', 'footnotes', 'images', 'tables', 'phrases', 'lists', 'source', 'bibliography'] if Booky.name.nil? puts "\n\nBooky Examples: Please select one of the following categories:\n\n" examples.each { |example| puts " -> #{example}" } puts "\n\n" return end puts "\n\nBooky Example for #{Booky.name.capitalize}\n\n\n" puts File.open("#{Booky.root}/lib/examples/#{Booky.name}.textile", 'rb') { |f| f.read } puts "\n\n" end |
.help ⇒ Object
help
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/booky.rb', line 53 def self.help puts %Q( Booky #{Booky::VERSION} Help Usage: booky create BOOK_TEXTILE Creates a pdf out of a textile file and opens it booky version Shows the current Booky version booky help Shows this help Paths: Custom Fonts Add them to the #{Booky.root}/lib/fonts folder Layout Tweaking Add them to the #{Booky.root}/lib/booky/layouts folder Examples: booky examples Shows a list of all commands that can be used inside textile documents booky examples formatting Formatting Examples booky examples cover Cover Page Examples booky examples chapters Chapter Examples booky examples footnotes Footnote Examples booky examples images Images Examples booky examples tables Table Examples booky examples phrases Phrase Examples booky examples lists Lists Examples booky examples source Source Examples booky examples bibliography Bibliography Examples ) end |
.layout ⇒ Object
book layout
123 124 125 |
# File 'lib/booky.rb', line 123 def self.layout @@layout end |
.layout=(value) ⇒ Object
127 128 129 |
# File 'lib/booky.rb', line 127 def self.layout=(value) @@layout = value end |
.name ⇒ Object
book name
105 106 107 |
# File 'lib/booky.rb', line 105 def self.name @@name end |
.name=(value) ⇒ Object
109 110 111 |
# File 'lib/booky.rb', line 109 def self.name=(value) @@name = value end |
.root ⇒ Object
131 132 133 |
# File 'lib/booky.rb', line 131 def self.root "#{__FILE__}".gsub("/lib/booky.rb", "") end |
.source ⇒ Object
book source
114 115 116 |
# File 'lib/booky.rb', line 114 def self.source @@source end |
.source=(value) ⇒ Object
118 119 120 |
# File 'lib/booky.rb', line 118 def self.source=(value) @@source = value end |