class Begin::CLI

The CLI interface for the application.

Public Instance Methods

install(path) click to toggle source
# File lib/begin/cli.rb, line 32
def install(path)
  repo = repository
  template_name = repo.template_name path
  Output.action "Installing template '#{template_name}' from '#{path}'"
  repo.install path, template_name
  Output.success "Template '#{template_name}' successfully installed"
end
list() click to toggle source
# File lib/begin/cli.rb, line 27
def list
  repository.each { |x| Output.info(x) }
end
new(template) click to toggle source
# File lib/begin/cli.rb, line 14
def new(template)
  template_impl = repository.template template
  if options[:yaml]
    context = YAML.load_file(options[:yaml])
  else
    context = Input.prompt_user_for_tag_values(template_impl.config.tags)
  end
  Output.action "Running template '#{template}'"
  template_impl.run Dir.getwd, context
  Output.success "Template '#{template}' successfully run"
end
repository() click to toggle source
# File lib/begin/cli.rb, line 68
def repository
  Repository.new
end
uninstall(template) click to toggle source
# File lib/begin/cli.rb, line 41
def uninstall(template)
  template_impl = repository.template template
  Output.action "Uninstalling template #{template}"
  template_impl.uninstall
  Output.success "Template '#{template}' successfully uninstalled"
end
update(template = nil) click to toggle source
# File lib/begin/cli.rb, line 49
def update(template = nil)
  if template
    template_impl = repository.template template
    Output.action "Updating template #{template}"
    template_impl.update
  else
    repository.each do |x|
      Output.action "Updating template #{x}"
      repository.template(x).update
    end
  end
end
version() click to toggle source
# File lib/begin/cli.rb, line 63
def version
  Output.info VERSION
end