class RBT::GenerateRbtConfiguration

Constants

LAST_UPDATE
#

LAST_UPDATE

#
NAMESPACE
#

NAMESPACE

#
SAVE_NEW_FILE_HERE
#

SAVE_NEW_FILE_HERE

#
STORE_WHERE_BASE_DIR
#

STORE_WHERE_BASE_DIR

#

Public Class Methods

new( run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 44
def initialize(
    run_already = true
  )
  reset
  run if run_already
end

Public Instance Methods

_(i)
Alias for: add
add(i) click to toggle source
#

add

This will append to @_ and will also append two newlines.

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 73
def add(i)
  @_ << i+N
end
Also aliased as: _
e_get_user_input_then_add(variable_name, desc = '') click to toggle source
#

e_get_user_input_then_add

Here we will combine get_user_input() with add().

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 116
def e_get_user_input_then_add(variable_name, desc = '')
  desc = "Description: #{variable_name}" if desc.to_s.empty?
  print desc+' '
  get_user_input
  add ' '+variable_name+': '+@user_input
end
get_user_input() click to toggle source
#

get_user_input

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 80
def get_user_input
  @user_input = $stdin.gets.chomp
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 54
def reset
  super()
  set_store_here SAVE_NEW_FILE_HERE
  @_ = ''.dup # The result string.
  @namespace = NAMESPACE
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 141
def run
  show_welcome_message
  opnn; e 'We will now generate a new configuration file.'
  opnn; e 'We will store this configuration file here: '+sfile(@store_here)
  opnn; e 'We will guide you through the process of creating a'
  opnn; e 'new configuration file from scratch.'
  show_last_update
  run_through_all_configure_options
  save_result # store it into a new file.
end
run_through_all_configure_options() click to toggle source
#

run_through_all_configure_options

Here we will grab all configuration entries.

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 98
def run_through_all_configure_options
  _ = RBT.config_directory?
  # ========================================================================== #
  # Load it up next.
  # ========================================================================== #
  available_keys = Dir[_+'*.yml'].map {|entry|
    File.basename(entry).gsub!(/\.yml$/,'')
  }
  available_keys.each {|entry|
    _ entry+': t'
  }
end
save_result() click to toggle source
#

save_result

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 133
def save_result # Save the result.
  opnn; e 'Storing into `'+sfile(@store_here)+'`.'
  save_file(@_, @store_here)
end
set_store_here(i) click to toggle source
#

set_store_here

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 64
def set_store_here(i)
  @store_here = rds(i.to_s)
end
show_last_update() click to toggle source
#

show_last_update

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 126
def show_last_update
  opnn; e 'This was last updated at: '+simp(LAST_UPDATE)
end
show_welcome_message() click to toggle source
#

show_welcome_message

#
# File lib/rbt/utility_scripts/generate_rbt_configuration.rb, line 87
def show_welcome_message
  cliner {
    opnn; e 'Welcome to the RBT Project, class GenerateRbtConfiguration.'
  }
end