lib/itamae/template/cli.rb in itamae-template-0.1.3 vs lib/itamae/template/cli.rb in itamae-template-0.1.4
- old
+ new
@@ -25,20 +25,24 @@
def generate(target, name)
validate_target!(target)
create_directory(File.join("#{target}s", name))
create_file(File.join("#{target}s", name, 'default.rb'), "# noop\n")
- create_file(File.join("#{target}s", name, 'node.yml'), "# No variables\n")
+ if target == 'role'
+ create_file(File.join("#{target}s", name, 'node.yml'), "# No variables\n")
+ end
end
method_option :generate, aliases: :g
desc 'destroy [role|cookbook] [NAME]', 'Destroy role or cookbook'
def destroy(target, name)
validate_target!(target)
recursive_remove(File.join("#{target}s", name))
recursive_remove(File.join("#{target}s", name, 'default.rb'))
- recursive_remove(File.join("#{target}s", name, 'node.yml'))
+ if target == 'role'
+ recursive_remove(File.join("#{target}s", name, 'node.yml'))
+ end
end
method_option :destroy, aliases: :d
private