class RBT::Cookbooks::RegisteredBinaries
Public Class Methods
location?()
click to toggle source
new( run_already = true ) { || ... }
click to toggle source
opnn()
click to toggle source
search_for_this_program(i, &block)
click to toggle source
Public Instance Methods
opnn()
click to toggle source
report_to_the_user_what_we_will_do()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Cookbooks::Registered#reset
# File lib/rbt/registered/registered_binaries.rb, line 51 def reset super() infer_the_namespace # ======================================================================= # # === @hash_to_be_stored # ======================================================================= # @hash_to_be_stored = {} # This is the hash that will be stored. # ======================================================================= # # === @cookbook_dataset # ======================================================================= # @cookbook_dataset = nil # ======================================================================= # # === @this_program # ======================================================================= # @this_program = nil end
return_program_version_of(i)
click to toggle source
run()
click to toggle source
#¶ ↑
run¶ ↑
#¶ ↑
# File lib/rbt/registered/registered_binaries.rb, line 198 def run report_to_the_user_what_we_will_do # ======================================================================= # # We could rescue the following code, but I think it is better to fail, # and then correct the error. But in case we wish to change the # behaviour again, the rescue-clause below was retained in the comments. # ======================================================================= # available_programs?.each { |program_name| _ = action(:SanitizeCookbook, program_name) { :fast } 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 # opne '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/rbt/registered/registered_binaries.rb, line 91 def save_yaml_file into = RBT.file_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_for_the_registered_yaml_files?}"\ "#{File.basename(into)}" also_storing_into e "`#{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/rbt/registered/registered_binaries.rb, line 134 def search_for_this_program( i = @this_program ) be_verbose = be_verbose? i = i.to_s if i.include? '/' i = File.basename(i) opne "The input includes a #{simp('/')} token. We will "\ "truncate this to the" opne 'last part only, as we only keep the names registered, '\ 'not the paths.' opne "Thus, our input will be #{sfancy(i)}#{rev}." end if be_verbose opne "#{rev}Searching for `#{sfancy(i)}#{rev}` now:" end # ======================================================================= # # Query whether it is already included or not. # ======================================================================= # if RBT.does_include? i if be_verbose opne "Yes, this appears to be already registered with the "\ "same name #{simp(i)}#{rev}." end program_version = RBT.swift_return_version_of_this_program(i) if be_verbose opne "Its program version is: #{lightblue(program_version)}" end return i else hash = load_yaml(FILE_REGISTERED_BINARIES) if hash.keys.include?(i) result = hash[i] if be_verbose opne "#{rev}The binary called `#{sfancy(i)}#{rev}` was found." it_is_part_of_the_package(result) opne rev+'The currently registered version of '+ tomato(result)+"#{rev} is: "+ orchid( return_program_version_of(result) ) end return result else if be_verbose opne sfancy(i)+rev+' is '+swarn('NOT')+rev+' included. We could '\ 'not find any program' opne 'including this program.' end end false # Not included, thus we return false. end end