class RBT::Cookbooks::Cookbook

Constants

ARRAY_ARRAY_ENTRIES
#

Cookbooks::ARRAY_ARRAY_ENTRIES (array tag)

These entries should be kept as an Array at all time. They will all allow us to run .each on them.

In “pure” ruby code, these would all be set to e. g. “xyz = []”, so really just an Array of Arrays.

#
ARRAY_EMPTY_VALUES
#

Cookbooks::ARRAY_EMPTY_VALUES

All values that will initialize default to an empty string, have to be registered here.

#
ARRAY_FALSE_VALUES
#

RBT::Cookbooks::Cookbook::ARRAY_FALSE_VALUES (false tag)

This constant collects all values that must be explicitely set to false on startup.

#
ARRAY_MAIN_PROGRAM_ENTRIES
#

Cookbooks::ARRAY_MAIN_PROGRAM_ENTRIES

We need the following 8 entries defined here, so that we do not forget them lateron.

These are the only entries we care about and describe the most important components of a program.

#
ARRAY_NIL_ENTRIES
#

Cookbooks::ARRAY_NIL_ENTRIES (nil tag)

All entries that are nil by default.

#
ARRAY_TRUE_VALUES
#

ARRAY_TRUE_VALUES (true tag)

Only a few variables are true for now, by default - prefix, run_ldconfig and has_to_be_compiled at the very least.

#
DEFAULT_PROGRAM_VERSION
#

DEFAULT_PROGRAM_VERSION

#
HOW_TO_INVOKE_THE_PROGRAM
#

HOW_TO_INVOKE_THE_PROGRAM

#
NAMESPACE
#

NAMESPACE

#
REPLACE_PLUS_WITH_LONG_NAME
#

REPLACE_PLUS_WITH_LONG_NAME

If this constant is true then we will replace '+' with 'plus' if they are part of a program name.

#

Public Class Methods

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

[]

#
# File lib/rbt/cookbooks/class/class_methods/class_methods.rb, line 19
def self.[](i = '')
  self.new(i)
end
do_not_honour_threshold_value() click to toggle source
#

RBT::Cookbooks::Cookbook.do_not_honour_threshold_value

#
# File lib/rbt/cookbooks/class/report.rb, line 25
def self.do_not_honour_threshold_value
  @honour_threshold_value = false
end
does_include?(i) click to toggle source
#

RBT::Cookbooks::Cookbook.does_include?

#
# File lib/rbt/cookbooks/class/class_methods/class_methods.rb, line 43
def self.does_include?(i)
  RBT.does_include?(i)
end
e(i = '') click to toggle source
#

RBT::Cookbooks::Cookbook.e

#
# File lib/rbt/cookbooks/class/class_methods/e.rb, line 18
def self.e(i = '')
  RBT.e(i)
end
feedback_all_available_formats() click to toggle source
#

RBT::Cookbooks::Cookbook.feedback_all_available_formats

To invoke this method from the commandline, try:

cookbooks --feedback_all_available_formats
#
# File lib/rbt/cookbooks/class/feedback/feedback_all_available_formats.rb, line 24
def self.feedback_all_available_formats
  dataset = return_file_specification_of_registered_cookbook_entries
  dataset.each_pair {|key, value|
    if Object.const_defined? :Colours
      separator = slateblue(': ')
    else
      separator = simp(': ')
    end
    ::RBT.e(
      key.ljust(30)+separator+value.rjust(10)
    )
  }
end
feedback_format_specification_of( i = 'extract_to' ) click to toggle source
#

Cookbooks::Cookbook.feedback_format_specification_of

This is the method that will tell us whether an entry in the cookbooks settings is an Array or a String or a Hash or a Boolean value.

Usage example:

Cookbooks::Cookbook.feedback_format_specification_of :headers

From the commandline:

scookie --format-specification-of=extract_to
cookbooks --format-specification-of=extract_to
#
# File lib/rbt/cookbooks/class/feedback/feedback_format_specification_of.rb, line 34
def self.feedback_format_specification_of(
    i = 'extract_to'
  )
  i = i.to_s unless i.is_a? String # We need a String here.
  # ======================================================================= #
  # First, load the YAML file that has our dataset.
  # ======================================================================= #
  dataset = YAML.load_file(
    return_file_specification_of_registered_cookbook_entries # We need this method.
  )
  if dataset.has_key? i
    format_type = dataset[i]
    opnn; e "The format type for the key `#{Colours.simp(i)}` is:"
    opnn; e "  #{Colours.sfancy(format_type)}"
  else
    opnn; e 'No format called `'+Colours.simp(i)+'` is known.'
  end
end
honour_threshold_value?() click to toggle source
#

RBT::Cookbooks::Cookbook.honour_threshold_value?

#
# File lib/rbt/cookbooks/class/report.rb, line 32
def self.honour_threshold_value?
  @honour_threshold_value
end
main_program_entries?() click to toggle source
#

RBT::Cookbooks::Cookbook.main_program_entries?

#
# File lib/rbt/cookbooks/class/constants.rb, line 147
def self.main_program_entries?
  ARRAY_MAIN_PROGRAM_ENTRIES
end
new( commandline_arguments = nil, run_already = true ) { || ... } click to toggle source
#

initialize

#
# File lib/rbt/cookbooks/class/initialize.rb, line 16
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  # ======================================================================= #
  # Next handle blocks. This must happen before the invocation of the
  # method set_commandline_arguments() because we can thus also
  # bypass calling menu().
  # ======================================================================= #
  if block_given?
    yielded = yield
    # ===================================================================== #
    # For now, we will only check for Symbols in the given block.
    # ===================================================================== #
    if yielded.is_a? Symbol
      case yielded
      when :be_quiet_and_bypass_menu
        @use_menu_interface = false
        be_quiet 
      when :skip_menu_interface,
           :bypass_menu,
           :bypass_menu_check
        @use_menu_interface = false
      else
        opnn; e "Unknown symbol called #{sfancy(yielded.to_s)} passed." 
      end
    # ===================================================================== #
    # === Handle hashes next
    # ===================================================================== #
    elsif yielded.is_a? Hash
      if yielded.has_key? :use_menu_interface
        set_use_menu_interface(
          yielded.delete(:use_menu_interface)
        )
      end
      if yielded.has_key? :make_use_of_aliases_kept_in_the_file_cookbook_aliases
        _ = yielded.delete(:make_use_of_aliases_kept_in_the_file_cookbook_aliases)
        set_make_use_of_aliases_kept_in_the_file_cookbook_aliases(_)
      end
    end
  end
  if commandline_arguments
    case commandline_arguments
    when :do_not_run_yet
      run_already = false
      commandline_arguments = nil
    else
      set_commandline_arguments(
        commandline_arguments
      )
    end
  end
  run if run_already
end
opnn(i = NAMESPACE) click to toggle source
#

RBT::Cookbooks::Cookbook.opnn

#
# File lib/rbt/cookbooks/class/class_methods/opnn.rb, line 18
def self.opnn(i = NAMESPACE)
  if i.is_a? String
    i = { namespace: i }
  end
  Opn.opn(i)
end
return_dataset(of_this_program = :htop) click to toggle source
#

Cookbooks::Cookbook.return_dataset

This will return the whole dataset. You can then use this dataset in other programs.

Returns: a Hash

Usage examples:

htop_dataset = RBT::Cookbooks::Cookbook.return_dataset(:htop)
ruby_dataset = RBT::Cookbooks::Cookbook.return_dataset(:ruby)
#
# File lib/rbt/cookbooks/class/class_methods/class_methods.rb, line 35
def self.return_dataset(of_this_program = :htop)
  dataset = RBT::Cookbooks::Cookbook.new(of_this_program) { :bypass_menu_check }.yaml_dataset?
  return dataset
end

Public Instance Methods

[](i) click to toggle source
#

[]

#
# File lib/rbt/cookbooks/class/obtain.rb, line 596
def [](i)
  @internal_hash[:yaml_dataset][i]
end
[]=( key, new_value = nil )
Alias for: set_in_yaml_dataset
active_project()
Alias for: active_project?
active_project?() click to toggle source
#

active_project?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1006
def active_project?
  obtain(:active_project)
end
Also aliased as: active_project
append_this_to_the_configure_options(i = '') click to toggle source
#

append_this_to_the_configure_options

This method can be used to append something to the (stored) configure options in use.

#
# File lib/rbt/cookbooks/class/class.rb, line 622
def append_this_to_the_configure_options(i = '')
  _ = configure_options?.to_s
  _ << " #{i}"
  set_configure_options(_)
end
apply_patch?() click to toggle source
#

apply_patch?

Query method whether we shall apply a patch or whether we shall not.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 177
def apply_patch?
  obtain(:apply_patch)
end
archive?()
Alias for: archive_type?
archive_name?()
Alias for: archive_type?
archive_size()
Alias for: archive_size?
archive_size?() click to toggle source
#

archive_size?

This method keeps track of the size of the program tarball in question.

For this to work, we should have initialized the program size at 0.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 250
def archive_size?
  obtain(:archive_size)
end
archive_type()
Alias for: archive_type?
archive_type=( i = DEFAULT_ARCHIVE_TYPE )
Alias for: set_archive_type
archive_type?() click to toggle source
#

archive_type?

Simply query the archive type here. The archive_type is something such as “.tar.gz” or “.tar.bz2”.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 409
def archive_type?
  obtain(:archive_type)
end
Also aliased as: archive?, archive_type, archive_name?
are_we_on_gobolinux?() click to toggle source
#

are_we_on_gobolinux?

Determine whether we are on GoboLinux or whether we are not.

#
# File lib/rbt/cookbooks/class/class.rb, line 520
def are_we_on_gobolinux?
  RBT.are_we_on_gobolinux?
end
array?()
Alias for: yaml_dataset?
array_invalid_keys()
Alias for: array_invalid_keys?
array_invalid_keys?() click to toggle source
#

array_invalid_keys?

All invalid cookbook-entries will be kept in this Array.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 232
def array_invalid_keys?
  @internal_hash[:array_invalid_keys]
end
Also aliased as: array_invalid_keys
assemble_default_program_name( i = return_program_name ) click to toggle source
#

assemble_default_program_name

This method will assemble the program_name (6) variable, which is derived directly from:

short_name? and '-' and program_version?

For example it could look like this:

"gnome-mahjongg-5.08"
#
# File lib/rbt/cookbooks/class/set.rb, line 1246
def assemble_default_program_name(
    i = return_program_name
  )
  set_program_name(i)
end
assemble_full_path()
Alias for: update_program_path
assemble_program_full_name( i = return_default_program_full_name ) click to toggle source
#

assemble_program_full_name

This method will build-up a valid “program_full_name” setting.

In order to achieve this, it will make use of the method called return_default_program_full_name, which itself is a combination of program_name?+archive_type?.

#
# File lib/rbt/cookbooks/class/set.rb, line 315
def assemble_program_full_name(
    i = return_default_program_full_name
  )
  set_program_full_name(i)
end
assemble_program_name( i = return_program_name )
assemble_program_path( i = return_default_program_path ) click to toggle source
#

assemble_program_path

This method will always ultimate attempt to set the program path, if possible.

#
# File lib/rbt/cookbooks/class/set.rb, line 1228
def assemble_program_path(
    i = return_default_program_path
  )
  assemble_default_program_name # Assign to something such as: "gnome-mahjongg-0.1.3"
  set_program_path(i)
end
Also aliased as: reassemble_program_path
assign( i = search_which_program? )
assign_and_run( i = search_which_program? )
assume_default_archive_type() click to toggle source
#

assume_default_archive_type

#
# File lib/rbt/cookbooks/class/set.rb, line 1037
def assume_default_archive_type
  set_archive_type(DEFAULT_ARCHIVE_TYPE)
end
attach_program_name_and_program_version( i = return_program_name )
base_dir()
Alias for: base_dir?
base_dir=( i = source_dir?+ real_short_name?.downcase.delete('.')+ '/' )
Alias for: set_base_dir
base_dir?() click to toggle source
#

base_dir?

This is entry (5), a simple query method. It will give us back the base directory of our program in question, such as '/Users/x/SRC/htop/'.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 140
def base_dir?
  obtain(:base_dir)
end
Also aliased as: base_dir
batch_validate_the_cookbooks() click to toggle source
#

batch_validate_the_cookbooks

#
# File lib/rbt/cookbooks/class/class.rb, line 339
def batch_validate_the_cookbooks
  unless RBT::Cookbooks.const_defined? :BatchValidateTheCookbookRecipes
    require 'rbt/validation/batch_validate_the_cookbook_recipes.rb'
  end
  BatchValidateTheCookbookRecipes.new
end
bin?()
Alias for: binaries?
binaries()
Alias for: binaries?
binaries?() click to toggle source
#

binaries?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 440
def binaries?
  obtain(:binaries)
end
Also aliased as: binaries, bin?
blfs?() click to toggle source
#

blfs? (blfs tag)

The “Beyond linux from scratch” variable will be returned here, should it exist.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 606
def blfs?
  obtain(:blfs)
end
build_appdir_path( programs_dir_to_use = programs_dir?, short_name_to_use = real_short_name?.capitalize, program_version_to_use = program_version? )
Alias for: return_appdir_path
build_dir?()
build_program_full_name( i = return_program_full_name )
build_static()
Alias for: build_static?
build_static?() click to toggle source
#

build_static?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 922
def build_static?
  obtain(:build_static)
end
Also aliased as: build_static
build_system?()
calculate_archive_size() click to toggle source
#

calculate_archive_size

This method can be used to determine the size of the target archive in question. The corresponding entry will be set in the main Hash, called 'archive_size'.

In order for this to work, we need the content of program_path defined before, however. Whenever we set program_path, we can re-calculate the filesize anew.

#
# File lib/rbt/cookbooks/class/class.rb, line 129
def calculate_archive_size
  if found_result?
    if File.exist? program_path?.to_s
      size = File.size?(program_path?.to_s)
      set_archive_size(size)
    end
  end
end
calculate_md5sum(i = md5sum?) click to toggle source
#

calculate_md5sum

We will set the proper md5sum here via this method.

#
# File lib/rbt/cookbooks/class/class.rb, line 143
def calculate_md5sum(i = md5sum?)
  set_md5sum(i)
end
can_be_compiled_statically?() click to toggle source
#

can_be_compiled_statically?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1076
def can_be_compiled_statically?
  obtain(:can_be_compiled_statically)
end
can_be_found_where?()
Alias for: program_path?
check_against_menu( i = commandline_arguments? )
Alias for: menu
check_for_binary_names?() click to toggle source
#

check_for_binary_names?

#
# File lib/rbt/cookbooks/class/class.rb, line 256
def check_for_binary_names?
  CHECK_FOR_BINARY_NAMES
end
check_for_library_names?() click to toggle source
#

check_for_library_names?

#
# File lib/rbt/cookbooks/class/class.rb, line 235
def check_for_library_names?
  CHECK_FOR_LIBRARY_NAMES
end
check_for_outdated_entries() click to toggle source
#

check_for_outdated_entries

This method will check for outdated/obsolete entries and notify the user about this. Tha way we can get rid of such obsolete entries.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 992
def check_for_outdated_entries
  _ = yaml_dataset?
  if _.has_key?('github') and !_['github'].nil? and !_['github'].empty?
    opnn; e crimson('This file contains an obsolete entry: ')+
            royalblue('github')
    opnn; e crimson('This entry could be replaced with the '\
            'entry called git_url.')
    opnn; e crimson('It should be possible to get rid of this entry in ')+
            crimson('the yaml file ')
    e
    e "  #{sfile(yaml_file?)}"
    e
  end
end
chop_off_revision_number() click to toggle source
#

chop_off_revision_number

This method will check if a program version ends with a String such as “-r8”. If so then this part will be chopped off.

Usually this trailing part denotes an internal revision rather than an external program version.

#
# File lib/rbt/cookbooks/class/set.rb, line 338
def chop_off_revision_number
  _ = program_version?
  use_this_regex = /(-r\d{1,2})$/
  if _ =~ use_this_regex
    _.sub!(use_this_regex,'')
    set_program_version(_)
  end
end
cleanup_unusued_variables() click to toggle source
#

cleanup_unusued_variables

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 214
def cleanup_unusued_variables
  # ======================================================================= #
  # Must safeguard to query whether the key still exists. When it does,
  # we will simply delete them.
  # ======================================================================= #
  if ihash?.has_key? :array_invalid_keys
    ihash?.delete :array_invalid_keys
  end
end
clear() click to toggle source
#

clear

#
# File lib/rbt/cookbooks/class/set.rb, line 1193
def clear
  set_configure_options nil
end
clear_yaml_dataset() click to toggle source
#

clear_yaml_dataset

#
# File lib/rbt/cookbooks/class/dataset.rb, line 50
def clear_yaml_dataset
  set_yaml_dataset :clear
end
commandline_arguments?() click to toggle source
#

commandline_arguments?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 223
def commandline_arguments?
  @internal_hash[:commandline_arguments]
end
Also aliased as: input?
compiler_to_use=(i = :gcc)
Alias for: set_compiler_to_use
compiler_to_use?() click to toggle source
#

compiler_to_use?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1062
def compiler_to_use?
  obtain(:compiler_to_use)
end
configuration_options()
Alias for: configure_options?
configuration_options?()
Alias for: configure_options?
configure_base_dir?() click to toggle source
#

configure_base_dir?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 753
def configure_base_dir?
  obtain(:configure_base_dir)
end
Also aliased as: configure_base_directory?
configure_base_directory?()
Alias for: configure_base_dir?
configure_command()
Alias for: configure_command?
configure_command=(i)
configure_command?() click to toggle source
#

configure_command?

The specific configure command that we will use.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 54
def configure_command?
  obtain(:configure_command)
end
Also aliased as: configure_command
configure_options()
Alias for: configure_options?
configure_options=(i)
configure_options?() click to toggle source
#

configure_options?

Convenience method to query the configuration options available.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 962
def configure_options?
  obtain(:configure_options)
end
connective_token?()
consider_reporting_how_many_programs_are_registered( shall_we_report = false ) click to toggle source
#

consider_reporting_how_many_programs_are_registered

#
# File lib/rbt/cookbooks/class/report.rb, line 73
def consider_reporting_how_many_programs_are_registered(
    shall_we_report = false
  )
  if shall_we_report
    RBT.report_the_registered_programs
  end
end
dataset?()
Alias for: yaml_dataset?
debug?() click to toggle source
#

debug?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 216
def debug?
  @internal_hash[:debug]
end
decompose_program_name(i = program_name?) click to toggle source
#

decompose_program_name

This method will set short_name and program_version, by making use of the content stored in program_name? by default.

#
# File lib/rbt/cookbooks/class/set.rb, line 367
def decompose_program_name(i = program_name?)
  _ = ::ProgramInformation.return_short_name_and_program_version(i)
  set_short_name(_.short_name?, :propagate_towards_real_short_name)
  set_program_version(_.program_version?)
end
dependencies?()
Alias for: required_deps_on?
dependencies_on?()
Alias for: required_deps_on?
deps?()
Alias for: required_deps_on?
deps_on?()
Alias for: required_deps_on?
desc?(wrap_result = wrap_result?)
Alias for: description?
description?(wrap_result = wrap_result?) click to toggle source
#

description? (description tag)

The description value of a program will be returned via this method.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 469
def description?(wrap_result = wrap_result?)
  result = obtain(:description)
  case wrap_result
  when :retain_newlines
    wrap_result = false
  end
  if wrap_result
    if use_word_wrap?
      result = word_wrap(result)
    end if result # Do not work on nil-values here.
  end
  return result
end
Also aliased as: desc?, description_of?
description_of?(wrap_result = wrap_result?)
Alias for: description?
determine_base_dir( i = source_dir?+ real_short_name?.downcase.delete('.')+ '/' )
Alias for: set_base_dir
determine_base_directory( i = source_dir?+ real_short_name?.downcase.delete('.')+ '/' )
Alias for: set_base_dir
determine_program_full_name( i = return_default_program_full_name )
determine_real_short_name( i = short_name? )
Alias for: set_real_short_name
display_all( program_name = short_name? )
Alias for: report
display_md5sum?()
do_change_to_appdir_layout() click to toggle source
#

do_change_to_appdir_layout

You can use this method to change to the AppDir layout.

#
# File lib/rbt/cookbooks/class/class.rb, line 311
def do_change_to_appdir_layout
  sanitize_prefix(:return_appdir_path)
end
do_extract(i = program_path?) click to toggle source
#

do_extract

You can use this method, if you have class Extracter available, to force class Extracter to extract this program.

#
# File lib/rbt/cookbooks/class/class.rb, line 184
def do_extract(i = program_path?)
  begin
    require 'extracter' unless Object.const_defined? :Extracter
  rescue LoadError; end
  if Object.const_defined? :Extracter
    # ===================================================================== #
    # Ok, extracter is available so we can continue.
    # ===================================================================== #
    Extracter.new(i?).extracted_path? # Specify the path.
  else
    opnn; e 'class Extracter is not available. Consider installing it via:'
    e
    opnn; e orange('  gem install extracter')
    e
  end
end
do_not_download?() click to toggle source
#

do_not_download?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 161
def do_not_download?
  obtain(:do_not_download)
end
do_not_make_use_of_aliases_kept_in_the_file_cookbook_aliases() click to toggle source
#

do_not_make_use_of_aliases_kept_in_the_file_cookbook_aliases

#
# File lib/rbt/cookbooks/class/class.rb, line 438
def do_not_make_use_of_aliases_kept_in_the_file_cookbook_aliases
  @internal_hash[:make_use_of_aliases_kept_in_the_file_cookbook_aliases] = false
end
do_permanently_use_psych() click to toggle source
#

do_permanently_use_psych

Use this method if you wish to permanently use psych, rather than syck.

#
# File lib/rbt/cookbooks/class/class.rb, line 352
def do_permanently_use_psych
  opnn; e 'We will use the psych module for yaml-datasets from now on.'
  opnn; e 'This will be stored in the file '+sfile(FILE_USE_PSYCH_OR_SYCK)
  write_what_into(YAML.dump(:psych), FILE_USE_PSYCH_OR_SYCK)
  if is_on_roebe?
    write_what_into(YAML.dump(:psych),
      ROEBE_PATH_TO_COOKBOOKS+'yaml/configuration/'+
      File.basename(FILE_USE_PSYCH_OR_SYCK)
    )
  end
end
do_permanently_use_syck() click to toggle source
#

do_permanently_use_syck

Use this method if you wish to permanently use syck, rather than psych.

#
# File lib/rbt/cookbooks/class/class.rb, line 370
def do_permanently_use_syck
  opnn; e 'We will use the syck module for yaml-datasets from now on.'
  opnn; e 'This will be stored in the file '+sfile(FILE_USE_PSYCH_OR_SYCK)
  write_what_into(YAML.dump(:syck), FILE_USE_PSYCH_OR_SYCK)
  if is_on_roebe?
    write_what_into(YAML.dump(:syck),
      ROEBE_PATH_TO_COOKBOOKS+'yaml/configuration/'+
      File.basename(FILE_USE_PSYCH_OR_SYCK)
    )
  end
