Class: Softcover::Builders::Mobi
- Inherits:
-
Softcover::Builder
- Object
- Softcover::Builder
- Softcover::Builders::Mobi
- Defined in:
- lib/softcover/builders/mobi.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary
Attributes inherited from Softcover::Builder
Instance Method Summary collapse
- #build!(options = {}) ⇒ Object
-
#mobi_command(filename, options = {}) ⇒ Object
Returns the command for making a MOBI, based on the options.
-
#mobi_filename(options = {}) ⇒ Object
Returns the filename of the MOBI (preview if necessary).
Methods inherited from Softcover::Builder
Methods included from Utils
#add_highlight_class!, #as_size, #book_txt_lines, #chapter_label, #commands, #current_book, #dependency_filename, #digest, #executable, #execute, #in_book_directory?, #language_labels, #linux?, #logged_in?, #master_content, #master_filename, #master_latex_header, #mkdir, #os_x?, #path, #raw_lines, #reset_current_book!, #rm, #silence, #source, #tmpify, #unpublish_slug, #write_master_latex_file, #write_pygments_file
Constructor Details
This class inherits a constructor from Softcover::Builder
Instance Method Details
#build!(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/softcover/builders/mobi.rb', line 5 def build!(={}) Softcover::Builders::Epub.new.build!() filename = mobi_filename() command = mobi_command(filename, ) silent = [:silent] || Softcover.test? if [:quiet] || silent silence { system(command) } else system(command) end if [:calibre] FileUtils.mv("ebooks/#{filename}.azw3", "ebooks/#{filename}.mobi") puts "MOBI saved to ebooks/#{filename}.mobi" unless silent end end |
#mobi_command(filename, options = {}) ⇒ Object
Returns the command for making a MOBI, based on the options.
27 28 29 30 31 32 33 |
# File 'lib/softcover/builders/mobi.rb', line 27 def mobi_command(filename, ={}) if [:calibre] "#{calibre} ebooks/#{filename}.epub ebooks/#{filename}.azw3" else "#{kindlegen} ebooks/#{filename}.epub" end end |
#mobi_filename(options = {}) ⇒ Object
Returns the filename of the MOBI (preview if necessary).
22 23 24 |
# File 'lib/softcover/builders/mobi.rb', line 22 def mobi_filename(={}) [:preview] ? manifest.filename + '-preview' : manifest.filename end |