Class: StackMaster::Commands::Tidy
Instance Method Summary
collapse
#unix_window_size, #window_size, #windows_window_size
included, #initialize, #success?
Instance Method Details
#find_parameter_files ⇒ Object
60
61
62
|
# File 'lib/stack_master/commands/tidy.rb', line 60
def find_parameter_files
Dir.glob(File.absolute_path(File.join(@config.base_dir, 'parameters', '*.{yml,yaml}')))
end
|
#find_templates ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/stack_master/commands/tidy.rb', line 43
def find_templates
template_dir = @config.template_dir || File.join(@config.base_dir, 'templates')
templates = Dir.glob(File.absolute_path(File.join(template_dir, '**', '*.{rb,yaml,yml,json}')))
dynamics_dir = File.join(template_dir, 'dynamics')
templates.select do |path|
!path.start_with?(dynamics_dir)
end
end
|
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/stack_master/commands/tidy.rb', line 7
def perform
used_templates = []
used_parameter_files = []
templates = Set.new(find_templates)
parameter_files = Set.new(find_parameter_files)
status = @config.stacks.each do |stack_definition|
parameter_files.subtract(stack_definition.parameter_files_from_globs)
template = File.absolute_path(stack_definition.template_file_path)
next unless template
templates.delete(template)
next if File.exist?(template)
StackMaster.stdout.puts(
"Stack \"#{stack_definition.stack_name}\" in \"#{stack_definition.region}\" " \
"missing template \"#{rel_path(template)}\""
)
end
templates.each do |path|
StackMaster.stdout.puts "#{rel_path(path)}: no stack found for this template"
end
parameter_files.each do |path|
StackMaster.stdout.puts "#{rel_path(path)}: no stack found for this parameter file"
end
end
|
#rel_path(path) ⇒ Object
39
40
41
|
# File 'lib/stack_master/commands/tidy.rb', line 39
def rel_path(path)
Pathname.new(path).relative_path_from(Pathname.new(@config.base_dir))
end
|