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
32 33 34 35 36 37 38 |
# 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 ⇒ Object
27 28 29 |
# File 'lib/begin/cli.rb', line 27 def list repository.each { |x| Output.info(x) } end |
#new(template) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/begin/cli.rb', line 14 def new(template) template_impl = repository.template template if [:yaml] context = YAML.load_file([:yaml]) else context = 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
41 42 43 44 45 46 |
# 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) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# 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 ⇒ Object
63 64 65 |
# File 'lib/begin/cli.rb', line 63 def version Output.info VERSION end |