Class: RBT::Action::ReportMateDesktopVersion

Inherits:
RBT::Action show all
Defined in:
lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb

Overview

RBT::Action::ReportMateDesktopVersion

Constant Summary collapse

N_LJUST =
#

N_LJUST

#
22

Constants inherited from LeanPrototype

LeanPrototype::ALL_COLOUR_METHODS, LeanPrototype::ARRAY_KDE_KONSOLE_COLOURS_IN_USE, LeanPrototype::DAY_NAMES, LeanPrototype::NAMESPACE, LeanPrototype::SILENT_REDIRECTION

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LeanPrototype

#a_or_an?, #abbreviations?, #absolute_path, #action, #add_to_the_commandline_arguments, #all_binaries?, #all_files_from, #all_libraries?, #allowed_cookbook_entries?, #appdir_location_of?, #append_onto_the_internal_hash, #append_what_into, #archive_type_of?, #available_programs?, #be_quiet?, #be_verbose?, #begins_with_a_comment?, #capitalize_first_alphabetical_character, #cd_to_the_log_directory, #cd_to_the_temp_directory, #change_directory, #change_permission, #cheering_person?, #chmod, #chop_off_archive, #clear_commandline_arguments, #cliner, #coloured_and_padded_e, #coloured_and_padded_esystem, #coloured_esystem, #colourize_directory_for_system_results, #colourize_this_error, #colourize_this_file_path, #colourize_this_warning, #commandline_arguments?, #commandline_arguments_without_hyphens?, #comment, #convert_dd_mm_yyyy_to_its_long_variant, #convert_env_variable, #copy_directory, #copy_files, #cpr, #create_directory, #current_hour?, #dd_mmm_yyy, #debug, #debug?, #directory_expanded_cookbooks?, #disable_colours, #display_md5sum?, #do_not_debug, #does_the_cookbook_include_this_program?, #does_this_expanded_cookbook_file_exist_for_this_program?, #does_this_file_exist?, #does_this_file_exist_and_is_it_a_file?, #e, #eblue, #ecomment, #ecrimson, #edir, #editor?, #efancy, #eimp, #enable_colours, #enable_debug, #ensure_main_encoding_for, #eparse, #esystem, #esystem_gold, #etomato, #ewarn, #exit_program, #expanded_cookbooks_directory_exists?, #extract_this_archive, #extract_to?, #file_compiled_programs?, #file_dirname_retaining_trailing_slash, #file_predefined_installation_instructions?, #file_specification_of_registered_cookbook_entries, #find_cookbook_alias_for, #find_this_yaml_file, #first_argument?, #first_non_hyphen_argument?, #get_all_directories_from, #get_all_files_from, #get_all_programs, #get_date, #get_extended_date, #get_files_and_directories_from, #go_to_base_dir, #home_dir?, #host_system?, #infer_the_namespace, #internal_hash?, #internal_hash_set_commandline_arguments, #is_an_archive?, #is_directory?, #is_file?, #is_github_url?, #is_make_available?, #is_meson_installed?, #is_on_gobolinux?, #is_on_windows?, #is_roebe?, #is_superuser?, #is_symlink?, #is_this_a_header?, #is_this_a_library?, #is_this_program_included?, #iso_encoding?, #load_dataset_from_this_expanded_cookbook, #load_yaml, #load_yaml_file_from_the_cookbook_directory_for_this_program, #log_directory?, #main_encoding?, #meson_build_file_exists?, #months?, #move_file, #n_programs_are_available?, #n_programs_available?, #namespace?, #no_directory_exists_at, #no_directory_was_found_at, #no_opn, #no_such_file_exists, #open_in_browser, #open_in_editor, #opncomment, #opne, #opnef, #opnerev, #opnerror, #opnesystem, #opnewarn, #opnfancy, #opnn, #packages_directory?, #path_to_this_expanded_cookbooks_dataset, #pkgconfig_directory?, #populate_the_internal_hash_with_default_values, #predefined_installation_instructions?, #prepend_this_commandline_argument, #program_version_of?, #project_base_directory?, #project_yaml_directory?, #query_path?, #rarrow?, #read_file, #read_file_in_default_encoding, #read_file_with_default_encoding, #readlines, #readlines_with_proper_encoding, #register_sigint, #registered_cookbook_entries?, #remove, #remove_archive_from_the_end, #remove_comments_from_each_line, #remove_directory, #remove_double_slashes, #remove_file, #remove_newlines, #remove_parens, #remove_symlink, #remove_the_first_commandline_argument, #remove_this_commandline_argument, #remove_this_entry_from_the_commandline_arguments, #remove_trailing_ANSII_escape_code, #remove_unnecessary_data_from_url, #rename, #report_pwd, #require_the_rbt_aliases, #reset_the_internal_hash, #return_all_archives_from_this_directory, #return_appdir_prefix, #return_commandline_arguments_with_leading_hyphens, #return_current_hour_minutes_second, #return_date, #return_day_of_the_month_based_on_utc, #return_full_time, #return_hours_minutes_seconds_based_on_utc, #return_location_to_this_programs_yaml_file, #return_month_based_on_this_number, #return_month_based_on_utc, #return_opnn, #return_program_information, #return_program_name_for_gobolinux_systems, #return_pwd, #return_unicode_warning_symbol_or_empty_string, #return_utc, #return_utc_time_in_a_format_similar_to_slackware, #return_weekday_based_on_utc, #return_year_based_on_utc, #rev, #run_simulation=, #run_simulation?, #sdir, #sdir_return_pwd, #set_be_silent, #set_be_verbose, #set_first_commandline_argument, #set_namespace, #set_use_opn, #set_xorg_buffer, #sfancy, #sfile, #silent_redirection?, #silently_create_this_directory_if_it_does_not_yet_exist, #simp, #source_base_directory?, #ssym, #stderr, #store_into_this_directory?, #string_right_arrow?, #swarn, #symlink, #sysbin_directory?, #sysetc_directory?, #sysinclude_directory?, #syslib_directory?, #sysshare_directory?, #system_directory?, #temp_directory?, #to_bool, #to_camelcase, #to_iso_encoding, #to_unicode, #today?, #touch, #try_to_require_beautiful_url, #try_to_require_the_environment_information_gem, #try_to_require_the_extracter_gem, #try_to_require_the_open_gem, #try_to_require_the_xorg_buffer, #try_to_require_wget, #try_to_return_a_special_compile_component, #unicode_cliner, #unicode_middle_cliner, #use_colours=, #use_colours?, #use_opn=, #use_opn?, #utf_encoding?, #verbose_truth, #word_wrap, #write_what_into, #write_what_into_via_unicode, #yes_or_no

