class RBT::ShowVersionsOfThesePrograms

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::ShowVersionsOfThesePrograms[]

#
# File lib/rbt/utility_scripts/show_versions_of_these_programs.rb, line 98
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/show_versions_of_these_programs.rb, line 24
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

do_work_on_the_programs( i = commandline_arguments? ) click to toggle source
#

do_work_on_the_programs

#
# File lib/rbt/utility_scripts/show_versions_of_these_programs.rb, line 46
def do_work_on_the_programs(
    i = commandline_arguments?
  )
  e
  i.each {|this_program|
    if RBT.respond_to? :swift_return_program_version
      version = RBT.swift_return_program_version(this_program)
    else
      require 'rbt/requires/require_the_cookbook_class.rb'
      version = RBT::Cookbooks::SanitizeCookbook.new(this_program) { :fast }.version?
    end
    this_program = (
      "#{File.basename(this_program).sub(/\.yml$/,'')}:"
    ).ljust(30)
    e "  #{steelblue(this_program)} "+
      mediumpurple(version.to_s)
  }
  e
end
menu( i = commandline_arguments? ) click to toggle source
#

menu (menu tag)

#
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/show_versions_of_these_programs.rb, line 38
def reset
  super()
  infer_the_namespace
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/show_versions_of_these_programs.rb, line 86
def run
  menu
  if commandline_arguments?.empty?
    opne 'Please provide at the least one argument to this class.'
  else
    do_work_on_the_programs
  end
end