Module: Treebis::PathUtils

Included in:
Task
Defined in:
lib/nandoc/support/treebis-extlib.rb

Instance Method Summary collapse

Instance Method Details

#path_from_full(path) ⇒ Object



24
25
26
# File 'lib/nandoc/support/treebis-extlib.rb', line 24

def path_from_full path
  File.join(@from, undot(path))
end

#path_from_full_assert(path) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/nandoc/support/treebis-extlib.rb', line 27

def path_from_full_assert path
  fullpath = path_from_full(path)
  unless File.exist?(fullpath)
    name = respond_to?(:name) ? " #{self.name.inspect}" : ''
    fail "      Treebis task\#{name} referred to file \#{path}\n      that did not exist at \#{fullpath}\n    HERE\n  end\n  fullpath\nend\n".gsub(/^ +/, '')

#undot(path) ⇒ Object



21
22
23
# File 'lib/nandoc/support/treebis-extlib.rb', line 21

def undot path
  $1 if /^(?:\.\/)?(.+)$/ =~ path
end