class RBT::FlatpakUrlScanner
Constants
- REMOTE_URL
#¶ ↑
REMOTE_URL
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = ARGV, run_already = true )
click to toggle source
Public Instance Methods
detect_the_remote_programs()
click to toggle source
#¶ ↑
detect_the_remote_programs
¶ ↑
This method will detect which remote flatpaks are available. This can then be used to compare it with the local listing done through RBT
.
The remote entries will appear like so:
<a href="org.videolan.VLC.flatpakref">org.videolan.VLC.flatpakref</a> 21-Aug-2019 15:24 4021 <a href="org.vim.Vim.flatpakref">org.vim.Vim.flatpakref</a> 19-Aug-2019 15:25 4011 <a href="org.vranki.spectral.flatpakref">org.vranki.spectral.flatpakref</a> 26-Apr-2019 10:24 4026 <a href="org.wesnoth.Wesnoth.flatpakref">org.wesnoth.Wesnoth.flatpakref</a> 15-Oct-2019 22:29
So we need to grab the entries that are like “VLC” or “Vim”.
#¶ ↑
# File lib/rbt/utility_scripts/flatpak_url_scanner.rb, line 71 def detect_the_remote_programs use_this_regex = /a href="org.(.+)\.(.+)\.flatpakref">/ # See: https://rubular.com/r/a4tOp4udOXVy1T splitted = @dataset_from_the_remote_website.split("\n") splitted.select! {|entry| entry.include?('<a href="org.') and entry.include?('</a>') } scanned = splitted.join("\n").scan( use_this_regex ) scanned = scanned.map {|a, b| b } report(scanned) end
obtain_the_dataset_available_from_the_remote_website()
click to toggle source
remote_url?()
click to toggle source
report(i)
click to toggle source
#¶ ↑
report (report tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/flatpak_url_scanner.rb, line 95 def report(i) e e "#{rev}The following programs are available at #{steelblue(remote_url?)}:" e i.each_with_index {|entry, index| index += 1 name_of_the_program = entry.downcase.delete('-') result = lightgreen(" #{index.to_s.rjust(3)}) ")+ royalblue( "#{name_of_the_program.ljust(22)}" ).dup if RBT.is_this_program_registered? name_of_the_program result << olivedrab( ' [is a registered program]' ) # =================================================================== # # Next determine whether this file has a flatpak_entry or # whether it does not. # =================================================================== # dataset = quickly_obtain_expanded_cookbook_dataset_from(name_of_the_program) if dataset.nil? require 'rbt/requires/require_the_cookbook_class.rb' # ================================================================= # # This error here can happen if we do not yet have the expanded # dataset. After May 2020 this will no longer be the case, as # we will have at the least one expanded dataset in the home # directory of the gem - but for the time being, if this returns # nil then we will use class Cookbook to add data. # ================================================================= # dataset = RBT::Cookbooks::SanitizeCookbook.new(name_of_the_program) { :fast } end if dataset.has_key?('flatpak_url') and !dataset['flatpak_url'].empty? else if is_on_roebe? result << crimson(' [This entry lacks a flatpak URL.]') open_this_file( RUBY_SRC_RBT_COOKBOOKS+ name_of_the_program+'.yml' ) sleep 1 end end end e result unless result.empty? } e end
reset()
click to toggle source