class RBT::ConvertToTraditional

Constants

USE_THIS_TARGET_PREFIX
#

USE_THIS_TARGET_PREFIX

#

Public Class Methods

new( full_location_of_package_or_name = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/convert_to_traditional.rb, line 26
def initialize(
    full_location_of_package_or_name = nil,
    run_already                      = true
   )
  reset
  set_full_location_of_package_or_name(
    full_location_of_package_or_name
  )
  run if run_already
end

Public Instance Methods

convert_to_fhs(i) click to toggle source
#

convert_to_fhs

This method will “convert” the package to a FHS install.

#
# File lib/rbt/utility_scripts/convert_to_traditional.rb, line 83
def convert_to_fhs(i)
  i = i.dup if i.frozen?
  i << '/Current/'
  if File.exist?(i)
    opne "Now #{springgreen(converting)} `#{sfile(i)}`."
    opne "to a FHS package (into --prefix #{prefix?})."
    copy_recursively(i, prefix?, true) # true for "be verbose".
    opne 'Done!'
  else
    opne 'Sorry, we can not continue. The directory at:'
    opne sdir(i)
    opne 'does not seem to exist.'
  end
end
prefix?() click to toggle source
#

prefix?

#
# File lib/rbt/utility_scripts/convert_to_traditional.rb, line 74
def prefix?
  @target_prefix_to_use
end
reset() click to toggle source
#

reset

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/convert_to_traditional.rb, line 40
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @target_prefix_to_use
  # ======================================================================= #
  @target_prefix_to_use = USE_THIS_TARGET_PREFIX
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/convert_to_traditional.rb, line 101
def run
  if @full_location_of_package_or_name # Was given.
    set_start_location(programs_directory?)
    if File.exist? @start_location
      convert_to_fhs(@start_location)
    end
  end
end
set_full_location_of_package_or_name(i) click to toggle source
#

set_full_location_of_package_or_name

#
# File lib/rbt/utility_scripts/convert_to_traditional.rb, line 52
def set_full_location_of_package_or_name(i)
  i = i.first if i.is_a? Array
  @full_location_of_package_or_name = i
end
set_start_location( i = programs_directory? ) click to toggle source
#

set_start_location

#
# File lib/rbt/utility_scripts/convert_to_traditional.rb, line 60
def set_start_location(
    i = programs_directory?
  )
  if RBT.configuration?.capitalize_program_names # Whether to capitalize the directory.
    i << @full_location_of_package_or_name.capitalize
  else
    i << @full_location_of_package_or_name
  end
  @start_location = i
end