end
do_show_full_description() click to toggle source
#

do_show_full_description

This method will allow us to show the full description of a given program.

#
# File lib/rbt/cookbooks/class/class.rb, line 225
def do_show_full_description
  # ======================================================================= #
  # The following method-call will toggle the proper behaviour.
  # ======================================================================= #
  RBT::Cookbooks::Cookbook.do_not_honour_threshold_value
end
do_use_this_program_version(i = '1.52.1') click to toggle source
#

do_use_this_program_version

Use this method specifically to set (and use) another program version.

The difference towards set_program_version is that we will also re-assemble the default program path.

#
# File lib/rbt/cookbooks/class/set.rb, line 965
def do_use_this_program_version(i = '1.52.1')
  set_program_version(i)
  reassemble_program_path
end
do_use_this_version=(i = '1.52.1')
does_include?( i, honour_aliases = make_use_of_aliases_kept_in_the_file_cookbook_aliases? ) click to toggle source
#

does_include?

#
# File lib/rbt/cookbooks/class/class.rb, line 498
def does_include?(
    i,
    honour_aliases = make_use_of_aliases_kept_in_the_file_cookbook_aliases?
  )
  ::RBT.does_include? i, honour_aliases # Delegate towards the class method.
end
Also aliased as: is_included?
enable_debug() click to toggle source
#

enable_debug

#
# File lib/rbt/cookbooks/class/class.rb, line 75
def enable_debug
  @internal_hash[:debug] = true
end
enable_shared?() click to toggle source
#

enable_shared?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 168
def enable_shared?
  obtain(:enable_shared)
end
enable_static?() click to toggle source
#

enable_static?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 842
def enable_static?
  obtain(:enable_static)
end
ensure_proper_true_false_array_and_empty_values() click to toggle source
#

ensure_proper_true_false_array_and_empty_values (ensure tag)

This method will ensure that the main hash will have certain default values set.

#
# File lib/rbt/cookbooks/class/ensure.rb, line 36
def ensure_proper_true_false_array_and_empty_values
  ensure_that_the_boolean_values_are_there # <- Will set true and false values.
  ensure_that_the_empty_values_are_there
  ensure_that_the_array_values_are_there
end
ensure_that_the_array_values_are_there() click to toggle source
#

ensure_that_the_array_values_are_there

This method will ensure that all specified Array entries are part of the internal yaml dataset.

#
# File lib/rbt/cookbooks/class/ensure.rb, line 56
def ensure_that_the_array_values_are_there
  ARRAY_ARRAY_ENTRIES.each {|this_entry_must_become_an_array|
    set(this_entry_must_become_an_array, []) unless has_key? this_entry_must_become_an_array
  }
end
ensure_that_the_boolean_values_are_there() click to toggle source
#

ensure_that_the_boolean_values_are_there

#
# File lib/rbt/cookbooks/class/ensure.rb, line 45
def ensure_that_the_boolean_values_are_there
  ensure_that_the_false_values_are_there
  ensure_that_the_true_values_are_there
end
ensure_that_the_empty_values_are_there() click to toggle source
#

ensure_that_the_empty_values_are_there

We must ensure that the empty values are also properly set to “” on startup, in a mandatory fashion.

#
# File lib/rbt/cookbooks/class/ensure.rb, line 68
def ensure_that_the_empty_values_are_there
  ARRAY_EMPTY_VALUES.each {|empty_value|
    set(empty_value, '') unless has_key? empty_value
  }
end
ensure_that_the_false_values_are_there() click to toggle source
#

ensure_that_the_false_values_are_there (false tag)

Here we will set all false values into our main dataset.

We do this only if we do not yet have such a value in our dataset though.

#
# File lib/rbt/cookbooks/class/ensure.rb, line 97
def ensure_that_the_false_values_are_there
  # ======================================================================= #
  # Set the false values to false next.
  # ======================================================================= #
  ARRAY_FALSE_VALUES.each {|this_false_value|
    if has_key? this_false_value
      sanitize_boolean_value(this_false_value)
    else
      set(this_false_value, false)
    end
  }
end
ensure_that_the_nil_values_are_there( nil_values = ARRAY_NIL_ENTRIES ) click to toggle source
#

ensure_that_the_nil_values_are_there (nil tag)

#
# File lib/rbt/cookbooks/class/ensure.rb, line 22
def ensure_that_the_nil_values_are_there(
    nil_values = ARRAY_NIL_ENTRIES
  )
  nil_values.each {|this_entry_must_be_nil|
    set(this_entry_must_be_nil, nil) unless has_key? this_entry_must_be_nil
  }
end
ensure_that_the_true_values_are_there() click to toggle source
#

ensure_that_the_true_values_are_there

Now come the true values, array_true_values. Right now only prefix must default to true - but only if it is empty.

#
# File lib/rbt/cookbooks/class/ensure.rb, line 80
def ensure_that_the_true_values_are_there
  ARRAY_TRUE_VALUES.each {|true_value|
    if has_key? true_value
      sanitize_boolean_value(true_value)
    else
      set(true_value, true)
    end
  }
end
ensure_that_this_hash_has_only_valid_keys( i = yaml_dataset? ) click to toggle source
#

ensure_that_this_hash_has_only_valid_keys

The input to this method must be a Hash.

This method will ensure that the given Hash has only valid keys.

In the past, we could use it to convert it into Symbols but this is no longer in use. We now make no further modifications to the original dataset in use.

If all keys are valid then we won't have to notify the user about it at all.

#
# File lib/rbt/cookbooks/class/ensure.rb, line 124
def ensure_that_this_hash_has_only_valid_keys(
    i = yaml_dataset?
  )
  if i.nil?
    cliner
    opnn; e sfancy('nil')+' was passed into the method '+
            orange('ensure_that_this_hash_has_only_valid_keys()')
    opnn; e 'This can not be right. Program name was: '+
             sfancy(program_name?.to_s)+'.'
    pp caller()
    pp self
    cliner
  else
    i.each_pair {|key, value|
      unless registered_cookbook_entries?.include?(key)
        seek_this_yaml_file = "#{seek_this_program?}.yml"
        opnn; e "#{swarn('Warning')} - the cookbook-file for `"\
                "#{sfancy(seek_this_yaml_file)}"\
                "` contains a key that was"
        opnn; e "#{swarn('NOT')} registered. The name of that (invalid / "\
                "ignored) key is: `#{sfancy(key.to_s)}`."
        opnn; e 'This is defined in the file '+Colours.sfile(
                'registered_cookbook_entries.yml')
        register_invalid_key(key)
        # ================================================================= #
        # Next, also try to find a name that is similar.
        # ================================================================= #
        if registered_cookbook_entries?.any? {|entry|
            entry.include? key.to_s
          }
          select_this_entry = registered_cookbook_entries?.select {|entry|
            entry.include? key.to_s
          }.first
          opnn; e "Did you mean this entry instead? "\
                  "#{sfancy(select_this_entry)}"  
        end
      end
    }
  end
end
entry_exists?() click to toggle source
#

entry_exists?

#
# File lib/rbt/cookbooks/class/class.rb, line 242
def entry_exists?
  File.exist? location?
end
env_variables?()
Alias for: set_env_variables?
extra_information()
Alias for: extra_information?
extra_information?() click to toggle source
#

extra_information?

We must not get rid of information from the original dataset.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 427
def extra_information?
  result = obtain(:extra_information)
  if result
    if use_word_wrap?
      result = word_wrap(result)
    end if result # Do not work on nil-values here.
  end
  return result
end
Also aliased as: extra_information
extract_to=( i = RBT.rbt_log_directory? )
Alias for: set_extract_to
extract_to?() click to toggle source
#

extract_to?

This must return a String.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 537
def extract_to?
  obtain(:extract_to)
end
extracted_towards?() click to toggle source
#

extracted_towards?

Determine where the archive will be extracted towards.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 786
def extracted_towards?
  result = "#{extract_to?}#{program_name?}"
  unless result.end_with? '/'
    result = result.dup if result.frozen?
    result << '/'
  end
  result
end
feedback( program_name = short_name? )
Alias for: report
feedback_available_cookbooks() click to toggle source
#

feedback_available_cookbooks

Feedback which cookbooks are available.

#
# File lib/rbt/cookbooks/class/feedback.rb, line 16
def feedback_available_cookbooks
  e 'These cookbooks are available:'; print '  '
  e available_programs?.join(', ')
end
feedback_colourized_result( program_name = short_name? )
Alias for: report
feedback_description() click to toggle source
#

feedback_description

Use this method if you wish to feedback the description of a given program at hand.

#
# File lib/rbt/cookbooks/class/feedback.rb, line 27
def feedback_description
  e description?
end
feedback_format_specification_of(i) click to toggle source
#

feedback_format_specification_of

#
# File lib/rbt/cookbooks/class/feedback/feedback_format_specification_of.rb, line 56
def feedback_format_specification_of(i)
  ::Cookbooks::Cookbook.feedback_format_specification_of(i)
end
feedback_version(shall_we_exit = true) click to toggle source
#

feedback_version

This will feedback the program-version.

#
# File lib/rbt/cookbooks/class/feedback/feedback.rb, line 20
def feedback_version(shall_we_exit = true)
  opnn; e "The current RBT-Version is: #{RBT.version?}"
  exit if shall_we_exit
end
file_size()
Alias for: archive_size?
file_size?()
Alias for: archive_size?
fill_in_missing_entries() click to toggle source
#

fill_in_missing_entries

This will fill in the missing entries. They will default to empty String.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 162
def fill_in_missing_entries
  registered_cookbook_entries?.each {|key|
    set(key, '') unless has_key? key
  }
end
find( i = search_which_program? )
find_this_program( i = search_which_program? )
first_url?() click to toggle source
#

first_url?

Returns the first url. Should be used if you want to access URLs.

#
# File lib/rbt/cookbooks/class/class.rb, line 215
def first_url?
  dataset?.remote_urls.empty? ? '' : dataset?.remote_urls.first  
end
found?()
found_result?()
full_path()
Alias for: program_path?
full_path?()
Alias for: program_path?
full_report( program_name = short_name? )
Alias for: report
get_value_of(i)
Alias for: obtain
git_url?() click to toggle source
#

git_url?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 856
def git_url?
  obtain(:git_url)
end
Also aliased as: giturl?
giturl?()
Alias for: git_url?
guess_entries_based_on_the_first_url() click to toggle source
#

guess_entries_based_on_the_first_url

This method is used to call some entries on the dataset.

If the program_name is already set, though, then we will NOT guess it at all. But we will split it up, and set the cascading variants on it.

#
# File lib/rbt/cookbooks/class/guess.rb, line 82
def guess_entries_based_on_the_first_url
  _ = url1?.dup
  if _.include? '-release.tar'
    _ = chop_off_archive(_)
    _.sub!(/-release/,'')
  end
  if _.include? '-trunk'
    _ = RBT.remove_file_extension(_)
  end
  # ======================================================================= #
  # Next, check if it is a github url and if it may not have a
  # "-" and if it consists only of numbers; in this case we know
  # we have to determine the program name in a different manner.
  # ======================================================================= #
  if is_github_url?(_) and
     !_.include?('-')  and
     (_ =~ /\d{0,2}\.\d{0,2}\.?\d{0,2}/)
     # ===================================================================== #
     # In this case we will re-write this URL; and also modify the
     # variable called _.
     # The current content of _ may be a String such as:
     #
     #   'https://github.com/opencv/opencv/archive/3.4.5.tar.gz'
     #
     # ===================================================================== #
     use_this_regex = /\/(\d{0,2}\.\d{0,2}\.\d{0,2}\.)/ # See: https://rubular.com/r/7AwQrKGdqDoVlm
     # ===================================================================== #
     # We must use the unmodified input-name here because that name may
     # still include '-' characters, which may be important for some
     # programs.
     # ===================================================================== #
     _.sub!(use_this_regex, '/'+original_unmodified_name?.dup+'-\1')
  end
  basename = File.basename(_)
  if basename.include? '%2B' # This means '+'.
    basename.gsub!(/%2B/,'+')
  end
  # ======================================================================= #
  # Some yaml-entries may have program_name set. We have to check for this
  # here.
  # ======================================================================= #
  unless program_name?.to_s.empty?
    basename = program_name?
  end
  # ======================================================================= #
  # At this point, sanitize program_name.
  # ======================================================================= #
  basename = return_sanitized_program_name(basename)
  basename = remove_archive_from_the_end(basename)
  basename.chop! if basename.end_with? '.'
  # ======================================================================= #
  # Obtain information from ProgramInformation.
  # ======================================================================= #
  program_information = ::ProgramInformation.new(basename)
  if program_information.program_version?
    set_program_version(program_information.program_version?)
  end
  if program_information.real_short_name?
    set_real_short_name(program_information.real_short_name?)
  end
  if program_information.short_name?
    set_short_name(program_information.short_name?)
  end
  if File.basename(url?).include? '_'
    unless File.basename(url?).include? '-'
      # ===================================================================== #
      # Specifically change this for programs such as 'artemis_v16.0.11.jar'.
      # ===================================================================== #
      set_use_this_connective_token '_'
    end
  end
  assemble_program_name # This is short_name?+'-'+program_version? usually.
  set_archive_type(_)
  set_base_dir(
    source_dir?+
    real_short_name?.downcase.delete('.')+ # <- Is not allowed to have any '.' tokens.
    '/'
  )
  if !program_name?.empty?
    program_information = ProgramInformation.new(program_name)
    set_short_name(program_information.name?)
    set_program_version(program_information.version?)
  end
  assemble_program_path
  # use_default_connective_token_again <- This should be re-enabled one day.
end
guess_program_version(i = program_name?) click to toggle source
#

guess_program_version

We can use this method to guess the program version. This requires that the entry for program_name exists.

We will delegate towards the method set_program_version() then.

#
# File lib/rbt/cookbooks/class/guess.rb, line 68
def guess_program_version(i = program_name?)
  _ = ::ProgramInformation.return_version(i)
  set_program_version(_)
end
guess_real_short_name( i = short_name? ) click to toggle source
#

guess_real_short_name

#
# File lib/rbt/cookbooks/class/guess.rb, line 28
def guess_real_short_name(
    i = short_name?
  )
  set_real_short_name(i)
end
guess_short_name( i = program_name? ) click to toggle source
#

guess_short_name

This method can be used to guess the short name of a program.

#
# File lib/rbt/cookbooks/class/guess.rb, line 18
def guess_short_name(
    i = program_name?
  )
  _ = ::ProgramInformation.return_short_name(i)
  set_short_name(_)
end
has_a_dependency_on_meson?() click to toggle source
#

has_a_dependency_on_meson?

This method will return a boolean value, indicating whether the given program at hand has a dependency on the build system called meson or whether it has not.

#
# File lib/rbt/cookbooks/class/misc.rb, line 64
def has_a_dependency_on_meson?
  required_deps_on?.include? 'meson'
end
has_key?(i = :blfs) click to toggle source
#

has_key?

This query method will delegate towards the yaml dataset, whether it has a given key or whether it does not.

The key should ideally be a Symbol - keep this in mind.

#
# File lib/rbt/cookbooks/class/dataset.rb, line 142
def has_key?(i = :blfs)
  yaml_dataset?.has_key?(i)
end
has_tags?() click to toggle source
#

has_tags?

This method will return true or false depending on whether the given program at hand has any tags registered at all, or whether it has not.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 44
def has_tags?
  return false if tags?.empty?
  return true
end
has_to_be_compiled()
Alias for: has_to_be_compiled?
has_to_be_compiled?() click to toggle source
#

has_to_be_compiled?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 528
def has_to_be_compiled?
  obtain(:has_to_be_compiled)
end
Also aliased as: has_to_be_compiled
hash?()
Alias for: yaml_dataset?
headers()
Alias for: headers?
headers?() click to toggle source
#

headers?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 61
def headers?
  obtain(:headers)
end
Also aliased as: headers
homepage()
Alias for: homepage?
homepage?() click to toggle source
#

homepage?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 653
def homepage?
  obtain(:homepage)
end
ihash()
Alias for: internal_hash?
ihash?()
Alias for: internal_hash?
initialize_the_internal_hash() click to toggle source
#

initialize_the_internal_hash

#
# File lib/rbt/cookbooks/class/reset.rb, line 29
def initialize_the_internal_hash
  # ======================================================================= #
  # Everything is stored here into this main Hash.
  # ======================================================================= #
  @internal_hash = {}
  @internal_hash[:yaml_dataset]                            = nil # Is nil initially.
  # ======================================================================= #
  # The next variable will keep track of which program we are
  # searching for.
  # ======================================================================= #
  @internal_hash[:search_for_this_program]                 = nil
  @internal_hash[:original_unmodified_name]                = nil
  @internal_hash[:is_the_program_included]                 = false
  @internal_hash[:replace_plus_with_long_name]             = REPLACE_PLUS_WITH_LONG_NAME
  @internal_hash[:array_invalid_keys]                      = [] # Invalid entries will be stored here. Must ALWAYS be an Array.
  @internal_hash[:shall_we_display_the_md5sum]             = RBT.display_md5sum?
  # ======================================================================= #
  # By default, we will word-wrap too long text lines.
  # ======================================================================= #
  @internal_hash[:wrap_result]                             = true
  @internal_hash[:report_how_many_programs_are_registered] = false
  @internal_hash[:use_this_connective_token]               = '-'
  # ======================================================================= #
  # Next, determine whether to use cookbook-internal aliases or whether
  # we shall not.
  # ======================================================================= #
  @internal_hash[:make_use_of_aliases_kept_in_the_file_cookbook_aliases] = true
end
initialize_yaml_dataset() click to toggle source
#

initialize_yaml_dataset

#
# File lib/rbt/cookbooks/class/dataset.rb, line 16
def initialize_yaml_dataset
  set_archive_size 0 # Initialize the program size to 0. It will may be changed lateron.
  # ======================================================================= #
  # Add nil, array, empty values and booleans.
  # ======================================================================= #
  ensure_that_the_nil_values_are_there
  ensure_that_the_array_values_are_there
  ensure_that_the_empty_values_are_there
  # ======================================================================= #
  # === Ensure that the boolean values (true and false) will be there
  # ======================================================================= #
  ensure_that_the_boolean_values_are_there
  # ======================================================================= #
  # Last but not least, add the missing entries.
  # ======================================================================= #
  fill_in_missing_entries
end
input?()
installation_steps?() click to toggle source
#

installation_steps?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 777
def installation_steps?
  obtain(:installation_steps)
end
internal_hash?() click to toggle source
#

internal_hash?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 506
def internal_hash?
  @internal_hash
end
Also aliased as: ihash?, ihash
is_a_boolean_configuration_value?(i) click to toggle source
#

is_a_boolean_configuration_value?

Query method to determine whether the input is a boolean configuration value. For example, the String “use_glib_schema”, would be a boolean configuration value and thus this method would return true.

#
# File lib/rbt/cookbooks/class/constants.rb, line 174
def is_a_boolean_configuration_value?(i)
  ( ARRAY_FALSE_VALUES + ARRAY_TRUE_VALUES ).flatten.include? i
end
is_a_game?() click to toggle source
#

is_a_game?

This method will simply return true if the program in question is a game, and false if it is not a game. That way we can quickly find out whether the input is a game or whether it is not.

Usage example:

ProgramInformation.return_name @program_name
ProgramInformation.return_name 'supertux-0.1.1'
#
# File lib/rbt/cookbooks/class/obtain.rb, line 981
def is_a_game?
  return true if tags?.to_s.include? 'game'
  return false # Else return false here.
end
is_a_valid_key?(key)
Alias for: valid_key?
is_github_url?( i = url1? ) click to toggle source
#

is_github_url?

This method will return true if the main url (url1) is a github url.

#
# File lib/rbt/cookbooks/class/misc.rb, line 50
def is_github_url?(
    i = url1?
  )
  i.start_with?('https://github.com/') or
  i.start_with?('http://github.com/')
end
is_included?( i, honour_aliases = make_use_of_aliases_kept_in_the_file_cookbook_aliases? )
Alias for: does_include?
keep_extracted()
Alias for: keep_extracted?
keep_extracted=(i)
Alias for: set_keep_extracted
keep_extracted?() click to toggle source
#

keep_extracted?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 147
def keep_extracted?
  obtain(:keep_extracted)
end
Also aliased as: keep_extracted
last_update()
Alias for: last_update?
last_update?() click to toggle source
#

last_update?

The last_update tag keeps track over as to when that particular program was last updated.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 296
def last_update?
  obtain(:last_update)
end
Also aliased as: last_update
last_url?() click to toggle source
#

last_url?

Returns the last url. Should be used if you want to access URLs.

#
# File lib/rbt/cookbooks/class/class.rb, line 206
def last_url?
  dataset?.remote_urls.empty? ? '' : dataset?.remote_urls.last  
end
libexec=(i)
Alias for: set_libexec
libexec?() click to toggle source
#

libexec?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1069
def libexec?
  obtain(:libexec)
end
libraries?() click to toggle source
#

libraries?

Return the given libraries that will be installed by the given program at hand.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 209
def libraries?
  obtain(:libraries)
end
licence?() click to toggle source
#

licence?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 448
def licence?
  obtain(:licence)
end
Also aliased as: license?
license?()
Alias for: licence?
load_and_display_the_allowed_tags() click to toggle source
#

load_and_display_the_allowed_tags

#
# File lib/rbt/cookbooks/class/class.rb, line 328
def load_and_display_the_allowed_tags
  dataset = YAML.load_file(FILE_ALLOWED_TAGS).sort
  opnn; e 'The following tags are allowed/registered/valid:'
  dataset.each {|entry|
    e "  #{simp(entry)}"
  }
end
load_yaml_dataset_from_this_file( i = search_for_this_program? ) click to toggle source
#

load_yaml_dataset_from_this_file

This is the main method, the powerhorse of the class - it will load up the dataset for a given program, from the .yml file at hand.

In order for this to work, the .yml file must of course exist locally.

You can also pass the name of the program, such as “htop”, rather than specify the full path. The method will automatically expand in such a case.

