class RBT::ReportXfceVersion

Constants

N_LJUST
#

N_LJUST

#

Public Class Methods

[](i = '') click to toggle source
#

RBT::ReportXfceVersion[]

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 245
def self.[](i = '')
  new(i)
end
new( commandline_arguments = nil, run_already = true ) { || ... } click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 32
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 (add tag)

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 74
def add(
    i           = '',
    add_newline = true
  )
  case add_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_garcon_version() click to toggle source
#

add_garcon_version

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 209
def add_garcon_version
  add '  garcon: '.ljust(@n_ljust)+determine_version_of('garcon')
end
add_newline() click to toggle source
#

add_newline

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 100
def add_newline
  add
end
determine_version_of( i = 'xfdesktop' ) click to toggle source
#

determine_version_of

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 151
def determine_version_of(
    i = 'xfdesktop'
  )
  case i
  # ======================================================================= #
  # === exo
  # ======================================================================= #
  when 'exo'
    result = `pkg-config --modversion exo-2`.strip
  # ======================================================================= #
  # === libxfce4util
  # ======================================================================= #
  when 'libxfce4util'
    result = `pkg-config --modversion libxfce4util-1.0`.strip
  # ======================================================================= #
  # === libxfce4ui
  # ======================================================================= #
  when 'libxfce4ui'
    result = `pkg-config --modversion libxfce4ui-2`.strip
  # ======================================================================= #
  # === xfce4-panel
  # ======================================================================= #
  when /xfce4-?panel/
    result = `pkg-config --modversion libxfce4panel-2.0`.strip
  # ======================================================================= #
  # === garcon
  # ======================================================================= #
  when 'garcon'
    result = `pkg-config --modversion garcon-1`.strip
  else # This is the default entry point.
    result = `#{i} --version 2>&1`
  end
  if result.include? N
    result = result.split(N).first
  end
  # ======================================================================= #
  # Check for results such as:
  #
  #   "This is xfdesktop version 4.14.2, running on Xfce 4.15."
  #
  # or
  #
  #   "xfce4-session 4.14.1 (Xfce 4.15)"
  #
  # ======================================================================= #
  if result.include?(' version ')
    result = result.scan(
      /version (\d{1,2}\.?\d{1,2}\.?\d{1,2})/
    ).flatten.first
  elsif result.include?(' (')
    result = result.split(' (').first.split(' ').last
  end
  result
end
left_padded() click to toggle source
#

left_padded

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 107
def left_padded
  "#{grey}  "
end
pkgconfig_result( i = :libmatekbd )
report() click to toggle source
#

report

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 134
def report
  if @do_report
    string_to_display?.split(N).each {|line|
      if line.include? ':'
        _ = line.split(':')
        e seagreen(_[0]+':')+steelblue(_[1])
      else
        e line
      end
    }
    e
  end
end
report_pluma_version() click to toggle source
#

report_pluma_version

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 114
def report_pluma_version
  add left_padded+'Pluma: '.ljust(@n_ljust)+slateblue(plumav?)
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/report_xfce_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?()
Alias for: string_to_display?
return_pkgconfig_result_for( i = :libmatekbd ) click to toggle source
#

return_pkgconfig_result_for

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 121
def return_pkgconfig_result_for(
    i = :libmatekbd
  )
  result = `pkg-config --modversion #{i} 2>&1`.strip
  if result.include?('No package ') and result.include?(' found')
    result = ''
  end
  return result
end
Also aliased as: pkgconfig_result
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 216
def run
  add grey, :no_newline
  add 'Reporting the installed versions of the '+
      royalblue('xfce-desktop components')+
      grey(':')
  add_newline
  # ======================================================================= #
  # Next, add the programs that will be queried. These must all belong
  # to XFCE in one way or another.
  # ======================================================================= #
  add '  thunar: '.ljust(@n_ljust)+pkgconfig_result('thunarx-3')
  add '  tumbler: '.ljust(@n_ljust)+pkgconfig_result('tumbler-1')
  add '  xfconf: '.ljust(@n_ljust)+pkgconfig_result('libxfconf-0')
  add '  xfdesktop: '.ljust(@n_ljust)+determine_version_of('xfdesktop')
  add '  xfwm4: '.ljust(@n_ljust)+determine_version_of('xfwm4')
  add '  xfce4-session: '.ljust(@n_ljust)+determine_version_of('xfce4-session')
  add '  xfce4-settings: '.ljust(@n_ljust)+determine_version_of('xfce4-settings-manager')
  add '  xfce4-panel: '.ljust(@n_ljust)+determine_version_of('xfce4-panel')
  add '  libxfce4util: '.ljust(@n_ljust)+determine_version_of('libxfce4util')
  add '  libxfce4ui: '.ljust(@n_ljust)+determine_version_of('libxfce4ui')
  add '  exo: '.ljust(@n_ljust)+determine_version_of('exo')
  add_garcon_version
  add_newline
  report
end
string?()
Alias for: string_to_display?
string_to_display?() click to toggle source
#

string_to_display?

#
# File lib/rbt/utility_scripts/report_xfce_version.rb, line 92
def string_to_display?
  @internal_hash[:string_to_display]
end
Also aliased as: string?, result?