class Begin::SymlinkTemplate

Encapsulates the logic for templates that are installed as symlinks on the user's machine.

Public Class Methods

install(source_uri, path) click to toggle source
# File lib/begin/template.rb, line 124
def self.install(source_uri, path)
  source_path = Path.new source_uri, '.', 'Source path'
  source_path.ensure_dir_exists
  begin
    File.symlink source_path, path
    Output.success "Created symbolic link to '#{source_path}'"
  rescue NotImplementedError
    raise NotImplementedError, 'TODO: Copy tree when symlinks not supported'
  end
  SymlinkTemplate.new path
end
new(path) click to toggle source
Calls superclass method Begin::Template::new
# File lib/begin/template.rb, line 119
def initialize(path)
  super path
  @path.ensure_symlink_exists
end

Public Instance Methods

uninstall() click to toggle source
# File lib/begin/template.rb, line 140
def uninstall
  File.unlink @path
end
update() click to toggle source
# File lib/begin/template.rb, line 136
def update
  # Do nothing. Symlink templates are always up-to-date.
end