Constructor Details

#initialize(run_already = true, &block) ⇒ ReportMateDesktopVersion

#

initialize

#


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 35

def initialize(
    run_already = true,
    &block
  )
  reset
  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

Class Method Details

.[](i = ARGV) ⇒ Object

#

RBT::Action::ReportMateDesktopVersion[]

#


679
680
681
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 679

def self.[](i = ARGV)
  new(i)
end

Instance Method Details

#add(i = '', add_newline = true) ⇒ Object

#

add (add tag)

This method will simply append onto the corresponding variable, stored in the primary Hash.

#


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 77

def add(
    i           = '',
    add_newline = true
  )
  case add_newline
  # === :no_newline
  when :no_newline
    add_newline = false
  end
  if add_newline
    i = i.dup if i.frozen?
    i << "\n"
  end
  @internal_hash[:string_to_display] << i
end

#add_newlineObject

#

add_newline

#


104
105
106
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 104

def add_newline
  add
end

#array?Boolean

#

array?

#

Returns:

  • (Boolean)


462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 462

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?Boolean Also known as: mate_atril_version?, atril_version?

#

atrilv?

#

Returns:

  • (Boolean)


413
414
415
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 413

def atrilv?
  return_sanitized_sys_command(:atril)
end

#caja_extensions?Boolean

