environment_information 1.4.124 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +91 -15
- data/doc/README.gen +42 -14
- data/doc/todo/TODO_FOR_THE_ENVIRONMENT_INFORMATION_PROJECT.md +16 -12
- data/lib/environment_information/base/base.rb +483 -99
- data/lib/environment_information/colours/colours.rb +92 -66
- data/lib/environment_information/commandline/commandline.rb +137 -0
- data/lib/environment_information/constants/constants.rb +372 -11
- data/lib/environment_information/project/project.rb +1 -1
- data/lib/environment_information/query/constants.rb +46 -0
- data/lib/environment_information/query/help.rb +88 -0
- data/lib/environment_information/query/menu.rb +487 -0
- data/lib/environment_information/query/misc.rb +2006 -0
- data/lib/environment_information/query/query.rb +245 -0
- data/lib/environment_information/query/reset.rb +202 -0
- data/lib/environment_information/query/run.rb +70 -0
- data/lib/environment_information/requires/require_the_environment_information_project.rb +2 -7
- data/lib/environment_information/requires/require_the_toplevel_methods.rb +1 -3
- data/lib/environment_information/toplevel_methods/toplevel_methods.rb +2258 -0
- data/lib/environment_information/version/version.rb +2 -2
- data/lib/environment_information/www/sinatra_interface.rb +20 -17
- data/lib/environment_information/www/webobject_interface.cgi +6 -7
- data/lib/environment_information/yaml/colours.yml +3 -3
- data/lib/environment_information/yaml/query_to_use_for_all_components.yml +284 -0
- data/lib/environment_information/yaml/{array_tracked_programs.yml → track_these_components.yml} +77 -11
- metadata +18 -60
- data/lib/environment_information/class/class.rb +0 -2580
- data/lib/environment_information/class/colours.rb +0 -282
- data/lib/environment_information/colours/sfancy.rb +0 -19
- data/lib/environment_information/colours/simp.rb +0 -19
- data/lib/environment_information/constants/array_tracked_components.rb +0 -210
- data/lib/environment_information/constants/encoding.rb +0 -21
- data/lib/environment_information/constants/error_line.rb +0 -17
- data/lib/environment_information/constants/file_constants.rb +0 -102
- data/lib/environment_information/constants/misc.rb +0 -86
- data/lib/environment_information/constants/namespace.rb +0 -14
- data/lib/environment_information/constants/newline.rb +0 -16
- data/lib/environment_information/constants/regex.rb +0 -30
- data/lib/environment_information/constants/temp_directory.rb +0 -52
- data/lib/environment_information/misc_components/README.md +0 -3
- data/lib/environment_information/misc_components/cflags.rb +0 -36
- data/lib/environment_information/misc_components/cpuinfo.rb +0 -64
- data/lib/environment_information/misc_components/operating_system.rb +0 -54
- data/lib/environment_information/misc_components/operating_system_bit_type.rb +0 -42
- data/lib/environment_information/misc_components/ram.rb +0 -30
- data/lib/environment_information/misc_components/rubygems_installation_directory.rb +0 -54
- data/lib/environment_information/misc_components/screen_resolution.rb +0 -50
- data/lib/environment_information/queries/README.md +0 -2
- data/lib/environment_information/queries/complex_version.rb +0 -273
- data/lib/environment_information/queries/pkg_config.rb +0 -125
- data/lib/environment_information/queries/simple_version.rb +0 -272
- data/lib/environment_information/requires/require_the_individual_misc_components.rb +0 -30
- data/lib/environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb +0 -153
- data/lib/environment_information/toplevel_methods/cd.rb +0 -16
- data/lib/environment_information/toplevel_methods/e.rb +0 -43
- data/lib/environment_information/toplevel_methods/hash.rb +0 -65
- data/lib/environment_information/toplevel_methods/internet_is_available.rb +0 -30
- data/lib/environment_information/toplevel_methods/is_on_roebe.rb +0 -16
- data/lib/environment_information/toplevel_methods/menu.rb +0 -90
- data/lib/environment_information/toplevel_methods/misc.rb +0 -324
- data/lib/environment_information/toplevel_methods/n_subcommands.rb +0 -31
- data/lib/environment_information/toplevel_methods/prefix_to_use.rb +0 -39
- data/lib/environment_information/toplevel_methods/register_this_component_is_missing.rb +0 -61
- data/lib/environment_information/toplevel_methods/remote_url_of_this_program.rb +0 -45
- data/lib/environment_information/toplevel_methods/replay_from_the_stored_file.rb +0 -84
- data/lib/environment_information/toplevel_methods/return_alias_to.rb +0 -30
- data/lib/environment_information/toplevel_methods/return_pkgconfig_based_programs.rb +0 -28
- data/lib/environment_information/toplevel_methods/return_remote_gtk2_version.rb +0 -54
- data/lib/environment_information/toplevel_methods/return_simple_version_based_programs.rb +0 -28
- data/lib/environment_information/toplevel_methods/return_version_of_this_program.rb +0 -182
- data/lib/environment_information/toplevel_methods/show_all_available_components.rb +0 -192
- data/lib/environment_information/toplevel_methods/write_what_into.rb +0 -24
- data/lib/environment_information/yaml/array_default_programs_on_linux.yml +0 -15
- data/lib/environment_information/yaml/array_lfs_core_programs.yml +0 -37
- data/lib/environment_information/yaml/array_science_cluster.yml +0 -12
- data/lib/environment_information/yaml/array_tracked_non_programs.yml +0 -13
- data/lib/environment_information/yaml/array_tracked_xorg_components.yml +0 -37
- data/lib/environment_information/yaml/query_to_use_for_the_individual_components.yml +0 -284
@@ -2,16 +2,377 @@
|
|
2
2
|
# Encoding: UTF-8
|
3
3
|
# frozen_string_literal: true
|
4
4
|
# =========================================================================== #
|
5
|
-
# This file will require the other .rb files in the environment/constants/
|
6
|
-
# subdirectory.
|
7
|
-
# =========================================================================== #
|
8
5
|
# require 'environment_information/constants/constants.rb'
|
9
6
|
# =========================================================================== #
|
10
|
-
|
11
|
-
|
12
|
-
require '
|
13
|
-
require 'environment_information/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
module EnvironmentInformation
|
8
|
+
|
9
|
+
require 'yaml'
|
10
|
+
require 'environment_information/project/project.rb'
|
11
|
+
|
12
|
+
# ========================================================================== #
|
13
|
+
# === EnvironmentInformation::N
|
14
|
+
#
|
15
|
+
# A newline constant to simplify our life.
|
16
|
+
# ========================================================================== #
|
17
|
+
N = "\n"
|
18
|
+
|
19
|
+
# ========================================================================== #
|
20
|
+
# === NAMESPACE
|
21
|
+
# ========================================================================== #
|
22
|
+
NAMESPACE = inspect
|
23
|
+
|
24
|
+
# ========================================================================== #
|
25
|
+
# === ARRAY_DEFAULT_PROGRAMS_ON_LINUX
|
26
|
+
# ========================================================================== #
|
27
|
+
ARRAY_DEFAULT_PROGRAMS_ON_LINUX = %i(
|
28
|
+
bash
|
29
|
+
gcc
|
30
|
+
binutils
|
31
|
+
bison
|
32
|
+
busybox
|
33
|
+
bzip2
|
34
|
+
coreutils
|
35
|
+
diffutils
|
36
|
+
findutils
|
37
|
+
flex
|
38
|
+
gawk
|
39
|
+
grep
|
40
|
+
gzip
|
41
|
+
linux
|
42
|
+
perl
|
43
|
+
xz
|
44
|
+
)
|
45
|
+
|
46
|
+
# ========================================================================== #
|
47
|
+
# === EnvironmentInformation::ARRAY_VERSION
|
48
|
+
# ========================================================================== #
|
49
|
+
ARRAY_VERSION = [
|
50
|
+
/^-?-?version\??$/i
|
51
|
+
]
|
52
|
+
|
53
|
+
# ========================================================================== #
|
54
|
+
# === EnvironmentInformation::NOT_FOUND
|
55
|
+
#
|
56
|
+
# This constant is used to denote that a component was not found.
|
57
|
+
# ========================================================================== #
|
58
|
+
NOT_FOUND = '[Not available, installed or found.]'
|
59
|
+
|
60
|
+
# ========================================================================== #
|
61
|
+
# === EnvironmentInformation::NOT_FOUND
|
62
|
+
#
|
63
|
+
# This was the old variant.
|
64
|
+
# ========================================================================== #
|
65
|
+
# NOT_FOUND = 'not found'
|
66
|
+
|
67
|
+
# ========================================================================== #
|
68
|
+
# === EnvironmentInformation::TEMP_DIRECTORY
|
69
|
+
#
|
70
|
+
# This constant denotes into which directory files should be stored,
|
71
|
+
# e. g. autogenerated files from the EnvironmentInformation project.
|
72
|
+
#
|
73
|
+
# This constant MUST have a trailing '/' character.
|
74
|
+
#
|
75
|
+
# The environment variable called MY_TEMP_DIR can overrule all
|
76
|
+
# other guesses made here, but it is not always available,
|
77
|
+
# e. g. in a .cgi file such an environment variable may not
|
78
|
+
# be available.
|
79
|
+
# ========================================================================== #
|
80
|
+
if ENV.has_key? 'MY_TEMP_DIR'
|
81
|
+
TEMP_DIRECTORY = ENV['MY_TEMP_DIR'].to_s
|
82
|
+
elsif File.directory? '/home/x/Temp/' # ← My main directory.
|
83
|
+
TEMP_DIRECTORY = '/home/x/Temp/'
|
84
|
+
elsif File.directory? '/Depot/Temp/'
|
85
|
+
TEMP_DIRECTORY = '/Depot/Temp/'
|
86
|
+
else
|
87
|
+
TEMP_DIRECTORY = '/tmp/' # ← "Rescue" for most other users on linux.
|
88
|
+
end
|
89
|
+
|
90
|
+
# ========================================================================== #
|
91
|
+
# === @temp_directory
|
92
|
+
# ========================================================================== #
|
93
|
+
@temp_directory = TEMP_DIRECTORY
|
94
|
+
|
95
|
+
# ========================================================================== #
|
96
|
+
# === EnvironmentInformation.temp_directory?
|
97
|
+
#
|
98
|
+
# This method will refer to the temp-directory in use for this project.
|
99
|
+
#
|
100
|
+
# It is advised to make use of the method, rather than the
|
101
|
+
# TEMP_DIRECTORY constant, as that is more convenient in the
|
102
|
+
# long run.
|
103
|
+
# ========================================================================== #
|
104
|
+
def self.temp_directory?(
|
105
|
+
i = @temp_directory
|
106
|
+
)
|
107
|
+
i.squeeze('/').dup
|
108
|
+
end; self.instance_eval { alias temp_dir? temp_directory? } # === EnvironmentInformation.temp_dir?
|
109
|
+
|
110
|
+
# ========================================================================== #
|
111
|
+
# === EnvironmentInformation::ARRAY_COMPARE_PROGRAM_VERSIONS
|
112
|
+
# ========================================================================== #
|
113
|
+
ARRAY_COMPARE_PROGRAM_VERSIONS = [
|
114
|
+
/^-?-?compare(-|_)?to(-|_)?program(-|_)?versions$/i,
|
115
|
+
/^-?-?compare(-|_)?program(-|_)?versions$/i,
|
116
|
+
/^-?-?compare(-|_)?programs$/i,
|
117
|
+
/^-?-?compare$/i,
|
118
|
+
/^-?-?compare(-|_)?version$/i
|
119
|
+
]
|
120
|
+
|
121
|
+
# ========================================================================== #
|
122
|
+
# === EnvironmentInformation::NOT_INSTALLED_OR_NOT_FOUND
|
123
|
+
# ========================================================================== #
|
124
|
+
NOT_INSTALLED_OR_NOT_FOUND = '[Not installed or not found.]'
|
125
|
+
|
126
|
+
# ========================================================================== #
|
127
|
+
# === EnvironmentInformation::COMMAND_NOT_FOUND
|
128
|
+
# ========================================================================== #
|
129
|
+
COMMAND_NOT_FOUND = 'command not found'
|
130
|
+
|
131
|
+
# ========================================================================== #
|
132
|
+
# === EnvironmentInformation::VERSION_STRING
|
133
|
+
# ========================================================================== #
|
134
|
+
VERSION_STRING = 'version'
|
135
|
+
|
136
|
+
# ========================================================================== #
|
137
|
+
# === EnvironmentInformation::NOT_FOUND_IN_PKG_CONFIG_SEARCH_PATH
|
138
|
+
#
|
139
|
+
# This constant is specifically for missing (or not found) .pc
|
140
|
+
# files.
|
141
|
+
# ========================================================================== #
|
142
|
+
NOT_FOUND_IN_PKG_CONFIG_SEARCH_PATH =
|
143
|
+
'as not found in the pkg-config search path'
|
144
|
+
|
145
|
+
# ========================================================================== #
|
146
|
+
# === EnvironmentInformation::THE_PROGRAM_WAS_NOT_FOUND
|
147
|
+
# ========================================================================== #
|
148
|
+
THE_PROGRAM_WAS_NOT_FOUND =
|
149
|
+
'[The program was not found.]'
|
150
|
+
|
151
|
+
# ========================================================================== #
|
152
|
+
# === EnvironmentInformation::PKGCONFIG_COMMAND_NOT_FOUND
|
153
|
+
#
|
154
|
+
# The constant that follows next is used to determine whether
|
155
|
+
# pkg-config could find a corresponding .pc file. If not then
|
156
|
+
# pkg-config will typically report a line such as this:
|
157
|
+
#
|
158
|
+
# Package libdr was not found in the pkg-config search path.
|
159
|
+
#
|
160
|
+
# We will include the last part of this string, as a generic
|
161
|
+
# message that can be used to indicate "this package could
|
162
|
+
# not be found on the given computer system at hand".
|
163
|
+
# ========================================================================== #
|
164
|
+
PKGCONFIG_COMMAND_NOT_FOUND =
|
165
|
+
' was not found in the pkg-config search path.'
|
166
|
+
|
167
|
+
# ========================================================================== #
|
168
|
+
# === EnvironmentInformation::NO_SUCH_FILE_OR_DIRECTORY
|
169
|
+
# ========================================================================== #
|
170
|
+
NO_SUCH_FILE_OR_DIRECTORY =
|
171
|
+
'No such file or directory'
|
172
|
+
|
173
|
+
# ========================================================================== #
|
174
|
+
# === TRY_TO_MAKE_USE_OF_THE_OPN_GEM_IF_IT_IS_AVAILABLE
|
175
|
+
#
|
176
|
+
# This gem is closely connected to the NAMESPACE constant, so it
|
177
|
+
# will also reside in this file here.
|
178
|
+
# ========================================================================== #
|
179
|
+
TRY_TO_MAKE_USE_OF_THE_OPN_GEM_IF_IT_IS_AVAILABLE = true
|
180
|
+
|
181
|
+
# ========================================================================== #
|
182
|
+
# === ERROR_LINE
|
183
|
+
#
|
184
|
+
# The error line is the one that can be appended to system-related
|
185
|
+
# queries (e. g. via system()).
|
186
|
+
# ========================================================================== #
|
187
|
+
ERROR_LINE = '2>&1'
|
188
|
+
|
189
|
+
# ========================================================================== #
|
190
|
+
# === EnvironmentInformation::SAVE_FILE
|
191
|
+
#
|
192
|
+
# Where to save stuff to. This depends on a proper setting of the
|
193
|
+
# toplevel variable called @temp_directory.
|
194
|
+
# ========================================================================== #
|
195
|
+
SAVE_FILE =
|
196
|
+
"#{@temp_directory}EnvironmentInformation.md"
|
197
|
+
|
198
|
+
# ========================================================================== #
|
199
|
+
# === EnvironmentInformation::UTF_ENCODING
|
200
|
+
#
|
201
|
+
# UTF-8 is the default encoding for the EnvironmentInformation namespace.
|
202
|
+
# ========================================================================== #
|
203
|
+
UTF_ENCODING = 'UTF-8'
|
204
|
+
|
205
|
+
# ========================================================================== #
|
206
|
+
# === EnvironmentInformation::MAIN_ENCODING
|
207
|
+
# ========================================================================== #
|
208
|
+
MAIN_ENCODING = UTF_ENCODING
|
209
|
+
|
210
|
+
# ========================================================================= #
|
211
|
+
# === ARRAY_TRACKED_PROGRAMS
|
212
|
+
# ========================================================================= #
|
213
|
+
this_file = EnvironmentInformation.project_base_directory?+
|
214
|
+
'yaml/track_these_components.yml'
|
215
|
+
if File.exist? this_file
|
216
|
+
ARRAY_TRACKED_PROGRAMS = YAML.load_file(this_file)
|
217
|
+
else
|
218
|
+
ARRAY_TRACKED_PROGRAMS = []
|
219
|
+
end
|
220
|
+
|
221
|
+
# ========================================================================= #
|
222
|
+
# === FILE_THESE_PROGRAMS_CAN_BE_UPGRADED
|
223
|
+
#
|
224
|
+
# We may store which programs could be upgraded into a local file.
|
225
|
+
# ========================================================================= #
|
226
|
+
FILE_THESE_PROGRAMS_CAN_BE_UPGRADED =
|
227
|
+
'these_programs_can_be_upgraded.yml'
|
228
|
+
|
229
|
+
# ========================================================================= #
|
230
|
+
# === EnvironmentInformation::ARRAY_TRACKED_XORG_COMPONENTS (xorg tag)
|
231
|
+
# ========================================================================= #
|
232
|
+
ARRAY_TRACKED_XORG_COMPONENTS = %w(
|
233
|
+
libevdev
|
234
|
+
libinput
|
235
|
+
libx11
|
236
|
+
libxaw3d
|
237
|
+
libxau
|
238
|
+
libxcb
|
239
|
+
libxcm
|
240
|
+
libxcursor
|
241
|
+
libxdamage
|
242
|
+
libxi
|
243
|
+
libxkbfile
|
244
|
+
libxmu
|
245
|
+
libxpm
|
246
|
+
libxpresent
|
247
|
+
libxtst
|
248
|
+
libxt
|
249
|
+
libxv
|
250
|
+
libxvmc
|
251
|
+
randrproto
|
252
|
+
xextproto
|
253
|
+
xkbcomp
|
254
|
+
xrandr
|
255
|
+
xstdcmap
|
256
|
+
xf86bigfontproto
|
257
|
+
xf86dgaproto
|
258
|
+
xf86driproto
|
259
|
+
)
|
260
|
+
|
261
|
+
# ========================================================================== #
|
262
|
+
# === EnvironmentInformation.tracked_xorg_components?
|
263
|
+
# ========================================================================== #
|
264
|
+
def self.tracked_xorg_components?
|
265
|
+
ARRAY_TRACKED_XORG_COMPONENTS
|
266
|
+
end; self.instance_eval { alias return_all_xorg_components_as_array tracked_xorg_components? } # === EnvironmentInformation.return_all_xorg_components_as_array
|
267
|
+
self.instance_eval { alias xorg_components? tracked_xorg_components? } # === EnvironmentInformation.xorg_components?
|
268
|
+
|
269
|
+
# ========================================================================== #
|
270
|
+
# === EnvironmentInformation.file_query_to_use_for_the_individual_components
|
271
|
+
# ========================================================================== #
|
272
|
+
def self.file_query_to_use_for_the_individual_components
|
273
|
+
"#{project_base_directory?}yaml/query_to_use_for_all_components.yml"
|
274
|
+
end
|
275
|
+
|
276
|
+
# ========================================================================== #
|
277
|
+
# === EnvironmentInformation::ARRAY_TRACKED_NON_PROGRAMS
|
278
|
+
# ========================================================================== #
|
279
|
+
ARRAY_TRACKED_NON_PROGRAMS = %w(
|
280
|
+
cpuinfo
|
281
|
+
operating_system
|
282
|
+
operating_system_bit_type
|
283
|
+
cflags
|
284
|
+
ram
|
285
|
+
rubygems_installation_directory
|
286
|
+
screen_resolution
|
287
|
+
)
|
288
|
+
|
289
|
+
# ========================================================================== #
|
290
|
+
# === EnvironmentInformation.tracked_components?
|
291
|
+
# ========================================================================== #
|
292
|
+
def self.tracked_components?
|
293
|
+
[
|
294
|
+
ARRAY_TRACKED_PROGRAMS+
|
295
|
+
ARRAY_TRACKED_NON_PROGRAMS
|
296
|
+
].flatten
|
297
|
+
end
|
298
|
+
|
299
|
+
# ========================================================================= #
|
300
|
+
# === EnvironmentInformation.tracked_non_programs?
|
301
|
+
#
|
302
|
+
# Simpler toplevel-method to find out which non-programs are registered
|
303
|
+
# within the EnvironmentInformation project.
|
304
|
+
# ========================================================================= #
|
305
|
+
def self.tracked_non_programs?
|
306
|
+
ARRAY_TRACKED_NON_PROGRAMS
|
307
|
+
end; self.instance_eval { alias registered_extra_functionality tracked_non_programs? } # === EnvironmentInformation.registered_extra_functionality
|
308
|
+
|
309
|
+
# ========================================================================== #
|
310
|
+
# === EnvironmentInformation::ARRAY_SCIENCE_CLUSTER
|
311
|
+
#
|
312
|
+
# This is currently hardcoded here.
|
313
|
+
# ========================================================================== #
|
314
|
+
ARRAY_SCIENCE_CLUSTER = %w(
|
315
|
+
hmmer pbbam relion samtools viennarna
|
316
|
+
)
|
317
|
+
|
318
|
+
# ========================================================================== #
|
319
|
+
# === EnvironmentInformation.science_cluster?
|
320
|
+
# ========================================================================== #
|
321
|
+
def self.science_cluster?
|
322
|
+
ARRAY_SCIENCE_CLUSTER
|
323
|
+
end
|
324
|
+
|
325
|
+
# ========================================================================= #
|
326
|
+
# === ARRAY_LFS_TEMPORARY_PROGRAMS
|
327
|
+
#
|
328
|
+
# All programs that are temporary, e. g. for enabling the bootstrapping
|
329
|
+
# of the compiler, are stored in the following Array.
|
330
|
+
# ========================================================================= #
|
331
|
+
ARRAY_LFS_TEMPORARY_PROGRAMS = %i(
|
332
|
+
binutils
|
333
|
+
gcc
|
334
|
+
linux_API_headers
|
335
|
+
glibc
|
336
|
+
libstdc++
|
337
|
+
binutils
|
338
|
+
tcl
|
339
|
+
expect
|
340
|
+
dejagnu
|
341
|
+
m4
|
342
|
+
ncurse
|
343
|
+
bash
|
344
|
+
bison
|
345
|
+
bzip2
|
346
|
+
coreutils
|
347
|
+
diffutils
|
348
|
+
file
|
349
|
+
findutils
|
350
|
+
gawk
|
351
|
+
gettext
|
352
|
+
grep
|
353
|
+
gzip
|
354
|
+
make
|
355
|
+
patch
|
356
|
+
perl
|
357
|
+
python
|
358
|
+
sed
|
359
|
+
tar
|
360
|
+
texinfo
|
361
|
+
xz
|
362
|
+
)
|
363
|
+
|
364
|
+
# ========================================================================= #
|
365
|
+
# === EnvironmentInformation.tracked_programs?
|
366
|
+
#
|
367
|
+
# Simpler toplevel-method to find out which programs are registered
|
368
|
+
# within the EnvironmentInformation project.
|
369
|
+
# ========================================================================= #
|
370
|
+
def self.tracked_programs?
|
371
|
+
ARRAY_TRACKED_PROGRAMS
|
372
|
+
end
|
373
|
+
|
374
|
+
end
|
375
|
+
|
376
|
+
if __FILE__ == $PROGRAM_NAME
|
377
|
+
pp EnvironmentInformation.lfs_core_programs?
|
378
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# ============================================================================ #
|
5
|
+
# require 'environment_information/query/constants.rb'
|
6
|
+
# ============================================================================ #
|
7
|
+
require 'environment_information/base/base.rb'
|
8
|
+
|
9
|
+
module EnvironmentInformation
|
10
|
+
|
11
|
+
class Query < ::EnvironmentInformation::Base # === EnvironmentInformation::Query
|
12
|
+
|
13
|
+
# ========================================================================== #
|
14
|
+
# === EnvironmentInformation::EnvironmentInformation::THIS_FILE
|
15
|
+
#
|
16
|
+
# THIS_FILE = __FILE__
|
17
|
+
#
|
18
|
+
# We hardcode this since it is only relevant on my home system, anyway.
|
19
|
+
# ========================================================================== #
|
20
|
+
THIS_FILE =
|
21
|
+
'/home/x/programming/ruby/src/'\
|
22
|
+
'environment_information/lib/environment_information/query/'\
|
23
|
+
'query.rb'
|
24
|
+
|
25
|
+
# ========================================================================== #
|
26
|
+
# === N_LEFT_PAD
|
27
|
+
# ========================================================================== #
|
28
|
+
N_LEFT_PAD = 35
|
29
|
+
|
30
|
+
# ========================================================================== #
|
31
|
+
# === FILE_COLOURS
|
32
|
+
# ========================================================================== #
|
33
|
+
FILE_COLOURS = "#{::EnvironmentInformation.project_base_dir?}"\
|
34
|
+
"yaml/colours.yml"
|
35
|
+
|
36
|
+
# ========================================================================== #
|
37
|
+
# === NAMESPACE
|
38
|
+
# ========================================================================== #
|
39
|
+
NAMESPACE = inspect
|
40
|
+
|
41
|
+
# ========================================================================== #
|
42
|
+
# === QUERY_TO_USE_FOR_ALL_COMPONENTS
|
43
|
+
# ========================================================================== #
|
44
|
+
QUERY_TO_USE_FOR_ALL_COMPONENTS = ::EnvironmentInformation.query_to_use_for_all_components?
|
45
|
+
|
46
|
+
end; end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# ============================================================================ #
|
5
|
+
# require 'environment_information/query/help.rb'
|
6
|
+
# ============================================================================ #
|
7
|
+
require 'environment_information/base/base.rb'
|
8
|
+
|
9
|
+
module EnvironmentInformation
|
10
|
+
|
11
|
+
class Query < ::EnvironmentInformation::Base # === EnvironmentInformation::Query
|
12
|
+
|
13
|
+
# ========================================================================== #
|
14
|
+
# === do_show_help (help tag)
|
15
|
+
#
|
16
|
+
# Show the commandline-usage through this method here.
|
17
|
+
#
|
18
|
+
# To invoke this, try:
|
19
|
+
#
|
20
|
+
# envi --help
|
21
|
+
#
|
22
|
+
# ========================================================================== #
|
23
|
+
def do_show_help
|
24
|
+
e
|
25
|
+
lpad = "#{col1} "
|
26
|
+
e "#{rev}The following options are available for "\
|
27
|
+
"#{simp('class EnvironmentInformation:')}#{rev}#{N}#{N}"
|
28
|
+
if ASCIITABLE_IS_AVAILABLE
|
29
|
+
e col1+' asciitable '+rev+'# Print in Ascii Table format'
|
30
|
+
end
|
31
|
+
e lpad+'html '+rev+'# Save the environment information '\
|
32
|
+
'into a .html file'
|
33
|
+
e lpad+'gui '+"#{rev}# Start the GTK gui bindings; some "\
|
34
|
+
"aliases are possible such as --GUI"
|
35
|
+
e lpad+'nocolours '+"#{rev}# Disable colours "\
|
36
|
+
"(--disable-colours also works)"
|
37
|
+
e lpad+'noruby '+rev+'# dont show ruby-related environment '\
|
38
|
+
'information'
|
39
|
+
e lpad+'help '+rev+'# show some help'
|
40
|
+
e lpad+'xorg '+rev+'# show some xorg-specific '\
|
41
|
+
'components (also --xorg-components)'
|
42
|
+
e lpad+'OS '+rev+'# show the OS then exit'
|
43
|
+
e lpad+'full '+rev+'# show full information, including '\
|
44
|
+
'GTK, Glib, Atk and Pango Version'
|
45
|
+
e ' # ^^^ This is probably the most useful usage.'
|
46
|
+
e lpad+'openssl '+"#{rev}# display openssl option"
|
47
|
+
e lpad+'REALLY_ALL '+"#{rev}# also compare the program_versions "\
|
48
|
+
"(--really-everything is an alias to this)"
|
49
|
+
e lpad+'save '+"#{rev}# display the result, then "\
|
50
|
+
"save it into a file"
|
51
|
+
e lpad+'sinatra '+"#{rev}# start the sinatra-interface "\
|
52
|
+
"of the environment_information project"
|
53
|
+
e lpad+'version '+rev+'# show the version of '\
|
54
|
+
'EnvironmentInformation in use'
|
55
|
+
e lpad+'--show-remote-url '+rev+'# show the remote URLs '\
|
56
|
+
'of a program (requires the RBT project)'
|
57
|
+
e lpad+'padding=value '+"#{rev}# set to another padding value"
|
58
|
+
e lpad+'--one-liner '+"#{rev}# show everything compacted, without a newline"
|
59
|
+
e lpad+'--nentries? '+"#{rev}# feedback how many entries are tracked in total"
|
60
|
+
e rev+N+'The above commands should be commandline arguments, '\
|
61
|
+
'such as: "'+teal('envi full')+rev+'".'
|
62
|
+
e
|
63
|
+
e "#{rev}Do note that you can prefix the above commands via "\
|
64
|
+
"a leading --, of course."
|
65
|
+
e
|
66
|
+
# ======================================================================== #
|
67
|
+
# Show a simple usage example next:
|
68
|
+
# ======================================================================== #
|
69
|
+
e 'Usage example:'
|
70
|
+
e
|
71
|
+
e steelblue(
|
72
|
+
' envi --version'
|
73
|
+
)
|
74
|
+
e
|
75
|
+
e "#{rev}If you wish to show only some programs, you could "\
|
76
|
+
"use the following:"
|
77
|
+
e
|
78
|
+
e steelblue(
|
79
|
+
' envi --use-these-programs=bash,binutils,bison,yacc,bzip2,coreutils,diff,find,gawk,gcc'
|
80
|
+
)
|
81
|
+
e steelblue(
|
82
|
+
' envi --use-these-programs=:lfs'
|
83
|
+
)
|
84
|
+
e true_rev # Reset via Colours.rev here.
|
85
|
+
do_exit_the_program
|
86
|
+
end; alias show_help do_show_help # === show_help
|
87
|
+
|
88
|
+
end; end
|