Skip to content

Commit

Permalink
fix suggested changes, ljust and rubystyles
Browse files Browse the repository at this point in the history
  • Loading branch information
zilchms committed Jan 16, 2024
1 parent 7073aa7 commit e43f57a
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions bin/outdated_modules_and_their_version
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ 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 = Array.new
# min width is with of Sting "Module"
mod_ary = []
# min width is with of String "Module"
width_modules = 6
# min width is width of String "modulesync_config version"
width_version = 25
Expand All @@ -16,8 +16,8 @@ Dir.glob('modules/voxpupuli/puppet-*/.msync.yml').each do|f|
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
width_modules = [width_modules, mod.length].max
width_version = [width_version, version_module.length].max
end
end

Expand All @@ -26,10 +26,7 @@ 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) + ' |'
puts '-' * total_width
mod_ary.each do |m|
mod = m[0]
version_module = m[1]
puts "| #{mod}" + ' '*(width_modules-mod.length) +" | #{version_module}" + ' '*(width_version-version_module.length) +' |'
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

0 comments on commit e43f57a

Please sign in to comment.