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
38
39
40
41
|
# File 'lib/r10k/cli/module/list.rb', line 7
def self.command
@cmd ||= Cri::Command.define do
name 'list'
usage 'list'
summary 'List modules that are instantiated in environments'
run do |opts, args, cmd|
deployment = R10K::Deployment.instance
env_list = deployment.environments
update_cache = (defined? opts[:update]) ? (opts[:update] == 'true') : false
if opts[:environment]
environments = env_list.select {|env| env.name == opts[:environment]}
else
environments = env_list
end
printree = {}
environments.each do |env|
module_names = env.modules.map(&:name)
printree[env.name] = module_names
end
printree.each_pair do |env_name, mod_list|
puts " - #{env_name}"
mod_list.each do |mod|
puts " #{mod}"
end
end
end
end
end
|