#

caja_extensions?

Report the version of libcaja-extensions in use (if installed).

#

Returns:

  • (Boolean)


447
448
449
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 447

def caja_extensions?
  return_sanitized_sys_command(:caja_extensions)
end

#cajadropboxv?Boolean Also known as: mate_cajadropbox_version?, caja_dropbox_version?

#

cajadropboxv?

#

Returns:

  • (Boolean)


454
455
456
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 454

def cajadropboxv?
  return_sanitized_sys_command(:caja_dropbox)
end

#cajav?Boolean Also known as: mate_caja_version?, caja_version?

#

cajav?

#

Returns:

  • (Boolean)


437
438
439
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 437

def cajav? # Return the version of caja
  return_sanitized_sys_command(:caja)
end

#engrampav?Boolean Also known as: mate_engrampa_version?

#

engrampav?

#

Returns:

  • (Boolean)


516
517
518
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 516

def engrampav?
  return_sanitized_sys_command(:engrampa)
end

#eomv?Boolean Also known as: mate_eom_version?, eom_version?

#

eomv?

#

Returns:

  • (Boolean)


421
422
423
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 421

def eomv?
  return_sanitized_sys_command(:eom)
end

#left_padded(i = rev) ⇒ Object

#

left_padded

#


111
112
113
114
115
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 111

def left_padded(
    i = rev
  )
  "#{i}  " # This used to be "grey" rather than "rev", up until January 2024.
end

#marcov?Boolean Also known as: mate_marco_version?, marco_version?

#

marcov?

#

Returns:

  • (Boolean)


405
406
407
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 405

def marcov? 
  return_sanitized_sys_command(:marco)
end

#mate_applets?Boolean Also known as: mate_applets_version?

#

mate_applets?

#

Returns:

  • (Boolean)


330
331
332
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 330

def mate_applets?
  return_sanitized_sys_command(:mate_applets)
end

#mate_common?Boolean Also known as: mate_common_version?

#

mate_common?

#

Returns:

  • (Boolean)


358
359
360
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 358

def mate_common?
  return_sanitized_sys_command(:mate_common)
end

#mate_control_center?Boolean Also known as: mate_control_center_version?, mate_controlcenter_version?

#

mate_control_center?

This method will return the version of the mate-control-center.

#

Returns:

  • (Boolean)


301
302
303
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 301

def mate_control_center?
  return_sanitized_sys_command(:mate_control_center)
end

#mate_desktopv?Boolean Also known as: mate_desktop_version?, return_version_of_mate_desktop

#

mate_desktopv?

#

Returns:

  • (Boolean)


365
366
367
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 365

def mate_desktopv?
  return_sanitized_sys_command(:mate_desktop)
end

#mate_keyboard?Boolean Also known as: mate_keyboard_version?, libmatekbd_version?

#

mate_keyboard?

Return the version of libmatekbd.

#

Returns:

  • (Boolean)


375
376
377
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 375

def mate_keyboard?
  return_sanitized_sys_command(:mate_keyboard)
end

#mate_media?Boolean

#

mate_media?

#

Returns:

  • (Boolean)


337
338
339
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 337

def mate_media?
  return_sanitized_sys_command(:mate_media)
end

#mate_mixer?Boolean Also known as: mate_mixer_version?, libmatemixer_version?

#

mate_mixer?

#

Returns:

  • (Boolean)


383
384
385
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 383

def mate_mixer?
  return_sanitized_sys_command(:mate_mixer)
end

#mate_panel?Boolean Also known as: mate_panel_version?

#

mate_panel?

#

Returns:

  • (Boolean)


292
293
294
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 292

def mate_panel?
  return_sanitized_sys_command(:mate_panel)
end

#mate_power_manager?Boolean

#

mate_power_manager?

#

Returns:

  • (Boolean)


398
399
400
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 398

def mate_power_manager?
  return_sanitized_sys_command(:mate_power_manager)
end

#mate_screensaver?Boolean

