class PleaseRun::User::Base
Constants
- InvalidTemplate
- STRING
- STRING_OR_NIL
Public Instance Methods
Source
# File lib/pleaserun/user/base.rb, line 64 def render(text) return Mustache.render(text, self) end
Render a text input through Mustache based on this object.
Source
# File lib/pleaserun/user/base.rb, line 35 def render_installer render_template("installer.sh") end
Source
# File lib/pleaserun/user/base.rb, line 39 def render_remover render_template("remover.sh") end
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
Source
# File lib/pleaserun/user/base.rb, line 44 def template_path return File.expand_path(File.join(File.dirname(__FILE__), "../../../templates/user/", platform)) end
Get the template path for this platform.