#
# File lib/rbt/cookbooks/class/dataset.rb, line 159
def load_yaml_dataset_from_this_file(
    i = search_for_this_program?
  )
  original_search_term = i.dup
  clear_yaml_dataset
  # ======================================================================= #
  # Initialize the yaml dataset first.
  # ======================================================================= #
  initialize_yaml_dataset
  # ======================================================================= #
  # Next, check whether there is any '/' character in the given input.
  # If not, then we will expand to the real, full path.
  # ======================================================================= #
  unless i.empty? # Ignore empty Strings.
    unless i.include?('/')
      if make_use_of_cookbook_aliases?
        if RBT.is_an_alias?(i) and
          !RBT.program_is_included?(i, :do_not_check_for_aliases)
          original_name = i.dup
          # ================================================================= #
          # Ok, it is an alias. This must also re-rewrite the program
          # that we are searching for.
          # ================================================================= #
          i = RBT.find_alias_for(original_name)
          opnn; e "The alias name #{sfancy(i)} will be "\
                  "used for #{simp(original_name)}."
          set_search_for_this_program(i)
        end
        i = return_default_location_of_this_cookbook(i)
      end
    end
  end
  if debug?
    opnn; e 'Now loading the dataset from the file `'+sfile(i)+'`.'
  end
  unless i.end_with? '.yml'
    i = return_default_location_of_this_cookbook(i)
  end
  # ======================================================================= #
  # The file must exist, because otherwise we can not load up the yaml
  # dataset. We will also have to ensure that it is a file.
  # ======================================================================= #
  if File.exist?(i) and File.file?(i)
    the_program_is_included
    begin
      dataset = YAML.load_file(i)
    rescue ArgumentError => error
      opnn; e 'An error happened for `'+sfancy(i)+'`.'
      opnn; e 'Exiting now as a consequence. Please fix this error.'
      pp error
      pp error.class
      exit
    end
    update_yaml_dataset(dataset)
    set_short_name nil # Must be specifically set to nil.
    if yaml_dataset_exists?
      sync_yaml_dataset_down_one_level
      sanitize_yaml_dataset
    end
  else
    this_program_was_not_found(original_search_term)
  end
end
local_url?()
Alias for: program_path?
location?()
Alias for: program_path?
main_eight?( use_padded_output = true ) click to toggle source
#

main_eight?

This method will return the main 8 entries that are the most important ones for any given program at hand.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 306
def main_eight?(
    use_padded_output = true
  )
  _ = ''.dup
  one   = 'real_short_name: '.dup
  two   = 'short_name: '.dup
  three = 'program_version: '.dup
  four  = 'archive_type: '.dup
  five  = 'base_dir: '.dup
  six   = 'program_name: '.dup
  seven = 'program_full_name: '.dup
  eight = 'program_path: '.dup
  # ======================================================================= #
  # Next make sure to pad the output, if the user requested this.
  # ======================================================================= #
  if use_padded_output
    n_ljust = 19
    one   = one.ljust(n_ljust)
    two   = two.ljust(n_ljust)
    three = three.ljust(n_ljust)
    four  = four.ljust(n_ljust)
    five  = five.ljust(n_ljust)
    six   = six.ljust(n_ljust)
    seven = seven.ljust(n_ljust)
    eight = eight.ljust(n_ljust)
  end
  _ << one+real_short_name?.dup+N
  _ << two+short_name?.dup+N
  _ << three+program_version?.dup+N
  _ << four+archive_type?.dup+N
  _ << five+base_dir?.dup+N
  _ << six+program_name?.dup+N
  _ << seven+program_full_name?.dup+N
  _ << eight+program_path?.dup+N
  return _
end
main_url()
Alias for: url?
main_url?()
Alias for: url?
make_options()
Alias for: parameters_to_make?
make_options?()
Alias for: parameters_to_make?
make_use_of_aliases_kept_in_the_file_cookbook_aliases?() click to toggle source
#

make_use_of_aliases_kept_in_the_file_cookbook_aliases?

This method can be used to query whether we will make use of aliases kept in the cookbook_aliases.yml file or whether we will not.

#
# File lib/rbt/cookbooks/class/class.rb, line 511
def make_use_of_aliases_kept_in_the_file_cookbook_aliases?
  @internal_hash[:make_use_of_aliases_kept_in_the_file_cookbook_aliases]
end
make_use_of_cookbook_aliases?()
may_we_modify_the_configure_options()
may_we_modify_the_configure_options?() click to toggle source
#

may_we_modify_the_configure_options?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 821
def may_we_modify_the_configure_options?
  obtain(:may_we_modify_the_configure_options)
end
md5sum( use_this_path = path? )
Alias for: md5sum?
md5sum?( use_this_path = path? ) click to toggle source
#

md5sum?

Conditionally use md5sum.

This method must accomodate three different possibilities.

(1) We have generated a .yml file in a special directory. We

will preferentially use that one, if it exists. This requires
of the user to have generated these values already. If the
user did so then we will use these values rather than
calculate them anew again. The advantage of this way is that
it will significantly speed up the process.

(2) IF we do not have such a file as described in (1), then we will

first try to use the ruby Md5sum class, specifically its Md5sum[]
class method. Note that the ruby Md5sum class is fairly slow for
large programs, which is why option (1) is the default since as
of April 2016.

(3) The other two options (1) and (2) not being available, we will

try to use the unix coreutils "md5sum" instead, which is a binary,
and should be pretty fast.

Note that as of May 2016, we also make available a way to NOT calculate the md5sum at all. Not everyone will need the md5sum information after all.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 687
def md5sum?(
    use_this_path = path?
  )
  # ======================================================================= #
  # === Try to use yaml files first
  #
  # The expanded directory on my system will be here:
  #
  #   /Depot/Temp/CookbookDirectory/expanded_cookbooks/
  #
  # ======================================================================= #
  if File.directory?(RBT.base_dir_to_store_expanded_cookbooks?) and
     File.exist?(use_this_path.to_s) and
     use_this_path.end_with?('.yml')
     begin
       dataset = YAML.load_file(use_this_path)
       return dataset['md5sum'].to_s
     rescue ArgumentError => error
       opnn; e 'An error happened for the path `'+
               sfile(use_this_path)+'`. We will '\
               'exit as a consequence.'
       pp error
       exit
     end
  # ======================================================================= #
  # === Use the pure ruby way next
  # ======================================================================= #
  elsif Object.const_defined? :Md5sum
    Md5sum[use_this_path].md5sum? # Calculate it anew via Md5sum[].
  # ======================================================================= #
  # === Try to use md5sum binary directly next
  # ======================================================================= #
  elsif (result = `md5sum bogus 2>&1`) and
        !result.include?('command not found')
    if File.directory? use_this_path # A workaround for now.
      return '0'
    else
      # =================================================================== #
      # Delegate to the system tool here, part of coreutils.
      # =================================================================== #
      result = `md5sum #{use_this_path}`.split(' ').first
      result.strip! if result
      return result
    end
  else
    '0' # Return 0 then. But that should not ever happen.
  end
end
Also aliased as: md5sum
menu( i = commandline_arguments? ) click to toggle source
#

menu (menu tag)

#
Also aliased as: check_against_menu
meson_configure_options()
meson_configure_options=(i)
meson_configure_options?() click to toggle source
#

meson_configure_options?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 863
def meson_configure_options?
  obtain(:meson_configure_options)
end
Also aliased as: meson_configure_options
modify_the_makefile()
modify_the_makefile?() click to toggle source
#

modify_the_makefile?

This method will query whether RBT will modify the Makefile at hand or whether it will not. Some Makefiles have hardcoded paths which do not respect the given –prefix variant, not even DESTDIR, as far as I know. Hence, for these .yml files, we need to have a way to modify that Makefile and correct it.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1106
def modify_the_makefile?
  obtain(:modify_the_makefile)
end
Also aliased as: modify_the_makefile
n_programs_available?() click to toggle source
#

n_programs_available?

#
# File lib/rbt/cookbooks/class/class.rb, line 294
def n_programs_available?
  RBT.n_programs?
end
name()
Alias for: short_name?
name?()
Alias for: short_name?
name_and_version?()
Alias for: program_name?
o(i)
Alias for: obtain
obtain(i) click to toggle source
#

obtain (obtain tag, o tag)

Use this getter-method to obtain elements of the main yaml dataset directly, stored within the @internal_hash.

The main reason why we will use this method here is because the keys can be either Symbols or Strings. If we ever wish to change to another format, we can do so thanks to the flexibility of this setup.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 620
def obtain(i)
  i = i.to_s unless i.is_a? String
  # ======================================================================= #
  # We can feedback input that was not found - but this can become noisy,
  # so I have disabled this as of Sep 2015.
  # ======================================================================= #
  # begin
  #   return _[i]
  # rescue NoMethodError; end
  # ======================================================================= #
  if @internal_hash[:yaml_dataset]
    @internal_hash[:yaml_dataset][i] # [] is better than .fetch() here.
  end
end
Also aliased as: o, get_value_of
opnn() click to toggle source
#

opnn

#
Calls superclass method RBT::Base#opnn
# File lib/rbt/cookbooks/class/class.rb, line 58
def opnn
  super(
    namespace:   NAMESPACE,
    use_colours: RBT.use_colours?
  )
end
optional_start_message()
optional_start_message?() click to toggle source
#

optional_start_message

#
# File lib/rbt/cookbooks/class/obtain.rb, line 104
def optional_start_message?
  obtain(:optional_start_message)
end
Also aliased as: optional_start_message
original_unmodified_name?() click to toggle source
#

original_unmodified_name?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 889
def original_unmodified_name?
  @internal_hash[:original_unmodified_name]
end
output_main_dataset() click to toggle source
#

output_main_dataset

#
# File lib/rbt/cookbooks/class/class.rb, line 286
def output_main_dataset
  do_not_use_colours
  pp yaml_dataset?
end
parameters_to_make?() click to toggle source
#

parameters_to_make?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 998
def parameters_to_make?
  obtain(:parameters_to_make)
end
Also aliased as: make_options, make_options?
path()
Alias for: program_path?
path?()
Alias for: program_path?
pkgconfig_files()
Alias for: pkgconfig_files?
pkgconfig_files=(i)
Alias for: set_pkgconfig_files
pkgconfig_files?() click to toggle source
#

pkgconfig_files?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 130
def pkgconfig_files?
  obtain(:pkgconfig_files)
end
Also aliased as: pkgconfig_files
pname?()
Alias for: program_name?
postinstall?() click to toggle source
#

postinstall?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 870
def postinstall?
  obtain(:postinstall)
end
Also aliased as: postinstallation?
postinstallation=(i)
Alias for: set_postinstall
postinstallation?()
Alias for: postinstall?
ppath?()
Alias for: program_path?
pre_configure_steps?() click to toggle source
#

pre_configure_steps?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1083
def pre_configure_steps?
  obtain(:pre_configure_steps)
end
pre_make_commands()
Alias for: pre_make_commands?
pre_make_commands?() click to toggle source
#

pre_make_commands?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 239
def pre_make_commands?
  obtain(:pre_make_commands)
end
Also aliased as: pre_make_commands
pre_make_install_sed()
pre_make_install_sed?() click to toggle source
#

pre_make_install_sed?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 828
def pre_make_install_sed?
  obtain(:pre_make_install_sed)
end
Also aliased as: pre_make_install_sed
prefix()
Alias for: prefix?
prefix=(i = '/usr/')
Alias for: set_prefix
prefix?() click to toggle source
#

prefix?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 835
def prefix?
  obtain(:prefix)
end
Also aliased as: prefix
prefix_to_use=(i = '/usr/')
Alias for: set_prefix
preinstall=(i)
Alias for: set_preinstall
preinstall?() click to toggle source
#

preinstall?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 739
def preinstall?
  obtain(:preinstall)
end
print_hash( program_name = short_name? )
Alias for: report
program?()
Alias for: short_name?
program_compile_name?() click to toggle source
#

program_compile_name?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 353
def program_compile_name?
  obtain(:program_compile_name).to_s
end
program_dependencies_on()
Alias for: required_deps_on?
program_full_name()
Alias for: program_full_name?
program_full_name?() click to toggle source
#

program_full_name?

This entry will have everything except the leading PATH.

For instance:

"gpm-1.20.1.tar.xz"
#
# File lib/rbt/cookbooks/class/obtain.rb, line 116
def program_full_name?
  obtain(:program_full_name)
end
Also aliased as: program_full_name
program_is_included?() click to toggle source
#

program_is_included?

Query method to determine whether the search term (the program we are seeking) is included or whether it is not.

Returns a boolean.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 574
def program_is_included?
  @internal_hash[:is_the_program_included]
end
program_name()
Alias for: program_name?
program_name=( i = return_program_name )
Alias for: set_program_name
program_name?() click to toggle source
#

program_name?

Feedback the program_name through this method.

The program_name in this context, would mean a String such as 'gnome-mahjonng-5.08', so it has the program version included.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 803
def program_name?
  obtain(:program_name)
end
program_name_and_program_version()
Alias for: program_name?
program_name_and_program_version?()
Alias for: program_name?
program_path()
Alias for: program_path?
program_path?() click to toggle source
#

program_path?

This method will return the 'program_path' value, through the reader method obtain().

The program_path variable has the FULL path to the archive in question, for instance:

/Users/x/SRC/gnomemahjonng/gnome-mahjonng-5.08.tar.xz
/Users/x/SRC/gpm/gpm-1.20.1.tar.bz2

Do note that the program_path value is the most important entry, as we can retrieve ALL other information from the information stored in this variable alone.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1026
def program_path?
  obtain(:program_path)
end
program_short_name?()
Alias for: real_short_name?
program_size()
Alias for: archive_size?
program_size?()
Alias for: archive_size?
program_version()
Alias for: program_version?
program_version?() click to toggle source
#

program_version?

This method must always return a String.

We use it to query the program version of the specific program at hand.

For instance, if the program name is “python-2.4” then this method will return the version string part, i.e. “2.4”.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 911
def program_version?
  obtain(:program_version)
end
program_was_found?()
programs_dir=(i = '/Programs/')
Alias for: set_programs_dir
properly_pad_and_colourize_this_help_option( key_to_invoke_the_method, text_that_is_to_be_displayed ) click to toggle source
#

properly_pad_and_colourize_this_help_option

#
# File lib/rbt/cookbooks/class/help.rb, line 176
def properly_pad_and_colourize_this_help_option(
    key_to_invoke_the_method,
    text_that_is_to_be_displayed
  )
  left_padding = '  ' # A bit of left-padding here.
  n_left_pad_value  = 38
  n_left_pad_value -= key_to_invoke_the_method.size
  left_padding+HOW_TO_INVOKE_THE_PROGRAM+
               skyblue(' '+key_to_invoke_the_method)+
               (' ' * n_left_pad_value)+' # '+
               text_that_is_to_be_displayed
end
pversion?()
Alias for: program_version?
quiet_down() click to toggle source
#

quiet_down

This method will cause the cookbook to be silent and not report how many programs are registered.

#
# File lib/rbt/cookbooks/class/class.rb, line 173
def quiet_down
  set_be_silent # This is defined in the parent class.
  @internal_hash[:report_how_many_programs_are_registered] = false
end
raw_description()
Alias for: raw_description?
raw_description?() click to toggle source
#

raw_description?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 487
def raw_description?
  obtain(:raw_description)
end
Also aliased as: raw_description
real_short_name?() click to toggle source
#

real_short_name

Reader method for real_short_name. This can only work after we invoked merge_basic_dataset().

real_short_name? may never include '-' characters.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 644
def real_short_name?
  obtain(:real_short_name)
end
Also aliased as: rshort?, shortname?, program_short_name?
reassemble_program_full_name( i = return_default_program_full_name )
reassemble_program_path( i = return_default_program_path )
rebuild_path()
register_invalid_key(i) click to toggle source
#

register_invalid_key

We store invalid entries in an Array, via this method here.

#
# File lib/rbt/cookbooks/class/class.rb, line 471
def register_invalid_key(i)
  i = i.to_s # To prevent nil-related errors.
  unless array_invalid_keys?.include? i
    array_invalid_keys? << i
  end unless i.empty?
end
registered_cookbook_entries?() click to toggle source
#

registered_cookbook_entries?

#
# File lib/rbt/cookbooks/class/class.rb, line 481
def registered_cookbook_entries?
  RBT.registered_cookbook_entries?
end
remote_homepage?()
Alias for: homepage?
remote_url()
Alias for: url?
remote_url?()
Alias for: url?
remote_urls()
Alias for: urls?
remote_urls?()
Alias for: urls?
replace_plus_with_long_name?() click to toggle source
#

replace_plus_with_long_name?

#
# File lib/rbt/cookbooks/class/class.rb, line 68
def replace_plus_with_long_name?
  @internal_hash[:replace_plus_with_long_name]
end
report( program_name = short_name? ) click to toggle source
#

report

This is just a general-purpose method that will output some values.

It will output useful information about a program.

For a full report system, use the specialized class DisplayCookbookDataset.

#
# File lib/rbt/cookbooks/class/report.rb, line 91
def report(
    program_name = short_name?
  )
  return if program_name.to_s.empty?
  @array_show_these_entries.clear
  @array_show_these_entries << :description
  # ======================================================================= #
  # Add a bunch of symbols to the main array here.
  # ======================================================================= #
  @array_show_these_entries << %i(
    program_path
    program_full_name
    program_name
    real_short_name
    short_name
    program_compile_name
    program_version
    archive_type
    base_dir
    remote_url
    extract_to
    prefix
    configure_options
    meson_configure_options
    md5sum
    file_size
    keep_extracted
  )
  @array_show_these_entries.flatten!
  # ======================================================================= #
  # === short_description
  # ======================================================================= #
  unless short_description?.empty?
    @array_show_these_entries << :short_description
  end if short_description?
  # ======================================================================= #
  # Unless the pkgconfig_files Array is empty, we will display the
  # .pc files of the given program.
  # ======================================================================= #
  if pkgconfig_files?
    unless pkgconfig_files?.empty?
      @array_show_these_entries << :pkgconfig_files
    end
  end
  unless extra_information?.empty?
    @array_show_these_entries << :extra_information
  end
  # ======================================================================= #
  # === Display installation_steps if they are not empty
  # ======================================================================= #
  if installation_steps? and !installation_steps?.empty?
    @array_show_these_entries << :installation_steps
  end
  unless configure_command?.empty?
    unless configure_command? == 'configure'
      @array_show_these_entries << :configure_command
    end
  end
  # ======================================================================= #
  # === Show the main homepage if it exists
  # ======================================================================= #
  if homepage?
    @array_show_these_entries << :homepage
  end
  # ======================================================================= #
  # === Add the headers, if they exist
  # ======================================================================= #
  unless headers?.empty?
    @array_show_these_entries << :headers
  end
  if build_static? == true
    @array_show_these_entries << :build_static
  end
  unless use_this_make_command?.to_s == 'make'
    @array_show_these_entries << :use_this_make_command
  end
  if sed? and sed?.is_a?(Array) and !sed?.empty?
    @array_show_these_entries << :sed
  end
  @array_show_these_entries << :do_not_download     if do_not_download?
  @array_show_these_entries << :binaries            unless binaries?.empty?
  @array_show_these_entries << :libraries           unless libraries?.empty?
  @array_show_these_entries << :apply_patch         if apply_patch?
  @array_show_these_entries << :required_deps_on    unless deps?.empty?
  @array_show_these_entries << :make_options        unless make_options?.empty?
  @array_show_these_entries << :enable_shared       if enable_shared?
  @array_show_these_entries << :preinstall          unless preinstall?.empty?
  @array_show_these_entries << :postinstall         unless postinstall?.empty?
  @array_show_these_entries << :tags                unless tags?.empty?
  @array_show_these_entries << :svn_url             if svn_url? and !svn_url?.empty?
  @array_show_these_entries << :git_url             if git_url? and !git_url?.empty?
  @array_show_these_entries << :pre_make_commands   unless pre_make_commands?.empty?
  @array_show_these_entries << :use_build_directory if use_build_directory?
  @array_show_these_entries << :licence # <- Mandatory entry.
  # ======================================================================= #
  # === use_this_build_system will always be shown
  # ======================================================================= #
  @array_show_these_entries << :use_this_build_system # <- Mandatory entry.
  # ======================================================================= #
  # === Use autogen will always be shown.
  # ======================================================================= #
  @array_show_these_entries << :use_autogen
  @array_show_these_entries << :configure_base_dir  if configure_base_dir? and !configure_base_dir?.to_s.empty?
  @array_show_these_entries << :blfs                unless blfs?.empty?
  @array_show_these_entries << :last_update
  @array_show_these_entries << :has_to_be_compiled
  @array_show_these_entries << :do_not_symlink      if do_not_symlink?
  @array_show_these_entries << :md5sum              if show_md5sum?
  @array_show_these_entries << :use_this_make_install_command if use_this_make_install_command?
  # ======================================================================= #
  # Show whether we will run "configure" or whether we will not:
  # ======================================================================= #
  @array_show_these_entries << :run_configure
  # ======================================================================= #
  # Next, display it with a coloured "border".
  # ======================================================================= #
  use_this_colour_or_no_colour = :lightblue
  unless use_colours?
    use_this_colour_or_no_colour = :do_not_use_colours
  end
  cliner(use_this_colour_or_no_colour) {
    e "Feedbacking all about the program `#{mediumslateblue(program_name)}`."
    e
    show_this_array(@array_show_these_entries)
    # ===================================================================== #
    # Show important URLs next.
    # ===================================================================== #
    if urls?.first
      e; e '  Important URLs:'
      _ = urls?.map {|entry| entry.to_s.chomp }.reject {|x| x.empty?}
      if _
        e; _.each_with_index {|line, index|
          e "#{grey('    (')}#{seagreen(index+1).to_s}#{grey(') ')}#{grey(line)}"
        }; e
      end
    end
  }
  e
end
report_binary_or_library_program_name( i, new_program_name, binary_or_library = 'binary' ) click to toggle source
#

report_binary_or_library_program_name

Only call this method when we have found an alias.

#
# File lib/rbt/cookbooks/class/class.rb, line 265
def report_binary_or_library_program_name(
    i, new_program_name, binary_or_library = 'binary'
  )
  if i and !i.empty?
    case binary_or_library
    when :binary
      binary_or_library = 'binary'
    when :library
      binary_or_library = 'library'
    end
    opnn; e '`'+simp(i)+'` was found as name of a '+simp(binary_or_library)+' file.'
    opnn; e 'We will now assume that you want to get this whole package '\
            'instead and will'
    opnn; e 'thus set the name to this program now, which belongs to '\
            'the package `'+sfancy(new_program_name)+'`.'+N
  end
end
report_size_of_these_programs(i, size_of_the_programs = 0) click to toggle source
#

report_size_of_these_programs

This method will report the size of the issued programs.

#
# File lib/rbt/cookbooks/class/report.rb, line 41
def report_size_of_these_programs(i, size_of_the_programs = 0)
  if i.is_a? String and i.include?('=')
    i = i.to_s.dup if i.frozen?
    i.gsub!(/--size=/,'')
    i = i.split(',') if i.include? ','
  end
  i = [i] unless i.is_a? Array
  i.each {|entry|
    dataset = self.new(entry)
    unless use_colours?
      dataset.disable_colours
    end
    size = dataset.size?.to_i
    opnn; e "Now working on #{sfancy(entry.rjust(8))}"\
            " (Size: #{size.to_s.rjust(8)} bytes)"
    size_of_the_programs += size
  }
  e
  opnn; e 'The size of the programs '+sfancy(i.join(','))+' is:'
  e
  if Object.const_defined? :HumanReadable
    size_of_the_programs = HumanReadable[size_of_the_programs]
  end
  result = "  #{simp(size_of_the_programs.to_s)}".dup
  result << ' bytes' unless size_of_the_programs.to_s.strip.end_with? 'B'
  opnn; e result
  e
