class EnvironmentInformation::EnvironmentInformation

Constants

THIS_FILE
#

THIS_FILE

THIS_FILE = __FILE__

We hardcode this since it is only relevant on my home system, anyway.

#
TRY_TO_USE_HTML_COLOURS
#

TRY_TO_USE_HTML_COLOURS

If true then we will try to use the konsole-colours, when possible.

These are part of the colours gem, so this adds a dependency on the colours gem.

#

Public Class Methods

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

EnvironmentInformation::EnvironmentInformation[]

#
# File lib/environment_information/class/initialize.rb, line 154
def self.[](i = '', &block)
  new(i, &block)
end
new( commandline_arguments = nil, run_already = true ) { || ... } click to toggle source
#

initialize

#
# File lib/environment_information/class/initialize.rb, line 51
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  register_sigint
  reset
  # ======================================================================= #
  # Next, we handle special run-mode variants.
  # ======================================================================= #
  case run_already
  when :do_show_everything
    do_show_everything
    run_already = true
  end
  # ======================================================================= #
  # And set @run_already, so that menu() can overrule it.
  # ======================================================================= #
  @run_already = run_already
  set_commandline_arguments(
    commandline_arguments
  )
  # ======================================================================= #
  # === Handle blocks
  #
  # Next blocks will be handled. This must come after the reset() method.
  # ======================================================================= #
  if block_given?
    yielded = yield
    case yielded # case tag
    # ===================================================================== #
    # === :do_not_use_rbt
    # ===================================================================== #
    when :do_not_use_rbt
      @may_we_try_to_use_rbt = false
    # ===================================================================== #
    # === :disable_colours
    # ===================================================================== #
    when :disable_colours
      disable_colours
    # ===================================================================== #
    # === :disable_colours_and_do_not_store_into_a_local_file
    # ===================================================================== #
    when :disable_colours_and_do_not_store_into_a_local_file
      disable_colours
      do_not_save_anything
    # ===================================================================== #
    # === :do_not_run_yet
    # ===================================================================== #
    when :do_not_run_yet
      @run_already = false
    else
      # =================================================================== #
      # Handle Hashes given in the block.
      # =================================================================== #
      if yielded.is_a? Hash
        # ================================================================= #
        # === :use_n_tokens
        # ================================================================= #
        if yielded.has_key? :use_n_tokens
          set_use_n_tokens(yielded.delete(:use_n_tokens))
        # ================================================================= #
        # === :n_tokens
        # ================================================================= #
        elsif yielded.has_key? :n_tokens
          set_use_n_tokens(yielded.delete(:n_tokens))
        end
        # ================================================================= #
        # === :use_colours
        # ================================================================= #
        if yielded.has_key? :use_colours
          set_use_colours(yielded.delete(:use_colours))
        end
        # ================================================================= #
        # === :be_silent
        # ================================================================= #
        if yielded.has_key? :be_silent
          set_be_silent(yielded.delete(:be_silent))
        end
        # ================================================================= #
        # === :show_ruby_stuff
        # ================================================================= #
        if yielded.has_key? :show_ruby_stuff
          if yielded.delete(:show_ruby_stuff) == false
            dont_show_ruby_stuff
          end
        end
      end
    end
  end
  # ======================================================================= #
  # Add the ruby components next.
  # ======================================================================= #
  consider_adding_the_ruby_components # ← Must come before menu().
  # ======================================================================= #
  # Invoke menu() to query for the commandline arguments.
  # ======================================================================= #
  menu
  run if @run_already
end

Public Instance Methods

add( i, version_to_use = nil ) click to toggle source
#

add (add tag)

This method can be used to add individual entries to the main array.

The entries will have two variables:

1) the name of the component (normally the program)
2) the version associated with that component

If a Symbol is given then we may use this as a “pointer” towards an array of registered programs.

Note that (1) will be converted into a Symbol if it is a String.

If the second entry (2) is nil, then the version will be inferred at “runtime” within the method display(). Otherwise display() will simply use the passed version (which should be a String in that case, then).

Before we can add an entry to the main dataset, we have to check whether it is a registered entry altogether. If it is not registered, the user has to be notified about this fact. This notification will ONLY happen if the associated version is nil; if a specific version is supplied then this method will assume that the program should be displayed anyway.

An Array can also be supplied to this method, if necessary.

#
# File lib/environment_information/class/add.rb, line 40
def add(
    i, version_to_use = nil
  )
  if i.is_a?(String) and i.include?(',')
    i = i.split(',')
  elsif i.is_a?(String) and i.include?('-')
    i = i.dup if i.frozen?
    i.delete!('-')
  end
  case i
  # ======================================================================= #
  # === :everything
  #
  # This entry point is meant for simply adding everything.
  # ======================================================================= #
  when :everything
    i = return_every_registered_component
  # ======================================================================= #
  # === :linux_kernel
  # ======================================================================= #
  when :linux_kernel
    i = :linux
  # ======================================================================= #
  # === :RAM
  # ======================================================================= #
  when :RAM
    i = :ram # Just the "alias" to the real entry.
  # ======================================================================= #
  # === :all_xorg_components
  # ======================================================================= #
  when :all_xorg_components
    i = return_all_xorg_components
  # ======================================================================= #
  # === envi --science
  # ======================================================================= #
  when :science_cluster
    i = ARRAY_SCIENCE_CLUSTER
   # ======================================================================= #
   # === envi --lfs_core_programs
   # ======================================================================= #
   when :lfs,
        :lfs_core_programs
    i = ::EnvironmentInformation.lfs_core_programs?
  end
  if i.is_a? Array
    i.each {|entry, version_to_use| add(entry, version_to_use) }
  else
    unless @array_display_these_components.map {|entry| entry.first }.include? i 
      @array_display_these_components << [i, version_to_use]
      #@array_display_these_components.flatten!
    end
  end
end
add_this_to_the_toplevel_hash(a, b) click to toggle source
#

add_this_to_the_toplevel_hash

#
# File lib/environment_information/class/report.rb, line 43
def add_this_to_the_toplevel_hash(a, b)
  ::EnvironmentInformation.hash?[a] = b
end
append( i, version_to_use = nil )
Alias for: add
append_this_to_main_string( i, version_to_use = nil )
Alias for: add
array_obtain_these_programs?()
array_with_entries?()
assign_components_for_the_short_format() click to toggle source
#

assign_components_for_the_short_format

We will only display 6 components when we use the short variant.

#
# File lib/environment_information/class/misc.rb, line 360
def assign_components_for_the_short_format
  clear_old_dataset
  dont_show_ruby_stuff
  add(%i(
    operating_system
    operating_system_bit_type
    cpuinfo
    cflags
    RAM
    screen_resolution
  ))
end
be_silent() click to toggle source
#

be_silent

#
# File lib/environment_information/class/misc.rb, line 277
def be_silent
  @be_silent = true
end
be_silent?() click to toggle source
#

be_silent?

#
# File lib/environment_information/class/misc.rb, line 291
def be_silent?
  @be_silent
