class RBT::Linux::Slackware::FilelistParser
Constants
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
Public Class Methods
[](i = nil)
click to toggle source
Public Instance Methods
obtain_the_remote_dataset()
click to toggle source
#¶ ↑
obtain_the_remote_dataset
¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/filelist_parser.rb, line 75 def obtain_the_remote_dataset # ======================================================================= # # We will first try open-uri, and if that fails with an openssl error # then we will try the second version. # ======================================================================= # begin dataset = open(main_url?).read rescue OpenSSL::SSL::SSLError e 'Trying to '+crimson('avoid')+' '+royalblue('OpenSSL')+ ' as we have just recieved '\ 'a '+crimson('OpenSSL::SSL::SSLError')+'.' require 'open-uri' require 'openssl' require 'json' request_uri = URI.parse(main_url?) result = open( request_uri, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE} ) dataset = result.readlines.join end @dataset = dataset end
register_this_program(i)
click to toggle source
report_information_about(i = @dataset)
click to toggle source
#¶ ↑
report_information_about
¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/filelist_parser.rb, line 101 def report_information_about(i = @dataset) if i.is_a? Array e 'A total of '+royalblue(i.size.to_s)+' programs are '\ 'available on the remote' e 'url '+orange(remote_url?)+'.' e e 'Next, these programs will be shown in two entries per row:' e i.sort.each {|original_line| line = remove_archive_at_the_end(original_line) if line.include?('-1alien') line.sub!(/-1alien/, '') end if line.include?('-2alien') line.sub!(/-2alien/, '') end if line.include?('-3alien') line.sub!(/-3alien/, '') end if line.include?('-4alien') line.sub!(/-4alien/, '') end if line.include?('-5alien') line.sub!(/-5alien/, '') end if line.include?('-6alien') line.sub!(/-6alien/, '') end if line.include?('-x86_64') line.sub!(/-x86_64/, '') end if line.include?('-noarch-2alien') line.sub!(/-noarch-2alien/, '') end if line.include?('-noarch') line.sub!(/-noarch/, '') end assumed_program_name = ProgramInformation.return_program_name(line) assumed_program_version = ProgramInformation.return_program_version(line) unless assumed_program_name.nil? or assumed_program_version.nil? e ' '+royalblue(line.ljust(55))+ steelblue( ' ['+assumed_program_name+', '+assumed_program_version+']' ) register_this_program(assumed_program_name) end } report_whether_these_programs_are_all_registered_in_the_rbt_project end end
report_whether_these_programs_are_all_registered_in_the_rbt_project( i = @array_registered_programs )
click to toggle source
#¶ ↑
report_whether_these_programs_are_all_registered_in_the_rbt_project
¶ ↑
This method will report whether all the discovered programs are registered in the RBT
project.
#¶ ↑
# File lib/rbt/linux/slackware/filelist_parser.rb, line 158 def report_whether_these_programs_are_all_registered_in_the_rbt_project( i = @array_registered_programs ) if @also_determine_whether_the_programs_are_registered_in_the_rbt_project i.each {|entry| if is_this_program_registered?(entry) # In this case all is fine. else e 'The program '+royalblue(entry)+' is '+crimson('not')+' registered.' end } end end
reset()
click to toggle source
run()
click to toggle source
#¶ ↑
run¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/filelist_parser.rb, line 184 def run obtain_the_remote_dataset if @dataset # ===================================================================== # # In this case we assume that we have found a result. We will select # all entries that have .txt as part of their name. # # Example: # # ./kde/plasma/kgamma5-5.16.0-x86_64-1alien.txz # # ===================================================================== # @dataset = @dataset.split("\n").select {|line| line.strip.end_with? '.txz' }.map {|line| File.basename(line) } report_information_about(@dataset) else opnn; e 'No dataset has been found.' end end
set_use_this_url(i)
click to toggle source