end
report_the_kde_status() click to toggle source
#

report_the_kde_status

This method will report the “status” of the KDE project, as far as the cookbooks project is concerned.

What is meant here is that this method will simply report the main constants that handle the remote URL to kde projects.

To invoke this method, do this on the commandline:

cookbooks --report-the-kde-status
#
# File lib/rbt/cookbooks/class/report.rb, line 548
def report_the_kde_status
  n_rjust = 7
  kde_frameworks_version = File.basename(
    REMOTE_URL_FOR_KDE_FRAMEWORKS
  ).rjust(n_rjust)
  kde_applications_version = File.basename(
    REMOTE_URL_FOR_KDE_APPLICATIONS.sub(/src\/$/,'')
  ).rjust(n_rjust)
  kde_plasma_version = File.basename(
    REMOTE_URL_FOR_KDE_PLASMA
  ).sub(/\.php$/,'').sub(/^plasma-/,'').rjust(n_rjust)
  e
  e 'KDE Frameworks version:   '+
    cyan(kde_frameworks_version)
  e 'KDE Applications version: '+
    cyan(kde_applications_version)
  e 'KDE Plasma version:       '+
    cyan(kde_plasma_version)
  e
end
report_total_size_of_locally_available_files() click to toggle source
#

report_total_size_of_locally_available_files

This method will simply calculate the total file size of all locally available programs.

#
# File lib/rbt/cookbooks/class/report.rb, line 508
def report_total_size_of_locally_available_files
  total_file_size = 0
  _ = available_programs?
  _.each {|name_of_the_program|
    size = ::Cookbooks::Cookbook.new(name_of_the_program) { :bypass_menu }.file_size?
    opnn; e 'Now adding the file size of the '\
            'program `'+sfancy(name_of_the_program)+'` ('+
            orange(size.to_s)+' bytes).'
    total_file_size += size
  }
  opnn; e "Total file size of #{sfancy(_.size.to_s)} programs: "\
          "#{slateblue(total_file_size.to_s+' bytes')}"
end
required_dependencies_on?()
Alias for: required_deps_on?
required_deps?()
Alias for: required_deps_on?
required_deps_on?() click to toggle source
#

required_deps_on?

This method will list the required dependencies of a given program and returns them, at least those that are defined in the 'required_deps_on:' entry of the respective yaml file.

Please keep in mind that our dependencies must be kept in Array form.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1048
def required_deps_on?
  obtain(:required_deps_on)
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/cookbooks/class/reset.rb, line 18
def reset
  super()
  @use_colours = true
  @use_menu_interface = true
  @array_show_these_entries = []
  initialize_the_internal_hash 
end
return_appdir_path( programs_dir_to_use = programs_dir?, short_name_to_use = real_short_name?.capitalize, program_version_to_use = program_version? ) click to toggle source
#

return_appdir_path

This method will return an App-Dir like path.

It may be used from within sanitize_prefix() - that is, when you wish to sanitize the prefix passed.

This method requires that short_name? and program_version? were already defined prior to invocation.

The appdir components would be like this:

/Programs/Ruby/2.4.1
programs_dir?+real_short_name?.capitalize+'/'+program_version?
#
# File lib/rbt/cookbooks/class/class.rb, line 572
def return_appdir_path(
    programs_dir_to_use    = programs_dir?, 
    short_name_to_use      = real_short_name?.capitalize,
    program_version_to_use = program_version?
  )
  _ = programs_dir_to_use.dup
  if are_we_on_gobolinux?
    _ << program_compile_name?.dup
  else
    _ << short_name_to_use.dup
  end
  _ << "/#{program_version_to_use.dup}/"
  return _
end
return_appdir_prefix( programs_dir_to_use = programs_dir?, short_name_to_use = real_short_name?.capitalize, program_version_to_use = program_version? )
Alias for: return_appdir_path
return_dataset()
Alias for: yaml_dataset?
return_default_location( i = search_term? )
return_default_location_of_this_cookbook( i = search_term? ) click to toggle source
#

return_default_location_of_this_cookbook

This will use the default location based on the search_term.

#
# File lib/rbt/cookbooks/class/class.rb, line 593
def return_default_location_of_this_cookbook(
    i = search_term?
  )
  individual_cookbooks_directory?+i+'.yml'
end
Also aliased as: return_default_location
return_default_program_full_name() click to toggle source
#

return_default_program_full_name

program_full_name is something like 'gnome-mahjonng-5.08.tar.xz'.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 399
def return_default_program_full_name
  program_name?+archive_type?
end
Also aliased as: return_program_full_name
return_default_program_path()
Alias for: return_program_path
return_dependencies()
Alias for: required_deps_on?
return_first_dot_as_hyphen_from_this_url(i = url?) click to toggle source
#

return_first_dot_as_hyphen_from_this_url

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 314
def return_first_dot_as_hyphen_from_this_url(i = url?)
  new_url = File.basename(i).dup # Obtain the URL here.
  new_url.sub!(/\./,'-') # This replaces only the first '.' found.
  return new_url
end
return_first_underscore_as_hyphen_and_other_undscores_as_dots(i = url?) click to toggle source
#

return_first_underscore_as_hyphen_and_other_undscores_as_dots

This method exists specifically for input such as 'boost_1_61_0'.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 334
def return_first_underscore_as_hyphen_and_other_undscores_as_dots(i = url?)
  i = return_first_underscore_as_hyphen_from_this_url(i).dup
  i.tr!('_','.')
  return i
end
return_first_underscore_as_hyphen_from_this_url(i = url?) click to toggle source
#

return_first_underscore_as_hyphen_from_this_url

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 323
def return_first_underscore_as_hyphen_from_this_url(i = url?)
  new_url = File.basename(i).dup # Obtain the URL here.
  new_url.sub!(/_/,'-') # This replaces only the first '_' found.
  return new_url
end
return_hash()
Alias for: yaml_dataset?
return_homepage()
Alias for: homepage?
return_n_programs_available() click to toggle source
#

return_n_programs_available

#
# File lib/rbt/cookbooks/class/class.rb, line 301
def return_n_programs_available
  '  -> '+sfancy(n_programs_available?.to_s)+' programs '\
  'registered as of '+simp(today?)+'.'
end
return_program_full_name()
return_program_name( use_this_connective_token = use_this_connective_token? ) click to toggle source
#

return_program_name

Note that the connective token in use is usually '-', but there are programs such as 'artemis_v16.0.11.jar' that have no '-' at all whatsoever. To also honour this, we have to use this connective token - it will be re-defined towards '_' specifically for programs that have no '-' token.

#
# File lib/rbt/cookbooks/class/set.rb, line 1102
def return_program_name(
    use_this_connective_token = use_this_connective_token?
  )
  short_name?+use_this_connective_token+program_version?
end
return_program_path() click to toggle source
#

return_program_path

This method will return the full program path, consisting of the base_dir and program_full_name component.

Example:

'/Users/x/SRC/gnomemahjonng/' + 'gnome-mahjonng-5.08.tar.xz'
#
# File lib/rbt/cookbooks/class/obtain.rb, line 269
def return_program_path
  base_dir?+program_full_name?
end
Also aliased as: return_default_program_path
return_program_version()
Alias for: program_version?
return_sanitized_program_name( i = program_name?.dup ) click to toggle source
#

return_sanitized_program_name

This will also get rid of archives.

A full program_name would be something like 'gnome-mahjonng-5.08'.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 869
def return_sanitized_program_name(
    i = program_name?.dup
  )
  url = url?.dup
  case i # case tag
  # ======================================================================= #
  # === USE_URL_LAST_HYPHEN_IS_DOT
  #
  # This entry point will convert the last hyphen, aka '-', into a '.'
  # dot. The input may be 'ImageMagick-7.0.8-27' and it will then
  # become 'ImageMagick-7.0.8.27'.
  # ======================================================================= #
  when 'USE_URL_LAST_HYPHEN_IS_DOT'
    i = remove_archive_from_the_end(
      File.basename(url1?)
    )
    i = i.reverse.sub(/-/,'.').reverse
  # ======================================================================= #
  # === FIRST_UNDERSCORE_AS_HYPHEN
  #
  # This will convert input such as 'boost_1_61_0' into 'boost-1_61_0'.
  # ======================================================================= #
  when 'FIRST_UNDERSCORE_AS_HYPHEN',
       'FIRST_UNDERSCORE_IS_HYPHEN',
       'USE_URL_REPLACE_UNDERSCORE'
    i = return_first_underscore_as_hyphen_from_this_url(url) 
  # ======================================================================= #
  # === FIRST_UNDERSCORE_AS_HYPHEN_AND_OTHER_UNDERSCORES_AS_DOTS
  #
  # This is due to boost again - apparnetly the boost developers make
  # use of a very strange packaging schemata.
  #
  # So this entry point will convert input such as 'boost_1_61_0' into
  # 'boost-1.61.0'.
  # ======================================================================= #
  when 'FIRST_UNDERSCORE_AS_HYPHEN_AND_OTHER_UNDERSCORES_AS_DOTS'
    i = return_first_underscore_as_hyphen_and_other_undscores_as_dots(url)
  # ======================================================================= #
  # === FIRST_DOT_AS_HYPHEN
  #
  # The following case is for input such as "sendmail.5.2.18"
  # which should become "sendmail-5.2.18".
  #
  # We only manipulate the last part though, so if we have input that
  # contains a '/', we assume that this is a path and split it up.
  # This is the reason why we will use File.basename()
  # ======================================================================= #
  when 'FIRST_DOT_AS_HYPHEN'
    i = return_first_dot_as_hyphen_from_this_url(url)
  # ======================================================================= #
  # === URL_REPLACE_UNDERSCORE
  #
  # This entry point handles the case when the input has '_' characters
  # in the String. If this is the case then all '_' will be replaced
  # via '-' characters.
  # ======================================================================= #
  when 'URL_REPLACE_UNDERSCORE',
       'URL_CONVERT_UNDERSCORE',
       'USE_URL_SANITIZED',
       'REPLACE_UNDERSCORES',
       'USE_URL_MIDDLE_HYPHENS'
    i = return_url_replace_underscore(url)
  # ======================================================================= #
  # === USE_URL_DOWNCASE
  #
  # Use the URL as program name but downcase it.
  # ======================================================================= #
  when 'USE_URL_DOWNCASE',
       'USE_DOWNCASED'
    i = url.downcase
  # ======================================================================= #
  # === USE_URL
  #
  # Simply use the URL as-is, for the program name.
  # ======================================================================= #
  when 'USE_URL'
    i = url
  # ======================================================================= #
  # === PROGRAM_VERSION
  # ======================================================================= #
  when /PROGRAM_VERSION/
    program_version = program_version?
    if program_version.empty?
      program_version = remove_archive_from_the_end(
        File.basename(url?.dup).delete('a-z')
      )
    end
    i.sub!(/PROGRAM_VERSION/, program_version)
    i.squeeze!('.')
  else
    # ===================================================================== #
    # Handle github-specific links next.
    # ===================================================================== #
    if is_github_url? and
       i.start_with?('v-') and
       (i =~ /v-\d{0,2}.\d{1,2}.\d{1,2}/) # See: http://rubular.com/r/tWF7ikLZiw
      # =================================================================== #
      # Ok, we now know that the input is something like 'v-1.11.0'.
      # We must thus sanitize several parts of the dataset.
      # =================================================================== #
      if short_name? == 'v' # <- This must evidently be replaced then.
        set_short_name(
          search_for_this_program?.dup, :also_set_other_names
        )
        set_program_name
        set_base_dir
        i = program_name?
      end
    end
  end
  # ======================================================================= #
  # Get rid of any .tar.xz or similar archive end here.
  # ======================================================================= #
  i = remove_archive_from_the_end(i)
  return i
end
return_tags()
Alias for: tags?
return_url_replace_underscore(i = url?) click to toggle source
#

return_url_replace_underscore

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 300
def return_url_replace_underscore(i = url?)
  _ = File.basename(i).dup
  if _.include? '_'
    _.tr!('_','-') # Replace all '_' with '-'.
  elsif _.include? '.' # Else replace just the first '.'.
    _.sub!('.','-')
  end
  _ = remove_file_extension(_)
  return _
end
rshort?()
Alias for: real_short_name?
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/cookbooks/class/run.rb, line 16
def run
  # ======================================================================= #
  # Must check whether the .yml file exists.
  # ======================================================================= #
  update_with_this_program(
    search_for_this_program?
  )
end
run_configure?() click to toggle source
#

run_configure

#
# File lib/rbt/cookbooks/class/obtain.rb, line 770
def run_configure?
  obtain(:run_configure)
end
run_make()
Alias for: run_make?
run_make?() click to toggle source
#

run_make?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1113
def run_make?
  obtain(:run_make)
end
Also aliased as: run_make
sanitize_apply_patch() click to toggle source
#

sanitize_apply_patch

Here we sanitize the value for apply_patch.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 229
def sanitize_apply_patch
  _ = apply_patch?
  if _
    if _.include? '#'
      _ = _[0 .. (_.index('#') - 1)]
      set_apply_patch _
    end
    if _.include? 'if PROGRAM_VERSION' # Ok, we specified a specific version.
      version_to_compare = _.split(' ').last
      if version_to_compare == program_version? # Ok, patch can be applied.
      else # Else do not apply this patch.
        set_apply_patch ''
      end
    end
  end
end
sanitize_base_dir() click to toggle source
#

sanitize_base_dir

This method will currently only downcase the last part, so that “Eterm/” becomes “eterm/” instead.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 284
def sanitize_base_dir
  _ = base_dir?
  if _.include? '/'
    splitted = _.split('/')
    last_part = splitted.last
    unless last_part == last_part.downcase
      splitted[-1] = last_part.downcase
      _ = splitted.join('/')
      set_base_dir(_)
    end
  end
end
sanitize_binaries() click to toggle source
#

sanitize_binaries (binaries tag)

This method will sanitize the binaries entry, @_. We must keep the binaries in Array format.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 685
def sanitize_binaries
  _ = binaries? # Obtain a pointer.
  _ = [] if _.nil?
  if _.is_a?(String) and !_.empty?
    _ = _.split(',')
  elsif _.is_a? String
    _ = [_]
  end
  if _.is_a? Array
    if _.first.include? ',' # Assume that we must split then.
      _.map! {|entry| entry.split(',') }
    end if _.first
  end
  _ = _.flatten.compact.map(&:strip)
  set_binaries(_)
end
sanitize_blfs_entry() click to toggle source
#

sanitize_blfs_entry

This method will clean up the BLFS entry, should it exist.

It must be guaranteed to be an Array.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 651
def sanitize_blfs_entry
  if has_key? 'blfs'
    _ = blfs?
    unless _.is_a? Array
      if _.nil?
        _ = []
      elsif _.empty?
        _ = [] # Empty Array then.
      else
        _ = [_]
      end
      set_blfs _
    end
  else
    set_blfs []
  end
end
sanitize_boolean_value(i) click to toggle source
#

sanitize_boolean_value

This method will turn 't' into true and 'f' into false.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1434
def sanitize_boolean_value(i)
  _ = obtain(i)
  case _
  when 't','true','yes','y'
    set(i, true)
  when 'f','false','no','n'
    set(i, false)
  end
end
sanitize_configure_base_dir() click to toggle source
#

sanitize_configure_base_dir

We must ensure that this variable has a trailing / character.

There are several reasons for this, but one important reason is that class RBT::Compile will do a calculation based on the amount of '/' in the configure_base_dir string. So if we have one more or less '/', the calculation's result will vary - thus, we must ensure that the '/' is trailing here.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 772
def sanitize_configure_base_dir
  _ = configure_base_dir?
  if _
    unless _.empty?
      set_configure_base_dir rds("#{_}/")
    end
  end
end
sanitize_configure_command() click to toggle source
#

sanitize_configure_command

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 829
def sanitize_configure_command
  _ = configure_command?
  if _.empty? and deps_on?.include?('waf')
    _ = 'waf'
  end
  if _
    if _.empty?
      set_configure_command 'configure' # set default, reset every time.
    else
      _ = ConvertGlobalEnv[_] if _.include? '$'
      set_configure_command(_)
    end
  else
    if _.include? '$'
      _ = ConvertGlobalEnv[_]
    end
    set_configure_command(_) # set rescue.
  end
end
sanitize_configure_options() click to toggle source
#

sanitize_configure_options (configure tag)

Work on the configure options, i.e. @dataset.

Note that this depends on program_version? having been set properly.

