Class: Bookbinder::Commands::GeneratePDF
Defined Under Namespace
Classes: AppNotPublished, IncompletePDFConfig, PDFConfigMissing, PDFOptionMissing
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Naming
command_name
#initialize
Class Method Details
.usage ⇒ Object
35
36
37
|
# File 'lib/bookbinder/commands/generate_pdf.rb', line 35
def self.usage
"generate_pdf [<file_name>.yml] \t \t Generate a PDF from the files specified in <file_name.yml>"
end
|
Instance Method Details
#find_pdf_config_file(params) ⇒ Object
48
49
50
51
52
53
54
55
56
|
# File 'lib/bookbinder/commands/generate_pdf.rb', line 48
def find_pdf_config_file(params)
if params.first
pdf_config_file = File.expand_path(params.first)
raise PDFConfigMissing, File.basename(pdf_config_file) unless File.exists?(pdf_config_file)
pdf_config_file
else
@logger.warn "Declaring PDF options in config.yml is deprecated.\nDeclare them in a PDF config file, instead, and target that file when you re-invoke bookbinder.\ne.g. bookbinder generate_pdf theGoodParts.yml"
end
end
|
#run(params) ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/bookbinder/commands/generate_pdf.rb', line 39
def run(params)
raise AppNotPublished unless Dir.exists?('final_app')
@pdf_config_file = find_pdf_config_file(params)
ServerDirector.new(@logger, directory: 'final_app').use_server { |port| capture_pages_into_pdf_at(port) }
0
end
|