class Cookbooks::RegisteredHeaders
Constants
- NAMESPACE
#¶ ↑
NAMESPACE¶ ↑
#¶ ↑
- 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
available_programs?()
click to toggle source
opnn()
click to toggle source
report_to_the_user_what_we_will_do()
click to toggle source
reset()
click to toggle source
run()
click to toggle source
#¶ ↑
run¶ ↑
#¶ ↑
# File lib/cookbooks/utility_scripts/registered_headers.rb, line 130 def run report_to_the_user_what_we_will_do available_programs?.each { |program_name| @query.update_with_this_program(program_name) headers = @query.headers? # This is guaranteed to be an Array. unless headers.empty? if SHOW_PROGRAM_NAME opnn; e 'The program called '+sfancy(program_name)+' has '\ 'some header files.' end headers.each {|entry| if entry.include? ',' entry.split(',').each {|inner_entry| inner_entry = File.basename(inner_entry) @hash_to_be_stored[inner_entry] = program_name } else entry = File.basename(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 binaries (in hash format). Right now, we need to manually update this yaml file on our own.
#¶ ↑
# File lib/cookbooks/utility_scripts/registered_headers.rb, line 172 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? into = ruby_src_dir?+'cookbooks/lib/cookbooks/yaml/'+ 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(p)
click to toggle source
#¶ ↑
#search_for_this_program¶ ↑
Use this method to search for a specific program.
#¶ ↑
# File lib/cookbooks/utility_scripts/registered_headers.rb, line 93 def search_for_this_program(p) p = p.to_s opnn; e 'Searching for '+simp(p)+' now:' hash = load_yaml(LOCATION_REGISTERED_HEADERS) if hash.keys.include? p opnn; e 'The header called `'+sfancy(p)+'` was found.' opnn; e 'It is part of the package `'+simp(hash[p])+'`.' else opnn; e p+' is '+swarn('NOT')+' included. We could not find any program' opnn; e 'including this header.' end end