class RBT::CreateLogFile

Public Class Methods

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

RBT::CreateLogFile[]

#
# File lib/rbt/logging/create_log_file.rb, line 207
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = nil, run_already = true ) { || ... } click to toggle source
#

initialize

#
# File lib/rbt/logging/create_log_file.rb, line 28
def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  # ======================================================================= #
  # === Handle blocks next
  # ======================================================================= #
  if block_given?
    yielded = yield
    parse_this_input(yielded)
  end
  run if run_already
end

Public Instance Methods

clear_the_main_hash() click to toggle source
#

clear_the_main_hash

#
# File lib/rbt/logging/create_log_file.rb, line 94
def clear_the_main_hash
  @hash.clear
end
do_store_into_the_appdir(store_here) click to toggle source
#

do_store_into_the_appdir

#
# File lib/rbt/logging/create_log_file.rb, line 189
def do_store_into_the_appdir(store_here)
  opne "Storing into the file `#{sfile(store_here)}`."
  write_what_into(
    return_the_dataset_for_the_environment,
    store_here
  )
end
parse_this_input(i) click to toggle source
#

parse_this_input

#
# File lib/rbt/logging/create_log_file.rb, line 115
def parse_this_input(i)
  if i.is_a? Hash
    # ===================================================================== #
    # === :clear_the_main_hash
    # ===================================================================== #
    if i.has_key? :clear_the_main_hash
      clear_the_main_hash if (i.delete(:clear_the_main_hash) == true)
    end
    # ===================================================================== #
    # === :use_environment_flags
    # ===================================================================== #
    if i.has_key? :use_environment_flags
      @hash[:use_environment_flags] = i.delete(:use_environment_flags)
    end
    # ===================================================================== #
    # === :program_name
    # ===================================================================== #
    if i.has_key? :program_name
      @hash[:program_name] = i.delete(:program_name)
    end
    # ===================================================================== #
    # === :uses_appdir_prefix
    # ===================================================================== #
    if i.has_key? :uses_appdir_prefix
      @hash[:uses_appdir_prefix] = i.delete(:uses_appdir_prefix)
    end
    # ===================================================================== #
    # === :store_where
    # ===================================================================== #
    if i.has_key? :store_where
      @hash[:store_where] = i.delete(:store_where)
    end
  end
end
program_name?() click to toggle source
#

program_name?

#
# File lib/rbt/logging/create_log_file.rb, line 87
def program_name?
  @hash[:program_name].to_s
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/logging/create_log_file.rb, line 49
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @hash
  # ======================================================================= #
  @hash = {}
  # ======================================================================= #
  # === :installation_was_a_success_or_failure
  #
  # Populate the hash with some dummy-variables on startup:
  # ======================================================================= #
  @hash[:installation_was_a_success_or_failure] = :failure
  # ======================================================================= #
  # === :program_name
  # ======================================================================= #
  @hash[:program_name] = :foobar
  # ======================================================================= #
  # === :full_configure_command
  # ======================================================================= #
  @hash[:full_configure_command] = '../configure --prefix=/usr'
  # ======================================================================= #
  # === :store_where
  # ======================================================================= #
  @hash[:store_where] = "#{program_name?}.yml"
  # ======================================================================= #
  # === :uses_appdir_prefix
  # ======================================================================= #
  @hash[:uses_appdir_prefix] = false
  # ======================================================================= #
  # === :use_environment_flags
  # ======================================================================= #
  @hash[:use_environment_flags] = false
end
return_the_dataset_for_the_environment() click to toggle source
#

return_the_dataset_for_the_environment

#
# File lib/rbt/logging/create_log_file.rb, line 180
def return_the_dataset_for_the_environment
  "Time of installation:  #{dd_mm_yyyy}, #{hh_mm_ss}#{N}"\
  "PATH:                  #{ENV['PATH']}#{N}"\
  "CFLAGS:                #{ENV['CFLAGS']}#{N}"
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/logging/create_log_file.rb, line 200
def run
  store_file
end
set_program_name(i) click to toggle source
#

set_program_name

#
# File lib/rbt/logging/create_log_file.rb, line 108
def set_program_name(i)
  @hash[:program_name] = i.to_sym
end
store_file( store_where = store_where? ) click to toggle source
#

store_file

#
# File lib/rbt/logging/create_log_file.rb, line 160
def store_file(
    store_where = store_where?
  )
  _ = @hash
  opne "Storing into the file `#{sfile(store_where)}`."
  # ======================================================================= #
  # Handle environment-flags part first:
  # ======================================================================= #
  if _.has_key?(:use_environment_flags) and (_.delete(:use_environment_flags) == true)
    #_.delete(:use_environment_flags)
    write_what_into(return_the_dataset_for_the_environment, store_where)
  else
    _ = YAML.dump(_)
    write_what_into(_, store_where)
  end
end
store_where?() click to toggle source
#

store_where?

#
# File lib/rbt/logging/create_log_file.rb, line 153
def store_where?
  @hash[:store_where]
end
uses_appdir_prefix?() click to toggle source
#

uses_appdir_prefix?

#
# File lib/rbt/logging/create_log_file.rb, line 101
def uses_appdir_prefix?
  @hash[:uses_appdir_prefix]
end