class RBT::Cookbooks::RegisteredHeaders
Constants
- SHOW_PROGRAM_NAME
#¶ ↑
SHOW_PROGRAM_NAME
¶ ↑Whether to show the program name as well, as we iterate over our dataset.
#¶ ↑
Public Class Methods
location?()
click to toggle source
Public Instance Methods
create_yaml_file( what = YAML.dump(@hash_to_be_stored), into = LOCATION_REGISTERED_HEADERS )
Alias for: save_yaml_file
iterate_over_the_available_programs()
click to toggle source
#¶ ↑
iterate_over_the_available_programs
¶ ↑
#¶ ↑
# File lib/rbt/registered/registered_headers.rb, line 161 def iterate_over_the_available_programs available_programs?.each {|program_name| headers = return_headers_of_this_program(program_name) unless headers.empty? if SHOW_PROGRAM_NAME opne "The program called #{sfancy(program_name)} has "\ "some header files (#{headers.size} of them)." end headers.each {|entry| if entry.include? ',' entry.split(',').each {|inner_entry| @hash_to_be_stored[inner_entry.dup] = program_name.dup } else @hash_to_be_stored[entry] = program_name.dup end } end } end
report_to_the_user_what_we_will_do()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
RBT::Cookbooks::Registered#reset
# File lib/rbt/registered/registered_headers.rb, line 92 def reset super() infer_the_namespace # ======================================================================= # # === @hash_to_be_stored # ======================================================================= # @hash_to_be_stored = {} # This is the hash that will be stored. # ======================================================================= # # === @try_to_use_the_expanded_cookbook_dataset_if_available # # This option should be significantly faster, so we will try to # make use of it. The drawback is that we may have outdated # data, if we did not update the expanded dataset for a long # time - but the speed advantage is a big reason in keeping # this set to true. # ======================================================================= # @try_to_use_the_expanded_cookbook_dataset_if_available = true end
return_headers_of_this_program(i)
click to toggle source
#¶ ↑
return_headers_of_this_program
¶ ↑
#¶ ↑
# File lib/rbt/registered/registered_headers.rb, line 114 def return_headers_of_this_program(i) use_this_key = :headers 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[use_this_key] else headers = RBT::Cookbooks::SanitizeCookbook.new(i) { :fast }.headers? end return headers end
run()
click to toggle source
save_yaml_file( what = YAML.dump(@hash_to_be_stored), into = LOCATION_REGISTERED_HEADERS )
click to toggle source
#¶ ↑
save_yaml_file
¶ ↑
The method ‘save_yaml_file` will create the yaml file which lists our binaries (in hash format). Right now, we need to manually update this yaml file on our own.
#¶ ↑
# File lib/rbt/registered/registered_headers.rb, line 198 def save_yaml_file( what = YAML.dump(@hash_to_be_stored), into = LOCATION_REGISTERED_HEADERS ) e sfancy('Storing yaml dataset in') e " #{sfile(into)}" write_what_into(what, into) if on_roebe? # ← Store on my home dir as well. into = "#{ruby_src_dir_for_the_registered_yaml_files?}#{File.basename(into)}" e sfancy('Storing the yaml dataset also in') e " #{sfile(into)}" write_what_into(what, into) end end
Also aliased as: create_yaml_file
search_for_this_program(i)
click to toggle source
#¶ ↑
search_for_this_program
¶ ↑
Use this method to search for a specific program.
#¶ ↑
# File lib/rbt/registered/registered_headers.rb, line 131 def search_for_this_program(i) i = i.to_s opne "Searching for #{simp(i)} now:" hash = load_yaml(Studium.file_registered_headers) if hash.has_key?(i) # This entry point means that we header was directly found. opne 'The header called `'+sfancy(i)+'` was found.' opne 'It is part of the package `'+simp(hash[i])+'`.' elsif hash.keys.map {|entry| File.basename(entry) }.include? i selection = hash.select {|key, value| key.include? i } this_program hash[selection.keys.first] opne 'Yes, is a sub-header and belongs to the '\ 'program `'+simp(this_program)+'`.' return this_program else opne i+' is '+swarn('NOT')+' included. We could not find any program' opne 'including this header.' end end