class Capistrano::Template::Helpers::PathsLookup

Attributes

paths[RW]

Public Class Methods

new(paths, context) click to toggle source
Calls superclass method
# File lib/capistrano/template/helpers/paths_lookup.rb, line 7
def initialize(paths, context)
  super context
  self.paths = paths
end

Public Instance Methods

existence_check(path) click to toggle source
# File lib/capistrano/template/helpers/paths_lookup.rb, line 20
def existence_check(path)
  File.exist?(path)
end
paths_for_file(filename) click to toggle source
# File lib/capistrano/template/helpers/paths_lookup.rb, line 24
def paths_for_file(filename)
  paths.map do |path|
    path = format(path, host: host)
    ["#{path}/#{filename}.erb", "#{path}/#{filename}"]
  end.flatten
end
template_exists?(filename) click to toggle source
# File lib/capistrano/template/helpers/paths_lookup.rb, line 12
def template_exists?(filename)
  !template_file(filename).nil?
end
template_file(filename) click to toggle source
# File lib/capistrano/template/helpers/paths_lookup.rb, line 16
def template_file(filename)
  paths_for_file(filename).find { |path| existence_check(path) }
end