Some options should not be sanitized, such as “-Wno-dev -G Ninja ..” in applications that use the cmake build system, e. g. LLVM.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1017
def sanitize_configure_options
  # ======================================================================= #
  # We must first check if we are allowed to modify the configure options
  # at all. Some programs, such as openssl, will not allow such modification
  # due to their strange way how they mix different configure-options.
  #
  # There are some exceptions to this, though. Newlines for example
  # can always be removed.
  # ======================================================================= #
  _ = configure_options?.to_s.strip # Don't want empty thingies here.
  if may_we_modify_the_configure_options?
    # ===================================================================== #
    # Get rid of multi-blanks next.
    # ===================================================================== #
    if _
      _.squeeze!('/')
      _.gsub!(/#{N}/,' ')
    end
    # ===================================================================== #
    # Treat 'VERSION' as a macro, for expansion.
    # ===================================================================== #
    if _.include? 'PROGRAM_VERSION'
      _.gsub!(/PROGRAM_VERSION/, program_version?.to_s) if _
    elsif _.include? 'VERSION'
      _.gsub!(/VERSION/, program_version?.to_s) if _
    end
    # ===================================================================== #
    # Treat 'CURRENT' as a macro, for expansion.
    # ===================================================================== #
    if _.include? 'CURRENT'
      _.gsub!(/CURRENT/, program_version?.to_s) if _
    end
    # ===================================================================== #
    # === NAME_OF_THE_DISTRIBUTION
    # ===================================================================== #
    if _.include? 'NAME_OF_THE_DISTRIBUTION'
      name = YAML.load_file(
        project_yaml_directory?+'configuration/name_of_the_distribution.yml'
      )
      _.gsub!(/NAME_OF_THE_DISTRIBUTION/, name)
    end
    unless _.empty?
      # =================================================================== #
      # Finally, run through the configure options. If they start with
      # the Strings "enable" or "disable", with or without, we prepend --
      # if this is not yet the case.
      #
      # Since as of September 2011, we will always prepend --, unless
      # the first character already is a '-' (this is done to
      # =================================================================== #
      splitted = _.split(' ')
      _ = splitted.map {|configure_option|
        # If configure_option =~ /^disable|enable|with|without/
        # ================================================================= #
        # Only add when not yet first char is NOT a '-'.
        # ================================================================= #
        unless configure_option.start_with?('-') or
               configure_option.start_with?('$') or
               configure_option.start_with?('.')
          unless (configure_option == 'Ninja') and
                 splitted.include?('-G') # For cmake variants like: "-G Ninja"
            configure_option.prepend('--')
          end
        end
        # end
        configure_option
      }.join(' ')
    end
    # ===================================================================== #
    # Try to handle $ input.
    # ===================================================================== #
    if _.include? '$'
      _ = ConvertGlobalEnv.convert(_)
    end
  end
  _.tr!(N, ' ') # Replace all newlines again.
  set_configure_options(_) # Last but not least, reassign.
end
sanitize_description() click to toggle source
#

sanitize_description (description tag, desc tag)

Get rid of trailing newlines in our description, and apply some other operations.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 584
def sanitize_description
  _ = description?.to_s.chomp
  _.chop! if _.end_with? '"' # Get rid of leading and trailing ".
  _[0,1] = '' if _.start_with? '"'
  # ======================================================================= #
  # Some macros have to be expanded before we invoke substitute_macros().
  # SELF_NAME is such an example.
  # ======================================================================= #
  if _.include? 'SELF_NAME'
    _.gsub!(/SELF_NAME/, short_name?)
  end
  _ = substitute_macros(_)
  begin # Replace newlines with ' ' characters.
    _ = _.gsub(/#{N}/,' ').squeeze(' ')
  rescue Exception => error
    cliner {
      opnn; e 'An error happened for the description:'
      pp @_
      pp error
    }
  end
  # ======================================================================= #
  # Next, if this is empty, but short_description? is not, then
  # simply copy-paste the content of short_description? onto
  # the main program description.
  # ======================================================================= #
  if _.to_s.empty? and !short_description?.to_s.strip.empty?
    _ = short_description?.dup
  end
  set_description _
end
sanitize_env_variables() click to toggle source
#

sanitize_env_variables

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 249
def sanitize_env_variables
  _ = env_variables?
  if _ and _.is_a? Array # Must also check for nil.
    # ===================================================================== #
    # If it is an Array, then it must be wrong, so correct this here
    # silently. We need a Hash, as specified in the specification.
    # ===================================================================== #
    hash = {}
    _.each {|inner_hash|
      if inner_hash.is_a? Hash
        key   = inner_hash.keys.first
        value = inner_hash.values.first
        hash[key] = value
      end
    }
    set_env_variables(hash)
  end
end
sanitize_extra_information() click to toggle source
#

sanitize_extra_information

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 271
def sanitize_extra_information
  if extra_information?
    _ = extra_information?.chomp.rstrip
    set_extra_information(_)
  end
end
sanitize_has_to_be_compiled() click to toggle source
#

sanitize_has_to_be_compiled

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 619
def sanitize_has_to_be_compiled
  _ = has_to_be_compiled?
  case _
  when 'no'
    _ = false
  when 'yes'
    _ = true
  end
  set_has_to_be_compiled(_)
end
sanitize_headers() click to toggle source
#

sanitize_headers (headers tag)

This method was added as of May 2014.

The headers entry must be kept as an Array.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 551
def sanitize_headers
  _ = headers?
  if _.is_a? Array
    if _.first.include? ','
      _ = _.first.split(',')
    end if _.first
  end
  if _.is_a? String
    _ = _.to_s.strip
    _ = _.split(',') if _.include? ','
    _ = nil if _.empty?
  end
  _ = [_] unless _.is_a? Array
  _ = _.flatten.compact
  # ======================================================================= #
  # The individual entries may have a newline or an empty String at
  # the beginning. The next line of code ensures that we will get
  # rid of these.
  # ======================================================================= #
  _.map! {|entry| entry.delete(N).strip }
  # ======================================================================= #
  # Must keep it sorted, since as of July 2017.
  # ======================================================================= #
  _.sort!
  set_headers(_)
end
sanitize_homepage_entry() click to toggle source
#

sanitize_homepage_entry

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 672
def sanitize_homepage_entry
  _ = homepage?
  unless _.is_a? String
    set_homepage(_.to_s)
  end
end
sanitize_installation_steps() click to toggle source
#

sanitize_installation_steps

Installation steps are steps that we have to perform in order to get different programs to install on a given computer system.

Special macros can be used as part of the installation steps.

For instance:

MY_PROGRAMS/Procps/PROGRAM_VERSION

Will be expanded to whatever value MY_PROGRAMS was set to; usually it is, or should be, pointing towards “/Programs/”.

Do note that this means that the value for MY_PROGRAMS must exist, otherwise this can not possibly work. Of course you can omit using macros and just hardcode values there.

Another example for macro-conversion would be the String 'RINSTALL1', which will become expanded into the following three actions:

ruby install.rb config
ruby install.rb setup
ruby install.rb install

The latter expansions are part of the file:

predefined_installation_instructions.yml

So if you want to add new macros, you can do so by modifying that very yaml file.

Keep in mind that the installation steps are stored as Array at all times.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1342
def sanitize_installation_steps
  _ = installation_steps?
  unless _.is_a? Array
    _ = [_].compact # <- .compact to avoid retaining nil values.
  end
  if _.empty?
    _ << 'make' # <- This is the hardcoded default value at all times.
  end
  # ======================================================================= #
  # bl $RBT/yaml/predefined_installation_instructions.yml
  # ======================================================================= #
  dataset = YAML.load_file(
    file_predefined_installation_instructions?
  )
  _.map! {|entry|
    if dataset.has_key? entry
      entry = dataset[entry]
      if entry.is_a? String
        # ================================================================= #
        # The String may look like this:
        #
        #   copy_ruby; ruby setup.rb config; ruby setup.rb setup; ruby setup.rb install
        #
        # ================================================================= #
        if entry.include? ';'
          entry = entry.split(';').map(&:strip)
        end
      end
    end
  }
  _.flatten!
  _.compact!
  _.reject!(&:empty?)
  # ========================================================================= #
  # Past this point here we have an Array.
  # ========================================================================= #
  unless _.empty?
    _.map! {|line|
      line = line.dup if line.frozen?
      line.strip!
      # =================================================================== #
      # Next, replace all ',' with ';' characters.
      # =================================================================== #
      line.tr!(',',';') if line.include? ','
      if Object.const_defined? :ConvertGlobalEnv
        line = ConvertGlobalEnv[line] if line.include? '$'
      end
      # =================================================================== #
      # === Replace the predefined installation instruction next
      # =================================================================== #
      if predefined_installation_instructions?.include? line
        line = predefined_installation_instructions?[line]
      end
      if line.include? 'VERSION'
        # ================================================================= #
        # Need to set @program_version first, hence we update some stuff.
        # ================================================================= #
        set_program_name(program_name?) # This equals, for example, to "gnome-mahjonng-5.08"
        if line.include? 'PROGRAM_VERSION' 
          line.gsub!(/PROGRAM_VERSION/, program_version?) if program_version?
        elsif line.include? 'VERSION'
          line.gsub!(/VERSION/, program_version?) if program_version?
        end
      end
      line = line.split(';') if line.include? ';' # This may turn it into an Array.
      line
    }
  end
  _.flatten!
  _.map!(&:strip)
  set_installation_steps _
end
sanitize_last_update()
sanitize_last_update_entry() click to toggle source
#

sanitize_last_update_entry

The only sanitize-operation we do here is if it is an valid date such as “32 Aug 2017”.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 417
def sanitize_last_update_entry
  _ = last_update?
  if _.include? ' '
    splitted = _.split(' ')
    day = splitted.first
    if day.to_i > 31
      opnn; e swarn('The last_update entry for ')+sfancy(program_name?)+
              swarn(' is wrong (too high).')
      opnn; e swarn('Please correct this entry.')
      # =================================================================== #
      # We could exit here but this is mostly an annoyance rather than
      # a bug, so we continue.
      # =================================================================== #
    end
  elsif _.count('.') == 2 # Input such as '24.09.2017'
    splitted = _.split('.')
    splitted[1] = return_month_based_on_this_number(splitted[1])[0,3] # This is the month but only the first 3 characters.
    _ = splitted.join(' ')
    set_last_update(_)
  end
end
Also aliased as: sanitize_last_update
sanitize_libraries() click to toggle source
#

sanitize_libraries

This sanitizes the libraries entry, @_.

We must keep this entry in Array format.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 175
def sanitize_libraries
  _ = libraries?
  unless _.is_a? Array
    _ = [_].compact
  end
  # ======================================================================= #
  # Next, we will assume something such as:
  #   ["libdevkit-power-gobject.{so,a},libupower-glib.{so,a}"]
  # ======================================================================= #
  unless _.empty? # safeguard against nil entries.
    if _ and _.first and _.first.include?('}') and _.first.include?('{')
      splitted = _.first.split(/\},/)
      splitted.map! {|entry|
        entry =~ REGEX_TO_SANITIZE_LIBRARIES
        [$1+'.'+$2, $1+'.'+$3]
      }
      splitted.flatten!
      _ = splitted
    end
  end
  if _.is_a? Array
    if _.first.include? ','
      _ = _.first.split(',')
      _.map!(&:strip) # It should not include empty whitespace.
      # =================================================================== #
      # Some libraries may have components such as foo{so.a}
      # We need to split these up into foo.so and foo.a.
      # =================================================================== #
    end if _.first
  end
  new_value = [] # default.
  new_value = [_].flatten unless _.empty?
  new_value.compact! if new_value.is_a? Array
  set_libraries(new_value)
end
sanitize_license() click to toggle source
#

sanitize_license

Empty license should default to “unknown” license. This method will ensure that this is the case.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 523
def sanitize_license
  _ = licence?
  begin
    if _.nil? or _.empty?
      set_licence('unknown')
    else
      if _.is_a?(String) and _.include?(',') # <- In this case, turn it into an Array.
        set_licence(_.split(',').map(&:strip))
      end
    end
  rescue Exception => error
    opnn; e 'An error happened.'
    pp data?
    pp error
    pp error.class
    opnn; e 'Exiting now - this error (in sanitize_license()) '\
            'should be fixed though.'
    exit
  end
end
sanitize_make_options()
sanitize_meson_configure_options() click to toggle source
#

sanitize_meson_configure_options

This method is similar to the method sanitize_configure_options() but it is only valid for meson, not for GNU autoconfigure.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1102
def sanitize_meson_configure_options
  _ = meson_configure_options?
  if _ and !_.empty?
    _ = _.to_s.strip.tr(N,' ')
    set_meson_configure_options(_)
  end
end
sanitize_parameters_to_make() click to toggle source
#

sanitize_parameters_to_make

This method will sanitize the parameters that can be given to the program called “make” (on the commandline). “make” is typically invoked for a given program.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1422
def sanitize_parameters_to_make
  _ = parameters_to_make?
  set_parameters_to_make(
    [_].flatten.compact
  )
end
Also aliased as: sanitize_make_options
sanitize_postinstall() click to toggle source
#

sanitize_postinstall

This will sanitize the postinstall stuff, by assigning to the respective entry in the main Hash.

Note that we have to invoke this method only after real_short_name and program_version was set, because one entry requires this.

As of 20.09.2014, postinstall must be an Array.

Invocation example:

scookie libraw1394
#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1220
def sanitize_postinstall
  _ = postinstall?
  if _.nil? # Safeguard to ensure Array.
    set_postinstall []
    _ = postinstall?
  end
  _.compact! if _.is_a? Array # Get rid of nil values.
  unless _.empty?
    if _.is_a? Array
      _.map! {|entry| substitute_macros(entry) }
    end
    _.gsub!(/#{N}/,',') if _.include?(N) # Replace newlines with ',' char.
    # ===================================================================== #
    # Replace universal targets with real targets.
    # ===================================================================== #
    case prefix?
    when false # Yup. Only one option for false..
      point_to_libraries   = RBT.syslib_directory?
      point_to_binaries    = sysbin_directories?
      point_to_includes    = SYSINCLUDE_DIR
      point_to_program_dir = rds( # Remove double slashes.
        programs_dir?+
        real_short_name?.to_s.capitalize+'/'+
        program_version?.to_s+'/bin'
      )
    when true
      # =================================================================== #
      # FHS installation method comes here. It will defaults to /usr/bin.
      # It also includes true of course.
      # =================================================================== #
      point_to_libraries   = '/usr/lib'
      point_to_binaries    = '/usr/bin'
      point_to_includes    = '/usr/include'
      point_to_program_dir = point_to_binaries
    else
      point_to_libraries   = prefix?+'lib'
      point_to_binaries    = prefix?+'bin' # For example, /Programs/Glib/2.40.0/bin/
      point_to_includes    = prefix?+'include'
      point_to_program_dir = point_to_binaries
    end
    # ===================================================================== #
    # Turn it into an Array for sure:
    # ===================================================================== #
    _ = [_].flatten.compact
    # ===================================================================== #
    # Sanitize the @postinstall variable next.
    # ===================================================================== #
    if _.is_a? Array
      _.map! {|entry|
        if entry.include? 'UNIVERSAL_BINARY_DIR'
          entry.gsub!(/UNIVERSAL_BINARY_DIR/,  point_to_binaries)
        end
        entry.gsub!(/UNIVERSAL_BINARIES_DIR/,  point_to_binaries)
        entry.gsub!(/UBD/,                     point_to_binaries)
        entry.gsub!(/UNIVERSAL_LIBRARIES_DIR/, point_to_libraries)
        entry.gsub!(/ULD/,                     point_to_libraries)
        entry.gsub!(/UNIVERSAL_INCLUDE_DIR/,   point_to_includes)
        entry.gsub!(/PROGRAM_DIR/,             point_to_program_dir)
        entry.gsub!(/PROGRAMS_DIR/,            point_to_program_dir)
        entry.gsub!(/,cp/,                     ',copy_file')
        entry.strip! # Strip it.
        entry = rds(entry) # Replace // with // here.
        entry
      }
      set_postinstall _ # Reassign.
    end
  end
  unless postinstall?.is_a? Array
    _ = rds(postinstall?)
    _ = _.split(',') if _.include? ','
    set_postinstall [_].flatten
  end
end
sanitize_pre_make_commands() click to toggle source
#

sanitize_pre_make_commands

We must keep the pre_make_commands in Array format. The method here will make sure of this.

We can only invoke this after having set program_version before, because some macro-substitutions require the program version to be properly set before the make-commands can be sanitized.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 807
def sanitize_pre_make_commands
  _ = pre_make_commands?
  _.compact! if _.is_a? Array # Get rid of nil values.
  case _ # Do a bit free-form sanitizing next.
  when 'handle configure.py'
    _ = 'python configure.py'
  end
  array = []
  if _
    unless _.empty?
      _ = substitute_macros(_)
      array << _
    end
  end
  array.flatten!
  array.compact!
  set_pre_make_commands(array) # Turn it into an Array here.
end
sanitize_prefix() click to toggle source
#

sanitize_prefix (sanitize prefix tag)

The value for the prefix of the program at hand will be sanitized here, in this method.

Since as of May 2013, we will never use a shortcut anymore, we will always store the full, absolute path to our entry.

“false” as value, is an indication of using the path to an AppDir. For example, this would be something such as /Programs/Htop/2.0.0 - that would be a proper appdir.

The –prefix is always a directory, so as of Jan 2014 we will append a / to this unless the last character is already a /.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 368
def sanitize_prefix
  _ = prefix?.dup
  # ======================================================================= #
  # General way to overrule the prefix setting in this case.
  # ======================================================================= #
  _ = false if COMPILE_EVERYTHING_INTO_STANDALONE_DIRECTORY
  if _.is_a?(FalseClass) or _.is_a?(TrueClass)
    _ = _.to_s
  end
  _ = _.to_s.dup
  if _.is_a? String
    case _
    when 't','true','yes','y','traditional'
      _ = '/usr/'
    when 'f','false','no','AppDir','return_appdir_path','appdir_path'
      _ = return_appdir_prefix.dup # <- This is the AppDir variant.
    end
    if _.is_a? String
      _ = _.dup if _.frozen? # Unfreeze it.
      # =================================================================== #
      # As of January 2014, we will pass the String through the macro-check,
      # which has to be done because our string may include PROGRAM_NAME as
      # a prefix.
      # =================================================================== #
      _ = substitute_macros(_).dup
      # =================================================================== #
      # Append '/' unless we already have a trailing '/'.
      # =================================================================== #
      _ << '/' unless _.end_with? '/'
      _.gsub!(/ULOCAL/,'/usr/local') if _.include? 'ULOCAL' # ULOCAL gets expanded to /usr/local
      _.gsub!(/ULOC/,  '/usr/local') if _.include? 'ULOC'   # same counts for ULOC
      # =================================================================== #
      # We used to delete '-' here in the past, but as of Sep 2017 this
      # is no longer the case. Some programs may have a '-' as part of
      # the program version, and it may be better to include this rather
      # than remove it.
      # =================================================================== #
      # _.delete!('-') if _.include? '-'
    end
    set_prefix(_)
  end
end
sanitize_preinstall() click to toggle source
#

sanitize_preinstall

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 730
def sanitize_preinstall
  _ = preinstall?
  if _.is_a?(String) and (_.count(N) > 1)
    _ = _.split(N)
  end
  if _.nil? # Safeguard to ensure Array.
    set_preinstall []
  else
    _ = [_] if _.is_a? String
    if _.is_a? Array
      _.compact!
      _.map!(&:strip)
      _.reject! {|entry| entry.empty? } # Weed out empty entries.
      _.flatten!
    end
    set_preinstall _
  end
end
sanitize_program_compile_name() click to toggle source
#

sanitize_program_compile_name

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 752
def sanitize_program_compile_name
  _ = program_compile_name?
  if are_we_on_gobolinux? and
    !use_this_program_name_on_gobolinux?.to_s.empty?
    _ = use_this_program_name_on_gobolinux?
  end
  set_program_compile_name(_.to_s) # Will always be at the least an empty String.
end
sanitize_program_name() click to toggle source
#

sanitize_program_name

This method can be used to sanitize the program_name entry.

The program_name entry is something such as 'gnome-mahjonng-5.08'.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 856
def sanitize_program_name
  _ = program_name?.dup # Obtain a reference-copy first.
  i = return_sanitized_program_name(_)
  set_program_name(i) # And set the new variant.
end
sanitize_program_path() click to toggle source
#

sanitize_program_path

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1447
def sanitize_program_path
  reassemble_program_path
end
Also aliased as: rebuild_path
sanitize_required_deps() click to toggle source
#

sanitize_required_deps

The entry required_deps_on will be sanitized here - it must be an Array at all times.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 467
def sanitize_required_deps
  _ = required_deps_on?
  if _.is_a?(String) # Input such as 'perl cmake'. Has to become an Array.
    if _.include? ' '
      unless _.include?('>') or _.include?('<') # But not when we have comparison-operators.
        _ = _.split(' ')
      end
    end
  end
  array = []
  _ = [_] unless _.is_a? Array # Must be an Array.
  _.compact!
  _.map! {|entry|
    if entry.include? ','
      entry = entry.split(',').map(&:strip)
    end 
    entry
  } unless _.empty?
  _ = [] if _.nil? # Safeguard to keep this as an Array.
  array << _
  array = array.flatten.compact
  # ======================================================================= #
  # At this point the entry is a sanitized Array. But the cookbook
  # file may still have made a mistake, such as when an entry
  # was accidentally listed twice. (I had this problem in Feb
  # 2017, which was why I added the following code.)
  # So we need to check whether the entries are all unique - and
  # if they are not, we will notify the user that something may
  # be wrong with the yaml file in question.
  # ======================================================================= #
  if array.uniq.size != array.size
    path = Cookbooks.individual_cookbooks_dir?+program?+'.yml'
    non_unique_entries = array.uniq.map { |e| [array.count(e), e] }.select { | c, _ | c > 1 }.sort.reverse.first.last
    unless non_unique_entries.is_a? Array
      non_unique_entries = [non_unique_entries] # We need an Array.
    end
    opnn; e swarn('There may be one (or several) duplicate dependencies '\
                  ' listed in the yaml file.')
    opnn; e swarn('  Path: ')+sfile(path)
    opnn; e swarn('Here are the duplicate entries:')
    non_unique_entries.each {|duplicate_entry|
      e '  '+simp(duplicate_entry)
    }
    e swarn('If you wish to check for that on your own, have a look at the')
    e swarn('yaml file at `')+sfile(path)+swarn('`.')
    e swarn('Check the "required_deps_on:" entry of the .yml file.')
  end
  set_required_deps_on(array)
end
sanitize_run_configure() click to toggle source
#

sanitize_run_configure

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 784
def sanitize_run_configure
  _ = run_configure?
  if _.is_a? String
    case _
    when 'f'
      _ = false
    when 't'
      _ = true
    end
  end
  set_run_configure(_)
end
sanitize_short_description() click to toggle source
#

sanitize_short_description

right now this will only get rid of newlines.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 454
def sanitize_short_description
  if short_description?.to_s.include? N
    set_short_description(short_description?.delete(N))
  end
end
sanitize_tags() click to toggle source
#

sanitize_tags

Keep in mind that the tags must always be in Array format.

We will update the tags entry through this method here.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1117
def sanitize_tags
  _ = tags?
  if _.is_a? Array
    _.map! {|line|
      if line
        line.tr!(' ','_')
        line.strip!
      end
      line
    }
  end
  format = SPECIFICATION_OF_REGISTERED_COOKBOOK_ENTRIES['tags']
  unless _.class.to_s == format
    case format
    when 'Array'
      if _.is_a? String
        if _.include? ','
          _ = _.split(',').map(&:strip)
        end
      end 
      _ = [_].compact.flatten # Convert the String into an Array here and remove nil values.
    end
  end
  if _.is_a? Array
    # ===================================================================== #
    # Before we do anything else, we will apply a .map-strip
    # and a exchange of all ' ' with '_' operation:
    # ===================================================================== #
    _.map! {|line|
      if line
        line.tr!(' ','_')
        line.strip!
      end
      line
    }
    first = _.first
    if first
      if first.include? ' ' # We have a situation such as this one here: ["video gnome"]
        first = first.split(' ')
        _ = first
      elsif first.is_a?(String) and first.include?(',') # Some entries may have something like:  ruby,gnome  in the yaml file, we check for these here.
        first = first.split(',')
        _ = first
      end
    end
  end
  # ======================================================================= #
  # Since as of Feb 2017, we will also ensure that the tags that are
  # in use, conform to our specification. If not then we will notify
  # the user, and exit.
  # ======================================================================= #
  allowed_tags = YAML.load_file(FILE_ALLOWED_TAGS)
  allowed_tags.map! {|line|
    line.tr(' ','_').strip
  }
  _.each {|this_tag|
    if this_tag.to_s.empty? or # Empty tags are skipped as well.
       allowed_tags.include?(this_tag)
    else
      this_program = short_name?
      e
      e "The specified tag called `#{simp(this_tag)}` for the program "\
        "#{sfancy(this_program.downcase)}"\
        " has not"
      e 'been registered in the file:'
      e
      e "  `#{sfile(FILE_ALLOWED_TAGS)}`."
      e
      e 'This is currently '+
        violet('discouraged')+
        ', but still allowed.'
      e
      e 'The faulty entry should still be corrected though. So either'
      e 'the cookbook file in question should be modified, or the tag should'
      e 'be added to the registry of allowed tags in the specification file. '\
        '('+sfile('allowed_tags.yml')+')'
      e
      if is_on_roebe?
        open_in_editor(
          this_program.downcase.delete('-')
        )
      end
      # No longer exit as of November 2013.
      # exit # And exit here.
    end
  }
  set_tags _ # Finally set the Array that has our tags.
end
sanitize_url(i = url1?) click to toggle source
#

sanitize_url

We will chop off some parts of the URL.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 345
def sanitize_url(i = url1?)
  if i.end_with? '/download'
    i.gsub!(/\/download$/,'')
    set_url1(i)
  end
end
sanitize_use_this_build_system() click to toggle source
#

sanitize_use_this_build_system

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 1297
def sanitize_use_this_build_system
  _ = use_this_build_system?
  if _ and _.is_a?(String) and _.empty?
    # ===================================================================== #
    # Must set a new default value in this case.
    # ===================================================================== #
    set_use_this_build_system :default
  end
end
sanitize_use_this_make_command() click to toggle source
#

sanitize_use_this_make_command

This will default to whatever is stored in the configuration file.

Should be 'make' usually, but could be “cmake” or another make-like command.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 638
def sanitize_use_this_make_command
  if use_this_make_command?.to_s.empty?
    set_use_this_make_command(MAKE_COMMAND_TO_USE) # MAKE_COMMAND_TO_USE is defined in constants.rb
  end
end
sanitize_yaml_dataset() click to toggle source
#

sanitize_yaml_dataset (sanitize tag, sani tag)

Sanitize the whole yaml dataset. Note that some entries have to come in a specific order.

This method must ensure that the mandatory entries will exist in the main yaml dataset.

Additionally, we will run various sanitize-commands, through subsequent method calls.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 37
def sanitize_yaml_dataset
  check_for_outdated_entries
  set_default_raw_description
  sanitize_libraries
  sanitize_binaries
  if url1? and (short_name?.nil? or short_name?.empty?)
    guess_entries_based_on_the_first_url
  end
  sanitize_blfs_entry
  sanitize_required_deps
  sanitize_license
  sanitize_preinstall
  sanitize_use_this_make_command
  sanitize_pre_make_commands
  # sanitize_may_we_modify_the_configure_options # <- Must come before sanitize_configure_options()
  # ^^^ but it is currently not needed anyway.
  sanitize_configure_options
  sanitize_meson_configure_options
  sanitize_configure_command
  sanitize_configure_base_dir
  sanitize_url
  sanitize_apply_patch
  sanitize_short_description
  sanitize_headers
  sanitize_description
  sanitize_extra_information
  sanitize_tags
  sanitize_env_variables
  sanitize_last_update_entry
  sanitize_has_to_be_compiled
  try_to_sanitize_sed_entry
  sanitize_base_dir
  sanitize_program_compile_name
  sanitize_program_name
  sanitize_program_path
  sanitize_run_configure
  sanitize_homepage_entry
  sanitize_run_configure
  sanitize_installation_steps
  sanitize_use_this_build_system
  sanitize_parameters_to_make
  # ======================================================================= #
  # The prefix setting can only be sanitized after the program_version
  # has been sanitized, since the actual prefix may depend on the
  # program version in use, such as for AppDirs.
  # ======================================================================= #
  sanitize_prefix # Must come BEFORE sanitize_postinstall.
  # ======================================================================= #
  # === sanitize_postinstall
  #
  # sanitize_postinstall should only be called after the prefix was
  # already defined, since a few internal-parts of the method
  # sanitize_postinstall may need to know the real prefix in use.
  # ======================================================================= #
  sanitize_postinstall
  unless File.exist? program_path?
    # ===================================================================== #
    # Try to see whether we can modify archive_type, in order to find
    # a proper match.
    # ===================================================================== #
    target = base_dir?+'*'
    possible_matches = Dir[target]
    unless possible_matches.empty?
      # =================================================================== #
      # This means we may have found another archive. We will sort this
      # first.
      # =================================================================== #
      possible_matches = sort_by_archive_priority(possible_matches)
      first_entry = possible_matches.first # Obtain an entry to it.
      # =================================================================== #
      # Check for nil-entries:
      # =================================================================== #
      if first_entry.nil?
        opnn; e swarn('Error at line '+__LINE__.to_s+':')
        pp possible_matches
        pp Dir[target]
      end
      short_first_entry = File.basename(first_entry)
      set_archive_type(
        short_first_entry
      )
      # =================================================================== #
      # Check whether the program name is like 'apt_1.2.1'
      # =================================================================== #
      if program_name.include?('_') and !program_name.include?('-')
        unless File.basename(first_entry).include?('_')
          name, version = ProgramInformation.return_name_and_version_of(File.basename(first_entry))
          set_short_name(name)
          set_program_version(version)
          use_default_connective_token_again 
          assemble_program_name
        end
      end
      sync_archive_type_entries # This method will also update the program path.
    end
  end
  if archive_type?.empty? and !program_name?.empty?
    try_to_guess_the_archive_type
  end
  # ======================================================================= #
  # Do some syncing next - first, make sure that the program_full_name
  # setting is not empty.
  # ======================================================================= #
  if program_full_name?.empty?
    sync_archive_type_entries
  end
  set_extract_to
  # ======================================================================= #
  # Last but not least, find out the file size of the program in question.
  # ======================================================================= #
  calculate_archive_size
  calculate_md5sum if shall_we_display_the_md5sum?
  # ======================================================================= #
  # Last but not least, delete the array that holds the invalid keys,
  # since this information will no longer be relevant.
  # ======================================================================= #
  cleanup_unusued_variables
end
search_for_this_program?() click to toggle source
#

search_for_this_program? (seek tag)

This method will tell us as for which program we will search.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 879
def search_for_this_program?
  @internal_hash[:search_for_this_program]
end
search_which_program?()
sed=(i)
Alias for: set_sed
sed?() click to toggle source
#

sed?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 184
def sed?
  obtain(:sed)
end
seek( i = DEFAULT_ENTRY )
seek_this_program( i = DEFAULT_ENTRY )
seek_this_program?()
seek_which_program?()
send_this_method_and_sanitize_arrays(i) click to toggle source
#

send_this_method_and_sanitize_arrays

#
# File lib/rbt/cookbooks/class/report.rb, line 494
def send_this_method_and_sanitize_arrays(i)
  result = send(i)
  if result.is_a? Array
    result = '['+result.join(',')+']' unless result.compact.empty?
  end
  return result
end
set( key, new_value = nil )
Alias for: set_in_yaml_dataset
set_active_project(i = true) click to toggle source
#

set_active_project

The default assumption is that all projects are actively maintained. If this assumption is incorrect then it has to be registered in the particular .yml file, via an entry such as: “active_project: no”

#
# File lib/rbt/cookbooks/class/set.rb, line 1218
def set_active_project(i = true)
  set(:active_project, i)
end
set_apply_patch(i = nil) click to toggle source
#

set_apply_patch

#
# File lib/rbt/cookbooks/class/set.rb, line 285
def set_apply_patch(i = nil)
  set(:apply_patch, i)
end
set_archive( i = DEFAULT_ARCHIVE_TYPE )
Alias for: set_archive_type
set_archive_format( i = DEFAULT_ARCHIVE_TYPE )
Alias for: set_archive_type
set_archive_size(i = 0) click to toggle source
#

set_archive_size

The archive size, that is, how large the archive is - in bytes.

The archive size will default to 0 on startup or when no argument is passed to it.

#
# File lib/rbt/cookbooks/class/set.rb, line 1030
def set_archive_size(i = 0)
  set(:archive_size, i)
end
set_archive_type( i = DEFAULT_ARCHIVE_TYPE ) click to toggle source
#

set_archive_type (archive tag, 4 tag)

This method will set the 'archive_type' of a given program at hand.

This is entry number (4), such as '.tar.xz' in a program like 'gnome-mahjonng-5.08.tar.xz'.

Typically, archives will be kept in the .tar.xz format, or rather the content of the constant DEFAULT_ARCHIVE_TYPE. We need this part when we wish to assemble the program_full_name setting lateron, at entry number (7).

#
# File lib/rbt/cookbooks/class/set.rb, line 1054
def set_archive_type(
    i = DEFAULT_ARCHIVE_TYPE
  )
  case i
  when nil, :default, 'default'
    i = DEFAULT_ARCHIVE_TYPE # Safeguard.
  end
  i = i.to_s.dup.downcase # Keep it downcased as well, and in String format.
  # ======================================================================= #
  # === Get rid of '/'
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i)
  end
  # ======================================================================= #
  # Do some sanitizing next.
  # ======================================================================= #
  i.sub!(/\.source$/,'') if i.include? '.source'
  # ======================================================================= #
  # If the input includes a '-' token, then something can not be right.
  # ======================================================================= #
  if i.include? '-'
    i = i[(i.rindex('-')+1)..-1]
  # ======================================================================= #
  # Same for input containing '_'.
  # ======================================================================= #
  elsif i.include? '_'
    i = i[(i.rindex('_')+1)..-1]
  end
  if i == 'guess'
    i = File.basename(url?)
  end
  i = return_archive_type(i) # This method must have registered all archive-types.
  set(:archive_type, i)
end
set_autoconf(i) click to toggle source
#

set_autoconf

#
# File lib/rbt/cookbooks/class/set.rb, line 205
def set_autoconf(i)
  set(:use_autoconf, i)
end
Also aliased as: use_autoconf=
set_base_dir( i = source_dir?+ real_short_name?.downcase.delete('.')+ '/' ) click to toggle source
#

set_base_dir (base_dir tag, base dir tag, 5 tag)

This setter will set the base_directory setting, which is entry number (5).

An example for a proper base_directory setting would be a String such as this one here:

"/Users/x/SRC/file/"

If the input is :guess_base_dir then this means that we will try to guess the base directory.

Also note that real_short_name? should be set before calling this method, in some situations.

#
# File lib/rbt/cookbooks/class/set.rb, line 487
def set_base_dir(
    i = source_dir?+
        real_short_name?.downcase.delete('.')+ # Note that the base_dir part is not allowed to have any '.' characters.
        '/'
  )
  case i
  when :guess_base_dir, :guess
    i = guess_base_dir
  end
  # ======================================================================= #
  # We don't want any '-' in the base_dir name.
  # ======================================================================= #
  i.delete!('-') if i.include? '-'
  # ======================================================================= #
  # === Delete _ from the name of the directory
  #
  # Added the following code as of January 2014. While programs can have
  # names such as 'e_dbus', the directory name itself is not allowed
  # to contain any '_' token. It looks visually odd otherwise.
  # ======================================================================= #
  i.delete!('_') if i.include? '_'
  # ======================================================================= #
  # === Handle + tokens
  #
  # Some directory names may include a '+' character, such as is the
  # case with gtk+. There are several ways how to deal with this, but
  # if we have a certain configuration option set, then we will
  # replace '+' with long name, which is 'plus'. I personally no
  # longer use this - my directory names will also include a '+'
  # character as a consequence.
  # ======================================================================= #
  if i.include? '+'
    i.gsub!(/\+/, 'plus') if replace_plus_with_long_name?
  end
  i = rds(i) # Remove double slashes
  # ======================================================================= #
  # Assume that a path starting with ./ is never correct.
  # ======================================================================= #
  if i.start_with? './'
    i[0,2] = source_dir?
  end
  # ======================================================================= #
  # === Append /
  #
  # It is the correct way to ensure that the last char is a /. The
  # reason is: directories contain a '/' as part of their name.
  # ======================================================================= #
  i << '/' unless i.end_with? '/'
  set(:base_dir, i)
end
set_base_dir=( i = source_dir?+ real_short_name?.downcase.delete('.')+ '/' )
Alias for: set_base_dir
set_binaries(i) click to toggle source
#

set_binaries

#
# File lib/rbt/cookbooks/class/set.rb, line 141
def set_binaries(i)
  set(:binaries, i)
end
set_blfs(i) click to toggle source
#

set_blfs

#
# File lib/rbt/cookbooks/class/set.rb, line 577
def set_blfs(i)
  set(:blfs, i)
end
set_can_be_compiled_statically(i) click to toggle source
#

set_can_be_compiled_statically

#
# File lib/rbt/cookbooks/class/set.rb, line 1275
def set_can_be_compiled_statically(i)
  set(:can_be_compiled_statically, i)
end
set_commandline_arguments(i = '') click to toggle source
#

set_commandline_arguments

#
# File lib/rbt/cookbooks/class/set.rb, line 784
def set_commandline_arguments(i = '')
  # ======================================================================= #
  # Keep track of the commandline arguments in the main Hash of this class.
  # ======================================================================= #
  @internal_hash[:commandline_arguments] = i
  if i.is_a? Array
    i = i.join(' ').strip
  end 
  i = i.to_s.dup
  i.delete!('-') if i.include? '-'
  # ======================================================================= #
  # And then, we will seek for this program.
  # ======================================================================= #
  set_search_for_this_program(i)
end
set_compiler_to_use(i = :gcc) click to toggle source
#

set_compiler_to_use

Do note that this method is normally not used by default; it primarily exists so that downstream code in RBT::Compile can keep track of which compiler is used, e. g. :gcc or :clang and similar variants.

#
# File lib/rbt/cookbooks/class/set.rb, line 1261
def set_compiler_to_use(i = :gcc)
  set(:compiler_to_use, i)
end
Also aliased as: compiler_to_use=
set_complex_program_version( i, be_verbose = true ) click to toggle source
#

set_complex_program_version

The purpose of this method is to allow you to overrule the respective settings, at run-time.

That way, you can change e. g. “glib-2.24” to “glib-2.25”.

#
# File lib/rbt/cookbooks/class/set.rb, line 254
def set_complex_program_version(
    i,
    be_verbose = true
  )
  case be_verbose
  when :be_quiet, :be_silent
    be_verbose = false
  end
  # ======================================================================= #
  # Add a '=' to make it easier to know what we want to modify.
  # ======================================================================= #
  i.prepend '=' unless i.include? '='
  # ======================================================================= #
  # Next, we fetch a specific version. We assume this to be the last part
  # of the command given, which must include a '=' character.
  # ======================================================================= #
  new_version = i.split('=').last
  # ======================================================================= #
  # Chop off archive-extension since we don't need these.
  # ======================================================================= #
  new_version = remove_file_extension(new_version)
  if be_verbose
    opnn; e "Setting a new version: #{simp(new_version)}"
  end
  set_program_version(new_version, :propagate_the_change) # The second argument will propagate the change, by cascading downwards.
  update_prefix :bypass_check
end
set_configure_base_dir(i) click to toggle source
#

set_configure_base_dir

#
# File lib/rbt/cookbooks/class/set.rb, line 169
def set_configure_base_dir(i)
  set(:configure_base_dir, i)
end
set_configure_command(i) click to toggle source
#

set_configure_command

The configure command will usually be configure, but it may also be cmake or waf or something like that.

#
# File lib/rbt/cookbooks/class/set.rb, line 770
def set_configure_command(i)
  set(:configure_command, i)
end
Also aliased as: configure_command=
set_configure_options(i) click to toggle source
#

set_configure_options

#
# File lib/rbt/cookbooks/class/set.rb, line 1177
def set_configure_options(i)
  # ======================================================================= #
  # Since as of September 2017, the input is no longer allowed to have
  # any newlines. This is explicitely mentioned here in the event that
  # we may have to rever this decision one day.
  # ======================================================================= #
  if i and i.include?(N)
    i.delete!(N)
    i.squeeze!(' ') # And also get rid of '  ' variants.
  end
  set(:configure_options, i)
end
Also aliased as: configure_options=
set_dataset( i = search_which_program? )
set_default_raw_description() click to toggle source
#

set_default_raw_description

#
# File lib/rbt/cookbooks/class/set.rb, line 422
def set_default_raw_description
  set_raw_description(description?(:retain_newlines).to_s) # We must retain the original newlines here.
end
set_description(i) click to toggle source
#

set_description

Note that we will always STORE the full description - it is only the actual display that will be truncated.

#
# File lib/rbt/cookbooks/class/set.rb, line 408
def set_description(i)
  set(:description, i)
end
set_env_variable()
Alias for: set_env_variables
set_env_variables()
Also aliased as: set_env_variable
Alias for: set_env_variables?
set_env_variables?() click to toggle source
#

set_env_variables?

Query the environment variables that this cookbook may set.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 285
def set_env_variables?
  obtain(:set_env_variables)
end
Also aliased as: set_env_variables, env_variables?
set_extra_information(i) click to toggle source
#

set_extra_information

#
# File lib/rbt/cookbooks/class/set.rb, line 357
def set_extra_information(i)
  set(:extra_information, i)
end
set_extract_to( i = RBT.rbt_log_directory? ) click to toggle source
#

set_extract_to

Consistently use this method when you wish to use the extract_to variable.

This variable must ALWAYS keep the location of where to extract a package to lateron.

#
# File lib/rbt/cookbooks/class/set.rb, line 551
def set_extract_to(
    i = RBT.rbt_log_directory?
  )
  i = RBT.rbt_log_directory? if i.nil? # default.
  i = i.dup # We don't want to keep a tainted reference.
  # ======================================================================= #
  # Ensure that we have a proper default value if the input was ''.
  # ======================================================================= #
  i = extract_to? if i.to_s.empty?
  # ======================================================================= #
  # Try to get an ENV variable here, if ENV is part of @extract_to.
  # ======================================================================= #
  if i.include? 'ENV'
    match = i.gsub(/ENV\['/,'').gsub(/'\]/,'') # contains the ENV variable
    i = ENV[match].dup
  end
  # ======================================================================= #
  # append / if the last character is not '/'
  # ======================================================================= #
  i << '/' unless i.end_with? '/'
  set(:extract_to, i)
end
Also aliased as: extract_to=
set_has_to_be_compiled(i = true) click to toggle source
#

set_has_to_be_compiled

#
# File lib/rbt/cookbooks/class/set.rb, line 459
def set_has_to_be_compiled(i = true)
  set(:has_to_be_compiled, i)
end
set_headers(i) click to toggle source
#

set_headers

#
# File lib/rbt/cookbooks/class/set.rb, line 219
def set_headers(i)
  set(:headers, i)
end
set_homepage(i = nil) click to toggle source
#

set_homepage

#
# File lib/rbt/cookbooks/class/set.rb, line 584
def set_homepage(i = nil)
  set(:homepage, i)
end
set_in_dataset( key, new_value = nil )
Alias for: set_in_yaml_dataset
set_in_main_hash( key, new_value = nil )
Alias for: set_in_yaml_dataset
set_in_yaml_dataset( key, new_value = nil ) click to toggle source
#

set_in_yaml_dataset (set tag, setter tag)

This is the main setter for the yaml dataset.

Note that you can also use it to set several subsequent entries.

We will also batch-update if you send in a String that contains ','.

An example for this would be the following:

set '4,5,6,7,8'
#
# File lib/rbt/cookbooks/class/set.rb, line 50
def set_in_yaml_dataset(
    key,
    new_value = nil
  )
  if key.is_a? Array # Recursive invocation in this case.
    key.flatten.each {|inner_key|
      set(inner_key, new_value)
    }
  elsif key.is_a?(String) and key.include?(',')
    key.split(',').each {|inner_entry|
      set(inner_entry, new_value) # Recursive calling then.
    }
  elsif key.is_a?(String) and key.include?('-') # Ok, we have a range here such as 2-5, meaning to update 2,3,4,5.
    splitted = key.split('-')
    min, max = splitted[0].to_i, splitted[1].to_i
    min.upto(max) {|entry| set(entry) }
  else
    # ===================================================================== #
    # All keys in the yaml_dataset have to be kept as Strings, for now.
    # This may change one day but for now, it will remain how it is.
    # ===================================================================== #
    key = key.to_s unless key.is_a? String
    # ===================================================================== #
    # After this point, all keys will be Strings. We must be careful when
    # we apply rds() - valid URLs may contain '//', which we evidently
    # do NOT want to turn into '/'.
    # ===================================================================== #
    if new_value and new_value.is_a? String # Only sanitize Strings.
      if new_value.include?('//') and
        !( new_value.include?('http://') or new_value.include?('https://') )
        new_value = rds(new_value)
      end
    end
    # ===================================================================== #
    # Next set some aliases for keys issued.
    # ===================================================================== #
    case key
    when '1'
      key = 'real_short_name'
    when '2'
      key = 'short_name'
    when '3','version',/program_?version/
      key = 'program_version'
    when '4'
      key = 'archive_type'
    when '5','dir'
      key = 'base_dir'
    when '6'
      key = 'program_name'
    when '7'
      key = 'program_full_name'
    when '8','program_full_path'
      key = 'program_path'
    end
    # ===================================================================== #
    # Store in the internal Hash. The internal Hash must always exist,
    # for this to work.
    # ===================================================================== #
    @internal_hash[:yaml_dataset][key] = new_value
  end
end
set_installation_steps(i) click to toggle source
#

set_installation_steps

#
# File lib/rbt/cookbooks/class/set.rb, line 605
def set_installation_steps(i)
  set(:installation_steps, i)
end
set_keep_extracted(i) click to toggle source
#

set_keep_extracted

#
# File lib/rbt/cookbooks/class/set.rb, line 242
def set_keep_extracted(i)
  set(:keep_extracted, i)
end
Also aliased as: keep_extracted=
set_last_update(i) click to toggle source
#

set_last_update

#
# File lib/rbt/cookbooks/class/set.rb, line 384
def set_last_update(i)
  set(:last_update, i)
end
set_libexec(i) click to toggle source
#

set_libexec

#
# File lib/rbt/cookbooks/class/set.rb, line 1268
def set_libexec(i)
  set(:libexec, i)
end
Also aliased as: libexec=
set_libraries(i) click to toggle source
#

set_libraries

#
# File lib/rbt/cookbooks/class/set.rb, line 148
def set_libraries(i)
  set(:libraries, i)
end
set_licence(i) click to toggle source
#

set_licence

#
# File lib/rbt/cookbooks/class/set.rb, line 398
def set_licence(i)
  set(:licence, i)
end
Also aliased as: set_license
set_license(i)
Alias for: set_licence
set_make_options(i)
set_make_use_of_aliases_kept_in_the_file_cookbook_aliases(i) click to toggle source
#

set_make_use_of_aliases_kept_in_the_file_cookbook_aliases

#
# File lib/rbt/cookbooks/class/set.rb, line 436
def set_make_use_of_aliases_kept_in_the_file_cookbook_aliases(i)
  case i
  when :nope, :user_disabled_this_setting_via_the_commandline
    i = false
  end
  @internal_hash[:make_use_of_aliases_kept_in_the_file_cookbook_aliases] = i
end
set_may_we_modify_the_configure_options(i) click to toggle source
#

set_may_we_modify_the_configure_options

#
# File lib/rbt/cookbooks/class/set.rb, line 1163
def set_may_we_modify_the_configure_options(i)
  set(:may_we_modify_the_configure_options, i)
end
set_md5sum(i) click to toggle source
#

set_md5sum

#
# File lib/rbt/cookbooks/class/set.rb, line 235
def set_md5sum(i)
  set(:md5sum, i)
end
set_meson_configure_options(i) click to toggle source
#

set_meson_configure_options

#
# File lib/rbt/cookbooks/class/set.rb, line 1170
def set_meson_configure_options(i)
  set(:meson_configure_options, i)
end
Also aliased as: meson_configure_options=
set_modify_the_makefile(i) click to toggle source
#

set_modify_the_makefile

#
# File lib/rbt/cookbooks/class/set.rb, line 1296
def set_modify_the_makefile(i)
  set(:modify_the_makefile, i)
end
set_original_unmodified_name(i) click to toggle source
#

set_original_unmodified_name

#
# File lib/rbt/cookbooks/class/set.rb, line 928
def set_original_unmodified_name(i)
  i = i.dup if i
  @internal_hash[:original_unmodified_name] = i
end
set_parameters_to_make(i) click to toggle source
#

set_parameters_to_make

#
# File lib/rbt/cookbooks/class/set.rb, line 1207
def set_parameters_to_make(i)
  set(:parameters_to_make, i)
end
Also aliased as: set_make_options
set_pkgconfig_files(i) click to toggle source
#

set_pkgconfig_files

#
# File lib/rbt/cookbooks/class/set.rb, line 186
def set_pkgconfig_files(i)
  unless i.is_a? Array
    i = [i].compact
  end
  set(:pkgconfig_files, i)
end
Also aliased as: pkgconfig_files=
set_postinstall(i) click to toggle source
#

set_postinstall

#
# File lib/rbt/cookbooks/class/set.rb, line 803
def set_postinstall(i)
  set(:postinstall, i)
end
set_postinstallation(i)
Alias for: set_postinstall
set_pre_configure_steps(i) click to toggle source
#

set_pre_configure_steps

#
# File lib/rbt/cookbooks/class/set.rb, line 1282
def set_pre_configure_steps(i)
  set(:pre_configure_steps, i)
end
set_pre_make_commands(i) click to toggle source
#

set_pre_make_commands

#
# File lib/rbt/cookbooks/class/set.rb, line 212
def set_pre_make_commands(i)
  set(:pre_make_commands, i)
end
set_prefix(i = '/usr/') click to toggle source
#

set_prefix

Use this method to set towards a specific prefix, such as '/usr/'.

This is then the option that will be passed into scripts such as 'configure' or cmake-based systems.

#
# File lib/rbt/cookbooks/class/set.rb, line 686
def set_prefix(i = '/usr/')
  case i
  when :appdir
    i = return_appdir_path
  end
  set(:prefix, i)
end
Also aliased as: prefix=, prefix_to_use=
set_preinstall(i) click to toggle source
#

set_preinstall

#
# File lib/rbt/cookbooks/class/set.rb, line 777
def set_preinstall(i)
  set(:preinstall, i)
end
Also aliased as: preinstall=
set_program( i = return_program_name )
Alias for: set_program_name
set_program_compile_name(i) click to toggle source
#

set_program_compile_name

#
# File lib/rbt/cookbooks/class/set.rb, line 350
def set_program_compile_name(i)
  set(:program_compile_name, i)
end
set_program_full_name( i = return_program_full_name ) click to toggle source
#

set_program_full_name

We combine program_name? and archive_type? here.

#
# File lib/rbt/cookbooks/class/set.rb, line 28
def set_program_full_name(
    i = return_program_full_name
  )
  case i
  when :default
    i = return_program_full_name
  end
  set(:program_full_name, i) 
end
Also aliased as: build_program_full_name
set_program_name( i = return_program_name ) click to toggle source
#

set_program_name (entry number 6)

The program name of a program might be something such as this:

gnome-mahjonng-5.08
file-5.05

So in other words, this is entry number (6) and it will combine the two entries (2) and (3):

short_name?+'-'+program_version?

A '-' is usually required as separator for a proper “program_name” entry, about at the least in 99.5% of the programs out there in the wild. They usually include a '-' as part of the program name. Note that there are some weird exceptions such as “boost_1_59_0”.

Consistently use this and ONLY this method when modifying the 'program_name' entry in the main dataset.

One more question should be answered - why do we use real_short_name? rather than short_name?

We need to use real_short_name? because some other settings may require input without any '-' as part of their name.

Some other programs require to have a '_' as part of the program name.

This can lead to problems such as for those programs that have a _ as part of their name. A good example is the name “e_dbus”, which includes includes a '_' token as part of its name.

In Jan 2014, I realized that eliminating '_' is too much of a hassle, so I disabled it again. I will retain the explanation above though, in the event that future programmers - or future me - may encounter similar problems.

#
# File lib/rbt/cookbooks/class/set.rb, line 647
def set_program_name(
    i = return_program_name
  )
  # ======================================================================= #
  # A program name never has a '/'.
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i)
  end
  i = remove_file_extension(i) if i.include? '.' # <- Added this as of Nov 2013.
  case i
  when 'URL_REPLACE_UNDERSCORE'
    i = url?.to_s.dup
  when '', nil, :assemble, :guess # Then we assemble it for these two conditions.
    assemble_program_name # In these cases, we will try to guess the name.
  end
  i = i.to_s.dup
  # if i.include?('_') and !i.include?('-')
  #   i.tr!('_','-')
  # end # ^^^ this line would break artemis.
  set(:program_name, i)  
