class RBT::Cookbooks::RegisteredPkgconfigFiles

Constants

LOCATION_REGISTERED_PKGCONFIG_FILES
#

LOCATION_REGISTERED_PKGCONFIG_FILES

#
SHOW_PROGRAM_NAME
#

SHOW_PROGRAM_NAME

#

Public Class Methods

new( run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 51
def initialize(
    run_already = true
  )
  reset
  case run_already
  when :do_not_run_yet
    run_already = false
  end
  run if run_already
end

Public Instance Methods

create_yaml_file()
Alias for: save_yaml_file
location_pkgconfig_files?() click to toggle source
#

location_pkgconfig_files?

#
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 96
def location_pkgconfig_files?
  RBT.file_registered_pkgconfig_files
end
report_to_the_user_what_we_will_do() click to toggle source
#

report_to_the_user_what_we_will_do

#
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 86
def report_to_the_user_what_we_will_do
  opne "Obtaining Information about available pkgconfig "\
       "#{steelblue('.pc')} next."
  opne 'This may take a while.'
  opne 'Please be patient.'
end
reset() click to toggle source
#

reset

#
Calls superclass method RBT::Cookbooks::Registered#reset
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 65
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @hash_to_be_stored
  # ======================================================================= #
  @hash_to_be_stored = {} # This is the hash that will be stored.
  # ======================================================================= #
  # === @query
  # ======================================================================= #
  @query = nil
  # ======================================================================= #
  # === @try_to_use_the_expanded_cookbook_dataset_if_available
  # ======================================================================= #
  @try_to_use_the_expanded_cookbook_dataset_if_available = true
  @this_program = nil
end
return_pkgconfig_files_of_this_program(i) click to toggle source
#

return_pkgconfig_files_of_this_program

#
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 103
def return_pkgconfig_files_of_this_program(i)
  if @try_to_use_the_expanded_cookbook_dataset_if_available and
     does_this_expanded_cookbook_file_exist_for_this_program?(i)
    i = load_dataset_from_this_expanded_cookbook(i)
    headers = i['pkgconfig_files']
  else
    headers = RBT::Cookbooks::SanitizeCookbook.new(i) { :fast }.pkgconfig_files?
  end
  return headers
end
run() click to toggle source
#

run

#
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 117
def run
  report_to_the_user_what_we_will_do
  available_programs?.each { |program_name|
    pkgconfig_files = return_pkgconfig_files_of_this_program(program_name)
    if pkgconfig_files.nil?
      e "Nil value for #{sfancy(program_name)}."
      e 'Please correct this.'
      exit
    else
      unless pkgconfig_files.empty?
        if SHOW_PROGRAM_NAME # ← This constant is defined in the file registered.rb
          program_name = File.basename(program_name).sub(/\.yml$/,'')
          e program_name+
            steelblue(
              ' ['+
              pkgconfig_files.join(',').strip+
              ']'
            )
        end
        pkgconfig_files.each {|entry|
          @hash_to_be_stored[entry] = program_name
        }
      end
    end
  }
  save_yaml_file
end
save_yaml_file() click to toggle source
#

save_yaml_file

The method ‘save_yaml_file` will create the yaml file which lists our pkgconfig files (in hash format). Right now, we need to manually update this yaml file on our own.

#
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 152
def save_yaml_file
  what = YAML.dump(@hash_to_be_stored)
  into = location_pkgconfig_files?
  e sfancy('Storing yaml dataset in ')
  e "  #{sfile(into)}"
  write_what_into(what, into)
  if is_on_roebe?
    into = "#{ruby_src_dir_for_the_registered_yaml_files?}"\
           "#{File.basename(into)}"
    e 'Also storing into:'
    e
    e "  #{sfile(into)}"
    e
    write_what_into(what, into)
  end
end
Also aliased as: create_yaml_file
search_for_this_program( i = @this_program ) click to toggle source
#

search_for_this_program

Use this method to search for a specific program.

#
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 174
def search_for_this_program(
    i = @this_program
  )
  i = i.to_s
  opne "Searching for #{sfancy(i)} now:"
  hash = load_yaml(location_registered_pkgconfig_files?)
  if hash.keys.include? i
    opne "The pkgconfig file called `#{sfancy(i)}` was found."
    opne "It is part of the package → `#{simp(hash[i])}`."
  else
    opne p+' is '+swarn('NOT')+' included. We could not '\
            'find any program'
    opne 'including this program.'
  end
end