class RBT::ReportMateDesktopVersion
Constants
- ERROR_LINE
#¶ ↑
ERROR_LINE
¶ ↑#¶ ↑
- N_LJUST
#¶ ↑
N_LJUST
¶ ↑#¶ ↑
Public Class Methods
[](i = '')
click to toggle source
new( commandline_arguments = nil, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 37 def initialize( commandline_arguments = nil, run_already = true ) reset set_commandline_arguments( commandline_arguments ) if block_given? yielded = yield case yielded when :do_not_report, :do_not_report_anything @do_report = false end end run if run_already end
Public Instance Methods
add( i = '', add_newline = true )
click to toggle source
add_newline()
click to toggle source
array?()
click to toggle source
#¶ ↑
array?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 540 def array? # ======================================================================= # # The Array is currently hardcoded here. This may have to be changed # at a later time - but for the time being we will stick to that # approach. # ======================================================================= # array = %i( mate_desktop mate_utils mate_common libmatekbd mate_media libmatemixer libmateweather mate_applets mate_control_center marco atril eom pluma caja caja_dropbox ) # ======================================================================= # # Now that we have the array, we will self-send here, by simply # appending a '?' to the method call. For this to work, evidently # such methods must exist. Sine I am unsure of conflicts, I have # also appended "_version?" there instead. # ======================================================================= # array.map! {|name_of_the_program| assumed_version_of_this_program = send("#{name_of_the_program}_version?") # ===================================================================== # # Next we will modify the above a bit, for empty strings and # for "command not found" strings. # ===================================================================== # if assumed_version_of_this_program.empty? or assumed_version_of_this_program.include?('command not found') assumed_version_of_this_program = nil end if assumed_version_of_this_program [ name_of_the_program, assumed_version_of_this_program ] else nil end } array.compact! array end
atrilv?()
click to toggle source
#¶ ↑
atrilv?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 491 def atrilv? return_sanitized_sys_command(:atril) end
Also aliased as: mate_atril_version?, atril_version?
caja_extensions?()
click to toggle source
cajadropboxv?()
click to toggle source
#¶ ↑
cajadropboxv?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 532 def cajadropboxv? return_sanitized_sys_command(:caja_dropbox) end
Also aliased as: mate_cajadropbox_version?, caja_dropbox_version?
cajav?()
click to toggle source
#¶ ↑
cajav?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 515 def cajav? # Return the version of caja return_sanitized_sys_command(:caja) end
Also aliased as: mate_caja_version?, caja_version?
engrampav?()
click to toggle source
#¶ ↑
engrampav?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 594 def engrampav? return_sanitized_sys_command(:engrampa) end
Also aliased as: mate_engrampa_version?
eomv?()
click to toggle source
#¶ ↑
eomv?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 499 def eomv? return_sanitized_sys_command(:eom) end
Also aliased as: mate_eom_version?, eom_version?
left_padded()
click to toggle source
marcov?()
click to toggle source
#¶ ↑
marcov?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 483 def marcov? return_sanitized_sys_command(:marco) end
Also aliased as: mate_marco_version?, marco_version?
mate_applets?()
click to toggle source
#¶ ↑
mate_applets?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 415 def mate_applets? return_sanitized_sys_command(:mate_applets) end
Also aliased as: mate_applets_version?
mate_common?()
click to toggle source
#¶ ↑
mate_common?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 436 def mate_common? return_sanitized_sys_command(:mate_common) end
Also aliased as: mate_common_version?
mate_control_center?()
click to toggle source
#¶ ↑
mate_control_center?¶ ↑
This method will return the version of the mate-control-center.
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 386 def mate_control_center? return_sanitized_sys_command(:mate_control_center) end
Also aliased as: mate_control_center_version?, mate_controlcenter_version?
mate_desktopv?()
click to toggle source
#¶ ↑
mate_desktopv?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 443 def mate_desktopv? return_sanitized_sys_command(:mate_desktop) end
Also aliased as: mate_desktop_version?, return_version_of_mate_desktop
mate_keyboard?()
click to toggle source
#¶ ↑
mate_keyboard?¶ ↑
Return the version of libmatekbd.
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 453 def mate_keyboard? return_sanitized_sys_command(:mate_keyboard) end
Also aliased as: mate_keyboard_version?, libmatekbd_version?
mate_media?()
click to toggle source
mate_mixer?()
click to toggle source
#¶ ↑
mate_mixer?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 461 def mate_mixer? return_sanitized_sys_command(:mate_mixer) end
Also aliased as: mate_mixer_version?, libmatemixer_version?
mate_panel?()
click to toggle source
#¶ ↑
mate_panel?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 377 def mate_panel? return_sanitized_sys_command(:mate_panel) end
Also aliased as: mate_panel_version?
mate_power_manager?()
click to toggle source
mate_utils?()
click to toggle source
#¶ ↑
mate_utils?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 429 def mate_utils? return_sanitized_sys_command(:mate_utils) end
Also aliased as: mate_utils_version?
mate_weather?()
click to toggle source
#¶ ↑
mate_weather?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 469 def mate_weather? return_sanitized_sys_command(:mate_weather) end
Also aliased as: libmateweather_version?
plumav?()
click to toggle source
#¶ ↑
plumav?¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 507 def plumav? return_sanitized_sys_command(:pluma) end
Also aliased as: mate_pluma_version?, pluma_version?
report()
click to toggle source
report_atril_version()
click to toggle source
report_caja_dropbox_version()
click to toggle source
report_caja_version()
click to toggle source
report_engrampa_version()
click to toggle source
report_eom_version()
click to toggle source
report_libcaja_extensions()
click to toggle source
report_marco_version()
click to toggle source
report_mate_applets_version()
click to toggle source
report_mate_common_version()
click to toggle source
report_mate_control_center_version()
click to toggle source
report_mate_desktop_version()
click to toggle source
report_mate_keyboard_version()
click to toggle source
report_mate_media_version()
click to toggle source
report_mate_mixer_version()
click to toggle source
report_mate_panel_version()
click to toggle source
report_mate_power_manager_version()
click to toggle source
report_mate_utils_version()
click to toggle source
report_mate_weather_version()
click to toggle source
report_pluma_version()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 59 def reset super() infer_the_namespace # ======================================================================= # # === @n_ljust # ======================================================================= # @n_ljust = N_LJUST # ======================================================================= # # === :string_to_display # ======================================================================= # @internal_hash[:string_to_display] = ''.dup # ======================================================================= # # === @do_report # ======================================================================= # @do_report = true end
return_mate_media_version()
click to toggle source
#¶ ↑
return_mate_media_version
¶ ↑
This is a bit volatile since we depend on “mate-volume-control” here. It can lead to problems such as:
"mate-volume-control: symbol lookup error: /usr/lib/../lib/libpangoft2-1.0.so.0: undefined symbol: FcWeightFromOpenTypeDouble\n"
That is why we have to be a bit more carefeul when determining the version in place.
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 402 def return_mate_media_version result = `mate-volume-control --version #{ERROR_LINE}`.to_s if result.include? 'symbol lookup error' result = result.split('symbol lookup error').last elsif result.include? ' ' result = result.strip.split(' ').last end result end
Also aliased as: mate_media_version?
return_pkgconfig_result_for( i = :libmatekbd )
click to toggle source
#¶ ↑
return_pkgconfig_result_for
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 637 def return_pkgconfig_result_for( i = :libmatekbd ) result = `pkg-config --modversion #{i} #{ERROR_LINE}`.strip if result.include?('No package ') and result.include?(' found') result = '' end return result end
return_sanitized_sys_command( i = :caja )
click to toggle source
#¶ ↑
return_sanitized_sys_command
¶ ↑
This method will return the proper version of an installed mate-desktop component.
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 266 def return_sanitized_sys_command( i = :caja ) case i # case tag when :mate_common i = :mate_doc_common when :mate_utils i = :mate_screenshot when :mate_desktop i = :mate_about end # ======================================================================= # # Next, some packages such as libmatekbd, only come with a .pc file # rather than a commandline way to query its version, which we will # determine first. # ======================================================================= # case i # ======================================================================= # # === :mate_keyboard # ======================================================================= # when :mate_keyboard result = return_pkgconfig_result_for(:libmatekbd) # ======================================================================= # # === :mate_panel # ======================================================================= # when :mate_panel result = return_pkgconfig_result_for('libmatepanelapplet-4.0') # ======================================================================= # # === :caja_extensions # ======================================================================= # when :caja_extensions result = return_pkgconfig_result_for('libcaja-extension') # ======================================================================= # # === :mate_media # ======================================================================= # when :mate_media result = return_mate_media_version # ======================================================================= # # === :mate_power_manager # ======================================================================= # when :mate_power_manager result = run_safe_system_command('mate-power-manager --version').sub(/Version /,'') # ======================================================================= # # === :mate_mixer # ======================================================================= # when :mate_mixer result = return_pkgconfig_result_for(:libmatemixer) # ======================================================================= # # === :mate_weather # ======================================================================= # when :mate_weather result = return_pkgconfig_result_for(:mateweather) # ======================================================================= # # === :mate_applets # ======================================================================= # when :mate_applets result = return_version_of_mate_applets # ======================================================================= # # === :mate_control_center # ======================================================================= # when :mate_control_center result = return_pkgconfig_result_for('mate-default-applications') else i = i.to_s.tr('_','-') result = `#{i} --version #{ERROR_LINE}`.split(N).first # system tag end result.to_s. sub(/MATE /,''). sub(/caja /,''). sub(/marco /,''). sub(/mate-screenshot /,''). sub(/mate-doc-common \(mate-common\) /,''). sub(/Desktop Environment /,''). sub(/Document Viewer /,''). sub(/Eye of Image Viewer /,''). sub(/pluma - Version /,''). sub(/Engrampa Archive Manager /,''). strip end
return_version_of_mate_applets()
click to toggle source
#¶ ↑
return_version_of_mate_applets
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 238 def return_version_of_mate_applets version = nil _ = '/usr/share/mate-panel/applets/org.mate.applets.DriveMountApplet.mate-panel-applet' if File.exist? _ version = File.read(_).scan( /X-MATE-Bugzilla-Version=(\d{1,2}\.?\d{1,2}\.?\d{1,2})/ ).flatten.first.to_s end version end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 601 def run add grey, :no_newline add 'Reporting the installed versions of the '+ royalblue('mate-desktop components')+ grey(':') add_newline report_mate_desktop_version # === mate-desktop report_mate_utils_version # === mate-utils report_mate_common_version # === mate-common report_mate_keyboard_version # === libmatekbd report_mate_media_version # === mate-media report_mate_mixer_version # === libmatemixer report_mate_applets_version # === mate-applets report_mate_weather_version # === libmateweather report_mate_control_center_version # === mate-control-center report_mate_panel_version # === mate-panel report_mate_power_manager_version # === mate-power-manager report_marco_version # === marco report_atril_version # === atril report_eom_version # === eom report_pluma_version # === pluma # ======================================================================= # # Engrampa works via the --version switch, which was different in ~2019. # So we can enable it finally. # ======================================================================= # report_engrampa_version # === engrampa report_caja_version # === caja report_libcaja_extensions # === libcaja_extensions # report_caja_dropbox_version # === caja-dropbox add_newline report end
run_safe_system_command( i = 'mate-power-manager --version' )
click to toggle source
#¶ ↑
run_safe_system_command
¶ ↑
The idea here is to append 2>&1, via ERROR_LINE
.
#¶ ↑
# File lib/rbt/utility_scripts/report_mate_desktop_version.rb, line 254 def run_safe_system_command( i = 'mate-power-manager --version' ) `#{i} #{ERROR_LINE}`.to_s.sub(/Version /,'') end