end
Also aliased as: program_name=, set_program
set_program_path(i) click to toggle source
#

set_program_path (8 tag)

The program_path is composed of these two elements:

- base_dir?
- program_full_name?

It would look like this:

'/Users/x/SRC/gnomemahjongg/gnome-mahjonng-5.08.tar.xz'

In other words, it will add (5) + (7).

It is the most important entry, containing everything - which is the major goal for the class here.

The full program_path will look such as:

'/Users/x/SRC/file/file-5.08.tar.xz'
'/Users/x/SRC/gnomemahjongg/gnome-mahjonng-5.08.tar.xz'

The two main components are thus:

(5) base_dir,          such as: "/Users/x/SRC/file/"
(7) program_full_name, such as: "file-5.08.tar.xz"
#
# File lib/rbt/cookbooks/class/set.rb, line 1147
def set_program_path(i)
  set(:program_path, i)
end
set_program_short_name( i = short_name? )
Alias for: set_real_short_name
set_program_version(i) click to toggle source
#

set_program_version (version tag)

This method will set the program_version.

As of January 2019, this method will also eliminate all '/' from the input. A proper program version does not have this character.

Use this method whenever you wish to modify the version of the program, which is entry number (3), like:

"5.08"
#
# File lib/rbt/cookbooks/class/set.rb, line 984
def set_program_version(i)
  i = i.to_s.dup # Work on a copy.
  i.delete!('/')        if i.include? '/'
  i.sub!(/-source$/,'') if i.include? '-source'
  i.sub!(/\.src/,'')    if i.include? '.src'
  i.sub!(/-Source/,'')  if i.include? '-Source'
  i = chop_off_archive(i)
  i = remove_file_suffix(i) # Added this as of Jan 2014.
  if i.include? '#' # This is an illegal character as of Apr 2014.
    i = i[0, i.index('#')]
  end
  set(:program_version, i)
