environment_information 1.4.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of environment_information might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +1276 -0
- data/bin/envi +7 -0
- data/bin/fast_envi +7 -0
- data/doc/README.gen +1044 -0
- data/doc/todo/TODO_FOR_THE_ENVIRONMENT_INFORMATION_PROJECT.md +48 -0
- data/environment_information.gemspec +135 -0
- data/lib/environment_information/base/base.rb +159 -0
- data/lib/environment_information/class/add.rb +187 -0
- data/lib/environment_information/class/colours.rb +283 -0
- data/lib/environment_information/class/constants.rb +35 -0
- data/lib/environment_information/class/environment_information.rb +51 -0
- data/lib/environment_information/class/help.rb +90 -0
- data/lib/environment_information/class/html.rb +78 -0
- data/lib/environment_information/class/initialize.rb +177 -0
- data/lib/environment_information/class/menu.rb +465 -0
- data/lib/environment_information/class/misc.rb +897 -0
- data/lib/environment_information/class/opn.rb +33 -0
- data/lib/environment_information/class/register_sigint.rb +20 -0
- data/lib/environment_information/class/reset.rb +217 -0
- data/lib/environment_information/class/ruby.rb +79 -0
- data/lib/environment_information/class/run.rb +61 -0
- data/lib/environment_information/class/show_display_and_report.rb +355 -0
- data/lib/environment_information/colours/colours.rb +211 -0
- data/lib/environment_information/colours/sfancy.rb +19 -0
- data/lib/environment_information/colours/simp.rb +19 -0
- data/lib/environment_information/constants/array_tracked_components.rb +210 -0
- data/lib/environment_information/constants/constants.rb +17 -0
- data/lib/environment_information/constants/encoding.rb +21 -0
- data/lib/environment_information/constants/error_line.rb +17 -0
- data/lib/environment_information/constants/file_constants.rb +102 -0
- data/lib/environment_information/constants/misc.rb +86 -0
- data/lib/environment_information/constants/namespace.rb +14 -0
- data/lib/environment_information/constants/newline.rb +16 -0
- data/lib/environment_information/constants/regex.rb +30 -0
- data/lib/environment_information/constants/temp_directory.rb +52 -0
- data/lib/environment_information/gui/gtk2/environment_information.rb +35 -0
- data/lib/environment_information/gui/gtk3/environment_information.rb +34 -0
- data/lib/environment_information/gui/libui/environment_information.rb +74 -0
- data/lib/environment_information/gui/shared_code/environment_information_module.rb +409 -0
- data/lib/environment_information/misc_components/README.md +3 -0
- data/lib/environment_information/misc_components/cflags.rb +36 -0
- data/lib/environment_information/misc_components/cpuinfo.rb +64 -0
- data/lib/environment_information/misc_components/operating_system.rb +54 -0
- data/lib/environment_information/misc_components/operating_system_bit_type.rb +42 -0
- data/lib/environment_information/misc_components/ram.rb +30 -0
- data/lib/environment_information/misc_components/rubygems_installation_directory.rb +54 -0
- data/lib/environment_information/misc_components/screen_resolution.rb +50 -0
- data/lib/environment_information/project/project.rb +27 -0
- data/lib/environment_information/queries/README.md +2 -0
- data/lib/environment_information/queries/complex_version.rb +272 -0
- data/lib/environment_information/queries/pkg_config.rb +125 -0
- data/lib/environment_information/queries/simple_version.rb +217 -0
- data/lib/environment_information/requires/require_asciitable.rb +15 -0
- data/lib/environment_information/requires/require_the_constants.rb +7 -0
- data/lib/environment_information/requires/require_the_environment_information_project.rb +23 -0
- data/lib/environment_information/requires/require_the_individual_misc_components.rb +30 -0
- data/lib/environment_information/requires/require_the_toplevel_methods.rb +22 -0
- data/lib/environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb +152 -0
- data/lib/environment_information/toplevel_methods/cd.rb +16 -0
- data/lib/environment_information/toplevel_methods/e.rb +43 -0
- data/lib/environment_information/toplevel_methods/hash.rb +60 -0
- data/lib/environment_information/toplevel_methods/internet_is_available.rb +30 -0
- data/lib/environment_information/toplevel_methods/is_on_roebe.rb +16 -0
- data/lib/environment_information/toplevel_methods/menu.rb +90 -0
- data/lib/environment_information/toplevel_methods/misc.rb +309 -0
- data/lib/environment_information/toplevel_methods/n_subcommands.rb +31 -0
- data/lib/environment_information/toplevel_methods/prefix_to_use.rb +39 -0
- data/lib/environment_information/toplevel_methods/register_this_component_is_missing.rb +61 -0
- data/lib/environment_information/toplevel_methods/remote_url_of_this_program.rb +45 -0
- data/lib/environment_information/toplevel_methods/replay_from_the_stored_file.rb +84 -0
- data/lib/environment_information/toplevel_methods/return_alias_to.rb +30 -0
- data/lib/environment_information/toplevel_methods/return_pkgconfig_based_programs.rb +28 -0
- data/lib/environment_information/toplevel_methods/return_remote_gtk2_version.rb +54 -0
- data/lib/environment_information/toplevel_methods/return_simple_version_based_programs.rb +28 -0
- data/lib/environment_information/toplevel_methods/return_version_of_this_program.rb +182 -0
- data/lib/environment_information/toplevel_methods/show_all_available_components.rb +192 -0
- data/lib/environment_information/toplevel_methods/write_what_into.rb +24 -0
- data/lib/environment_information/version/version.rb +25 -0
- data/lib/environment_information/www/sinatra_interface.rb +213 -0
- data/lib/environment_information/www/webobject_interface.cgi +29 -0
- data/lib/environment_information/yaml/array_default_programs_on_linux.yml +15 -0
- data/lib/environment_information/yaml/array_lfs_core_programs.yml +37 -0
- data/lib/environment_information/yaml/array_science_cluster.yml +12 -0
- data/lib/environment_information/yaml/array_tracked_non_programs.yml +13 -0
- data/lib/environment_information/yaml/array_tracked_programs.yml +207 -0
- data/lib/environment_information/yaml/array_tracked_xorg_components.yml +37 -0
- data/lib/environment_information/yaml/colours.yml +3 -0
- data/lib/environment_information/yaml/query_to_use_for_the_individual_components.yml +256 -0
- data/lib/environment_information.rb +5 -0
- data/test/testing_environment_information.rb +26 -0
- data/test/testing_missing_components.rb +9 -0
- data/test/testing_prefix_for_the_environment_information_project.rb +20 -0
- metadata +191 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# === EnvironmentInformation::EnvironmentInformation
|
|
6
|
+
#
|
|
7
|
+
# The primary purpose of this class is to provide information about
|
|
8
|
+
# the computer environment ruby is running on. Obviously ruby must
|
|
9
|
+
# be available in order for this class (this program) to work.
|
|
10
|
+
#
|
|
11
|
+
# By default, class EnvironmentInformation will run in
|
|
12
|
+
# "commandline mode", that is, it will output information
|
|
13
|
+
# onto the console/terminal.
|
|
14
|
+
#
|
|
15
|
+
# The dataset is of course also available internally, though, so you
|
|
16
|
+
# can query this information and display it e. g. in a traditional
|
|
17
|
+
# GUI or WWW setting, like for a webpage.
|
|
18
|
+
# =========================================================================== #
|
|
19
|
+
# A complete usage example for the main class follows next:
|
|
20
|
+
#
|
|
21
|
+
# require 'environment_information'
|
|
22
|
+
#
|
|
23
|
+
# _ = EnvironmentInformation::EnvironmentInformation.new(:do_not_run_yet)
|
|
24
|
+
# _.disable_colours
|
|
25
|
+
# _.be_silent
|
|
26
|
+
# _.run
|
|
27
|
+
# _.string
|
|
28
|
+
#
|
|
29
|
+
# =========================================================================== #
|
|
30
|
+
# require 'environment_information/class/initialize.rb'
|
|
31
|
+
# =========================================================================== #
|
|
32
|
+
require 'environment_information/base/base.rb'
|
|
33
|
+
|
|
34
|
+
module EnvironmentInformation
|
|
35
|
+
|
|
36
|
+
class EnvironmentInformation < ::EnvironmentInformation::Base # === EnvironmentInformation::EnvironmentInformation
|
|
37
|
+
|
|
38
|
+
require 'environment_information/class/run.rb'
|
|
39
|
+
# ========================================================================= #
|
|
40
|
+
# === initialize
|
|
41
|
+
# ========================================================================= #
|
|
42
|
+
def initialize(
|
|
43
|
+
commandline_arguments = nil,
|
|
44
|
+
run_already = true
|
|
45
|
+
)
|
|
46
|
+
register_sigint
|
|
47
|
+
reset
|
|
48
|
+
# ======================================================================= #
|
|
49
|
+
# Next, we handle special run-mode variants.
|
|
50
|
+
# ======================================================================= #
|
|
51
|
+
case run_already
|
|
52
|
+
when :do_show_everything
|
|
53
|
+
do_show_everything
|
|
54
|
+
run_already = true
|
|
55
|
+
end
|
|
56
|
+
# ======================================================================= #
|
|
57
|
+
# And set @run_already, so that menu() can overrule it lateron.
|
|
58
|
+
# ======================================================================= #
|
|
59
|
+
@run_already = run_already
|
|
60
|
+
set_commandline_arguments(
|
|
61
|
+
commandline_arguments
|
|
62
|
+
)
|
|
63
|
+
# ======================================================================= #
|
|
64
|
+
# === Handle blocks
|
|
65
|
+
#
|
|
66
|
+
# Next blocks will be handled. This must come after the reset() method.
|
|
67
|
+
# ======================================================================= #
|
|
68
|
+
if block_given?
|
|
69
|
+
yielded = yield
|
|
70
|
+
case yielded # case tag
|
|
71
|
+
# ===================================================================== #
|
|
72
|
+
# === :do_not_use_rbt
|
|
73
|
+
# ===================================================================== #
|
|
74
|
+
when :do_not_use_rbt
|
|
75
|
+
@may_we_try_to_use_rbt = false
|
|
76
|
+
# ===================================================================== #
|
|
77
|
+
# === :disable_colours
|
|
78
|
+
# ===================================================================== #
|
|
79
|
+
when :disable_colours
|
|
80
|
+
disable_colours
|
|
81
|
+
# ===================================================================== #
|
|
82
|
+
# === :disable_colours_and_do_not_store_into_a_local_file
|
|
83
|
+
# ===================================================================== #
|
|
84
|
+
when :disable_colours_and_do_not_store_into_a_local_file
|
|
85
|
+
disable_colours
|
|
86
|
+
do_not_save_anything
|
|
87
|
+
# ===================================================================== #
|
|
88
|
+
# === :do_not_run_yet
|
|
89
|
+
# ===================================================================== #
|
|
90
|
+
when :do_not_run_yet
|
|
91
|
+
@run_already = false
|
|
92
|
+
else
|
|
93
|
+
# =================================================================== #
|
|
94
|
+
# Handle Hashes given in the block.
|
|
95
|
+
# =================================================================== #
|
|
96
|
+
if yielded.is_a? Hash
|
|
97
|
+
# ================================================================= #
|
|
98
|
+
# === :use_n_tokens
|
|
99
|
+
# ================================================================= #
|
|
100
|
+
if yielded.has_key? :use_n_tokens
|
|
101
|
+
set_use_n_tokens(yielded.delete(:use_n_tokens))
|
|
102
|
+
# ================================================================= #
|
|
103
|
+
# === :n_tokens
|
|
104
|
+
# ================================================================= #
|
|
105
|
+
elsif yielded.has_key? :n_tokens
|
|
106
|
+
set_use_n_tokens(yielded.delete(:n_tokens))
|
|
107
|
+
end
|
|
108
|
+
# ================================================================= #
|
|
109
|
+
# === :use_colours
|
|
110
|
+
# ================================================================= #
|
|
111
|
+
if yielded.has_key? :use_colours
|
|
112
|
+
set_use_colours(yielded.delete(:use_colours))
|
|
113
|
+
end
|
|
114
|
+
# ================================================================= #
|
|
115
|
+
# === :be_silent
|
|
116
|
+
# ================================================================= #
|
|
117
|
+
if yielded.has_key? :be_silent
|
|
118
|
+
set_be_silent(yielded.delete(:be_silent))
|
|
119
|
+
end
|
|
120
|
+
# ================================================================= #
|
|
121
|
+
# === :show_ruby_stuff
|
|
122
|
+
# ================================================================= #
|
|
123
|
+
if yielded.has_key? :show_ruby_stuff
|
|
124
|
+
if yielded.delete(:show_ruby_stuff) == false
|
|
125
|
+
dont_show_ruby_stuff
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
# ======================================================================= #
|
|
132
|
+
# First, we will add the default programs on a linux computer. The
|
|
133
|
+
# later invocation to menu() can change this, but we also want to
|
|
134
|
+
# provide "useful defaults" for users to benefit from this gem.
|
|
135
|
+
# ======================================================================= #
|
|
136
|
+
add_the_default_programs_on_a_linux_computer
|
|
137
|
+
# ======================================================================= #
|
|
138
|
+
# Add the ruby components next. This must come before menu().
|
|
139
|
+
# ======================================================================= #
|
|
140
|
+
consider_adding_the_ruby_components
|
|
141
|
+
# ======================================================================= #
|
|
142
|
+
# Invoke menu() to query and honour the commandline arguments.
|
|
143
|
+
# ======================================================================= #
|
|
144
|
+
menu
|
|
145
|
+
run if @run_already
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# ========================================================================= #
|
|
149
|
+
# === EnvironmentInformation::EnvironmentInformation[]
|
|
150
|
+
# ========================================================================= #
|
|
151
|
+
def self.[](i = ARGV, &block)
|
|
152
|
+
new(i, &block)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# =========================================================================== #
|
|
158
|
+
# === EnvironmentInformation.run_the_main_class
|
|
159
|
+
# =========================================================================== #
|
|
160
|
+
def self.run_the_main_class(i = ARGV, &block)
|
|
161
|
+
::EnvironmentInformation::EnvironmentInformation.new(i, &block)
|
|
162
|
+
end; self.instance_eval { alias result run_the_main_class } # === EnvironmentInformation.result
|
|
163
|
+
self.instance_eval { alias show run_the_main_class } # === EnvironmentInformation.show
|
|
164
|
+
self.instance_eval { alias new run_the_main_class } # === EnvironmentInformation.new
|
|
165
|
+
self.instance_eval { alias [] run_the_main_class } # === EnvironmentInformation[]
|
|
166
|
+
|
|
167
|
+
# =========================================================================== #
|
|
168
|
+
# === EnvironmentInformation.environment_information?
|
|
169
|
+
#
|
|
170
|
+
# This method will return a very long string containing all
|
|
171
|
+
# information about the locally installed/available programs.
|
|
172
|
+
# =========================================================================== #
|
|
173
|
+
def self.environment_information?
|
|
174
|
+
::EnvironmentInformation::EnvironmentInformation.new(:full_be_silent).stringified
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
end
|
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'environment_information/class/menu.rb'
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
require 'environment_information/base/base.rb'
|
|
8
|
+
|
|
9
|
+
module EnvironmentInformation
|
|
10
|
+
|
|
11
|
+
class EnvironmentInformation < ::EnvironmentInformation::Base # === EnvironmentInformation::EnvironmentInformation
|
|
12
|
+
|
|
13
|
+
require 'environment_information/class/help.rb'
|
|
14
|
+
require 'environment_information/class/html.rb'
|
|
15
|
+
require 'environment_information/class/misc.rb'
|
|
16
|
+
require 'environment_information/class/ruby.rb'
|
|
17
|
+
|
|
18
|
+
# ========================================================================= #
|
|
19
|
+
# === menu (menu tag)
|
|
20
|
+
#
|
|
21
|
+
# This method constitutes the "menu" interface for class
|
|
22
|
+
# EnvironmentInformation. It usually deals with the
|
|
23
|
+
# commandline-given arguments stored in ARGV.
|
|
24
|
+
# ========================================================================= #
|
|
25
|
+
def menu(
|
|
26
|
+
i = @commandline_arguments
|
|
27
|
+
)
|
|
28
|
+
if i.is_a? Array
|
|
29
|
+
i.each {|entry| menu(entry) }
|
|
30
|
+
else
|
|
31
|
+
case i # case tag
|
|
32
|
+
# ===================================================================== #
|
|
33
|
+
# === envi --one-liner
|
|
34
|
+
#
|
|
35
|
+
# A more complex usage example may be this:
|
|
36
|
+
#
|
|
37
|
+
# envi --rall --oneliner
|
|
38
|
+
#
|
|
39
|
+
# ===================================================================== #
|
|
40
|
+
when /^-?-?one(-|_)?liner$/i # === envi --oneliner
|
|
41
|
+
@internal_hash[:use_one_line_to_show_the_result] = true # This is different to the short-format.
|
|
42
|
+
# ===================================================================== #
|
|
43
|
+
# === envi --short
|
|
44
|
+
# ===================================================================== #
|
|
45
|
+
when /^-?-?short$/i,
|
|
46
|
+
/^-?-?display(-|_)?short(-|_)?format$/i,
|
|
47
|
+
/^-?-?do(-|_)?display(-|_)?in(-|_)?a(-|_)?short(-|_)?format$/i
|
|
48
|
+
do_display_in_a_short_format
|
|
49
|
+
# ===================================================================== #
|
|
50
|
+
# === envi --sort-alphabetically
|
|
51
|
+
#
|
|
52
|
+
# This entry point can also be combined, such as in:
|
|
53
|
+
#
|
|
54
|
+
# envi --show-everything --sort-alphabetically
|
|
55
|
+
#
|
|
56
|
+
# ===================================================================== #
|
|
57
|
+
when /^-?-?sort(-|_)?alphabetically$/i,
|
|
58
|
+
/^-?-?sort$/i,
|
|
59
|
+
/^-?-?alphabetically$/i,
|
|
60
|
+
/^-?-?alphabet$/i
|
|
61
|
+
enable_sort_alphabetically
|
|
62
|
+
# ===================================================================== #
|
|
63
|
+
# === envi --use-colours?
|
|
64
|
+
# ===================================================================== #
|
|
65
|
+
when /^-?-?use(-|_)?colou?rs\??$/i
|
|
66
|
+
e 'Will colours be used? '+
|
|
67
|
+
::EnvironmentInformation.verbose_truth(
|
|
68
|
+
::EnvironmentInformation.use_colours?.to_s
|
|
69
|
+
)
|
|
70
|
+
do_not_run
|
|
71
|
+
@do_exit_the_program = true
|
|
72
|
+
# ===================================================================== #
|
|
73
|
+
# === :do_show_everything
|
|
74
|
+
#
|
|
75
|
+
# An alternative way to make use of this entry point is via:
|
|
76
|
+
#
|
|
77
|
+
# envi --do-show-everything
|
|
78
|
+
# envi --show-everything
|
|
79
|
+
#
|
|
80
|
+
# ===================================================================== #
|
|
81
|
+
when :do_show_everything,
|
|
82
|
+
:show_really_everything,
|
|
83
|
+
/^-?-?do(_|-)?show(_|-)?everything$/i,
|
|
84
|
+
/^-?-?show(-|_)?everything$/i,
|
|
85
|
+
/^-?-?show(-|_)?full(-|_)?information$/i,
|
|
86
|
+
/^-?-?everything$/i,
|
|
87
|
+
/^-?-?rall$/i,
|
|
88
|
+
'ALL'
|
|
89
|
+
do_show_everything
|
|
90
|
+
@run_already = true
|
|
91
|
+
# ===================================================================== #
|
|
92
|
+
# === envi --kdeversions?
|
|
93
|
+
#
|
|
94
|
+
# Note that this variant depends on another gem, called "rbt", and
|
|
95
|
+
# the associated RBT namespace.
|
|
96
|
+
# ===================================================================== #
|
|
97
|
+
when /^-?-?kde(_|-)?versions\??$/i,
|
|
98
|
+
/^-?-?kde\??$/i
|
|
99
|
+
report_the_installed_KDE_software_suite
|
|
100
|
+
# ===================================================================== #
|
|
101
|
+
# === envi --registered-components?
|
|
102
|
+
# ===================================================================== #
|
|
103
|
+
when /^-?-?registered(_|-)?components\??$/i,
|
|
104
|
+
/^-?-?available\??$/i
|
|
105
|
+
do_not_run_already
|
|
106
|
+
show_the_registered_components
|
|
107
|
+
@do_exit_the_program = true
|
|
108
|
+
# ===================================================================== #
|
|
109
|
+
# === envi --additional=php
|
|
110
|
+
#
|
|
111
|
+
# This entry point allows us to show additional programs.
|
|
112
|
+
#
|
|
113
|
+
# Another usage example:
|
|
114
|
+
#
|
|
115
|
+
# envi --additional=php,python,perl
|
|
116
|
+
#
|
|
117
|
+
# ===================================================================== #
|
|
118
|
+
when /^-?-?additional=(.+)$/i,
|
|
119
|
+
/^-?-?add=(.+)$/i
|
|
120
|
+
_ = $1.to_s.dup
|
|
121
|
+
add(_)
|
|
122
|
+
# ===================================================================== #
|
|
123
|
+
# === envi --n_entries?
|
|
124
|
+
# ===================================================================== #
|
|
125
|
+
when /^-?-?n(_|-)?entries\??$/i,
|
|
126
|
+
/^-?-?n(_|-)?programs\??$/i # envi --nprograms?
|
|
127
|
+
show_n_registered_entries # === envi --n_entries
|
|
128
|
+
@do_exit_the_program = true
|
|
129
|
+
# ===================================================================== #
|
|
130
|
+
# === envi --use-these-programs=bash,binutils,bison,yacc,bzip2,coreutils,diff,find,gawk,gcc,grep,gzip,linux,make,m4,patch,perl,python,sed,tar,makeinfo,xz
|
|
131
|
+
# === envi --use-these-programs=:lfs
|
|
132
|
+
#
|
|
133
|
+
# This entry point can be used to display a certain subset of
|
|
134
|
+
# programs, at the user's discretion.
|
|
135
|
+
# ===================================================================== #
|
|
136
|
+
when /^-?-?use(-|_)?these(-|_)?programs=(.+)$/i # === $3
|
|
137
|
+
# =================================================================== #
|
|
138
|
+
# First clear (aka reset) the main dataset.
|
|
139
|
+
# =================================================================== #
|
|
140
|
+
clear_old_dataset
|
|
141
|
+
match = $3.to_s.dup
|
|
142
|
+
add(match)
|
|
143
|
+
# ===================================================================== #
|
|
144
|
+
# === envi --show-remote-url
|
|
145
|
+
#
|
|
146
|
+
# This entry point will also show the remote URL to the
|
|
147
|
+
# program at hand.
|
|
148
|
+
# ===================================================================== #
|
|
149
|
+
when /^-?-?show(_|-)?remote(_|-)?url$/i
|
|
150
|
+
do_report_the_remote_urls
|
|
151
|
+
# ===================================================================== #
|
|
152
|
+
# === envi --help
|
|
153
|
+
#
|
|
154
|
+
# This entry point will always show help-related information.
|
|
155
|
+
# ===================================================================== #
|
|
156
|
+
when /^-?-?help$/i
|
|
157
|
+
do_show_help
|
|
158
|
+
# ===================================================================== #
|
|
159
|
+
# === envi --really-all
|
|
160
|
+
#
|
|
161
|
+
# This entry point is for really showing everything.
|
|
162
|
+
# ===================================================================== #
|
|
163
|
+
when /^-?-?REALLY(_|-)?ALL$/i,
|
|
164
|
+
/^-?-?compare(_|-)?program(_|-)?version$/i,
|
|
165
|
+
/^-?-?compare(_|-)?to(_|-)?program(_|-)?versions$/i,
|
|
166
|
+
/^-?-?do(_|-)?compare(_|-)?program(_|-)?version$/i,
|
|
167
|
+
/^-?-?really(_|-)?everything$/i
|
|
168
|
+
clear_old_dataset
|
|
169
|
+
add_default_linux_programs
|
|
170
|
+
add_ruby_and_rubygems
|
|
171
|
+
do_show_almost_everything_excluding_the_default_linux_programs
|
|
172
|
+
do_compare_the_program_version
|
|
173
|
+
# ===================================================================== #
|
|
174
|
+
# === envi --no-save
|
|
175
|
+
#
|
|
176
|
+
# Skip saving into a local file through this entry point.
|
|
177
|
+
#
|
|
178
|
+
# Invocation example:
|
|
179
|
+
#
|
|
180
|
+
# envi --lfs --no-save
|
|
181
|
+
#
|
|
182
|
+
# ===================================================================== #
|
|
183
|
+
when /^-?-?no(_|-)?save$/i
|
|
184
|
+
do_not_save_anything
|
|
185
|
+
# ===================================================================== #
|
|
186
|
+
# === envi --os?
|
|
187
|
+
# ===================================================================== #
|
|
188
|
+
when /^-?-?OS\??$/i,
|
|
189
|
+
/^-?-?show(-|_)?only(-|_)?the(-|_)?operating(-|_)?system$/i
|
|
190
|
+
do_show_only_the_operating_system
|
|
191
|
+
show_no_ruby
|
|
192
|
+
# ===================================================================== #
|
|
193
|
+
# === envi --help
|
|
194
|
+
# ===================================================================== #
|
|
195
|
+
when /help/i
|
|
196
|
+
@show_help = true
|
|
197
|
+
# ===================================================================== #
|
|
198
|
+
# === envi --clear
|
|
199
|
+
#
|
|
200
|
+
# This entry point will simply clear the old dataset.
|
|
201
|
+
#
|
|
202
|
+
# This can be used to only display a few components, such as:
|
|
203
|
+
#
|
|
204
|
+
# envi --clear --python --ruby --perl
|
|
205
|
+
#
|
|
206
|
+
# ===================================================================== #
|
|
207
|
+
when /^-?-?clear$/i,
|
|
208
|
+
/^-?-?clear(_|-)?old(_|-)?dataset$/i
|
|
209
|
+
clear_old_dataset
|
|
210
|
+
# ===================================================================== #
|
|
211
|
+
# === envi --sinatra
|
|
212
|
+
# ===================================================================== #
|
|
213
|
+
when /^-?-?sinatra$/i,
|
|
214
|
+
/^-?-?www$/i
|
|
215
|
+
start_the_sinatra_interface
|
|
216
|
+
# ===================================================================== #
|
|
217
|
+
# === envi --open
|
|
218
|
+
# ===================================================================== #
|
|
219
|
+
when /^-?-?open$/i,
|
|
220
|
+
/^-?-?edit$/i
|
|
221
|
+
open_this_file_in_editor
|
|
222
|
+
# ===================================================================== #
|
|
223
|
+
# === envi --lfs
|
|
224
|
+
# ===================================================================== #
|
|
225
|
+
when /^-?-?lfs$/i,
|
|
226
|
+
/^-?-?lfs(_|-)?core(_|-)?programs$/i
|
|
227
|
+
clear_old_dataset
|
|
228
|
+
add(:lfs_core_programs)
|
|
229
|
+
# ===================================================================== #
|
|
230
|
+
# === envi openssl
|
|
231
|
+
# ===================================================================== #
|
|
232
|
+
when /^-?-?openssl$/,
|
|
233
|
+
'ssl'
|
|
234
|
+
add(:openssl)
|
|
235
|
+
# ===================================================================== #
|
|
236
|
+
# === envi --science
|
|
237
|
+
# ===================================================================== #
|
|
238
|
+
when /^-?-?science$/
|
|
239
|
+
clear_old_dataset
|
|
240
|
+
add(:science_cluster)
|
|
241
|
+
# ===================================================================== #
|
|
242
|
+
# === envi --nocolours
|
|
243
|
+
#
|
|
244
|
+
# This entry point can be used to disable usage of colours.
|
|
245
|
+
# ===================================================================== #
|
|
246
|
+
when /^-?-?nocolours/,'2',
|
|
247
|
+
/^-?-?no(-|_)?colou?rs$/i,
|
|
248
|
+
/^-?-?nocol$/i,
|
|
249
|
+
/^-?-?disable(-|_)?colou?rs$/i, # === envi --really-all --disable-colours
|
|
250
|
+
:disable_colours
|
|
251
|
+
disable_colours
|
|
252
|
+
# ===================================================================== #
|
|
253
|
+
# === envi --version
|
|
254
|
+
# ===================================================================== #
|
|
255
|
+
when *ARRAY_VERSION
|
|
256
|
+
report_version
|
|
257
|
+
# ===================================================================== #
|
|
258
|
+
# === envi --gui
|
|
259
|
+
# ===================================================================== #
|
|
260
|
+
when /^-?-?gui$/i,
|
|
261
|
+
/^-?-?gtk$/i,
|
|
262
|
+
/^-?-?start(-|_)?gtk$/i
|
|
263
|
+
start_gtk_component
|
|
264
|
+
# ===================================================================== #
|
|
265
|
+
# === envi --replay
|
|
266
|
+
# ===================================================================== #
|
|
267
|
+
when /^-?-?replay$/i
|
|
268
|
+
require 'environment_information/toplevel_methods/replay_from_the_stored_file.rb'
|
|
269
|
+
::EnvironmentInformation.replay_from_the_stored_file
|
|
270
|
+
# ===================================================================== #
|
|
271
|
+
# === envi --be_silent_no_colours
|
|
272
|
+
#
|
|
273
|
+
# Not sure why the following entry point exists, but I will retain it
|
|
274
|
+
# for the time being.
|
|
275
|
+
# ===================================================================== #
|
|
276
|
+
when /^-?-?be(_|-)?silent(_|-)?no(_|-)?colours$/
|
|
277
|
+
disable_colours
|
|
278
|
+
do_not_display_the_result
|
|
279
|
+
do_show_everything
|
|
280
|
+
# ===================================================================== #
|
|
281
|
+
# This entry point is mostly for internal use, e. g. to pass
|
|
282
|
+
# in Symbols to menu().
|
|
283
|
+
# ===================================================================== #
|
|
284
|
+
when :be_silent_no_colours_everything,
|
|
285
|
+
:be_silent_and_no_colours,
|
|
286
|
+
:be_silent_no_colours,
|
|
287
|
+
:full_be_silent
|
|
288
|
+
disable_colours
|
|
289
|
+
do_show_everything
|
|
290
|
+
do_not_display_the_result
|
|
291
|
+
# ===================================================================== #
|
|
292
|
+
# === envi --be_silent
|
|
293
|
+
# ===================================================================== #
|
|
294
|
+
when /^-?-?be(_|-)?silent$/i # === envi --be-silent
|
|
295
|
+
do_not_display_the_result
|
|
296
|
+
do_show_everything
|
|
297
|
+
# ===================================================================== #
|
|
298
|
+
# === envi --work-on-programs-directory-only
|
|
299
|
+
# ===================================================================== #
|
|
300
|
+
when /^-?-?work(-|_)?on(-|_)?programs(-|_)?directory(-|_)?only$/i,
|
|
301
|
+
/^-?-?work(-|_)?on(-|_)?the(-|_)?programs(-|_)?directory(-|_)?only$/i
|
|
302
|
+
work_on_the_programs_directory_only
|
|
303
|
+
# ===================================================================== #
|
|
304
|
+
# === envi --do-save
|
|
305
|
+
# ===================================================================== #
|
|
306
|
+
when /^save$/i,
|
|
307
|
+
/^-?-?do(_|-)?save$/i
|
|
308
|
+
@store_the_results_into_local_files = true
|
|
309
|
+
# ===================================================================== #
|
|
310
|
+
# === envi --asciitable
|
|
311
|
+
# ===================================================================== #
|
|
312
|
+
when /^-?-?asciitable$/i,
|
|
313
|
+
'table','1'
|
|
314
|
+
use_ascii_table if ASCIITABLE_IS_AVAILABLE
|
|
315
|
+
# ===================================================================== #
|
|
316
|
+
# === envi --read-from-this-file=/Depot/j/display_these_programs.md
|
|
317
|
+
# === envi --file=/Depot/j/display_these_programs.md
|
|
318
|
+
# === envi --input-from=/Depot/j/display_these_programs.md
|
|
319
|
+
# ===================================================================== #
|
|
320
|
+
when /^-?-?read(-|_)?from(-|_)?this(-|_)?file=(.+)$/i, # <- And this has $4
|
|
321
|
+
/^-?-?file=(.+)$/i, # <- This has only $1
|
|
322
|
+
/^-?-?input(-|_)?from=(.+)$/i # <- This has $2
|
|
323
|
+
_ = $1.to_s.dup
|
|
324
|
+
_ = $2.to_s.dup if $2
|
|
325
|
+
_ = $4.to_s.dup if $4
|
|
326
|
+
clear_old_dataset
|
|
327
|
+
set_use_this_as_main_input(
|
|
328
|
+
load_dataset_from_this_file(_)
|
|
329
|
+
)
|
|
330
|
+
# ===================================================================== #
|
|
331
|
+
# === envi --no-yaml-file
|
|
332
|
+
# ===================================================================== #
|
|
333
|
+
when /^-?-?no(-|_)?yaml(-|_)?file$/i,
|
|
334
|
+
/^-?-?no(-|_)?local(-|_)?file$/i
|
|
335
|
+
@store_the_results_into_local_files = false
|
|
336
|
+
# ===================================================================== #
|
|
337
|
+
# === envi noruby
|
|
338
|
+
# ===================================================================== #
|
|
339
|
+
when /^-?-?noruby$/i,
|
|
340
|
+
'show_no_ruby',
|
|
341
|
+
'classic',
|
|
342
|
+
'naked',
|
|
343
|
+
'3',
|
|
344
|
+
'minimal'
|
|
345
|
+
show_no_ruby
|
|
346
|
+
# ===================================================================== #
|
|
347
|
+
# === envi --show-all
|
|
348
|
+
# ===================================================================== #
|
|
349
|
+
when /^-?-?show(-|_)?all$/i,
|
|
350
|
+
/^-?-?all$/i,
|
|
351
|
+
/^-?-?full$/i,
|
|
352
|
+
/^-?-?everything$/i, # === envi --everything
|
|
353
|
+
/^-?-?information$/i,
|
|
354
|
+
'f',
|
|
355
|
+
'4'
|
|
356
|
+
do_show_everything # <- Just to be sure.
|
|
357
|
+
# ===================================================================== #
|
|
358
|
+
# === :be_silent
|
|
359
|
+
# ===================================================================== #
|
|
360
|
+
when /^-?-?be(_|-)?silent$/i,
|
|
361
|
+
:be_silent # We will be silent, but we will still show everything.
|
|
362
|
+
do_not_display_the_result
|
|
363
|
+
do_show_everything
|
|
364
|
+
# ===================================================================== #
|
|
365
|
+
# === envi --compare_programs
|
|
366
|
+
#
|
|
367
|
+
# This entry point allows us to compare the program versions with
|
|
368
|
+
# the one registered in RBT.
|
|
369
|
+
# ===================================================================== #
|
|
370
|
+
when *ARRAY_COMPARE_PROGRAM_VERSIONS
|
|
371
|
+
do_compare_the_program_version
|
|
372
|
+
# ===================================================================== #
|
|
373
|
+
# === envi --generate-html-file
|
|
374
|
+
#
|
|
375
|
+
# This entry point can be used to generate a local .html file.
|
|
376
|
+
# ===================================================================== #
|
|
377
|
+
when /^-?-?generate(-|_)?html(-|_)?file$/i,
|
|
378
|
+
/^-?-?html$/i # envi --HTML
|
|
379
|
+
@internal_hash[:generate_a_html_file] = true
|
|
380
|
+
set_runmode_html # Set it here again, just in case.
|
|
381
|
+
do_show_everything
|
|
382
|
+
# ===================================================================== #
|
|
383
|
+
# === envi --show-components?
|
|
384
|
+
# ===================================================================== #
|
|
385
|
+
when /^-?-?show(-|_)?components\??$/i
|
|
386
|
+
e "#{true_rev}The following components will be shown on a default run:"
|
|
387
|
+
e
|
|
388
|
+
show_these_components?.each {|this_component|
|
|
389
|
+
if this_component.is_a? Array
|
|
390
|
+
this_component = this_component.first
|
|
391
|
+
end
|
|
392
|
+
e " - #{steelblue(this_component)}#{true_rev}"
|
|
393
|
+
}
|
|
394
|
+
e
|
|
395
|
+
exit
|
|
396
|
+
# ===================================================================== #
|
|
397
|
+
# === :do_not_run_yet
|
|
398
|
+
#
|
|
399
|
+
# Invocation example:
|
|
400
|
+
#
|
|
401
|
+
# envi --do-not-run-yet
|
|
402
|
+
#
|
|
403
|
+
# ===================================================================== #
|
|
404
|
+
when /^-?-?-do(-|_)?not(-|_)?run(-|_)?yet$/i, # === envi --do-not-run-yet
|
|
405
|
+
:do_not_run_yet,
|
|
406
|
+
:dont_run_yet,
|
|
407
|
+
:default # This is the default variant.
|
|
408
|
+
@run_already = false
|
|
409
|
+
# ===================================================================== #
|
|
410
|
+
# === envi --pkgconfig
|
|
411
|
+
#
|
|
412
|
+
# Show all pkgconfig entries - but only these.
|
|
413
|
+
# ===================================================================== #
|
|
414
|
+
when /^-?-?pkg(-|_)?config$/i
|
|
415
|
+
clear_old_dataset
|
|
416
|
+
add(:pkgconfig_entries)
|
|
417
|
+
# ===================================================================== #
|
|
418
|
+
# === envi --xorg-components
|
|
419
|
+
#
|
|
420
|
+
# This entry point is for when the user only wants to show the
|
|
421
|
+
# xorg-components on the local computer system.
|
|
422
|
+
# ===================================================================== #
|
|
423
|
+
when /^-?-?xorg(_|-)?components$/i,
|
|
424
|
+
/^-?-?xorg$/i,
|
|
425
|
+
/^-?-?show(_|-)?xorg(_|-)?components$/i
|
|
426
|
+
do_show_only_the_xorg_components
|
|
427
|
+
else # else tag
|
|
428
|
+
# =================================================================== #
|
|
429
|
+
# It is better to report that the given commandline-input as
|
|
430
|
+
# not found, so this will be reported. Before we can do so, we
|
|
431
|
+
# will first check whether the user wanted to pass some
|
|
432
|
+
# existing/registered component nonetheless.
|
|
433
|
+
#
|
|
434
|
+
# This clause can be checked via something like this:
|
|
435
|
+
#
|
|
436
|
+
# envi --bash
|
|
437
|
+
# envi --brotli
|
|
438
|
+
#
|
|
439
|
+
# =================================================================== #
|
|
440
|
+
if is_a_registered_component?(i.delete('-'))
|
|
441
|
+
# ================================================================= #
|
|
442
|
+
# The next line has been added in August 2022. Not sure if we
|
|
443
|
+
# retain it or not - either way the future will show.
|
|
444
|
+
# ================================================================= #
|
|
445
|
+
@array_report_these_programs.clear # Clear the old result first.
|
|
446
|
+
do_not_store_anything
|
|
447
|
+
add(
|
|
448
|
+
i.delete('-')
|
|
449
|
+
)
|
|
450
|
+
else
|
|
451
|
+
# ================================================================= #
|
|
452
|
+
# Only enter the report-section if we do NOT want to exit early.
|
|
453
|
+
# ================================================================= #
|
|
454
|
+
do_show_help if show_help?
|
|
455
|
+
# Or:
|
|
456
|
+
# e 'Unhandled command input (in file environment_information/class/menu.rb): '
|
|
457
|
+
# e
|
|
458
|
+
# e " #{sfancy(i)}"
|
|
459
|
+
# e
|
|
460
|
+
end
|
|
461
|
+
end
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
end; end
|