#

mate_screensaver?

#

Returns:

  • (Boolean)


344
345
346
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 344

def mate_screensaver?
  return_sanitized_sys_command(:mate_screensaver)
end

#mate_utils?Boolean Also known as: mate_utils_version?

#

mate_utils?

#

Returns:

  • (Boolean)


351
352
353
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 351

def mate_utils?
  return_sanitized_sys_command(:mate_utils)
end

#mate_weather?Boolean Also known as: libmateweather_version?

#

mate_weather?

#

Returns:

  • (Boolean)


391
392
393
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 391

def mate_weather?
  return_sanitized_sys_command(:mate_weather)
end

#plumav?Boolean Also known as: mate_pluma_version?, pluma_version?

#

plumav?

#

Returns:

  • (Boolean)


429
430
431
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 429

def plumav?
  return_sanitized_sys_command(:pluma)
end

#report(i = string_to_display?, , do_report = @do_report) ⇒ Object

#

report (report tag)

#


630
631
632
633
634
635
636
637
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 630

def report(
    i         = string_to_display?, # This is the full String to be displayed.
    do_report = @do_report
  )
  if do_report
    e lightgreen(i)
  end
end

#report_atril_versionObject

#

report_atril_version

#


162
163
164
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 162

def report_atril_version
  add left_padded+'Atril: '.ljust(@n_ljust)+slateblue(atrilv?)
end

#report_caja_dropbox_versionObject

#

report_caja_dropbox_version

#


134
135
136
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 134

def report_caja_dropbox_version
  add left_padded+'Caja-dropbox: '.ljust(@n_ljust)+slateblue(cajadropboxv?)
end

#report_caja_versionObject

#

report_caja_version

#


120
121
122
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 120

def report_caja_version
  add left_padded+'Caja: '.ljust(@n_ljust)+slateblue(cajav?)
end

#report_engrampa_versionObject

#

report_engrampa_version

#


141
142
143
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 141

def report_engrampa_version
  add left_padded+'Engrampa: '.ljust(@n_ljust)+slateblue(engrampav?)
end

#report_eom_versionObject

#

report_eom_version (eom tag)

#


148
149
150
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 148

def report_eom_version
  add left_padded+'Eom: '.ljust(@n_ljust)+slateblue(eomv?)
end

#report_libcaja_extensionsObject

#

report_libcaja_extensions

#


127
128
129
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 127

def report_libcaja_extensions
  add left_padded+'Caja-extensions: '.ljust(@n_ljust)+slateblue(caja_extensions?)
end

#report_marco_versionObject

#

report_marco_version

#


169
170
171
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 169

def report_marco_version
  add left_padded+'Marco: '.ljust(@n_ljust)+slateblue(marcov?)
end

#report_mate_applets_versionObject

#

report_mate_applets_version

#


225
226
227
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 225

def report_mate_applets_version
  add left_padded+'Mate-Applets: '.ljust(@n_ljust)+slateblue(mate_applets?)
end

#report_mate_common_versionObject

#

report_mate_common_version

#


176
177
178
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 176

def report_mate_common_version
  add left_padded+'Mate-Common: '.ljust(@n_ljust)+slateblue(mate_common?)
end

#report_mate_control_center_versionObject

#

report_mate_control_center_version

#


232
233
234
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 232

def report_mate_control_center_version
  add left_padded+'Mate-Control-Center: '.ljust(@n_ljust)+slateblue(mate_control_center?)
end

#report_mate_desktop_versionObject

#

report_mate_desktop_version

#


271
272
273
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 271

def report_mate_desktop_version
  add left_padded+'Mate-Desktop: '.ljust(@n_ljust)+slateblue(mate_desktopv?)
end

#report_mate_keyboard_versionObject

#

report_mate_keyboard_version

#


183
184
185
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 183

def report_mate_keyboard_version
  add left_padded+'Mate-Keyboard: '.ljust(@n_ljust)+slateblue(mate_keyboard?)
end

#report_mate_media_versionObject

