class Cookbooks::RegisteredBinaries
Constants
- NAMESPACE
#¶ ↑
NAMESPACE¶ ↑
#¶ ↑
Public Class Methods
location?()
click to toggle source
new( run_already = true )
click to toggle source
opnn()
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_binaries.rb, line 153 def run report_to_the_user_what_we_will_do available_programs?.each { |program_name| begin _ = Cookbooks::Cookbook.new(program_name) { :bypass_menu } binaries = _.binaries? # This is an Array. unless binaries.empty? e program_name if SHOW_PROGRAM_NAME binaries.each {|entry| @hash_to_be_stored[entry] = program_name } end rescue Exception => error opnn; e 'An error happened for the program '+ sfile(program_name)+'. (Error: '+error.class.to_s+')' pp error 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_binaries.rb, line 114 def save_yaml_file into = LOCATION_REGISTERED_BINARIES what = YAML.dump(hash?) e sfancy('Storing yaml dataset in ') e ' '+sfile(into) write_what_into(what, into) if is_on_roebe? into = RUBY_SRC_DIR_AT_HOME+'cookbooks/lib/cookbooks/yaml/'+File.basename(into) e "Also storing into `#{sfile(into)}`." 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/cookbooks/utility_scripts/registered_binaries.rb, line 55 def search_for_this_program( i = @this_program ) i = i.to_s if i.include? '/' i = File.basename(i) opnn; e "The input includes a #{simp('/')} token. We will "\ "truncate this to the" opnn; e 'last part only, as we only keep the names registered, '\ 'not the paths.' opnn; e 'Thus, our input will be '+sfancy(i)+'.' end opnn; e 'Searching for `'+sfancy(i)+'` now:' if Cookbooks.does_include? i opnn; e 'Yes, this appears to be already registered with the '\ 'same name '+simp(i)+'.' else hash = load_yaml(LOCATION_REGISTERED_BINARIES) if hash.keys.include? i opnn; e "The binary called `#{sfancy(i)}` was found." opnn; e "It is part of the package -> `#{simp(hash[i])}`." else opnn; e sfancy(i)+' is '+swarn('NOT')+' included. We could not '\ 'find any program' opnn; e 'including this program.' end end end