class RBT::ConfigureHelp

Constants

BE_VERBOSE
#

BE_VERBOSE

#
CONFIGURE_STRING
#

CONFIGURE_STRING

#
CYAN
DEFAULT_COLOUR
GREEN
RED
#

Some hardcoded-colour definitions.

#

Public Class Methods

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

RBT::ParseConfigureHelp[]

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

initialize

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 49
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

colourize_environment_variables() click to toggle source
#

colourize_environment_variables

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 83
def colourize_environment_variables
  # ======================================================================= #
  # The next Array is to be defined via a leading ' ' token.
  # ======================================================================= #
  %w(
    CC
    CPPFLAGS
    CPP
    CFLAGS
    CXXCPP
    CXX
    CXXFLAGS
    LDFLAGS
    LIBS
    X_CFLAGS
    X_LIBS
    LIBELF_CFLAGS
    LIBELF_LIBS
    LIBNOTIFY_CFLAGS
    LIBNOTIFY_LIBS
    WEBKIT_CFLAGS
    WEBKIT_LIBS
    ITSTOOL
    XMLLINT
    GTKDOC_DEPS_CFLAGS
    GTKDOC_DEPS_LIBS
    LT_SYS_LIBRARY_PATH         
    PKG_CONFIG_LIBDIR
    PKG_CONFIG_PATH
    PKG_CONFIG
    LIBNL3_CFLAGS
    LIBNL3_LIBS
    LIBNL3GENL_CFLAGS
    LIBNL3GENL_LIBS
    LIBNL3GENL_CFLAGS
    LIBNL3GENL_LIBS
    XINPUT_CFLAGS
    XINPUT_LIBS
    XI2_CFLAGS
    XI2_LIBS
    XI21_CFLAGS
    XI21_LIBS
    XI22_CFLAGS
    XI22_LIBS
    ZENITY_CFLAGS
    ZENITY_LIBS
  ).each {|line|
    if @string.include? " #{line}"
      @string.gsub!(/( #{line})/, darkcyan('\1'))
    end
  }
end
colourize_the_string() click to toggle source
#

colourize_the_string

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 279
def colourize_the_string
  # ======================================================================= #
  # Usually we wish to colourize the result, but if we debug this class
  # we may want to NOT colourize the result at all.
  # ======================================================================= #
  if @colourize_the_result and use_colours?
    @string.gsub!(/(`configure')/, seagreen('\1'))
    @string.gsub!(/(environment variables)/, yellowgreen('\1'))
    @string.gsub!(/(Usage:)/, crimson('\1'))
    @string.gsub!(/(VAR=VALUE)/, crimson('\1'))
    @string.gsub!(/(--bindir=DIR)/, orange('\1'))
    @string.gsub!(/(--sbindir=DIR)/, orange('\1'))
    @string.gsub!(/(--libexecdir=DIR)/, orange('\1'))
    @string.gsub!(/(--datadir=DIR)/, orange('\1'))
    @string.gsub!(/(--sysconfdir=DIR)/, orange('\1'))
    @string.gsub!(/(--sharedstatedir=DIR)/, orange('\1'))
    @string.gsub!(/(--localstatedir=DIR)/, orange('\1'))
    @string.gsub!(/(--runstatedir=DIR)/, orange('\1'))
    @string.gsub!(/(--libdir=DIR)/, orange('\1'))
    @string.gsub!(/(--includedir=DIR)/, orange('\1'))
    @string.gsub!(/(--oldincludedir=DIR)/, orange('\1'))
    @string.gsub!(/(--infodir=DIR)/, orange('\1'))
    @string.gsub!(/(--mandir=DIR)/, orange('\1'))
    @string.gsub!(/(--datarootdir=DIR)/, orange('\1'))
    @string.gsub!(/(--localedir=DIR)/, orange('\1'))
    @string.gsub!(/(--docdir=DIR)/, orange('\1'))
    @string.gsub!(/(--htmldir=DIR)/, orange('\1'))
    @string.gsub!(/(--dvidir=DIR)/, orange('\1'))
    @string.gsub!(/(--pdfdir=DIR)/, orange('\1'))
    @string.gsub!(/(--psdir=DIR)/, orange('\1'))
    @string.gsub!(/(Configuration:)/, dodgerblue('\1'))
    # ===================================================================== #
    # A bit royal-blue colourizing to be done next:
    # ===================================================================== #
    @string.gsub!(/(E?PREFIX\/)/, royalblue('\1'))
    @string.gsub!(/(DATAROOTDIR)/, royalblue('\1'))
    @string.gsub!(/(DOCDIR)/, royalblue('\1'))
    @string.gsub!(/\[(\/usr\/include)\]/, '['+royalblue('\1')+']')
    %w(
      --program-prefix=PREFIX
      --program-suffix=SUFFIX
      --program-transform-name=PROGRAM
      --build=BUILD
      --host=HOST
      --target=TARGET
    ).each {|line|
      @string.gsub!(/(#{line})/, plum('\1'))
    }
    %w(
      --disable-FEATURE
      --enable-FEATURE[=ARG]
      --enable-FEATURE=no
      --enable-maintainer-mode
      --with-PACKAGE[=ARG]
      --without-PACKAGE
      --with-helper-path-prefix=PATH
      --with-pic[=PKGS]
      --with-perl-options=OPTIONS
      --with-html-dir=PATH
      --with-release-version=STRING
      --with-proc=DIR
      --disable-option-checking
      --enable-silent-rules
      --disable-silent-rules
      --enable-dependency-tracking
      --disable-dependency-tracking
      --prefix=PREFIX
      --disable-rpath
      --enable-iso-c
      --enable-libnotify
      --disable-maintainer-mode
      --disable-nls
      --enable-static[=PKGS]
      --enable-shared[=PKGS]
      --enable-fast-install[=PKGS]
      --disable-libtool-lock
      --disable-perl-bindings
      --enable-gtk-doc
      --enable-gtk-doc-html
      --enable-gtk-doc-pdf
      --enable-debug[=no|minimum|yes|full]
      --disable-debug
      --enable-checks
      --disable-visibility
      --disable-linker-opts
      --enable-profiling
      --disable-selective-werror
      --enable-strict-compilation             
      --enable-proc
      --enable-openvz
      --enable-cgroup
      --enable-vserver
      --enable-ancient-vserver
      --enable-taskstats
      --enable-unicode
      --enable-linux-affinity
      --enable-hwloc
      --enable-setuid
      --enable-delayacct        
    ).each {|line|
      if @string.include? line
        @string.gsub!(
          /(#{Regexp.quote(line)})/, lightseagreen('\1')
        )
      end
    }
    [
      'Program names:',
      'Optional Features:',
      'Optional Packages:',
      'System types:',
      'Installation directories:',
      'Fine tuning of the installation directories:'
    ].each {|line|
      @string.gsub!(/(#{line})/, orangered('\1'))
    }
    if @string.include? '<http'
      @string.gsub!(/\<(https?:\/\/.+)\>/, '<'+springgreen('\1')+'>')
    end
    if @string.include? '@'
      # =================================================================== #
      # Colourize all emails.
      # =================================================================== #
      @string.gsub!(/<(\D{1,20}@\D{1,20}\.\D{1,5})>/, '<'+olivedrab('\1')+'>')
    end
    colourize_environment_variables
  end
end
cyan() click to toggle source
#

cyan

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 146
def cyan
  CYAN
end
extract_this_archive(i) click to toggle source
#

extract_this_archive

This is the part that helps the user in extracting a particular archive.

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 245
def extract_this_archive(i)
  require 'extracter'
  this_target = temp_dir?
  suffix_target = remove_archive_at_the_end(File.basename(i))
  opne 'Extracting the archive at `'+sfile(i)+'` `'+
       sfancy(this_target+suffix_target)+'`.'
  Extracter.extract_this(
    i,
    to: this_target,
    verbosity: be_quiet
  )
  if File.directory?(this_target+suffix_target)
    change_directory(this_target+suffix_target)
  end
end
include?(substring, be_verbose = @be_verbose) click to toggle source
#

include?

Will return true if our flag could be found.

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 162
def include?(substring, be_verbose = @be_verbose)
  substring = substring.dup if substring.frozen?
  substring.strip! # sanitize our input string
  substring.prepend '--' unless substring.start_with? '-'
  return false if @string.empty? # can never be true if @string is empty
  if @string.include? substring
    if be_verbose
      e '%-5s' % red+'  YES, the configure option `'+substring+'` is included.'+revert
    end
    return true 
  else
    if be_verbose
      e '%-5s' % cyan+'  No, the configure option `'+substring+'` is not included.'+revert
    end
    return false
  end
end
menu( i = commandline_arguments? ) click to toggle source
#

menu

#
red() click to toggle source
#

red

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 153
def red
  RED
end
report() click to toggle source
#

report

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 235
def report
  e "#{rev}#{@string}"
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 63
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @string
  # ======================================================================= #
  @string = ''.dup # empty on default
  # ======================================================================= #
  # === @colourize_the_result
  # ======================================================================= #
  @colourize_the_result = true
  # ======================================================================= #
  # === :be_verbose
  # ======================================================================= #
  set_be_verbose(BE_VERBOSE)
end
return_terse_version() click to toggle source
#

return_terse_version

Return a terse version of the string, only if it contains two ‘-’.

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 192
def return_terse_version
  @string.split(N).reject {|x| ! x.include? '--' }
end
revert() click to toggle source
#

revert

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 183
def revert # Return to default colour.
  DEFAULT_COLOUR
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 411
def run
  unless File.exist? 'configure'
    opne "#{rev}No file called #{sfile('configure')} #{rev}can be "\
         "found in the current directory."
    return
  end
  sanitize_string
  colourize_the_string
  report
end
sanitize_string( this_string = CONFIGURE_STRING ) click to toggle source
#

sanitize_string

This method will essentially run “./configure –help” and capture the output/result.

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 267
def sanitize_string(
    this_string = CONFIGURE_STRING
  )
  # ======================================================================= #
  # Obtain the output from "configure --help" next.
  # ======================================================================= #
  @string = `#{this_string}`.to_s.strip
end
string()
Alias for: string?
string?() click to toggle source
#

string?

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 139
def string?
  @string
end
Also aliased as: string
verbose_include?(s) click to toggle source
#

verbose_include?

Wrapper towards the method above.

#
# File lib/rbt/utility_scripts/parse_configure_help.rb, line 201
def verbose_include?(s)
  set_be_verbose(true)
  include?(s)
end
Also aliased as: vi?
vi?(s)
Alias for: verbose_include?