end
bit_type?() click to toggle source
#

bit_type?

#
# File lib/environment_information/class/misc.rb, line 337
def bit_type?
  ::EnvironmentInformation.send(__method__)
end
blue(i = '') click to toggle source
#

blue

#
# File lib/environment_information/class/colours.rb, line 110
def blue(i = '')
  if i.empty?
    Colours::BLUE
  end if use_colours?
end
build_up_the_main_string()
Alias for: report
cd(i) click to toggle source
#

cd (cd tag)

A shorter variant for the change-directory action.

#
# File lib/environment_information/class/misc.rb, line 667
def cd(i)
  ::EnvironmentInformation.cd(i)
end
cflags_in_use?() click to toggle source
#

cflags_in_use?

#
# File lib/environment_information/class/misc.rb, line 351
def cflags_in_use?
  ::EnvironmentInformation.send(__method__)
end
clear_main_dataset()
clear_old_dataset() click to toggle source
#

clear_old_dataset

#
# File lib/environment_information/class/misc.rb, line 77
def clear_old_dataset
  @array_display_these_components = []
end
clear_the_main_dataset() click to toggle source
#

clear_the_main_dataset

#
# File lib/environment_information/class/misc.rb, line 84
def clear_the_main_dataset
  clear_old_dataset
  do_not_display_the_ruby_components
end
clear_toplevel_hash() click to toggle source
#

clear_toplevel_hash

#
# File lib/environment_information/class/report.rb, line 36
def clear_toplevel_hash
  ::EnvironmentInformation.clear_hash
end
col1() click to toggle source
#

col1

The “first” colour to be used.

#
# File lib/environment_information/class/colours.rb, line 90
def col1
  if use_colours?
    Colours::BOLD_BLUE
  else
    ''
  end
end
colourize_this_in_the_right_side_colour(i) click to toggle source
#

colourize_this_in_the_right_side_colour

#
# File lib/environment_information/class/colours.rb, line 24
def colourize_this_in_the_right_side_colour(i)
  if use_colours?
    ::Colours.send(::EnvironmentInformation.colour_for_the_right_side, i)
  else
    i
  end
end
commandline?() click to toggle source
#

commandline?

Whether we run in the “commandline mode” or whether we run in the GUI or WWW/HTML mode.

#
# File lib/environment_information/class/misc.rb, line 270
def commandline?
  @runmode == :commandline
end
commandline_arguments?() click to toggle source
#

commandline_arguments?

#
# File lib/environment_information/class/misc.rb, line 164
def commandline_arguments?
  @commandline_arguments
end
compare_program_version?() click to toggle source
#

compare_program_version?

#
# File lib/environment_information/class/misc.rb, line 399
def compare_program_version?
  @compare_program_version
end
components?()
consider_adding_the_ruby_components() click to toggle source
#

consider_adding_the_ruby_components

This method can be used to consider adding the ruby-components, which means “ruby” itself, rubygems “gem”, and the rubygems installation directory.

#
# File lib/environment_information/class/ruby.rb, line 40
def consider_adding_the_ruby_components
  if @show_ruby_version_and_gem_version
    add(
      return_all_ruby_components # Combine three calls into one here - all related to ruby.
    )
  end
end
consider_storing_the_components_that_were_displayed() click to toggle source
#

consider_storing_the_components_that_were_displayed

#
# File lib/environment_information/class/misc.rb, line 237
def consider_storing_the_components_that_were_displayed
  ::EnvironmentInformation.consider_storing_these_results_into_a_local_file
end
consider_storing_which_components_were_displayed()
consider_storing_which_programs_are_not_up_to_date() click to toggle source
#

consider_storing_which_programs_are_not_up_to_date

#
# File lib/environment_information/class/misc.rb, line 104
def consider_storing_which_programs_are_not_up_to_date
  if shall_we_really_store_which_programs_are_not_up_to_date?
    into = FILE_THESE_PROGRAMS_CAN_BE_UPGRADED
    what = YAML.dump(@array_these_programs_not_up_to_date)
    if File.directory?('/home/Temp/rbt/')
      into = "/home/Temp/rbt/#{File.basename(into)}"
    else
      into = "#{log_dir?}#{File.basename(into)}"
    end
    opnn; e 'We will also store which programs are not up to date.'
    opnn; e "These will be stored into the file at `#{sfile(into)}`."
    ::EnvironmentInformation.write_what_into(what, into)
  end
end
cpu_model?() click to toggle source
#

cpu_model?

#
# File lib/environment_information/class/misc.rb, line 344
def cpu_model?
  ::EnvironmentInformation.send(__method__)
end
crimson(i = '') click to toggle source
#

crimson

