Class: Builtins::Init

Inherits:
Builtin show all
Defined in:
lib/builtins/init.rb

Constant Summary collapse

OPS_YML =
"ops.yml"
TEMPLATE_DIR =
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "etc"))
OPS_YML_TEMPLATE =
File.join(TEMPLATE_DIR, "%<template_name>s.template.yml")
DEFAULT_TEMPLATE_NAME =
"ops"

Instance Method Summary collapse

Methods inherited from Builtin

#initialize

Constructor Details

This class inherits a constructor from Builtin

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/builtins/init.rb', line 15

def run
	if File.exist?(OPS_YML)
		Output.error("File '#{OPS_YML} exists; not initializing.")
	else
		Output.out("Creating '#{OPS_YML} from template...")
		FileUtils.cp(template_path, OPS_YML)
	end
rescue SystemCallError
	Output.error(template_not_found_message)
	exit 1
end