#

report_mate_media_version

#


197
198
199
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 197

def report_mate_media_version
  add left_padded+'Mate-Media: '.ljust(@n_ljust)+slateblue(mate_media?)
end

#report_mate_mixer_versionObject

#

report_mate_mixer_version

#


190
191
192
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 190

def report_mate_mixer_version
  add left_padded+'Mate-Mixer: '.ljust(@n_ljust)+slateblue(mate_mixer?)
end

#report_mate_panel_versionObject

#

report_mate_panel_version

#


239
240
241
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 239

def report_mate_panel_version
  add left_padded+'Mate-Panel: '.ljust(@n_ljust)+slateblue(mate_panel?)
end

#report_mate_power_manager_versionObject

#

report_mate_power_manager_version

#


218
219
220
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 218

def report_mate_power_manager_version
  add left_padded+'Mate-Power-Manager: '.ljust(@n_ljust)+slateblue(mate_power_manager?)
end

#report_mate_screensaver_versionObject

#

report_mate_screensaver_version

#


204
205
206
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 204

def report_mate_screensaver_version
  add left_padded+'Mate-Screensaver: '.ljust(@n_ljust)+slateblue(mate_screensaver?)
end

#report_mate_utils_versionObject

#

report_mate_utils_version

#


278
279
280
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 278

def report_mate_utils_version
  add left_padded+'Mate-Utils: '.ljust(@n_ljust)+slateblue(mate_utils?)
end

#report_mate_weather_versionObject

#

report_mate_weather_version

#


211
212
213
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 211

def report_mate_weather_version
  add left_padded+'Mate-Weather: '.ljust(@n_ljust)+slateblue(mate_weather?)
end

#report_pluma_versionObject

#

report_pluma_version

#


155
156
157
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 155

def report_pluma_version
  add left_padded+'Pluma: '.ljust(@n_ljust)+slateblue(plumav?)
end

#resetObject

#

reset (reset tag)

#


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 54

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

#result?Boolean

#

string_to_display?

#

result?

Returns:

  • (Boolean)


99
100
101
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 99

def string_to_display?
  @internal_hash[:string_to_display]
end

#return_mate_media_versionObject Also known as: mate_media_version?

#

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.

#


317
318
319
320
321
322
323
324
325
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 317

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

#return_pkgconfig_result_for(i = :libmatekbd) ⇒ Object

#

return_pkgconfig_result_for

Note that this method will NOT modify the input given, so you have to ensure that the input is correct BEFORE calling this method.

#


526
527
528
529
530
531
532
533
534
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 526

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) ⇒ Object

#

return_sanitized_sys_command

This method will return the proper version of an installed mate-desktop component.

#


542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 542

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_screensaver
  # ======================================================================= #
  when :mate_screensaver
    result = return_pkgconfig_result_for('mate-screensaver')
  # ======================================================================= #
  # === :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_appletsObject

#

return_version_of_mate_applets

#


246
247
248
249
250
251
252
253
254
255
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 246

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

#runObject

#

run (run tag)

#


642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 642

def run
  add grey, :no_newline
  add "#{rev}Reporting the installed versions of the "\
      "#{royalblue('mate-desktop components')}"\
      "#{rev}:"
  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_mate_screensaver_version    # === mate-screensaver-version
  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') ⇒ Object

#

run_safe_system_command

The idea here is to append 2>&1, via ERROR_LINE.

#


262
263
264
265
266
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 262

def run_safe_system_command(
    i = 'mate-power-manager --version'
  )
  `#{i} #{ERROR_LINE}`.to_s.sub(/Version /,'')
end

#string?Boolean

#

string_to_display?

#

string?

Returns:

  • (Boolean)


98
99
100
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 98

def string_to_display?
  @internal_hash[:string_to_display]
end

#string_to_display?Boolean

#

string_to_display?

#

Returns:

  • (Boolean)


96
97
98
# File 'lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb', line 96

def string_to_display?
  @internal_hash[:string_to_display]
end