#
# File lib/environment_information/class/colours.rb, line 143
def crimson(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.crimson(i)
  end
  return i
end
cyan(i = '') click to toggle source
#

cyan

#
# File lib/environment_information/class/colours.rb, line 101
def cyan(i = '')
  if i.empty?
    Colours::CYAN
  end if use_colours?
end
darkgreen(i = '') click to toggle source
#

darkgreen

#
# File lib/environment_information/class/colours.rb, line 153
def darkgreen(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.darkgreen(i)
  end
  return i
end
darkolivegreen(i = '') click to toggle source
#

darkolivegreen

#
# File lib/environment_information/class/colours.rb, line 245
def darkolivegreen(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.darkolivegreen(i)
  end
  return i
end
dataset?()
dataset_as_string() click to toggle source
#

dataset_as_string

This method must return the dataset in String format. That String must already be properly “formatted”.

#
# File lib/environment_information/class/misc.rb, line 546
def dataset_as_string
  _ = ''.dup # Put the information onto that String here.
  main_dataset?.each {|entry|
    if entry.is_a? Array
      entry = entry.first # The second entry is ignored in that event.
    end
    # ===================================================================== #
    # Before we can use .send() we have to check whether EnvironmentInformation
    # actually responds to that method. If not then we will simply skip
    # this snippet for now; but this may have to be changed at some
    # point in the future, to more elegantly handle failure. (Sep 2019).
    # ===================================================================== #
    use_this_method = "return_version_of_#{entry}".to_sym
    if ::EnvironmentInformation.respond_to? use_this_method
      program_version = ::EnvironmentInformation.send(
        use_this_method
      )
      entry = "  #{entry}:"
      _ << "#{entry} #{program_version}#{N}"
    end
  }
  return _ # And return the generated String.
end
Also aliased as: string?, string, main_string?, stringified
dimgray(i = '') click to toggle source
#

dimgray

#
# File lib/environment_information/class/colours.rb, line 163
def dimgray(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.dimgray(i)
  end
  return i
end
disable_colours() click to toggle source
#

disable_colours

Call this method when you wish to disable the colours. Note that this will disable colours on the toplevel.

#
# File lib/environment_information/class/colours.rb, line 59
def disable_colours
  ::EnvironmentInformation.use_colours = false
end
Also aliased as: no_colours
display()
Alias for: report
display_the_components()
Alias for: report
display_the_dataset()
Alias for: report
display_the_main_components()
Alias for: report
display_these_components?() click to toggle source
#

display_these_components?

Note that @display_these_components is a Hash.

#
# File lib/environment_information/class/misc.rb, line 525
def display_these_components?
  @array_display_these_components
end
display_which_components?()
do_compare_the_program_version( be_verbose = true ) click to toggle source
#

do_compare_the_program_version

This method can be used if the user wishes to also compare the program version of the installed programs.

#
# File lib/environment_information/class/misc.rb, line 379
def do_compare_the_program_version(
    be_verbose = true
  )
  if be_verbose
    @array_show_this_to_the_user <<
      'The program versions will also be compared.'
  end
  @compare_program_versions = true
end
do_display_in_a_short_format() click to toggle source
#

do_display_in_a_short_format

The short-format means that we will use only a compact set of programs to display. For example, “make” and “bash” will not be displayed, neither “binutils” or “ruby”.

#
# File lib/environment_information/class/misc.rb, line 440
def do_display_in_a_short_format
  @display_everything_in_short_format = true
end
do_exit_the_program() click to toggle source
#

do_exit_the_program

#
# File lib/environment_information/class/misc.rb, line 639
def do_exit_the_program
  @do_exit_the_program = true
end
do_feedback_everything()
Alias for: run
do_generate_a_html_file( styling_instructions = :bold ) click to toggle source
#

do_generate_a_html_file (html tag)

The action-method that will generate the html file. This depends on the gem html_tags, with module HtmlTags though.

To invoke this method, do:

envi --generate-html-file
#
# File lib/environment_information/class/html.rb, line 25
def do_generate_a_html_file(
    styling_instructions = :bold
  )
  # ======================================================================= #
  # === Ensure that the html_tags project is available
  # ======================================================================= #
  unless Object.const_defined? :HtmlTags
    begin
      require 'html_tags'
    rescue LoadError
      e 'html_tags is not available. Considering installing it via:'
      e
      e '  gem install html_tags'
      e
    end
  end
  # ======================================================================= #
  # === Define where to store the .html file in question
  # ======================================================================= #
  this_html_file = "#{::EnvironmentInformation.temp_directory?}environment_information.html"
  what = dataset_as_string
  case styling_instructions
  when :bold
    what = HtmlTags.b(what)
  end
  what = HtmlTags.html(
    HtmlTags.body(
      HtmlTags.h1(
        'Your environment', css_style: 'margin-top:1em'
      )+
      HtmlTags.pre(what, css_style: 'font-size: larger; padding-left:1em;')
    )
  )
  ::EnvironmentInformation.write_what_into(what, this_html_file)
  # ======================================================================= #
  # Notify the user what has been done.
  # ======================================================================= #
  if File.exist? this_html_file
    opnn; e "Generated a HTML file at `#{sfile(this_html_file)}`."
  end
end
do_not_display_the_result() click to toggle source
#

do_not_display_the_result

#
# File lib/environment_information/class/misc.rb, line 330
def do_not_display_the_result
  @display_result = false
end
do_not_display_the_ruby_components()
do_not_run()
Alias for: do_not_run_already
do_not_run_already() click to toggle source
#

do_not_run_already

#
# File lib/environment_information/class/misc.rb, line 618
def do_not_run_already
  @run_already = false
end
Also aliased as: do_not_run
do_not_save_anything() click to toggle source
#

do_not_save_anything

#
# File lib/environment_information/class/misc.rb, line 226
def do_not_save_anything
  @shall_the_results_be_saved = false
  # ======================================================================= #
  # We will also avoid saving the results into a local yaml file.
  # ======================================================================= #
  @store_the_results_into_local_files = false
end
do_not_show_the_ruby_components() click to toggle source
#

do_not_show_the_ruby_components

#
# File lib/environment_information/class/ruby.rb, line 51
def do_not_show_the_ruby_components
  @show_ruby_version_and_gem_version = false
end
do_rename_kde_konsole( use_this_title = 'Environment Information' ) click to toggle source
#

do_rename_kde_konsole

This will attempt to rename the KDE Konsole tab, but only if we are on roebe.

#
# File lib/environment_information/class/misc.rb, line 586
def do_rename_kde_konsole(
    use_this_title = 'Environment Information'
  )
  begin
    require 'roebe/requires/require_kde_konsole.rb'
  rescue LoadError; end  
  if @try_to_rename_the_kde_konsole_tab and
     is_on_roebe? and
     Object.const_defined?(:Roebe) and
     Roebe.const_defined?(:KdeKonsole)
    Roebe.rename_konsole(use_this_title)
  end
end
do_report_the_remote_urls() click to toggle source
#

do_report_the_remote_urls

#
# File lib/environment_information/class/misc.rb, line 611
def do_report_the_remote_urls
  @report_the_remote_urls = true
end
do_show_everything() click to toggle source
#

do_show_everything (everything tag, full tag)

This method can be used when the user wishes to enable seeing full information about his local environment (on the computer).

Commandline invocation:

envi --everything
#
# File lib/environment_information/class/misc.rb, line 252
def do_show_everything
  add(:everything) # Simply add everything.
end
do_show_full_information()
Alias for: do_show_everything
do_show_help() click to toggle source
#

do_show_help (help tag)

Show the commandline-usage through this method here.

To invoke this, try:

envi --help
#
# File lib/environment_information/class/help.rb, line 23
def do_show_help
  e
  lpad = "#{col1}    "
  e "#{rev}The following options are available for "\
    "#{simp('class EnvironmentInformation:')}#{rev}#{N}#{N}"
  if ASCIITABLE_IS_AVAILABLE
    e col1+'    asciitable        '+rev+'# Print in Ascii Table format'
  end
  e lpad+'html              '+rev+'# Save the environment information '\
    'into a .html file'
  e lpad+'gui               '+rev+'# Start the GTK gui bindings; some '\
    'aliases are possible such as --GUI'
  e lpad+'nocolours         '+rev+'# Disable colours '\
    '(--disable-colours also works)'
  e lpad+'noruby            '+rev+'# dont show ruby-related environment '\
    'information'
  e lpad+'help              '+rev+'# show some help'
  e lpad+'xorg              '+rev+'# show some xorg-specific '\
    'components (also --xorg-components)'
  e lpad+'OS                '+rev+'# show the OS then exit'
  e lpad+'full              '+rev+'# show full information, including '\
    'GTK, Glib, Atk and Pango Version'
  e '                      # ^^^ This is probably the most useful usage.'
  e lpad+'openssl           '+rev+'# display openssl option'
  e lpad+'REALLY_ALL        '+rev+'# also compare the program_versions '\
    '(--really-everything is an alias to this)'
  e lpad+'save              '+rev+'# display the result, then '\
    'save it into a file'
  e lpad+'version           '+rev+'# show the version of '\
    'EnvironmentInformation in use'
  e lpad+'--show-remote-url '+rev+'# show the remote URLs '\
    'of a program (requires the RBT project)'
  e lpad+'padding=value     '+rev+'# set to another padding value'
  e rev+N+'The above commands should be commandline arguments, '\
    'such as: "'+teal('envi full')+rev+'".'
  e
  e rev+'Do note that you can prefix the above commands via '\
    'a leading --, of course.'
  e
  # Show a simple usage example next:
  e 'Usage example:'
  e
  e steelblue(
      '    envi --version'
    )
  e
  e rev+'If you wish to show only some programs, you could '\
    'use the following:'
  e
  e steelblue(
      '    envi --use-these-programs=bash,binutils,bison,yacc,bzip2,coreutils,diff,find,gawk,gcc'
    )
  e steelblue(
      '    envi --use-these-programs=:lfs'
    )
  e true_rev # Reset via Colours.rev here.
  do_exit_the_program
end
Also aliased as: show_help
do_show_only_the_operating_system() click to toggle source
#

do_show_only_the_operating_system

#
# File lib/environment_information/class/misc.rb, line 413
def do_show_only_the_operating_system
  clear_old_dataset
  add(:operating_system)
end
do_show_only_the_xorg_components() click to toggle source
#

do_show_only_the_xorg_components

This method will essentially clear the old dataset before adding all xorg-components to the display-part of this class.

The components that are appended here, are defined in the file constants/array_tracked_components.rb - so if you wish to add new xorg-related entries, you should modify the entries in that .rb file.

#
# File lib/environment_information/class/misc.rb, line 321
def do_show_only_the_xorg_components
  clear_old_dataset
  do_not_show_the_ruby_components
  add(:all_xorg_components)
end
do_sort_alphabetically() click to toggle source
#

do_sort_alphabetically (sort tag)

#
# File lib/environment_information/class/misc.rb, line 421
def do_sort_alphabetically
  _ = display_which_components?.sort_by {|name, version| name }
  set_main_array(_)
end
dont_show_ruby_stuff() click to toggle source
#

dont_show_ruby_stuff

Disable showing ruby + gem information.

#
# File lib/environment_information/class/ruby.rb, line 16
def dont_show_ruby_stuff # Dont show ruby stuff.
  @show_ruby_version_and_gem_version = false
end
Also aliased as: show_no_ruby
e(i = '') click to toggle source
#

e (e tag)

The e() method is the general output-method for this class.

#
# File lib/environment_information/class/report.rb, line 210
def e(i = '')
  if @display_everything_in_short_format
    # ===================================================================== #
    # Display the results in a single line.
    # ===================================================================== #
    print "#{i}, "
  else
    puts i
  end unless @be_silent
end
empty_main_array()
empty_main_dataset()
enable_colours() click to toggle source
#

enable_colours

#
# File lib/environment_information/class/colours.rb, line 49
def enable_colours
  ::EnvironmentInformation.use_colours = true
end
enable_sort_alphabetically() click to toggle source
#

enable_sort_alphabetically

#
# File lib/environment_information/class/misc.rb, line 429
def enable_sort_alphabetically
  @sort_alphabetically = true
end
feedback()
Alias for: run
feedback_everything()
Alias for: run
first_argument?() click to toggle source
#

first_argument?

#
# File lib/environment_information/class/misc.rb, line 171
def first_argument?
  @commandline_arguments.first
end
gui?() click to toggle source
#

gui?

#
# File lib/environment_information/class/misc.rb, line 260
def gui?
  @runmode == :gui
end
is_a_registered_component?(i) click to toggle source
#

is_a_registered_component?

#
# File lib/environment_information/class/misc.rb, line 603
def is_a_registered_component?(i)
  i = i.to_sym unless i.is_a? Symbol
  ::EnvironmentInformation.is_this_component_included?(i)
end
Also aliased as: is_an_allowed_entry?
is_an_allowed_entry?(i)
is_on_roebe?() click to toggle source
#

is_on_roebe?

#
# File lib/environment_information/class/misc.rb, line 576
def is_on_roebe?
  ::EnvironmentInformation.is_on_roebe?
end
is_rbt_available?() click to toggle source
#

is_rbt_available? (rbt tag)

Query whether the user has the necessary code from the RBT project installed.

#
# File lib/environment_information/class/misc.rb, line 789
def is_rbt_available?
  Object.const_defined? :RBT
end
is_this_program_included?(i) click to toggle source
#

is_this_program_included?

#
# File lib/environment_information/class/misc.rb, line 737
def is_this_program_included?(i)
  ::EnvironmentInformation.is_this_program_included?(i)
end
lightgreen(i = '') click to toggle source
#

lightgreen

#
# File lib/environment_information/class/colours.rb, line 255
def lightgreen(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.lightgreen(i)
  end
  return i
end
limegreen(i = '') click to toggle source
#

limegreen

#
# File lib/environment_information/class/colours.rb, line 235
def limegreen(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.limegreen(i)
  end
  return i
end
load_dataset_from_this_file(i) click to toggle source
#

load_dataset_from_this_file

This method can be used to read which programs will be displayed from a local file, rather than rely on the pre-set default.

#
# File lib/environment_information/class/misc.rb, line 142
def load_dataset_from_this_file(i)
  if File.exist? i
    File.readlines(i).map {|entry|
      entry.delete('-').strip # <- Clean up the input a little bit.
    }
  else
    opnn; e "No file exists at `#{sfile(i)}`."
  end
end
log_dir?() click to toggle source
#

log_dir?

#
# File lib/environment_information/class/misc.rb, line 219
def log_dir?
  ::EnvironmentInformation.temp_directory?
end
Also aliased as: log_directory?
log_directory?()
Alias for: log_dir?
main_array?()
main_dataset?()
main_entry?()
main_string?()
Alias for: dataset_as_string
may_we_try_to_use_rbt?() click to toggle source
#

may_we_try_to_use_rbt?

#
# File lib/environment_information/class/misc.rb, line 392
def may_we_try_to_use_rbt?
  @may_we_try_to_use_rbt
end
mediumpurple(i = '') click to toggle source
#

mediumpurple

#
# File lib/environment_information/class/colours.rb, line 265
def mediumpurple(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.mediumpurple(i)
  end
  return i
end
menu( i = @commandline_arguments ) click to toggle source
#

menu (menu tag)

This method constitutes the “menu” interface for class EnvironmentInformation. It usually deals with the commandline-given arguments stored in ARGV.

#
no_colours()
Alias for: disable_colours
olive(i = '') click to toggle source
#

olive

#
# File lib/environment_information/class/colours.rb, line 225
def olive(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.olive(i)
  end
  return i
end
olivedrab(i = '') click to toggle source
#

olivedrab

This one will be used for the right-hand side.

#
# File lib/environment_information/class/colours.rb, line 215
def olivedrab(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.olivedrab(i)
  end
  return i
end
open_this_file_in_editor() click to toggle source
#

open_this_file_in_editor

#
# File lib/environment_information/class/misc.rb, line 211
def open_this_file_in_editor
  _ = "bluefish #{THIS_FILE}"
  e _; system _; exit
end
operating_system?() click to toggle source
#

operating_system?

To quickly test this method, try:

EnvironmentInformation::EnvironmentInformation.new { :do_not_run_yet }.operating_system?
#
# File lib/environment_information/class/misc.rb, line 801
def operating_system?
  ::EnvironmentInformation.send(__method__)
end
opn()
Alias for: opnn
opnn() click to toggle source
#

opnn

#
# File lib/environment_information/class/opn.rb, line 21
def opnn
  Opn.opn({
    namespace:   NAMESPACE,
    use_colours: use_colours?
  }) if Object.const_defined? :Opn
end
Also aliased as: opn
orange(i = '') click to toggle source
#

orange

#
# File lib/environment_information/class/colours.rb, line 283
def orange(i = '')
  return ::Colours.orange(i) if use_colours?
  return i
end
output()
Alias for: run
programs?()
ram?() click to toggle source
#

ram?

#
# File lib/environment_information/class/misc.rb, line 674
def ram?
  ::EnvironmentInformation.send(__method__)
end
register_not_found(i)
register_sigint() click to toggle source
#

register_sigint

#
# File lib/environment_information/class/register_sigint.rb, line 14
def register_sigint
  Signal.trap('SIGINT') { e; exit }
end
register_unavailable_program(i) click to toggle source
#

register_unavailable_program

Programs that were not be found can be registered through this method.

#
# File lib/environment_information/class/misc.rb, line 180
def register_unavailable_program(i)
  i = i.to_sym # Let's store only Symbols.
  @array_unavailable_programs << i
end
Also aliased as: register_not_found
report() click to toggle source
#

report (report tag)

#
# File lib/environment_information/class/report.rb, line 50
def report
  if @array_display_these_components.empty?
    opn; e 'There are no components that can be displayed.' # And this ends here.
  else
    e
    clear_toplevel_hash
    # ===================================================================== #
    # Iterate over the main components next.
    # ===================================================================== #
    @array_display_these_components.each {|this_program, version|
      if version.nil?
        version = ::EnvironmentInformation.version_for?(this_program)
      end
      if version.nil?
        register_unavailable_program(this_program)
      end
      add_this_to_the_toplevel_hash(this_program, version)
      # =================================================================== #
      # Next do some sanitizing.
      # =================================================================== #
      case this_program.to_s
      # ===================================================================== #
      # === operating_system
      # ===================================================================== #
      when /^operating(_|-)?system$/i,
           /^operating(_|-)?system(_|-)?in(_|-)?use$/i
        this_program = 'Operating system'
      # ===================================================================== #
      # === operating_system_bit_type
      # ===================================================================== #
      when /^operating(_|-)?system(_|-)?bit(_|-)?type$/i
        this_program = 'Operating system bit type'
      # ===================================================================== #
      # === ram
      # ===================================================================== #
      when /^ram$/i
        this_program = 'RAM'
      # ===================================================================== #
      # === cflags
      # ===================================================================== #
      when /^cflags$/i
        this_program = 'cflags in use'
      # ===================================================================== #
      # === screen_resolution
      # ===================================================================== #
      when /^screen( |_)?resolution$/i
        this_program = 'Screen Resolution'
      # =================================================================== #
      # === cpflags
      # =================================================================== #
      when /^cflags$/i,
           /^CFLAGS in use$/i
        this_program = 'CFLAGS in use'
      # =================================================================== #
      # === cpuinfo
      # =================================================================== #
      when 'cpuinfo'
        this_program = 'CPU Model'
      end
      left_side  = ::EnvironmentInformation.prepare_left_side(this_program.to_s.dup)
      right_side = ::EnvironmentInformation.prepare_right_side(version.to_s.ljust(6)).to_s
      if version.nil?
        right_side = dimgray('[Not found or installed.]')
      end
      this_program = this_program.dup if this_program.frozen?
      case this_program.to_s.strip
      # =================================================================== #
      # === Screen Resolution
      # =================================================================== #
      when /^RAM$/
        right_side = right_side.dup if right_side.frozen?
        right_side << orange('MB RAM')
      # =================================================================== #
      # === Screen Resolution
      # =================================================================== #
      when /^Screen Resolution$/
        if right_side.include?('x') and use_colours?
          splitted = right_side.split('x')
          right_side = colourize_this_in_the_right_side_colour(splitted.first)+
                       royalblue('x')+
                       colourize_this_in_the_right_side_colour(splitted.last)
        end
      end
      if right_side.include? 'steelblue'
        # ================================================================= #
        # An ad-hoc solution - we assume it was not found.
        # ================================================================= #
        right_side = '[Not found.]'
        if use_colours?
          right_side = orange(right_side)
        end
      end
      # =================================================================== #
      # === @report_the_remote_urls
      #
      # Next, honour @report_the_remote_urls if it is true.
      # =================================================================== #
      if @report_the_remote_urls
        if Object.const_defined?(:RBT) and
           RBT.respond_to?(:remote_url_for?)
          version = ''.dup
          _ = this_program.to_s.delete('-').downcase.strip
          if RBT.does_include?(_)
            remote_url = RBT.remote_url_for?(_, :return_as_string)
            if is_a_registered_component? _
              if version.frozen?
                version = version.dup
              end
              version << lightgreen(remote_url)
              right_side = right_side.dup if right_side.frozen?
              right_side << " #{olive('→')} #{version}"
            end
          end
        end
      end
      e left_side+right_side
      _ = this_program.to_s.delete(':')
      # =================================================================== #
      # Next compare the program versions.
      # =================================================================== #
      if @compare_program_versions and
         may_we_try_to_use_rbt? and
         is_rbt_available?      and
         RBT.does_include?(_)
        registered_local_version = RBT.swift_return_version_of_this_program(_.to_sym).to_s
        # ================================================================= #
        # We ignore gtk2 when it comes to the version-check.
        # ================================================================= #
        next if this_program == :gtk2
        # ================================================================= #
        # Next use Gem::Version to compare them, but not if the version
        # is nil.
        # ================================================================= #
        unless version.nil?
          # =============================================================== #
          # The .delete('v') part is specifically to workaround node.
          # =============================================================== #
          if Gem::Version.new(registered_local_version.delete('v').tr('_','.')) > Gem::Version.new(version)
            e slateblue('     ^^^^^ This program could be upgraded, '\
              'to the version ')+
              steelblue(registered_local_version)
          end
        end
      end
    }
    e
  end
end
report_result()
Alias for: report
report_version() click to toggle source
#

report_version

#
# File lib/environment_information/class/misc.rb, line 656
def report_version
  require 'environment_information/toplevel_methods/menu.rb'
  ::EnvironmentInformation.report_version
  @do_exit_the_program = true
end
reset() click to toggle source
#

reset (reset tag)

#
# File lib/environment_information/class/reset.rb, line 14
def reset
  # ======================================================================= #
  # === @store_the_results_into_local_files
  #
  # If the following variable is set to true then the project will
  # generate local files too, e. g. yaml files and what not.
  # ======================================================================= #
  @store_the_results_into_local_files = true
  # ======================================================================= #
  # === @use_ascii_table
  #
  # Whether to use an ASCII table or whether we will not:
  # ======================================================================= #
  @use_ascii_table = false
  # ======================================================================= #
  # === @table
  # ======================================================================= #
  @table = nil # The ascii table.
  # ======================================================================= #
  # === @array_unavailable_programs
  #
  # Programs which could not be found can be registered into the following
  # Array.
  # ======================================================================= #
  @array_unavailable_programs = []
  # ======================================================================= #
  # === @runmode
  #
  # The @runmode variable can be :commandline or :gui or :www.
  # ======================================================================= #
  @runmode = :commandline
  # ======================================================================= #
  # === @show_everything
  #
  # If the following instance variable is set to true then this class
  # will try to show every registered (and thus, available) component.
  #
  # By default this is not wanted, so it is disabled. The user has to
  # specifically enable this option via the commandline, if so
  # desired, and thus overrule this default value.
  # ======================================================================= #
  @show_everything = false
  # ======================================================================= #
  # === @display_result
  #
  # If the following instance variable is true, which is the case by
  # default, then this class will report to the user on the commandline.
  #
  # If it is set to false then nothing will be displayed; this is
  # useful when you only want to obtain the dataset, without
  # showing anything to the user.
  # ======================================================================= #
  @display_result = true
  # ======================================================================= #
  # === @be_silent
  #
  # By default, this class is not silent, meaning that it will display
  # information to the user.
  # ======================================================================= #
  @be_silent = false
  # ======================================================================= #
  # === @array_these_programs_not_up_to_date
  #
  # This Array can be used to save into a local file which programs
  # are not up to date.
  # ======================================================================= #
  if is_on_roebe?
    @array_these_programs_not_up_to_date = []
  end
  # ======================================================================= #
  # === @compare_program_versions
  #
  # This instance variable can be used to also compare the program
  # versions, if the RBT project is available.
  #
  # By default this will not be done, though.
  # ======================================================================= #
  @compare_program_versions = false
  # ======================================================================= #
  # === @may_we_try_to_use_rbt
  #
  # Whether we may query RBT for additional help or not. By default
  # we will try to make use of RBT.
  # ======================================================================= #
  @may_we_try_to_use_rbt = true
  # ======================================================================= #
  # === @array_show_this_to_the_user
  #
  # The following Array can be used to show messages to the user.
  # ======================================================================= #
  @array_show_this_to_the_user = []
  # ======================================================================= #
  # === @array_display_these_components
  #
  # This Array will display the components on the commandline.
  #
  # Take note that the order is important: the entries that appear first
  # will be displayed earlier. In other words: first entries will be
  # shown first as well.
  # ======================================================================= #
  @array_display_these_components = []
  # ======================================================================= #
  # === @sort_alphabetically
  #
  # Whether to sort the main Hash alphabetically or not.
  # ======================================================================= #
  @sort_alphabetically = false
  # ======================================================================= #
  # === @show_ruby_version_and_gem_version
  #
  # This instance variable determines whether class EnvironmentInformation
  # will display the ruby version and the gem version.
  #
  # By default we will do so, but there may be situations where this
  # may be unwanted, or not a good idea, such as in a minimal system
  # where no ruby is running, or if the user only wants to display
  # very little information.
  # ======================================================================= #
  @show_ruby_version_and_gem_version = true
  # ======================================================================= #
  # === @display_everything_in_short_format
  #
  # This variable determines whether we will use a compact-display or
  # whether there will be one-entry-per-program instead.
  # ======================================================================= #
  @display_everything_in_short_format = false
  # ======================================================================= #
  # === @generate_a_html_file
  #
  # If the next instance variable is set to true then a html file will
  # be generated. By default this will not happen, though.
  # ======================================================================= #
  @generate_a_html_file = false
  # ======================================================================= #
  # === @try_to_rename_the_kde_konsole_tab
  #
  # The following instance variable will determine as to whether we will
  # try to make use of the KDE Konsole and rename the tab of the konsole
  # there.
  #
  # Since as of October 2018 we will not use the KDE konsole by default
  # anymore. This may change at a later moment in time, though.
  # ======================================================================= #
  @try_to_rename_the_kde_konsole_tab = false
  # ======================================================================= #
  # === @run_already
  #
  # This variable will be true by default.
  # ======================================================================= #
  @run_already = true
  # ======================================================================= #
  # === @show_help
  #
  # If this variable is set to true, then we will only show help, then
  # exit the program.
  # ======================================================================= #
  @show_help = false
  # ======================================================================= #
  # === @report_the_remote_urls
  #
  # If this instance variable is set to true then the remote URLs will
  # be shown as well, on the commandline.
  # ======================================================================= #
  @report_the_remote_urls = false
  # ======================================================================= #
  # === @do_exit_the_program
  #
  # The following variable can determine when we exit from this class.
  # By default we will not exist early.
  # ======================================================================= #
  @do_exit_the_program = false
  # ======================================================================= #
  # Add the default programs on a linux computer.
  # ======================================================================= #
  add(
    return_default_programs_on_a_linux_computer
  )
end
result()
Alias for: result_as_array
result?()
result_as_array() click to toggle source
#

result_as_array

The lines that we will have inside of this method, may look like this:

"  operating_system:                 GNU/Linux\n"
#
# File lib/environment_information/class/misc.rb, line 127
def result_as_array
  _ = dataset_as_string
  splitted = _.split("\n")
  splitted.map! {|inner_line|
    inner_line.split(': ').map {|entry| entry.strip }
  }
  return splitted
end
Also aliased as: result
return_all_ruby_components() click to toggle source
#

return_all_ruby_components

Combine three calls into one here - all related to ruby.

#
# File lib/environment_information/class/ruby.rb, line 25
def return_all_ruby_components
  %i(
    ruby
    rubygems
    rubygems_installation_directory
  )
end
return_all_xorg_components()
Alias for: xorg_components?
return_default_programs_on_a_linux_computer()
return_default_programs_on_linux() click to toggle source
#

return_default_programs_on_linux

This method should return the “main” programs on a linux computer, the most important entries.

#
# File lib/environment_information/class/misc.rb, line 649
def return_default_programs_on_linux
  ARRAY_DEFAULT_PROGRAMS_ON_LINUX
end
return_every_registered_component() click to toggle source
#

return_every_registered_component

#
# File lib/environment_information/class/misc.rb, line 465
def return_every_registered_component
  array = ::EnvironmentInformation.tracked_programs?+
          ::EnvironmentInformation.tracked_non_programs?+
          ::EnvironmentInformation.science_cluster?+
          ::EnvironmentInformation.xorg_components?
  array = array.flatten.uniq
  # ======================================================================= #
  # === The mate-desktop
  #
  # Since as of 31.03.2019 we will also try to show the mate-desktop
  # components if the RBT project is available/installed.
  # ======================================================================= #
  if is_rbt_available?
    if RBT.const_defined?(:ReportMateDesktopVersion)
      # =================================================================== #
      # Keep in mind that this Array is nested, so the name is
      # included as well as the version.
      # =================================================================== #
      _ = RBT.return_mate_desktop_version_array
      _.each {|a,b|
        array << [a, b]
      }
    end
  end
  return array # Return our findings.
end
return_remote_gtk2_version() click to toggle source
#

return_remote_gtk2_version

#
# File lib/environment_information/class/misc.rb, line 25
def return_remote_gtk2_version
  ::EnvironmentInformation.return_remote_gtk2_version
end
return_version_of_awk()
return_version_of_awk?() click to toggle source
#

return_version_of_awk?

#
# File lib/environment_information/class/misc.rb, line 695
def return_version_of_awk?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_awk
return_version_of_binutils()
return_version_of_binutils?() click to toggle source
#

return_version_of_binutils?

#
# File lib/environment_information/class/misc.rb, line 702
def return_version_of_binutils?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_binutils
return_version_of_bison()
return_version_of_bison?() click to toggle source
#

return_version_of_bison?

#
# File lib/environment_information/class/misc.rb, line 772
def return_version_of_bison?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_bison
return_version_of_boost()
return_version_of_boost?() click to toggle source
#

return_version_of_boost?

#
# File lib/environment_information/class/misc.rb, line 688
def return_version_of_boost?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_boost
return_version_of_coreutils()
return_version_of_coreutils?() click to toggle source
#

return_version_of_coreutils?

#
# File lib/environment_information/class/misc.rb, line 709
def return_version_of_coreutils?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_coreutils
return_version_of_diffutils()
return_version_of_diffutils?() click to toggle source
#

return_version_of_diffutils?

#
# File lib/environment_information/class/misc.rb, line 716
def return_version_of_diffutils?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_diffutils
return_version_of_flex()
return_version_of_flex?() click to toggle source
#

return_version_of_flex?

#
# File lib/environment_information/class/misc.rb, line 779
def return_version_of_flex?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_flex
return_version_of_gcc()
return_version_of_gcc?() click to toggle source
#

return_version_of_gcc?

#
# File lib/environment_information/class/misc.rb, line 723
def return_version_of_gcc?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_gcc
return_version_of_glibc()
return_version_of_glibc?() click to toggle source
#

return_version_of_glibc?

#
# File lib/environment_information/class/misc.rb, line 744
def return_version_of_glibc?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_glibc
return_version_of_gnupg()
return_version_of_gnupg?() click to toggle source
#

return_version_of_gnupg?

#
# File lib/environment_information/class/misc.rb, line 765
def return_version_of_gnupg?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_gnupg
return_version_of_grep()
return_version_of_grep?() click to toggle source
#

return_version_of_grep?

#
# File lib/environment_information/class/misc.rb, line 758
def return_version_of_grep?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_grep
return_version_of_intltool()
return_version_of_intltool?() click to toggle source
#

return_version_of_intltool?

#
# File lib/environment_information/class/misc.rb, line 751
def return_version_of_intltool?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_intltool
return_version_of_linux_kernel()
return_version_of_linux_kernel?() click to toggle source
#

return_version_of_linux_kernel?

#
# File lib/environment_information/class/misc.rb, line 730
def return_version_of_linux_kernel?
  ::EnvironmentInformation.send(__method__)
end
return_version_of_operating_system()
Alias for: operating_system?
return_version_of_ruby()
return_version_of_ruby?() click to toggle source
#

return_version_of_ruby?

#
# File lib/environment_information/class/ruby.rb, line 65
def return_version_of_ruby?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_ruby
return_version_of_rubygems()
return_version_of_rubygems?() click to toggle source
#

return_version_of_rubygems?

#
# File lib/environment_information/class/ruby.rb, line 58
def return_version_of_rubygems?
  ::EnvironmentInformation.send(__method__)
end
Also aliased as: return_version_of_rubygems
rev() click to toggle source
#

rev

#
# File lib/environment_information/class/colours.rb, line 66
def rev
  if use_colours?
    Colours::GREEN
  else
    ''
  end
end
royalblue(i = '') click to toggle source
#

royalblue

#
# File lib/environment_information/class/colours.rb, line 173
def royalblue(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.royalblue(i)
  end
  return i
end
run() click to toggle source
#

run (run tag)

#
# File lib/environment_information/class/run.rb, line 14
def run
  # ======================================================================= #
  # (1) Try to rename the KDE konsole first. This will happen on
  #     roebe-systems only.
  # ======================================================================= #
  do_rename_kde_konsole
  # ======================================================================= #
  # Only enter the report-section if we do NOT want to exit early.
  # ======================================================================= #
  do_show_help if @show_help
  # ======================================================================= #
  # ^^^ This check happens here again because menu() is allowed to
  # toggle this variable.
  # ======================================================================= #
  if @display_everything_in_short_format
    assign_components_for_the_short_format # Handle the short format here.
  end
  do_sort_alphabetically if @sort_alphabetically # ← Must come before the report-step.
  unless @do_exit_the_program
    # ===================================================================== #
    # We may only display the components if @display_result is true.
    # ===================================================================== #
    report if @display_result
  end
  # ======================================================================= #
  # Next check whether we should generate a .html file. This check
  # should come before we generate other local files.
  # ======================================================================= #
  do_generate_a_html_file if @generate_a_html_file
  if commandline? and @store_the_results_into_local_files
    # ===================================================================== #
    # Only store local files if the variable
    # @store_the_results_into_local_files is true.
    # ===================================================================== #
    consider_storing_the_components_that_were_displayed
    consider_storing_which_programs_are_not_up_to_date
  end
end
screen_resolution?() click to toggle source
#

screen_resolution?

#
# File lib/environment_information/class/misc.rb, line 681
def screen_resolution?
  ::EnvironmentInformation.send(__method__)
end
seagreen(i = '') click to toggle source
#

seagreen

#
# File lib/environment_information/class/colours.rb, line 203
def seagreen(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.seagreen(i)
  end
  return i
end
set_be_silent(i = true) click to toggle source
#

set_be_silent

#
# File lib/environment_information/class/misc.rb, line 284
def set_be_silent(i = true)
  @be_silent = i
end
set_commandline_arguments(i = '') click to toggle source
#

set_commandline_arguments

#
# File lib/environment_information/class/misc.rb, line 156
def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end
set_display_these_components(i)
Alias for: set_main_array
set_main_array(i) click to toggle source
#

set_main_array

#
# File lib/environment_information/class/misc.rb, line 68
def set_main_array(i)
  @array_display_these_components = i
end
set_runmode_gui() click to toggle source
#

set_runmode_gui

#
# File lib/environment_information/class/misc.rb, line 509
def set_runmode_gui
  @runmode = :gui
end
set_runmode_html() click to toggle source
#

set_runmode_html

#
# File lib/environment_information/class/misc.rb, line 516
def set_runmode_html
  @runmode = :html
end
set_use_colours(i = '') click to toggle source
#

set_use_colours

#
# File lib/environment_information/class/colours.rb, line 35
def set_use_colours(i = '')
  ::EnvironmentInformation.set_use_colours(true)
end
set_use_this_as_main_input(i)
Alias for: set_main_array
sfancy(i = '') click to toggle source
#

sfancy

#
# File lib/environment_information/class/colours.rb, line 135
def sfancy(i = '')
  return ::Colours.sfancy(i) if use_colours?
  return i
end
sfile(i) click to toggle source
#

sfile

#
# File lib/environment_information/class/colours.rb, line 127
def sfile(i)
  return ::Colours.sfile(i) if use_colours?
  return i
end
shall_we_really_store_which_programs_are_not_up_to_date?() click to toggle source
#

shall_we_really_store_which_programs_are_not_up_to_date?

This method will also honour whether the user is on a roebe-like system or whether the user is not.

#
# File lib/environment_information/class/misc.rb, line 97
def shall_we_really_store_which_programs_are_not_up_to_date?
  is_on_roebe? and !@array_these_programs_not_up_to_date.empty?
end
show_everything?() click to toggle source
#

show_everything?

#
# File lib/environment_information/class/misc.rb, line 204
def show_everything?
  @show_everything
end
show_full_information()
Alias for: do_show_everything
show_help()
Alias for: do_show_help
show_n_registered_entries() click to toggle source
#

show_n_registered_entries

Invoke this via:

envi --n_entries
#
# File lib/environment_information/class/misc.rb, line 500
def show_n_registered_entries
  e "#{true_rev}The EnvironmentInformation project contains "\
    "#{sfancy(::EnvironmentInformation.tracked_programs?.size)} "\
    "#{true_rev}registered entries."
end
show_no_ruby()
show_only_the_components_from_this_dataset(i)
Alias for: set_main_array
show_the_registered_components( i = ARRAY_TRACKED_PROGRAMS ) click to toggle source
#

show_the_registered_components

#
# File lib/environment_information/class/misc.rb, line 447
def show_the_registered_components(
    i = ARRAY_TRACKED_PROGRAMS
  )
  e
  e 'The following programs will be tracked:'
  e
  i.each_with_index {|this_program, index| index += 1
    padded_index = '  '+(index.to_s+') ').rjust(5)
    colourized_and_padded_index = seagreen(padded_index)
    e colourized_and_padded_index+
      steelblue(this_program)
  }
  e
end
show_these_components?()
show_these_entries( i, version_to_use = nil )
Alias for: add
simp(i) click to toggle source
#

simp

#
# File lib/environment_information/class/colours.rb, line 119
def simp(i)
  return ::Colours.simp(i) if use_colours?
  return i
end
slateblue(i = '') click to toggle source
#

slateblue

#
# File lib/environment_information/class/colours.rb, line 183
def slateblue(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.slateblue(i)
  end
  return i
end
start_gtk_component() click to toggle source
#

start_gtk_component

To invoke this method from the commandline, do:

envi --start-gtk
#
# File lib/environment_information/class/misc.rb, line 630
def start_gtk_component
  require 'environment_information/gui/gtk/bindings.rb'
  ::EnvironmentInformation.run_gtk
  @do_exit_the_program = true
end
start_the_sinatra_interface() click to toggle source
#

start_the_sinatra_interface

#
# File lib/environment_information/class/misc.rb, line 298
def start_the_sinatra_interface
  require 'environment_information/www/sinatra_interface.rb'
  ::EnvironmentInformation.start_sinatra_interface
end
steelblue(i = '') click to toggle source
#

steelblue

#
# File lib/environment_information/class/colours.rb, line 193
def steelblue(i = '')
  if use_colours? and TRY_TO_USE_HTML_COLOURS
    i = ::Colours.steelblue(i)
  end
  return i
end
string()
Alias for: dataset_as_string
string?()
Alias for: dataset_as_string
stringified()
Alias for: dataset_as_string
teal(i = '') click to toggle source
#

teal

#
# File lib/environment_information/class/colours.rb, line 275
def teal(i = '')
  return ::Colours.teal(i) if use_colours?
  return i
end
true_rev() click to toggle source
#

true_rev

#
# File lib/environment_information/class/colours.rb, line 77
def true_rev
  if use_colours?
    Colours::REV
  else
    ''
  end
end
try_to_load_dataset_from_this_file(i)
try_to_read_content_from_this_file(i)
update_version_for( i, version_to_use = nil )
Alias for: add
use_ascii_table() click to toggle source
#

use_ascii_table

We will display in ascii-table format here.

#
# File lib/environment_information/class/misc.rb, line 190
def use_ascii_table
  disable_colours # Can't use colours right now. Perhaps at a later time.
  extend Terminal::Table::TableHelper
  @table = table ['Name', 'Version']
  @table.style = {
    padding_left:  2,
    width:       110 # Set the width here.
  }
  @use_ascii_table = true
end
use_colours?() click to toggle source
#

use_colours?

#
# File lib/environment_information/class/colours.rb, line 42
def use_colours?
  ::EnvironmentInformation.use_colours?
end
work_on_the_programs_directory_only( use_this_as_programs_directory = '/home/Programs/' ) click to toggle source
#

work_on_the_programs_directory_only

This works on the /home/Programs/ directory directly.

Invocation example:

envi --work-on-programs-directory-only
#
# File lib/environment_information/class/misc.rb, line 39
def work_on_the_programs_directory_only(
    use_this_as_programs_directory = '/home/Programs/'
  )
  # ======================================================================= #
  # 1) First, we have to determine which programs are available.
  # ======================================================================= #
  e "#{rev}Determining which programs are available at the prefix "\
    "#{steelblue(use_this_as_programs_directory)}:"
  array_these_programs_are_available = []
  ARRAY_TRACKED_PROGRAMS.each {|entry|
    target = "#{use_this_as_programs_directory}#{entry.capitalize}"
    if File.directory?(target)
      # =================================================================== #
      # In this case we know that this target exists.
      # =================================================================== #
      array_these_programs_are_available << entry
    end
  }
  # ======================================================================= #
  # 2) Checking these programs next.
  # ======================================================================= #
  clear_main_dataset
  add(array_these_programs_are_available)
  ::EnvironmentInformation.set_prefix_to_use(use_this_as_programs_directory)
end
work_through_the_programs()
Alias for: report
write_what_into(what, into) click to toggle source
#

write_what_into

#
# File lib/environment_information/class/misc.rb, line 406
def write_what_into(what, into)
  ::EnvironmentInformation.write_what_into(what, into)
end
xorg_components?() click to toggle source
#

xorg_components?

#
# File lib/environment_information/class/misc.rb, line 306
def xorg_components?
  ::EnvironmentInformation.xorg_components?
end
Also aliased as: return_all_xorg_components