class PleaseRun::User::Base

Constants

InvalidTemplate
STRING
STRING_OR_NIL

Public Instance Methods

render(text) click to toggle source

Render a text input through Mustache based on this object.

# File lib/pleaserun/user/base.rb, line 64
def render(text)
  return Mustache.render(text, self)
end
render_installer() click to toggle source
# File lib/pleaserun/user/base.rb, line 35
def render_installer
  render_template("installer.sh")
end
render_remover() click to toggle source
# File lib/pleaserun/user/base.rb, line 39
def render_remover
  render_template("remover.sh")
end
render_template(name) click to toggle source
# File lib/pleaserun/user/base.rb, line 48
def render_template(name)
  possibilities = [ 
    File.join(template_path, "default", name),
    File.join(template_path, name)
  ]
  possibilities.unshift(File.join(template_path, version, name)) if version

  possibilities.each do |path|
    next unless File.readable?(path) && File.file?(path)
    return render(File.read(path))
  end

  raise InvalidTemplate, "Could not find template file for '#{name}'. Tried all of these: #{possibilities.inspect}"
end
template_path() click to toggle source

Get the template path for this platform.

# File lib/pleaserun/user/base.rb, line 44
def template_path
  return File.expand_path(File.join(File.dirname(__FILE__), "../../../templates/user/", platform))
end