Class: Begin::CLI
- Inherits:
-
Thor
- Object
- Thor
- Begin::CLI
- Defined in:
- lib/begin/cli.rb
Overview
The CLI interface for the application.
Instance Method Summary collapse
- #install(path) ⇒ Object
- #list ⇒ Object
- #new(template) ⇒ Object
- #uninstall(template) ⇒ Object
- #update(template = nil) ⇒ Object
- #version ⇒ Object
Instance Method Details
#install(path) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/begin/cli.rb', line 34 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 ⇒ Object
29 30 31 |
# File 'lib/begin/cli.rb', line 29 def list repository.each { |x| Output.info(x) } end |
#new(template) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/begin/cli.rb', line 16 def new(template) template_impl = repository.template template context = if [:yaml] YAML.load_file([:yaml]) else Input.prompt_user_for_tag_values(template_impl.config.) end Output.action "Running template '#{template}'" template_impl.run Dir.getwd, context Output.success "Template '#{template}' successfully run" end |
#uninstall(template) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/begin/cli.rb', line 43 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) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/begin/cli.rb', line 51 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 ⇒ Object
65 66 67 |
# File 'lib/begin/cli.rb', line 65 def version Output.info VERSION end |