forked from voxpupuli/modulesync_config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutdated_modules_and_their_version
More file actions
executable file
·40 lines (35 loc) · 1.3 KB
/
outdated_modules_and_their_version
File metadata and controls
executable file
·40 lines (35 loc) · 1.3 KB
1
2
3
4
5
6
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
#!/usr/bin/env ruby
require 'yaml'
require 'erb'
# the current version in modulesync_config
version = YAML.load(ERB.new(File.read('moduleroot/.msync.yml.erb')).result)['modulesync_config_version']
mod_ary = []
# min width is width of String "Module"
width_modules = 6
# min width is width of String "modulesync_config version"
width_version = 25
Dir.glob('modules/voxpupuli/puppet-*').sort.each do |f|
if File.exist?(f + '/.msync.yml')
version_module = YAML.load_file(f + '/.msync.yml')['modulesync_config_version']
mod = (f).split('/')[2]
if version != version_module
mod_ary.push([mod, version_module])
width_modules = [width_modules, mod.length].max
width_version = [width_version, version_module.length].max
end
else
version_module = 'None'
mod = (f).split('/')[2]
mod_ary.push([mod, version_module])
width_modules = [width_modules, mod.length].max
width_version = [width_version, version_module.length].max
end
end
total_width = width_modules + width_version + 7
puts '-' * total_width
puts "current version: #{version}"
puts '-' * total_width
puts "| #{'Module'.ljust(width_modules)} | #{'modulesync_config version'.ljust(width_version)} |"
mod_ary.each do |mod, version_module|
puts "| #{mod.ljust(width_modules)} | #{version_module.ljust(width_version)} |"
end