end
set_program_version=(i)
Alias for: set_program_version
set_programs_dir(i = '/Programs/') click to toggle source
#

set_programs_dir

This can set to another directory than '/Programs'.

#
# File lib/rbt/cookbooks/class/set.rb, line 228
def set_programs_dir(i = '/Programs/')
  @internal_hash[:programs_dir] = i
end
Also aliased as: programs_dir=
set_raw_description(i) click to toggle source
#

set_raw_description

#
# File lib/rbt/cookbooks/class/set.rb, line 415
def set_raw_description(i)
  set(:raw_description, i.to_s.dup) # Keep a reference-copy to the original description here.
end
set_real_program_name=( i, also_set_other_names = true )
Alias for: set_short_name
set_real_short_name( i = short_name? ) click to toggle source
#

set_real_short_name

This method should be used to set the value for the 'real_short_name'.

The real short name entry entry may not include any '-' characters.

Since Jan 2014 we also get rid of '_' characters - this is experimental though and may be subject to change.

#
# File lib/rbt/cookbooks/class/set.rb, line 1010
def set_real_short_name(
    i = short_name? # 1 tag
  )
  if i
    i = i.to_s.dup # Work on a copy to avoid side-effects.
    i.delete!('-') if i.include? '-'
    i.delete!('_') if i.include? '_'
  end
  set(:real_short_name, i)
end
set_required_deps_on(i) click to toggle source
#

set_required_deps_on

Set the required dependencies for a program through this method.

Note that this method will not do any sanitizing - you have to sanitize the input on your own prior to calling this method.

#
# File lib/rbt/cookbooks/class/set.rb, line 452
def set_required_deps_on(i)
  set(:required_deps_on, i)
end
set_run_configure(i) click to toggle source
#

set_run_configure

#
# File lib/rbt/cookbooks/class/set.rb, line 598
def set_run_configure(i)
  set(:run_configure, i)
end
set_run_make(i) click to toggle source
#

set_run_make

#
# File lib/rbt/cookbooks/class/set.rb, line 1303
def set_run_make(i)
  set(:run_make, i)
end
set_search_for_this_program( i = DEFAULT_ENTRY ) click to toggle source
#

set_search_for_this_program

Set the main program to work with. In other words, we will seek this program in the cookbooks “database”.

This should always be at least a String.

Keep in mind that the input to this method may also be in the form of a String such as “php.yml”. In that case, we have to get rid of the trailing '.yml' part.

Additionally, do note that the input could be a binary name or a library name. In these two cases, we may overrule the input provided but this can be configured via some settings.

Since as of Sep 2012, aliases can overrule this setting. This however may lead to problems, such as “make” suddenly becoming “makeinfo” rather than being kept as make.

#
# File lib/rbt/cookbooks/class/set.rb, line 827
def set_search_for_this_program(
    i = DEFAULT_ENTRY
  )
  i = i.keys.first if i.is_a? Hash
  i.flatten! if i.is_a? Array # Keep it flattened.
  i = DEFAULT_ENTRY if i.nil?
  i = i.first if i.is_a? Array
  i = i.to_s.dup
  set_original_unmodified_name(i)
  i.downcase! # Work on a reference copy that is also downcased.
  # ======================================================================= #
  # Pass the input into the menu() here, but only if we will use the
  # menu interface.
  # ======================================================================= #
  menu(i) if @use_menu_interface
  i.delete!('-_') # Neither '-' nor '_' are allowed as input.
  if i.include? '.'
    i.sub!(/#{File.extname(i)}/,'')
  end
  # ======================================================================= #
  # We will also chop off trailing '/' characters. A trailing '/' is
  # assumed to have been a typo. Nobody will call a file or input
  # program something such as 'libgweather/'.
  # ======================================================================= #
  i.chop! if i.end_with? '/'
  # ======================================================================= #
  # === Next check for entries that lack a leading 'lib' entry
  # ======================================================================= #
  unless does_include?(i, :do_not_check_for_aliases)
    if does_include?("lib#{i}", :do_not_check_for_aliases)
      opnn; e "The given input #{sfancy(i)} is not included "\
              "but #{sfancy('lib'+i)} is."
      opnn; e 'Thus using this as the new input next.'
      i.prepend('lib')
    end
  end
  all_binaries  = all_binaries?
  all_libraries = all_libraries?
  # ======================================================================= #
  # === Handle possible binary names next
  #
  # Here we will check for binary names of programs, but only if the input
  # has not yet been found as regular name of a registered program at
  # hand. As this is not always needed anyway, we will use various checks
  # to make sure that we really want to find a binary name.
  #
  # In order to test this, try:
  #   cookbooks2 xmlif
  #   ry xmlif
  # ======================================================================= #
  if !does_include?(i) and check_for_binary_names? and
     all_binaries.has_key?(i) and (i != all_binaries[i]) and
     (!i.empty?)
    new_name = all_binaries[i]
    report_binary_or_library_program_name(i, new_name, :binary)
    i = new_name
  # ======================================================================= #
  # === Check for library names
  #
  # Similar reasoning applies to this entry point, as to the one above
  # for binary names.
  # ======================================================================= #
  elsif !does_include?(i) and check_for_library_names? and
     all_libraries.has_key?(i) and (i != all_libraries[i])
    new_name = all_libraries[i]
    report_binary_or_library_program_name(i, new_name, :library)
    i = new_name
  end
  # ======================================================================= #
  # === Check for Abbreviations if the key was not found
  # ======================================================================= #
  unless does_include?(i, :do_not_check_for_aliases)
    unless i.empty?
      # =================================================================== #
      # Ok, we did not find anything, so check for abbreviations.
      # =================================================================== #
      available_programs = available_programs?
      require 'abbrev' unless Object.const_defined? :Abbrev
      abbrevs = Abbrev.abbrev(available_programs)
      if abbrevs.has_key? i
        # ================================================================= #
        # Ok, this means that our key is included.
        # ================================================================= #
        i = abbrevs.fetch(i)
      end
    end
  end
  # ======================================================================= #
  # Next, set it but not if it is empty.
  # ======================================================================= #
  unless i.empty?
    @internal_hash[:search_for_this_program] = i
  end
end
set_search_term( i = DEFAULT_ENTRY )
set_sed(i) click to toggle source
#

set_sed

#
# File lib/rbt/cookbooks/class/set.rb, line 120
def set_sed(i)
  set(:sed, i)
end
Also aliased as: sed=
set_seek_this_program( i = DEFAULT_ENTRY )
set_short_desc(i = nil)
set_short_description(i = nil) click to toggle source
#

set_short_description

The short_description entry should not end with a newline.

#
# File lib/rbt/cookbooks/class/set.rb, line 301
def set_short_description(i = nil)
  i.chomp! if i # We do not want trailing newlines.
  set(:short_description, i)
end
Also aliased as: set_short_desc
set_short_name( i, also_set_other_names = true ) click to toggle source
#

set_short_name

This method will set the short_name entry in the main yaml_dataset.

The 'short_name' variable is allowed to include the '-' character, and if the '-' character is part of the program name in question, such as for a program like “gnome-commander”, then it must be retained in the method set_short_name() here.

Numbers will be retained as well because they may be part of the short_name, such as for the program called “dzen2”.

For the variant without '-' please see to the method set_real_short_name() instead.

Valid input to this method could be something like:

"xfce4-dev-tools"
#
# File lib/rbt/cookbooks/class/set.rb, line 721
def set_short_name(
    i,             # 2 tag
    also_set_other_names = true
  )
  i = i.to_s.dup
  case also_set_other_names
  # ======================================================================= #
  # === :cascade_downwards
  # ======================================================================= #
  when :cascade_downwards,
       :cascade,
       :propagate_towards_real_short_name,
       :also_set_other_names
    also_set_other_names = true
  # ======================================================================= #
  # === :do_not_cascade
  # ======================================================================= #
  when :do_not_cascade
    also_set_other_names = false
  end
  # ======================================================================= #
  # === Get rid of '/'
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i)
  end
  # ======================================================================= #
  # If the input includes .tar, check it further.
  # ======================================================================= #
  if i.include?('.tar')
    i = ::ProgramInformation.return_short_name(i)
  end
  set(:short_name, i)
  # ======================================================================= #
  # We can propagate only into (1) from this method, which is the
  # 'real_short_name' again.
  # ======================================================================= #
  if also_set_other_names
    set_real_short_name(i)      # By default, sync when setting short_name.
    set_program_compile_name(i) # Also sync it here.
  end
end
Also aliased as: set_real_program_name=
set_skip_configure(i) click to toggle source
#

set_skip_configure

#
# File lib/rbt/cookbooks/class/set.rb, line 591
def set_skip_configure(i)
  set_run_configure(!i)
end
set_tags(i) click to toggle source
#

set_tags

#
# File lib/rbt/cookbooks/class/set.rb, line 155
def set_tags(i)
  set(:tags, i)
end
set_this_archive( i = DEFAULT_ARCHIVE_TYPE )
Alias for: set_archive_type
set_url1(i) click to toggle source
#

set_url1

#
# File lib/rbt/cookbooks/class/set.rb, line 936
def set_url1(i)
  set(:url1, i)
end
set_url2(i) click to toggle source
#

set_url2

#
# File lib/rbt/cookbooks/class/set.rb, line 325
def set_url2(i)
  set(:url2, i)
end
set_use_autogen()
Alias for: use_autogen
set_use_build_directory(i) click to toggle source
#

set_use_build_directory

#
# File lib/rbt/cookbooks/class/set.rb, line 162
def set_use_build_directory(i)
  set(:use_build_directory, i)
end
Also aliased as: use_build_directory=
set_use_glib_schema(i = nil) click to toggle source
#

set_use_glib_schema

#
# File lib/rbt/cookbooks/class/set.rb, line 196
def set_use_glib_schema(i = nil)
  if i
    set(:use_glib_schema, i)
  end
end
Also aliased as: use_glib_schema=
set_use_menu_interface( i = :bypass_menu ) click to toggle source
#

set_use_menu_interface

This method allows you to bypass the menu-interface.

#
# File lib/rbt/cookbooks/class/class.rb, line 447
def set_use_menu_interface(
    i = :bypass_menu
  )
  case i
  when :bypass_menu, :bypass_menu_check, :skip_menu_interface
    i = false
  end
  @use_menu_interface = i
end
set_use_this_build_directory(i) click to toggle source
#

set_use_this_build_directory

#
# File lib/rbt/cookbooks/class/set.rb, line 134
def set_use_this_build_directory(i)
  set(:use_this_build_directory, i)
end
Also aliased as: use_this_build_directory=
set_use_this_build_system( i = :default ) click to toggle source
#

set_use_this_build_system

This method will set the build-system that should be used for the given program at hand. By default we will infer automatically, with the default being set to the Symbol called :infer_automatically.

#
# File lib/rbt/cookbooks/class/set.rb, line 947
def set_use_this_build_system(
    i = :default
  )
  case i
  when :default
    i = :infer_automatically
  end
  set(:use_this_build_system, i)
end
set_use_this_connective_token(i = '-') click to toggle source
#

set_use_this_connective_token

#
# File lib/rbt/cookbooks/class/set.rb, line 391
def set_use_this_connective_token(i = '-')
  @internal_hash[:use_this_connective_token] = i
end
set_use_this_make_command(i) click to toggle source
#

set_use_this_make_command

#
# File lib/rbt/cookbooks/class/set.rb, line 466
def set_use_this_make_command(i)
  set(:use_this_make_command, i)
end
Also aliased as: use_this_make_command=
set_use_this_make_install_command(i) click to toggle source
#

set_use_this_make_install_command

#
# File lib/rbt/cookbooks/class/set.rb, line 1289
def set_use_this_make_install_command(i)
  set(:use_this_make_install_command, i)
end
set_version(i)
Alias for: set_program_version
set_yaml_dataset(i = nil) click to toggle source
#

set_yaml_dataset

Keep track of the yaml_dataset through this method.

#
# File lib/rbt/cookbooks/class/dataset.rb, line 39
def set_yaml_dataset(i = nil)
  case i
  when :clear, :reset
    i = {} # Must be a Hash.
  end
  ihash[:yaml_dataset] = i
end
shall_we_display_the_md5sum?() click to toggle source
#

shall_we_display_the_md5sum?

Query whether we shall display the md5sum or whether we shall not.

#
# File lib/rbt/cookbooks/class/class.rb, line 163
def shall_we_display_the_md5sum?
  ihash?[:shall_we_display_the_md5sum]
end
Also aliased as: display_md5sum?
short_desc?()
Alias for: short_description?
short_description?() click to toggle source
#

short_description?

This method will obtain the short description of a given program.

Not every program will have a short description, but it is recommended that all programs SHOULD have a short description.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 460
def short_description?
  obtain(:short_description)
end
Also aliased as: short_desc?
short_name()
Alias for: short_name?
short_name?() click to toggle source
#

short_name?

This method queries the short name of the program we are trying to find.

For example, this method will return the program name without the version, such as:

"ruby" (which is part of the program_name "ruby-2.2.0")

This method must always return a String, even if it is an empty String.

Characters such as '-' are allowed to be part of the short_name variable.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 556
def short_name?
  obtain(:short_name)
end
short_program_name?()
Alias for: short_name?
shortname?()
Alias for: short_name?
show_all_about( show_this_program = search_for_this_program? ) click to toggle source
#

show_all_about

#
# File lib/rbt/cookbooks/class/class.rb, line 609
def show_all_about(
    show_this_program = search_for_this_program?
  )
  require 'rbt/utility_scripts/show_all_about.rb'
  RBT::ShowAllAbout.new(show_this_program)
end
show_all_available_program() click to toggle source
#

show_all_available_program

To invoke this method, do:

cookbook --available_programs?
#
# File lib/rbt/cookbooks/class/feedback/feedback.rb, line 31
def show_all_available_program
  _ = available_programs?
  _.each_with_index {|name_of_the_program, index| index += 1
    e (index.to_s+')').rjust(5)+' '+sfancy(name_of_the_program)
  }
end
show_available_aliases() click to toggle source
#

show_available_aliases

To invoke this method, do:

cookbooks --aliases?
#
# File lib/rbt/cookbooks/class/class.rb, line 424
def show_available_aliases
  _ = RBT.cookbook_aliases?
  opnn; e "The available #{sfancy(_.size.to_s)} aliases are:"
  index = 0
  _.each_pair {|key, value| index += 1
    colourized_index = slateblue((index.to_s+')').rjust(5))
    e colourized_index+' '+sfancy(key.ljust(18))+
      mediumseagreen(' ->  ')+simp(value)
  }
end
show_configuration_options() click to toggle source
#

show_configuration_options

#
# File lib/rbt/cookbooks/class/class.rb, line 249
def show_configuration_options
  ShowConfigurationOptions.new # This is automatically required.
end
show_help() click to toggle source
#

show_help (help tag)

To invoke this particular method, try:

cookbook --help

To invoke individual entries, do:

cookbook nprograms?
cookbook --overview
cookbook --version
#
# File lib/rbt/cookbooks/class/help.rb, line 32
def show_help
  left_padding = '  ' # A bit of left-padding here.
  n_space_characters = 50
  how_to_invoke_the_program = HOW_TO_INVOKE_THE_PROGRAM
  opnn; e 'This class can feedback information about any '\
          'specific program.'
  e
  # ======================================================================= #
  # === Common usage examples
  # ======================================================================= #
  e 'Common usage examples:'
  e
  e left_padding+how_to_invoke_the_program+' ruby'
  e left_padding+how_to_invoke_the_program+' htop'
  e left_padding+how_to_invoke_the_program+' m4'
  e
  # ======================================================================= #
  # === Advanced Options
  # ======================================================================= #
  e 'Advanced options:'
  e
  e properly_pad_and_colourize_this_help_option('nprograms?',
      'show how many programs are registered in the cookbooks-collection'
    )
  e properly_pad_and_colourize_this_help_option('--aliases?',
      'show all available aliases to the registered cookbooks-programs'
    )
  e properly_pad_and_colourize_this_help_option('--available_programs?',
      'show all available programs'
    )
  e properly_pad_and_colourize_this_help_option('--batch-download-all-source-archives',
      'batch-download all source archives (optionally select for specific tags)'
    )
  e properly_pad_and_colourize_this_help_option('--overview',
      'give us an overview over all programs in the utility_scripts directory,'
    )
  e (' ' * n_space_characters)+'# of the cookbooks project'
  e properly_pad_and_colourize_this_help_option('--format=[name]',
      'feedback the format type of this entry,'
    )
  e (' ' * n_space_characters)+'# such as via '+simp('cookbook --format=postinstall')
  e properly_pad_and_colourize_this_help_option('--expand',
      'to expand the short yaml dataset into'
    )
  e properly_pad_and_colourize_this_help_option('--expand=PROGRAM_NAME',
      'to expand an individual program, such as python or ruby'
    )
  # ======================================================================= #
  # === --n-registered-binaries?
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--n-registered-binaries?',
      'to report how many registered binaries are available'
    )
  # ======================================================================= #
  # === --show-all-about=PROGRAM_NAME
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--show-all-about=PROGRAM_NAME',
      'to show all about the given program at hand'
    )
  e properly_pad_and_colourize_this_help_option('--permanently-disable-colours',
      'to permanently disable all colour output by the Cookbooks project'
    )
  e properly_pad_and_colourize_this_help_option('--update-kde-plasma',
      'batch-update (that is, download) all KDE5 components of KDE Plasma'
    )
  e (' ' * n_space_characters)+'# a long dataset; --initialize is an alias to this action'
  e properly_pad_and_colourize_this_help_option('--create-programs-version-html-file',
      'create and upload a .html file containing all '\
      'program_name-program_versions'
    )
  e (' ' * n_space_characters)+'# entries. This is primarily meant for my home system.'
  # ======================================================================= #
  # === --allowed_tags?
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--allowed_tags?',
     'show a list of all allowed tags in the '+simp('tags: subsection')+
     ' of a cookbook-yaml file'
    )
  # ======================================================================= #
  # === --generate_version_file
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--generate_version_file',
      'to generate a programs-version yaml file'
    )
  # ======================================================================= #
  # === --use-psych
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--use-psych',
      'to use psych for the yaml files'
    )
  # ======================================================================= #
  # === --use-syck
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--use-syck',
      'to use syck for the yaml files'
    )
  # ======================================================================= #
  # === --create-html-page-for-these-programs=
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--create-html-page-for-these-programs=',
      'to generate a .html page for the given programs; separate '\
      'the input via'
    )
  e (' ' * n_space_characters)+'# "'+sfancy(',')+'" such as in '+
    simp('=ruby,python,php')
  # ======================================================================= #
  # === --n_binaries?
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--n_binaries?',
      'tell us how many binaries/executables are tracked '\
      'in all cookbook-yaml files'
    )
  e properly_pad_and_colourize_this_help_option('--publish',
      'publish the list of all program versions of the cookbooks project'
    )
  e properly_pad_and_colourize_this_help_option('--total-size?',
      'show the total size of all locally available archives'
    )
  e properly_pad_and_colourize_this_help_option('--tutorial',
      'do show the short tutorial how the Cookbooks project may be used'
    )
  e properly_pad_and_colourize_this_help_option('--update-tags',
      'do update the tags defined in the various cookbooks'
    )
  e properly_pad_and_colourize_this_help_option('--validate-entries',
      'validate all Cookbook entries'
    )
  e properly_pad_and_colourize_this_help_option('--version',
      'feedback the current version of the Cookbooks gem'
    )
  e properly_pad_and_colourize_this_help_option('--set_source_dir=/tmp',
      'permanently set a new source dir (aka where all '\
      'archives are kept locally)'
    )
  e properly_pad_and_colourize_this_help_option('--set_temp_dir=/tmp',
      'permanently change the yaml file to set a '\
      'new temp directory'
    )
  e
