class RBT::CopyTheseArchives

Public Class Methods

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

RBT::CopyTheseArchives[]

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

initialize

#
# File lib/rbt/utility_scripts/copy_these_archives.rb, line 38
def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

copy_this_archive(i) click to toggle source
#

copy_this_archive

#
# File lib/rbt/utility_scripts/copy_these_archives.rb, line 60
def copy_this_archive(i)
  this_dir = return_pwd
  opne "#{rev}Now copying #{sfile(i)} #{rev}to the"
  opne "#{rev}current working directory (`#{sdir(this_dir)}#{rev}`)."
  copy_file(i, this_dir)
end
do_work_on_these_files( i = commandline_arguments? ) click to toggle source
#

do_work_on_these_files

#
# File lib/rbt/utility_scripts/copy_these_archives.rb, line 70
def do_work_on_these_files(
    i = commandline_arguments?
  )
  i.each {|this_target|
    full_target_path = this_target.dup
    if RBT.respond_to? :swift_return_version_of_this_program
      version_of_the_program = return_version_of_this_program(this_target)
    else
      version_of_the_program = action(:SanitizeCookbook, this_target) { :fast }.program_version?
    end
    unless this_target.include? '/'
      unless File.file?(this_target)
        full_target_path = src_dir?+this_target
      end
    end
    # ===================================================================== #
    # this_target may now look like this:
    #
    #   /home/x/src/linux
    #
    # We will next have to obtain the most recent version of the program.
    # ===================================================================== #
    unless full_target_path.end_with? '/'
      full_target_path << '/'
    end
    # ===================================================================== #
    # Now we can attempt to find a locally existing file. We will grab the
    # first entry found, if the result is not empty.
    # ===================================================================== #
    use_this_target = full_target_path+this_target+'-'+version_of_the_program+'*'
    possible_files = Dir[use_this_target]
    unless possible_files.empty?
      copy_this_archive(possible_files.first)
    end
  }
end
reset() click to toggle source
#

reset (reset tag)

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

run (run tag)

#
# File lib/rbt/utility_scripts/copy_these_archives.rb, line 110
def run
  do_work_on_these_files(commandline_arguments?)
end