Class: Builtins::Init
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"
Constants inherited
from Builtin
Builtin::BUILTIN_DIR
Instance Attribute Summary
Attributes inherited from Builtin
#args, #config
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Builtin
class_for, #initialize
Constructor Details
This class inherits a constructor from Builtin
Class Method Details
.description ⇒ Object
13
14
15
|
# File 'lib/builtins/init.rb', line 13
def description
"creates an ops.yml file from a template"
end
|
Instance Method Details
#run ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/builtins/init.rb', line 18
def run
if File.exist?(OPS_YML)
Output.error("File '#{OPS_YML} exists; not initializing.")
return false
end
Output.out("Creating '#{OPS_YML} from template...")
FileUtils.cp(template_path, OPS_YML)
true
rescue SystemCallError
Output.error(template_not_found_message)
exit 1
end
|