end
show_n_programs_available() click to toggle source
#

show_n_programs_available

#
# File lib/rbt/cookbooks/class/class.rb, line 114
def show_n_programs_available
  e return_n_programs_available
end
show_path_to_the_source_directory_yaml_file() click to toggle source
#

show_path_to_the_source_directory_yaml_file

This method will simply show the path to the source_dir.yml file.

#
# File lib/rbt/cookbooks/class/class.rb, line 153
def show_path_to_the_source_directory_yaml_file
  _ = RBT.project_yaml_directory?+'source_dir.yml'
  e sfile(_)
end
show_tags() click to toggle source
#

show_tags

#
# File lib/rbt/cookbooks/class/class.rb, line 94
def show_tags
  e return_tags
end
show_this_array(array) click to toggle source
#

show_this_array

#
# File lib/rbt/cookbooks/class/report.rb, line 238
def show_this_array(array)
  # ======================================================================= #
  # Determine the threshold value to use for this display.
  # ======================================================================= #
  threshold_value = 68
  left_pad = '  '
  ljust_value = 28
  array.each {|entry|
    case entry
    # ===================================================================== #
    # === :use_this_build_system
    # ===================================================================== #
    when :use_this_build_system
      result = send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s.dup
      result.prepend(':') if result == 'infer_automatically'
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        mediumpurple(result)
    # ===================================================================== #
    # === use_autogen
    # ===================================================================== #
    when :use_autogen
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        cadetblue(
          yes_or_no(
            send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s
          )
        )
    # ===================================================================== #
    # === extract_to
    # ===================================================================== #
    when :extract_to
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        mediumpurple(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)+rev
    # ===================================================================== #
    # === sed
    # ===================================================================== #
    when :sed
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        mediumturquoise(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === description
    #
    # Handle the description entry here.
    # ===================================================================== #
    when :description
      result = description?.chomp.rstrip
      if (result.size > threshold_value)
        result = result.tr("\n",' ')[0..(threshold_value-2)]+' [...]'
      end
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        limegreen(result)+rev
    # ===================================================================== #
    # === short_description
    # ===================================================================== #
    when :short_description
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        mediumturquoise(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === run_configure
    # ===================================================================== #
    when :run_configure
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        olivedrab(
          yes_or_no(send_this_method_and_sanitize_arrays(entry.to_s+'?')).to_s
        )
    # ===================================================================== #
    # === has_to_be_compiled
    # ===================================================================== #
    when :has_to_be_compiled
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        steelblue(
          yes_or_no(send_this_method_and_sanitize_arrays(entry.to_s+'?')).to_s
        )
    # ===================================================================== #
    # === skip_configure
    # ===================================================================== #
    when :skip_configure
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        mediumorchid(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === archive_size
    # ===================================================================== #
    when :archive_size,
         :file_size,
         :program_size # colourize program_size.
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        mediumorchid(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === homepage
    # ===================================================================== #
    when :homepage
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        cadetblue(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === program_name
    # ===================================================================== #
    when :program_name
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        mediumslateblue(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === program_compile_name
    # ===================================================================== #
    when :program_compile_name
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        mediumslateblue(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
    # ===================================================================== #
    # === extra_information
    # ===================================================================== #
    when :extra_information
      # =================================================================== #
      # === Handle extra_information
      #
      # Next, limit the size for extra_description. We do not want to show
      # too much here.
      # =================================================================== #
      result = send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s
      if self.class.honour_threshold_value?
        if (result.size > threshold_value)
          result = result[0, result.index("\n")].delete('"')+' [...]'
        end
      end
      result.chomp!
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        darkslateblue(result)
    # ===================================================================== #
    # === program_path
    # ===================================================================== #
    when :program_path
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        orange(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === configure_options
    # ===================================================================== #
    when :configure_options
      unless configure_options?.empty?
        e "#{left_pad}#{entry}: ".ljust(ljust_value)+
          mediumseagreen(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)+rev
      end
    # ===================================================================== #
    # === meson_configure_options
    # ===================================================================== #
    when :meson_configure_options
      if meson_configure_options?
        unless meson_configure_options.empty?
          e "#{left_pad}#{entry}: ".ljust(ljust_value)+
            mediumseagreen(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)+rev
        end
      end
    # ===================================================================== #
    # === do_not_symlink
    # ===================================================================== #
    when :do_not_symlink
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        lightslategray(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === keep_extracted
    # ===================================================================== #
    when :keep_extracted
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
       seagreen(
         yes_or_no(
           send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s
         )
       )
    # ===================================================================== #
    # === last_update
    # ===================================================================== #
    when :last_update
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        cornflowerblue(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === prefix
    # ===================================================================== #
    when :prefix
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        darkseagreen(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === program_version
    # ===================================================================== #
    when :program_version
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        springgreen(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === url1
    # ===================================================================== #
    when :url1,:url2,:url3,:url4,:url5
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        sandybrown(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === pkgconfig_files
    # ===================================================================== #
    when :pkgconfig_files
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        deepskyblue(send_this_method_and_sanitize_arrays(entry.to_s+'?').to_s)
    # ===================================================================== #
    # === headers
    # ===================================================================== #
    when :headers
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        darkseagreen(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
    # ===================================================================== #
    # === md5sum
    # ===================================================================== #
    when :md5sum
      if show_md5sum?
        e "#{left_pad}#{entry}: ".ljust(ljust_value)+
          sfancy(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
      end
    # ===================================================================== #
    # === remote_url
    # ===================================================================== #
    when :remote_url
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
    # ===================================================================== #
    # === program_full_name
    # ===================================================================== #
    when :program_full_name
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
    # ===================================================================== #
    # === base_dir
    # ===================================================================== #
    when :base_dir
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
    # ===================================================================== #
    # === real_short_name
    # ===================================================================== #
    when :real_short_name
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
    # ===================================================================== #
    # === archive_type
    # ===================================================================== #
    when :archive_type
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
    # ===================================================================== #
    # === short_name
    #
    # Is steelblue.
    # ===================================================================== #
    when :short_name
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        steelblue(send_this_method_and_sanitize_arrays(entry.to_s+'?'))
    else
      e "#{left_pad}#{entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays(entry.to_s+'?')).to_s
    end
  }
end
size()
Alias for: archive_size?
size?()
Alias for: archive_size?
skip_configure()
Alias for: skip_configure?
skip_configure?() click to toggle source
#

skip_configure?

Query-method over as to whether we will skip configure or whether we will not.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 763
def skip_configure?
  !run_configure?
end
Also aliased as: skip_configure
sname?()
Alias for: short_name?
sort_by_archive_priority(i) click to toggle source
#

sort_by_archive_priority

#
# File lib/rbt/cookbooks/class/misc.rb, line 16
def sort_by_archive_priority(i)
  array_priority = [
    '.xz',
    '.bz2',
    '.gz',
    '.lz',
    '.gem'
  ]
  begin
    selection = i.select {|entry|
      entry.include?('.') and is_an_archive?(entry)
    }
    i = selection.sort_by {|entry|
      extname = File.extname(entry)
      if array_priority.include? extname
        entry = array_priority.index(extname)
      end
      entry
    }
  rescue ArgumentError => error
    opnn; e 'An error occurred in the method '+
            slateblue(__method__.to_s)+'. (Line: '+royalblue(__LINE__)+')'
    pp i
    pp error
    exit
  end
  i
end
stored_where?()
Alias for: program_path?
substitute_macros(input) click to toggle source
#

substitute_macros

Do “macro” expansion with this method. We will sanitize some variables, which we assume were meant to be “macros” - that is, to be substituted with another value..

Right now this is only used for kernel variable, PROGRAM_NAME, PNAME, NAME, KERNEL_V and PROGRAM_VERSION but maybe someone else wants to do more macro processing, so we will keep this bundled here together.

#
# File lib/rbt/cookbooks/class/class.rb, line 535
def substitute_macros(input)
  if input.is_a? Array
    input.map {|entry| substitute_macros(entry) } # Recursive call.
  else
    i = input.to_s.dup # Work on a new copy here.
    if i.include? 'PROGRAM_VERSION'
      i.gsub!(/PROGRAM_VERSION/, program_version?)
    end
    if i.include? 'PNAME'
      i.gsub!(/PNAME/,           short_name?)
    elsif i.include? 'NAME'
      i.gsub!(/NAME/,            short_name?)
    elsif i.include? 'PROGRAM_NAME'
      i.gsub!(/PROGRAM_NAME/,    short_name?)
    end
    if ENV['KERNEL_V'] && i.include?('KERNEL_V')
      i.gsub!(/#{i}/, ENV['KERNEL_V'])
    end
    i
  end
end
svn_url?() click to toggle source
#

svn_url?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 849
def svn_url?
  obtain(:svn_url)
end
sync_archive_type_entries() click to toggle source
#

sync_archive_type_entries

This method will sync archive-type entries.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 444
def sync_archive_type_entries
  reassemble_program_full_name
  reassemble_program_path
end
sync_yaml_dataset_down_one_level( this_program = seek_which_program? ) click to toggle source
#

sync_yaml_dataset_down_one_level

#
# File lib/rbt/cookbooks/class/dataset.rb, line 57
def sync_yaml_dataset_down_one_level(
    this_program = seek_which_program?
  )
  dataset = ihash[:yaml_dataset]
  # ======================================================================= #
  # Obtain the dataset, through the pointer to the program being sought.
  # ======================================================================= #
  shortened_dataset = dataset[this_program]
  ensure_that_this_hash_has_only_valid_keys(shortened_dataset) # Must come early.
  update_yaml_dataset(shortened_dataset)
  # ======================================================================= #
  # Next, remove the old pointer.
  # ======================================================================= #
  dataset.delete(this_program)
  # ======================================================================= #
  # We can also sync towards real_short_name, since real_short_name
  # is the variant without any '-' characters. We can not yet determine
  # short_name though.
  # ======================================================================= #
  set_real_short_name(this_program)
end
tags()
Alias for: tags?
tags?() click to toggle source
#

tags?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 191
def tags?
  obtain(:tags)
end
Also aliased as: return_tags, tags
the_program_is_included() click to toggle source
#

the_program_is_included

This method will set-toggle that the program we are looking for, is included; aka that it was found.

#
# File lib/rbt/cookbooks/class/class.rb, line 491
def the_program_is_included
  @internal_hash[:is_the_program_included] = true
end
this_program_was_not_found(i) click to toggle source
#

this_program_was_not_found

#
# File lib/rbt/cookbooks/class/class.rb, line 460
def this_program_was_not_found(i)
  unless i.to_s.empty?
    opnn; e "The program #{sfancy(i.to_s)} does not appear to be registered."
  end
end
to_bool(i) click to toggle source
#

to_bool

#
# File lib/rbt/cookbooks/class/class.rb, line 101
def to_bool(i)
  case i
  when 't','true','yes','y'
    return true
  when 'f','false','no','n'
    return false
  end
  i
end
Also aliased as: to_boolean
to_boolean(i)
Alias for: to_bool
try_to_guess_the_archive_type() click to toggle source
#

try_to_guess_the_archive_type

This method will try to guess the archive type, e. g. .tar.xz or .tar.gz of a given program at hand, based on which files may exist locally already.

#
# File lib/rbt/cookbooks/class/guess.rb, line 41
def try_to_guess_the_archive_type
  target = base_dir?+program_name?.downcase+'*'
  files = Dir[target]
  unless files.empty?
    first = files.first
    set_archive(return_archive_type(first))
  end # else we won't set it
end
try_to_guess_the_base_dir( i = source_dir?+ real_short_name?.downcase.delete('.')+ '/' )
Alias for: set_base_dir
try_to_guess_the_program_version( i = program_name? ) click to toggle source
#

try_to_guess_the_program_version

#
# File lib/rbt/cookbooks/class/guess.rb, line 53
def try_to_guess_the_program_version(
    i = program_name?
  )
  _program_name, program_version = ProgramInformation.new(i).return_name_and_version
  set_program_version(program_version)
end
try_to_sanitize_sed_entry() click to toggle source
#

try_to_sanitize_sed_entry (sed tag)

sed entry allows us to make some very simple replacements in files.

We will guarantee that it will be an Array.

#
# File lib/rbt/cookbooks/class/sanitize.rb, line 709
def try_to_sanitize_sed_entry
  # ======================================================================= #
  # Only sanitize the sed entry if we have that key.
  # ======================================================================= #
  if has_key? :sed
    if sed?
      _ = sed?
      _ = _.split(N) if _.is_a? String
      if _
        _ = [_] unless _.is_a? Array # Will be an Array.
        _.compact! # We don't want to store nil values here.
        set_sed(_)
      end
    end
  else
  end
end
update( i = search_which_program? )
update_appdir_prefix() click to toggle source
#

update_appdir_prefix

#
# File lib/rbt/cookbooks/class/set.rb, line 698
def update_appdir_prefix
  set_prefix(:appdir)
end
update_entries( key, new_value = nil )
Alias for: set_in_yaml_dataset
update_entry( key, new_value = nil )
Alias for: set_in_yaml_dataset
update_kde_applications() click to toggle source
#

update_kde_applications

#
# File lib/rbt/cookbooks/class/misc.rb, line 71
def update_kde_applications
  unless RBT::Cookbooks.const_defined? :UpdateKdeApplications
    require 'rbt/check_for_updates/update_kde_applications.rb'
  end
  UpdateKdeApplications.new
end
update_kde_framework() click to toggle source
#

update_kde_framework

#
# File lib/rbt/cookbooks/class/class.rb, line 398
def update_kde_framework
  unless RBT::Cookbooks.const_defined? :UpdateKdeFramework
    require 'rbt/check_for_updates/update_kde_framework.rb'
  end
  UpdateKdeFramework.new
end
update_kde_plasma() click to toggle source
#

update_kde_plasma

Use this method, as delegation, in order to update the KDE5 plasma components.

#
# File lib/rbt/cookbooks/class/class.rb, line 388
def update_kde_plasma
  unless RBT::Cookbooks.const_defined? :UpdateKdePlasma
    require 'rbt/check_for_updates/update_kde_plasma.rb'
  end
  UpdateKdePlasma.new
end
update_kde_porting_aids() click to toggle source
#

update_kde_porting_aids

To invoke this, try:

cookbooks --update-kde-porting-aids
#
# File lib/rbt/cookbooks/class/class.rb, line 411
def update_kde_porting_aids
  unless RBT::Cookbooks.const_defined? :UpdateKdePortingAids
    require 'rbt/check_for_updates/update_kde_porting_aids.rb'
  end
  UpdateKdePortingAids.new
end
update_mate_desktop_components() click to toggle source
#

update_mate_desktop_components

Update mate-desktop via this method.

Invocation example:

cookbooks --update-mate
#
# File lib/rbt/cookbooks/class/misc.rb, line 86
def update_mate_desktop_components
  unless RBT::Cookbooks.const_defined? :CheckForMateDesktopUpdates
    require 'rbt/check_for_updates/check_for_mate_desktop_updates.rb'
  end
  CheckForMateDesktopUpdates.new
end
update_program_full_name( i = program_name?+archive_type? ) click to toggle source
#

update_program_full_name

This is:

'gnome-mahjonng-5.08.tar.xz', so this is program_name?+archive_type?
#
# File lib/rbt/cookbooks/class/set.rb, line 1114
def update_program_full_name(
    i = program_name?+archive_type?
  )
  set_program_full_name(i)
end
update_program_name( i = return_program_name )
update_program_path() click to toggle source
#

update_program_path

#
# File lib/rbt/cookbooks/class/set.rb, line 1154
def update_program_path
  set_program_path(
    base_dir?+program_full_name?
  )
end
Also aliased as: assemble_full_path
update_tags() click to toggle source
#

update_tags

This will simply update the tags, by tapping into the Cookbooks project.

#
# File lib/rbt/cookbooks/class/class.rb, line 320
def update_tags
  require 'cookbooks/utility_scripts/registered_tags.rb'
  RBT::Cookbooks::RegisteredTags.new
end
update_with_this_program( i = search_which_program? ) click to toggle source
#

update_with_this_program

This is a compound-method. It will first set the new program to be searched for; and then it will conditionally load the yaml dataset, if the program is included.

#
# File lib/rbt/cookbooks/class/dataset.rb, line 86
def update_with_this_program(
    i = search_which_program?
  )
  i = i.to_s.dup if i.frozen?
  i.delete!('-') if i.include? '-'
  if    i.end_with? '.yml'
    i.sub!(/\.yml$/,'')
  elsif i.end_with? '.pc'
    i.sub!(/\.pc$/,'')
  end
  set_search_for_this_program(i)
  load_yaml_dataset_from_this_file(i)
end
update_yaml_dataset(i) click to toggle source
#

update_yaml_dataset

This can be used to update the yaml dataset.

However had, for boolean values that are to be added, we will ALWAYS sanitize them, so that “t” becomes true, and “f” becomes false. But only if it is a boolean value.

#
# File lib/rbt/cookbooks/class/dataset.rb, line 114
def update_yaml_dataset(i)
  unless i.respond_to? :keys
    e 'A problem has been encountered. Showing some more information next:'
    cliner
    pp self
    cliner
  end
  the_size = i.keys.size
  if the_size > 1 # This check excludes Hashes that were not yet synced down one level.
    i.update(i) {|key, value|
      if is_a_boolean_configuration_value?(key)
        value = to_boolean(value)
      else
        value
      end
    }
  end
  ihash[:yaml_dataset].update(i) # .update() will replace in-place.
end
url1()
Alias for: url?
url1?()
Alias for: url?
url2()
Alias for: url2?
url2?() click to toggle source
#

url2?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 68
def url2?
  obtain(:url2)
end
Also aliased as: url2
url3()
Alias for: url3?
url3?() click to toggle source
#

url3?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 75
def url3?
  obtain(:url3)
end
Also aliased as: url3
url?() click to toggle source
#

url?

This method will “hold” the “most” important URL of a program, which is the entry called url1. Every entry of our cookbooks must have this entry available.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 364
def url?
  this_url = obtain(:url1).to_s
  return this_url
end
urls?() click to toggle source
#

urls?

This method will return all available URLs in Array format.

We only support 5 URLs at max right now. Since Jul 2012 we will not return empty values, as they are useless anyway.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 382
def urls?
  # ======================================================================= #
  # Build our Array that will hold all 5 URLs.
  # ======================================================================= #
  array = %w( url1 url2 url3 url4 url5 )
  _ = dataset?.values_at(*array) # We require the * here.
  _.compact!
  _.reject!(&:empty?) # We don't want empty entries, hence we filter them away.
  return _
end
Also aliased as: remote_urls, remote_urls?
use_autoconf=(i)
Alias for: set_autoconf
use_autoconf?() click to toggle source
#

use_autoconf?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 154
def use_autoconf?
  obtain(:use_autoconf)
end
use_autogen()
Also aliased as: use_autogen=, set_use_autogen
Alias for: use_autogen?
use_autogen=()
Alias for: use_autogen
use_autogen?() click to toggle source
#

use_autogen?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 97
def use_autogen?
  obtain(:use_autogen)
end
Also aliased as: use_autogen
use_build_dir?()
use_build_directory()
use_build_directory=(i)
use_build_directory?() click to toggle source
#

use_build_directory?

Query whether a build directory will be used for the given program at hand.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 932
def use_build_directory?
  obtain(:use_build_directory)
end
use_default_connective_token_again(i = '-')
use_glib_schema()
Alias for: use_glib_schema?
use_glib_schema=(i = nil)
Alias for: set_use_glib_schema
use_glib_schema?() click to toggle source
#

use_glib_schema?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 82
def use_glib_schema?
  obtain(:use_glib_schema)
end
Also aliased as: use_glib_schema
use_this_build_directory()
use_this_build_directory=(i)
use_this_build_directory?() click to toggle source
#

use_this_build_directory?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 940
def use_this_build_directory?
  obtain(:use_this_build_directory)
end
use_this_build_system()
use_this_build_system?() click to toggle source
#

use_this_build_system?

This method will query as to which build-system will be used for the given program at hand.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 951
def use_this_build_system?
  obtain(:use_this_build_system)
end
use_this_connective_token?() click to toggle source
#

use_this_connective_token?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 418
def use_this_connective_token?
  @internal_hash[:use_this_connective_token]
end
Also aliased as: connective_token?
use_this_make_command()
use_this_make_command=(i)
use_this_make_command?() click to toggle source
#

use_this_make_command?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 896
def use_this_make_command?
  obtain(:use_this_make_command)
end
use_this_make_install_command=(i)
use_this_make_install_command?() click to toggle source
#

use_this_make_install_command?

Which variant of “make install” we will use, if we will use a different variant that is.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 1093
def use_this_make_install_command?
  obtain(:use_this_make_install_command)
end
use_this_program_name() click to toggle source
#

use_this_program_name

#
# File lib/rbt/cookbooks/class/obtain.rb, line 346
def use_this_program_name
  obtain(:use_this_program_name).to_s
end
use_this_program_name_on_gobolinux?() click to toggle source
#

use_this_program_name_on_gobolinux?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 746
def use_this_program_name_on_gobolinux?
  obtain(:use_this_program_name_on_gobolinux).to_s
end
use_this_program_version(i = '1.52.1')
use_this_version=(i)
Alias for: set_program_version
use_which_build_system?()
use_which_make_command?()
use_word_wrap?()
Alias for: wrap_result?
valid_key?(key) click to toggle source
#

valid_key?

You can use this method to determine whether we have a specific, valid key or whether we don't.

#
# File lib/rbt/cookbooks/class/class.rb, line 85
def valid_key?(key)
  _ = true
  _ = false unless registered_cookbook_entries?.include? key.to_s # The key must be a String.
  return _
end
Also aliased as: is_a_valid_key?
version()
Alias for: program_version?
version?()
Alias for: program_version?
which_program?()
wrap_result?() click to toggle source
#

wrap_result?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 276
def wrap_result?
  @internal_hash[:wrap_result]
end
Also aliased as: use_word_wrap?
yaml_dataset?() click to toggle source
#

yaml_dataset?

Query method over the main dataset.

#
# File lib/rbt/cookbooks/class/obtain.rb, line 585
def yaml_dataset?
  @internal_hash[:yaml_dataset]
end
yaml_dataset_exists?() click to toggle source
#

yaml_dataset_exists?

#
# File lib/rbt/cookbooks/class/obtain.rb, line 514
def yaml_dataset_exists?
  ihash[:yaml_dataset]
end
yaml_file?() click to toggle source
#

yaml_file?

#
# File lib/rbt/cookbooks/class/class.rb, line 602
def yaml_file?
  "#{individual_cookbooks_directory?}#{search_which_program?}.yml"
end
yes_or_no(i) click to toggle source
#

yes_or_no

Return 'Yes.' or 'No.' through this method here.

#
# File lib/rbt/cookbooks/class/report.rb, line 527
def yes_or_no(i)
  case i
  when true,'true'
    'Yes.'
  when false,'false'
    'No.'
  end
end