class RBT::SaveTheAvailableProgramsVersions
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = nil, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/save_the_available_programs_versions.rb, line 27 def initialize( commandline_arguments = nil, run_already = true ) reset set_commandline_arguments( commandline_arguments ) if block_given? yielded = yield case yielded # ===================================================================== # # === :do_not_store # ===================================================================== # when :do_not_store @report_and_store_into_a_local_text_file = false end end run if run_already end
Public Instance Methods
fill_up_the_result_variable()
click to toggle source
#¶ ↑
fill_up_the_result_variable
¶ ↑
This method will populate @result with the proper content/data.
It will make use of class RawCookbook for this.
#¶ ↑
# File lib/rbt/utility_scripts/save_the_available_programs_versions.rb, line 75 def fill_up_the_result_variable # ======================================================================= # # We must store these entries: # # (1) program name # (2) program version # (3) last update of this program # (4) remote URL # # ======================================================================= # available_programs?.each {|this_program| # ===================================================================== # # The variable this_program looks like this: # # /home/Programs/Ruby/2.7.1/lib/ruby/site_ruby/2.7.0/rbt/yaml/cookbooks/gnote.yml # # ===================================================================== # _ = @raw_cookbook.load_this_program(this_program) # ===================================================================== # # All information is obtained from class RawCookbook. This means that # we have to pass Strings towards the [] method. # ===================================================================== # original_url1 = _[:url1].dup url1 = _[:url1] last_update = _[:last_update] if _.has_key? :program_name_and_program_version url1 = _[:program_name_and_program_version] url1 = sanitize_url1_entry(url1, _) end program_name = remove_archive_from_the_end( ProgramInformation.return_program_name( File.basename(url1) ) ) program_version = remove_archive_from_the_end( ProgramInformation.return_program_version( File.basename(url1) ) ) # ===================================================================== # # Next, we need to rescue github-URLs. # ===================================================================== # if url1.include?('//github.com') and program_name.empty? and program_version.empty? _ = RBT.return_program_name_and_program_version_from_this_github_url(url1) program_name = ProgramInformation.return_name(_) program_version = ProgramInformation.return_version(_) end if program_name.nil? ewarn 'problem for: '+steelblue(this_program) else @result << "#{program_name.to_s.downcase.ljust(25)} "\ "#{program_version.ljust(12)} "\ "#{last_update.ljust(12)} "\ "#{original_url1}\n" end } end
report_the_result()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/save_the_available_programs_versions.rb, line 51 def reset super() infer_the_namespace # ======================================================================= # # === @result # ======================================================================= # @result = ''.dup # ======================================================================= # # === @raw_cookbook # ======================================================================= # @raw_cookbook = action(:raw_cookbook) # ======================================================================= # # === @report_and_store_into_a_local_text_file # ======================================================================= # @report_and_store_into_a_local_text_file = true end
result?()
click to toggle source
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/save_the_available_programs_versions.rb, line 166 def run fill_up_the_result_variable if @report_and_store_into_a_local_text_file report_the_result store_the_result_into_a_local_text_file if is_on_roebe? into = RUBY_SRC_DIR_RBT_YAML+ 'programs_version/'\ 'the_expanded_coobkook_dataset_was_last_updated_on_this_day.yml' opne "#{rev}Storing into the file `#{sfile(into)}#{rev}` next." what = dd_mm_yyyy write_what_into(what, into) end end end
store_the_result_into_a_local_text_file()
click to toggle source
#¶ ↑
store_the_result_into_a_local_text_file
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/save_the_available_programs_versions.rb, line 152 def store_the_result_into_a_local_text_file what = @result into = "#{RUBY_SRC_DIR_RBT_YAML}programs_version/"\ "available_programs_versions.md" opne "#{rev}Now storing into this file:" e e " #{sfile(into)}" e write_what_into(what, into) end