Class: Texas::Build::Task::OpenPDF
- Inherits:
-
Base
- Object
- Base
- Texas::Build::Task::OpenPDF
show all
- Defined in:
- lib/texas/build/task/open_pdf.rb
Constant Summary
collapse
- DEFAULT_OPEN_CMD =
"evince"
Instance Attribute Summary
Attributes inherited from Base
#build
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#cmd ⇒ Object
7
8
9
|
# File 'lib/texas/build/task/open_pdf.rb', line 7
def cmd
@cmd ||= scripts && scripts['open']
end
|
#open_pdf_cmd ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/texas/build/task/open_pdf.rb', line 24
def open_pdf_cmd
if cmd
cmd
else
default = `which #{DEFAULT_OPEN_CMD}`.strip
default.empty? ? nil : default
end
end
|
#run ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/texas/build/task/open_pdf.rb', line 15
def run
return unless build.options.open_pdf
if open_pdf_cmd
system "#{open_pdf_cmd} #{build.dest_file}"
else
puts "Can't open PDF: no default command recognized. Specify in #{CONFIG_FILE}"
end
end
|
#scripts ⇒ Object
11
12
13
|
# File 'lib/texas/build/task/open_pdf.rb', line 11
def scripts
build.config['script']
end
|