class

ToposPlayground

Inherits Reference < Object

Constants

HelpText = "\ntopos-playground is a CLI tool which handles all of the orchestration necessary to run local Topos devnets with subnets, a TCE network, and apps.\n\n\nExample Usage\n\n $ topos-playground start\n Start the Topos-Playground. This command will output the status of the playground creation to the terminal as it runs, and will log a more detailed status to a log file.\n\n $ topos-playground start --verbose\n This will also start the topos playground, but the terminal output as well as the log file output will contain more information.\n This is useful for debugging if there are errors starting the playground.\n\n $ topos-playground start -q\n This will start the topos playground quietly. Most output will be suppressed.\n\n $ topos-playground clean\n This will clean the topos playground. It will shut down all containers, and remove all filesystem artifacts except for log files.\n\n $ topos-playground version\n This will print the version of the topos playground.\n\n $ topos-playground version -q')\n This will print only the numbers of the topos-playground version, with no other output.\n\nConfiguration\n\n topos-playground follows the XDG Base Directory Specification, which means that data files for use during runs of the playground are stored in $XDG_DATA_HOME/topos-playground, which defaults to $HOME/.local/share/topos-playground and log files are stored in $XDG_STATE_HOME/topos-playground/logs, which defaults to $HOME/.local/state/topos-playground/logs.\n\n These locations can be overridden by setting the environment variables HOME, XDG_DATA_HOME, and XDG_STATE_HOME.\n\nComponent Versions\n\n #{ToposPlayground::Command::Init::GIT_REPOS.map do |data| "#{data[:repo]}: #{data[:branch]}" end.join("\n ")}"
VERSION = {{ (read_file("/tmp/tmp.JkaOCN/src/src/topos-playground/../../VERSION")).chomp }}

Constructors

Class methods

bind_console_logging(log_config)
Source
break_line(lines, line, word, max_line_length, max_word_length, indentation)
Source
break_text(str : String, max_line_length : Int32 = 80) : String

This is a helper function for nicely formatting the text output from topos-playground. It takes a string and breaks it into lines of a maximum length, inserting newlines where necessary. It also attempts to break lines at word boundaries, and to avoid breaking lines in the middle of words. It does this by calculating the average word length and standard deviation of word length, and using these to determine the maximum word length to allow before breaking.

Words that are longer than the maximum word length (i.e. a word length that is larger than typical, and which would thus cause the text appearance to be peculiar, with a large end-of-line gap) are broken at a point that is 30-70% of the way through the word, using a hyphen. The algorithm also refuses to break a word that starts with a non-letter character, to avoid breaking things like directory paths.

Finally, the algorithm maintains the indetation at the start of a line, when a line is broken into multiple lines. This maintains text formatting, such as when examples are being provided in an indented section.)

ameba:disable Metrics/CyclomaticComplexity

Source
calculate_max_word_length(str, max_line_length)
Source
command
Source
config
Source
determine_terminal_width
Source
terminal_width
Source
terminal_width=(value : Int32)
Source

Instance methods

config
Source
config=(config : Config)
Source
dispatch
Source
error_check
Source
initialize_directories
Source
log_file
Source
parse_command_line
Source
setup_all_logging
Source
setup_console_logging
Source

Nested types