Class: Dupler::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/dupler/cli.rb

Overview

CLI class for dupler command based Thor

Constant Summary collapse

DEFAULT_CONF_PATH =
"./values.yaml"

Instance Method Summary collapse

Instance Method Details

#build(output_dir = "./output", *template_path) ⇒ Object

Raises:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/dupler/cli.rb', line 23

def build(output_dir = "./output", *template_path)
  if options["version"]
    puts "dupler #{Dupler::VERSION}"
    return
  end

  extracted_template_files = extract_template_files(template_path)

  values_file_path = options["conf"] || DEFAULT_CONF_PATH
  raise DuplerException, "No such conf file: #{values_file_path}" unless File.exist? values_file_path

  core = Dupler::Core.new
  begin
    core.build(values_file_path, output_dir, extracted_template_files)
  rescue Errno::EACCES => e
    raise DuplerException.new(e)
  end
end

#new_project(name) ⇒ Object



15
16
17
18
# File 'lib/dupler/cli.rb', line 15

def new_project(name)
  core = Dupler::Core.new
  core.new_project(name)
end