Class: LaTeXProjectTemplate::Latexmk
- Inherits:
-
Object
- Object
- LaTeXProjectTemplate::Latexmk
- Includes:
- Rake::DSL
- Defined in:
- lib/latex_project_template/task.rb
Constant Summary collapse
- COMMAND_TO_PRODUCE_FILE =
[:dvi, :ps, :pdf, :pdfdvi, :pdfps]
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #command(sym, target) ⇒ Object
- #execute_command(sym, target) ⇒ Object
-
#initialize ⇒ Latexmk
constructor
A new instance of Latexmk.
- #set(sym, &block) ⇒ Object
Constructor Details
#initialize ⇒ Latexmk
Returns a new instance of Latexmk.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/latex_project_template/task.rb', line 41 def initialize() @path = 'latexmk' @command = {} COMMAND_TO_PRODUCE_FILE.each do |type| set(type) do |target| "#{@path} -#{type.to_s} #{target}" end end set(:clean) do |target| "#{@path} -c" end set(:distclean) do |target| "#{@path} -C" end end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
39 40 41 |
# File 'lib/latex_project_template/task.rb', line 39 def path @path end |
Instance Method Details
#command(sym, target) ⇒ Object
62 63 64 |
# File 'lib/latex_project_template/task.rb', line 62 def command(sym, target) @command[sym] && @command[sym].call(target) end |
#execute_command(sym, target) ⇒ Object
66 67 68 69 70 |
# File 'lib/latex_project_template/task.rb', line 66 def execute_command(sym, target) if c = command(sym, target) sh(c) end end |
#set(sym, &block) ⇒ Object
58 59 60 |
# File 'lib/latex_project_template/task.rb', line 58 def set(sym, &block) @command[sym] = block end |