Class: Techbook::Builder
- Inherits:
-
Object
- Object
- Techbook::Builder
- Defined in:
- lib/techbook/builder.rb
Instance Attribute Summary collapse
-
#basename ⇒ Object
Returns the value of attribute basename.
-
#docbook ⇒ Object
Returns the value of attribute docbook.
-
#epub ⇒ Object
Returns the value of attribute epub.
-
#file ⇒ Object
Returns the value of attribute file.
-
#html ⇒ Object
Returns the value of attribute html.
-
#mobi ⇒ Object
Returns the value of attribute mobi.
-
#output ⇒ Object
Returns the value of attribute output.
-
#path ⇒ Object
Returns the value of attribute path.
-
#pdf ⇒ Object
Returns the value of attribute pdf.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(pdf, html, epub, mobi, docbook, output) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(pdf, html, epub, mobi, docbook, output) ⇒ Builder
Returns a new instance of Builder.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/techbook/builder.rb', line 32 def initialize(pdf, html, epub, mobi, docbook, output) @pdf = pdf @html = html @epub = epub @mobi = mobi @docbook = docbook @output = output @basename = File.basename @output @book = File.join @output, "#{@basename}.asc" @path = File.join @output, "build" end |
Instance Attribute Details
#basename ⇒ Object
Returns the value of attribute basename.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def basename @basename end |
#docbook ⇒ Object
Returns the value of attribute docbook.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def docbook @docbook end |
#epub ⇒ Object
Returns the value of attribute epub.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def epub @epub end |
#file ⇒ Object
Returns the value of attribute file.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def file @file end |
#html ⇒ Object
Returns the value of attribute html.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def html @html end |
#mobi ⇒ Object
Returns the value of attribute mobi.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def mobi @mobi end |
#output ⇒ Object
Returns the value of attribute output.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def output @output end |
#path ⇒ Object
Returns the value of attribute path.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def path @path end |
#pdf ⇒ Object
Returns the value of attribute pdf.
12 13 14 |
# File 'lib/techbook/builder.rb', line 12 def pdf @pdf end |
Class Method Details
.run(pdf:, html:, epub:, mobi:, docbook:, output:, watch:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/techbook/builder.rb', line 14 def self.run(pdf:, html:, epub:, mobi:, docbook:, output:, watch:) b = new pdf, html, epub, mobi, docbook, output b.build if watch Signal.trap("SIGINT") do puts "Bye :)".green exit end puts "Watching changes for #{output}".green listener = Listen.to(File.join(output, "book")) { b.build } listener.start sleep end end |
Instance Method Details
#build ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/techbook/builder.rb', line 45 def build puts "Building book...".yellow prepare generate_includes build_pdf build_html build_docbook build_epub build_mobi dist clean end |