Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add table formatting #868

Merged
merged 3 commits into from
Jan 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions bin/outdated_modules_and_their_version
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,30 @@ require 'erb'
# the current version in modulesync_config
version = YAML.load(ERB.new(File.read('moduleroot/.msync.yml.erb')).result)['modulesync_config_version']

puts "current version: #{version}"
puts '---------------------------------------------'
puts "| Module\t| modulesync_config version |"
puts '---------------------------------------------'
mod_ary = Array.new
zilchms marked this conversation as resolved.
Show resolved Hide resolved
# min width is with of Sting "Module"
zilchms marked this conversation as resolved.
Show resolved Hide resolved
width_modules = 6
# min width is width of String "modulesync_config version"
width_version = 25
Dir.glob('modules/voxpupuli/puppet-*/.msync.yml').each do|f|
version_module = YAML.load_file(f)['modulesync_config_version']
mod = f.split('/')[2]
puts "| #{mod}\t| #{version_module}\t|" if version != version_module
if version != version_module
mod_ary.push([mod,version_module])
zilchms marked this conversation as resolved.
Show resolved Hide resolved
width_modules = [width_modules,mod.length].max
width_version = [width_version,version_module.length].max
zilchms marked this conversation as resolved.
Show resolved Hide resolved
end
end

total_width = width_modules + width_version + 7

puts '-' * total_width
puts "current version: #{version}"
puts '-' * total_width
puts '| Module' + ' '* (width_modules - 6) + ' | modulesync_config version' + ' '*(width_version-25) + ' |'
zilchms marked this conversation as resolved.
Show resolved Hide resolved
puts '-' * total_width
mod_ary.each do |m|
mod = m[0]
version_module = m[1]
zilchms marked this conversation as resolved.
Show resolved Hide resolved
puts "| #{mod}" + ' '*(width_modules-mod.length) +" | #{version_module}" + ' '*(width_version-version_module.length) +' |'
zilchms marked this conversation as resolved.
Show resolved Hide resolved
end