Module: Softcover::Commands::Build

Extended by:
Build
Includes:
Output
Included in:
Build
Defined in:
lib/softcover/commands/build.rb

Instance Method Summary collapse

Methods included from Output

should_output?, silence!, silent?, #system, unsilence!

Instance Method Details

#all_formats(options = {}) ⇒ Object

Builds the book for all formats.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/softcover/commands/build.rb', line 18

def all_formats(options={})
  building_message('all formats', options)
  Softcover::BUILD_ALL_FORMATS.each do |format|
    if format == 'mobi'
      building_message('EPUB & MOBI', options)
    else
      building_message(format.upcase, options)
    end
    builder_for(format).build!(options)
  end
end

#builder_for(format) ⇒ Object

Returns the builder for the given format.



37
38
39
# File 'lib/softcover/commands/build.rb', line 37

def builder_for(format)
  "Softcover::Builders::#{format.titleize}".constantize.new
end

#for_format(format, options = {}) ⇒ Object

Builds the book for the given format.



8
9
10
11
12
13
14
15
# File 'lib/softcover/commands/build.rb', line 8

def for_format(format, options={})
  raise 'Invalid format' unless Softcover::FORMATS.include?(format)
  building_message(format.upcase, options)
  builder_for(format).build!(options)
  if format == 'html' && !(options[:silent] || options[:quiet])
    puts "LaTeX-to-XML debug information output to log/tralics.log"
  end
end

#preview(options = {}) ⇒ Object

Builds the book preview.



31
32
33
34
# File 'lib/softcover/commands/build.rb', line 31

def preview(options={})
  building_message('preview', options)
  builder_for('preview').build!
end