Class: Kubes::CLI::New::Resource
- Defined in:
- lib/kubes/cli/new/resource.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Logging
Class Method Details
.options ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/kubes/cli/new/resource.rb', line 5 def self. [ [:app, aliases: ["a"], default: "demo", desc: "App name"], [:force, aliases: ["y"], type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"], [:role, aliases: ["r"], desc: "Role. IE: web, clock, worker, migrate, etc. Defaults to convention: web or shared when not set"], [:type, aliases: ["t"], default: "yaml", desc: "Type: dsl or yaml"], ] end |
Instance Method Details
#create_resource ⇒ Object
93 94 95 |
# File 'lib/kubes/cli/new/resource.rb', line 93 def create_resource template file, ".kubes/resources/#{role}/#{file}" end |
#set_template_source ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/kubes/cli/new/resource.rb', line 84 def set_template_source path = File.("../../../templates/new/resource/#{[:type]}/#{file}", __dir__) unless File.exist?(path) logger.info "ERROR: Generator for #{file} not supported".color(:red) exit 1 end set_source("new/resource/#{[:type]}") end |