program_information 1.2.6 → 1.2.7
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.
- checksums.yaml +4 -4
- data/bin/program_information_version +10 -0
- data/lib/program_information/program_information.rb +217 -67
- data/lib/program_information/version/version.rb +2 -2
- metadata +5 -9
- data/lib/program_information/initialize.rb +0 -43
- data/lib/program_information/menu.rb +0 -29
- data/lib/program_information/report.rb +0 -48
- data/lib/program_information/reset.rb +0 -46
- data/lib/program_information/run.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53e8bc28a72a4c97854d6ae0a999ea70bba84d0ceff8811c767afdbbdaa8db99
|
4
|
+
data.tar.gz: c4ea22bf184c5eb7a5a356a68106d49d2174a25e0fff0e687f1efb832b13c543
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 239b16d41362f0ae71f4628f150d1f549f41d5bdccb9301135ab145308d6a6ceaeccb6b9e4db36d9c86d95c2e28fdfc241cf43ba602b886518c2355284f3a33c
|
7
|
+
data.tar.gz: 97c9ac8257aaf588d403094da235de5706cc9187df0139dd88f04d0f7629f1c50535c971c02d408669a71c9dbc935033871252dab17566819dcd9097c932ef2b
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'program_information'
|
6
|
+
|
7
|
+
if ARGV.first
|
8
|
+
_ = ProgramInformation::ProgramInformation.new(ARGV)
|
9
|
+
puts _.program_version?
|
10
|
+
end
|
@@ -43,37 +43,161 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
43
43
|
require 'program_information/toplevel_methods/remove_archive_type.rb'
|
44
44
|
require 'program_information/constants/constants.rb'
|
45
45
|
require 'program_information/version/version.rb'
|
46
|
-
require 'program_information/initialize.rb'
|
47
|
-
require 'program_information/menu.rb'
|
48
|
-
require 'program_information/reset.rb'
|
49
|
-
require 'program_information/report.rb'
|
50
|
-
require 'program_information/run.rb'
|
51
46
|
|
52
|
-
#
|
47
|
+
# ========================================================================== #
|
48
|
+
# === initialize
|
49
|
+
#
|
50
|
+
# Specific usage example:
|
51
|
+
#
|
52
|
+
# ProgramInformation::ProgramInformation.new('util-linux-ng-2.15')
|
53
|
+
#
|
54
|
+
# ========================================================================== #
|
55
|
+
def initialize(
|
56
|
+
i = ARGV,
|
57
|
+
run_already = true,
|
58
|
+
optional_be_verbose = false
|
59
|
+
)
|
60
|
+
reset
|
61
|
+
if optional_be_verbose
|
62
|
+
set_be_verbose(optional_be_verbose)
|
63
|
+
end
|
64
|
+
set_input(i)
|
65
|
+
case run_already
|
66
|
+
# ======================================================================= #
|
67
|
+
# === :do_run_already
|
68
|
+
# ======================================================================= #
|
69
|
+
when :do_run_already
|
70
|
+
run_already = true
|
71
|
+
# ======================================================================= #
|
72
|
+
# === :dont_run_already
|
73
|
+
# ======================================================================= #
|
74
|
+
when :dont_run_already,
|
75
|
+
:do_not_run_already
|
76
|
+
run_already = false
|
77
|
+
end
|
78
|
+
run if run_already
|
79
|
+
end
|
80
|
+
|
81
|
+
# ========================================================================== #
|
82
|
+
# === reset (reset tag)
|
83
|
+
# ========================================================================== #
|
84
|
+
def reset
|
85
|
+
set_be_verbose
|
86
|
+
# ======================================================================= #
|
87
|
+
# === @short_name
|
88
|
+
# ======================================================================= #
|
89
|
+
@short_name = nil
|
90
|
+
# ======================================================================= #
|
91
|
+
# === @real_short_name
|
92
|
+
# ======================================================================= #
|
93
|
+
@real_short_name = nil
|
94
|
+
# ======================================================================= #
|
95
|
+
# === @program_version
|
96
|
+
# ======================================================================= #
|
97
|
+
@program_version = nil
|
98
|
+
set_shall_we_downcase # Should become before set_input().
|
99
|
+
# ======================================================================= #
|
100
|
+
# === @remove_plus_and_minus
|
101
|
+
# ======================================================================= #
|
102
|
+
@remove_plus_and_minus = REMOVE_PLUS_AND_MINUS
|
103
|
+
# ======================================================================= #
|
104
|
+
# === @replace_plus_with_long_name
|
105
|
+
# ======================================================================= #
|
106
|
+
@replace_plus_with_long_name = REPLACE_PLUS_WITH_LONG_NAME
|
107
|
+
# ======================================================================= #
|
108
|
+
# === @remove_plus_token
|
109
|
+
# ======================================================================= #
|
110
|
+
@remove_plus_token = REMOVE_PLUS_TOKEN
|
111
|
+
if @remove_plus_and_minus # Overrule always in this case.
|
112
|
+
@replace_plus_with_long_name = false
|
113
|
+
end
|
114
|
+
if @remove_plus_and_minus
|
115
|
+
@remove_plus_token = false
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# ========================================================================== #
|
120
|
+
# === menu (menu tag)
|
121
|
+
# ========================================================================== #
|
122
|
+
def menu(i)
|
123
|
+
if i.is_a? Array
|
124
|
+
i.each {|entry| menu(entry) }
|
125
|
+
else
|
126
|
+
case i
|
127
|
+
# ===================================================================== #
|
128
|
+
# === help
|
129
|
+
# ===================================================================== #
|
130
|
+
when /-?-?help$/i
|
131
|
+
show_help
|
132
|
+
exit
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# ========================================================================== #
|
138
|
+
# === report (debug tag, report tag)
|
139
|
+
# ========================================================================== #
|
140
|
+
def report(
|
141
|
+
be_verbose = be_verbose?
|
142
|
+
)
|
143
|
+
case be_verbose
|
144
|
+
when :do_report, :be_verbose
|
145
|
+
be_verbose = true
|
146
|
+
end
|
147
|
+
lpad = 90
|
148
|
+
rpad = 49
|
149
|
+
if be_verbose
|
150
|
+
inner_ljust = 28
|
151
|
+
# ===================================================================== #
|
152
|
+
# === real short name
|
153
|
+
# ===================================================================== #
|
154
|
+
e (NAME_OF_CLASS+(' Program real short name ').ljust(inner_ljust)+'('+
|
155
|
+
yellow?+'@real_short_name'+rev+') is: ').ljust(lpad)+
|
156
|
+
(apostroph?+real_short_name?+apostroph?).
|
157
|
+
ljust(rpad)
|
158
|
+
# ===================================================================== #
|
159
|
+
# === short name
|
160
|
+
# ===================================================================== #
|
161
|
+
e (
|
162
|
+
NAME_OF_CLASS+(' Program name').ljust(inner_ljust)+'('+
|
163
|
+
yellow?+'@short_name'+rev+' ) is: '
|
164
|
+
).ljust(lpad)+(apostroph?+short_name?+apostroph?).
|
165
|
+
ljust(rpad)
|
166
|
+
# ===================================================================== #
|
167
|
+
# === program version
|
168
|
+
# ===================================================================== #
|
169
|
+
e (NAME_OF_CLASS+(' Program version ').ljust(inner_ljust)+'('+
|
170
|
+
yellow?+'@program_version'+rev+') is: ').ljust(lpad)+
|
171
|
+
(apostroph?+version?+apostroph?).
|
172
|
+
ljust(rpad)
|
173
|
+
end
|
174
|
+
end; alias report_result report # === report_result
|
175
|
+
|
176
|
+
# ========================================================================== #
|
53
177
|
# === return_proper_pipe_token_to_this_input
|
54
|
-
#
|
178
|
+
# ========================================================================== #
|
55
179
|
def return_proper_pipe_token_to_this_input(i)
|
56
180
|
::ProgramInformation.return_proper_pipe_token_to_this_input(i)
|
57
181
|
end
|
58
182
|
|
59
|
-
#
|
183
|
+
# ========================================================================== #
|
60
184
|
# === remove_file_suffix
|
61
185
|
#
|
62
186
|
# Delegate towards class RemoveFileSuffix. This is easier to handle
|
63
187
|
# Archive.
|
64
|
-
#
|
188
|
+
# ========================================================================== #
|
65
189
|
def remove_file_suffix(i)
|
66
190
|
RemoveFileSuffix[i.to_s]
|
67
191
|
end
|
68
192
|
|
69
|
-
#
|
193
|
+
# ========================================================================== #
|
70
194
|
# === do_not_replace_plus
|
71
|
-
#
|
195
|
+
# ========================================================================== #
|
72
196
|
def do_not_replace_plus
|
73
197
|
@replace_plus_with_long_name = false
|
74
198
|
end; alias do_not_replace_anything do_not_replace_plus # === do_not_replace_anything
|
75
199
|
|
76
|
-
#
|
200
|
+
# ========================================================================== #
|
77
201
|
# === set_program_version
|
78
202
|
#
|
79
203
|
# Use this method whenever you wish to assign to the @program_version
|
@@ -87,7 +211,7 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
87
211
|
# Until March 2015 we also replaced all '_' with '.' characters,
|
88
212
|
# but input such as "ncbi_cxx--12_0_0.tar.gz" would break as a
|
89
213
|
# consequence, so this was disabled again.
|
90
|
-
#
|
214
|
+
# ========================================================================== #
|
91
215
|
def set_program_version(i)
|
92
216
|
i = remove_file_suffix(i) unless i.nil? # Disallow archive-types here.
|
93
217
|
# ======================================================================= #
|
@@ -110,88 +234,88 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
110
234
|
@program_version = i
|
111
235
|
end; alias set_version set_program_version # === set_version
|
112
236
|
|
113
|
-
#
|
237
|
+
# ========================================================================== #
|
114
238
|
# === be_verbose?
|
115
|
-
#
|
239
|
+
# ========================================================================== #
|
116
240
|
def be_verbose?
|
117
241
|
@be_verbose
|
118
242
|
end
|
119
243
|
|
120
|
-
#
|
244
|
+
# ========================================================================== #
|
121
245
|
# === remove_plus_token?
|
122
|
-
#
|
246
|
+
# ========================================================================== #
|
123
247
|
def remove_plus_token?
|
124
248
|
@remove_plus_token
|
125
249
|
end
|
126
250
|
|
127
|
-
#
|
251
|
+
# ========================================================================== #
|
128
252
|
# === input?
|
129
|
-
#
|
253
|
+
# ========================================================================== #
|
130
254
|
def input?
|
131
255
|
@input
|
132
256
|
end
|
133
257
|
|
134
|
-
#
|
258
|
+
# ========================================================================== #
|
135
259
|
# === return_array
|
136
260
|
#
|
137
261
|
# This method will return a composite, 3-member Array that will hold the
|
138
262
|
# short_name, the real_short_name, and the program_version.
|
139
|
-
#
|
263
|
+
# ========================================================================== #
|
140
264
|
def return_array
|
141
265
|
[ short_name?, real_short_name?, program_version? ]
|
142
266
|
end; alias array? return_array # === array?
|
143
267
|
|
144
|
-
#
|
268
|
+
# ========================================================================== #
|
145
269
|
# === remove_plus_and_minus?
|
146
|
-
#
|
270
|
+
# ========================================================================== #
|
147
271
|
def remove_plus_and_minus?
|
148
272
|
@remove_plus_and_minus
|
149
273
|
end; alias remove_plus_and_minus remove_plus_and_minus? # === remove_plus_and_minus
|
150
274
|
|
151
|
-
#
|
275
|
+
# ========================================================================== #
|
152
276
|
# === apostroph?
|
153
|
-
#
|
277
|
+
# ========================================================================== #
|
154
278
|
def apostroph?
|
155
279
|
APOSTROPH
|
156
280
|
end
|
157
281
|
|
158
|
-
#
|
282
|
+
# ========================================================================== #
|
159
283
|
# === replace_plus_with_long_name?
|
160
|
-
#
|
284
|
+
# ========================================================================== #
|
161
285
|
def replace_plus_with_long_name?
|
162
286
|
@replace_plus_with_long_name
|
163
287
|
end
|
164
288
|
|
165
|
-
#
|
289
|
+
# ========================================================================== #
|
166
290
|
# === short_name_and_version?
|
167
291
|
#
|
168
292
|
# This method returns an aggregated @short_name+'-'+@program_version
|
169
293
|
# string.
|
170
|
-
#
|
294
|
+
# ========================================================================== #
|
171
295
|
def short_name_and_version?
|
172
296
|
"#{short_name?}-#{program_version?}"
|
173
297
|
end; alias short_name_and_version short_name_and_version? # === short_name_and_version
|
174
298
|
|
175
|
-
#
|
299
|
+
# ========================================================================== #
|
176
300
|
# === set_short_name_then_version
|
177
301
|
#
|
178
302
|
# This method will combine two other methods.
|
179
|
-
#
|
303
|
+
# ========================================================================== #
|
180
304
|
def set_short_name_then_version(a, b)
|
181
305
|
set_short_name(a)
|
182
306
|
set_program_version(b)
|
183
307
|
end; alias set_name_then_version set_short_name_then_version # === set_name_then_version
|
184
308
|
|
185
|
-
#
|
309
|
+
# ========================================================================== #
|
186
310
|
# === return_real_short_name_and_version
|
187
311
|
#
|
188
312
|
# We delegate to the module-method here.
|
189
|
-
#
|
313
|
+
# ========================================================================== #
|
190
314
|
def return_real_short_name_and_version(i)
|
191
315
|
::ProgramInformation.return_real_short_name_and_version(i)
|
192
316
|
end
|
193
317
|
|
194
|
-
#
|
318
|
+
# ========================================================================== #
|
195
319
|
# === return_name_and_version
|
196
320
|
#
|
197
321
|
# This method will return an array with two elements:
|
@@ -240,7 +364,7 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
240
364
|
# "CrownCutlass-Alpha1.4"
|
241
365
|
# unless we assume that alpha is a part of the version,
|
242
366
|
# which is possibly correct.
|
243
|
-
#
|
367
|
+
# ========================================================================== #
|
244
368
|
def return_name_and_version(i = nil)
|
245
369
|
if i
|
246
370
|
determine_the_three_main_variables(i)
|
@@ -258,36 +382,44 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
258
382
|
]
|
259
383
|
end; alias rnav return_name_and_version # === rnav
|
260
384
|
|
261
|
-
#
|
385
|
+
# ========================================================================== #
|
262
386
|
# === set_shall_we_downcase
|
263
|
-
#
|
387
|
+
# ========================================================================== #
|
264
388
|
def set_shall_we_downcase(
|
265
389
|
i = SHALL_WE_DOWNCASE
|
266
390
|
)
|
267
391
|
@shall_we_downcase = i
|
268
392
|
end
|
269
393
|
|
270
|
-
#
|
394
|
+
# ========================================================================== #
|
271
395
|
# === do_not_downcase
|
272
|
-
#
|
396
|
+
# ========================================================================== #
|
273
397
|
def do_not_downcase
|
274
398
|
@shall_we_downcase = false
|
275
399
|
end
|
276
|
-
|
277
|
-
#
|
400
|
+
|
401
|
+
# ========================================================================== #
|
278
402
|
# === set_be_verbose
|
279
403
|
#
|
280
404
|
# Set to report in a verbose way here.
|
281
|
-
#
|
405
|
+
# ========================================================================== #
|
282
406
|
def set_be_verbose(i = BE_VERBOSE)
|
283
407
|
case i
|
408
|
+
# ======================================================================== #
|
409
|
+
# === :be_quiet
|
410
|
+
# ======================================================================== #
|
411
|
+
when :be_quiet
|
412
|
+
i = false
|
413
|
+
# ======================================================================== #
|
414
|
+
# === :be_verbose
|
415
|
+
# ======================================================================== #
|
284
416
|
when :be_verbose
|
285
417
|
i = true
|
286
418
|
end
|
287
419
|
@be_verbose = i
|
288
420
|
end
|
289
421
|
|
290
|
-
#
|
422
|
+
# ========================================================================== #
|
291
423
|
# === determine_the_three_main_variables
|
292
424
|
#
|
293
425
|
# This method will determine the three main instance variables:
|
@@ -304,8 +436,10 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
304
436
|
# Note that presently, set_input() will modify the given input and
|
305
437
|
# ensure that there will be a '-' token, even in input that does
|
306
438
|
# not have any '-' or '_' such as in 'sendmail.8.15.2'.
|
307
|
-
#
|
308
|
-
def determine_the_three_main_variables(
|
439
|
+
# ========================================================================== #
|
440
|
+
def determine_the_three_main_variables(
|
441
|
+
i = input?
|
442
|
+
)
|
309
443
|
if i
|
310
444
|
if i.include? '|'
|
311
445
|
splitted = i.split('|')
|
@@ -314,12 +448,15 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
314
448
|
set_short_name(short_name)
|
315
449
|
set_program_version(program_version)
|
316
450
|
else
|
317
|
-
|
451
|
+
set_program_version(i) if (i =~ /\d+/)
|
452
|
+
if be_verbose?
|
453
|
+
opn; e "The input `#{i}` does not include a | character."
|
454
|
+
end
|
318
455
|
end
|
319
456
|
end
|
320
457
|
end; alias determine_name_and_program_version determine_the_three_main_variables # === determine_name_and_program_version
|
321
458
|
|
322
|
-
#
|
459
|
+
# ========================================================================== #
|
323
460
|
# === set_real_short_name
|
324
461
|
#
|
325
462
|
# The instance variable @real_short_name is not allowed to include any
|
@@ -330,20 +467,20 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
330
467
|
#
|
331
468
|
# Note that as of September 2017, we also disallow '.' tokens, such as
|
332
469
|
# may occur accidentally in input like "sendmail.5.8.2".
|
333
|
-
#
|
470
|
+
# ========================================================================== #
|
334
471
|
def set_real_short_name(i = @short_name)
|
335
472
|
i = i.to_s.dup.delete('-_.').rstrip
|
336
473
|
@real_short_name = i
|
337
474
|
end
|
338
475
|
|
339
|
-
#
|
476
|
+
# ========================================================================== #
|
340
477
|
# === set_short_name
|
341
478
|
#
|
342
479
|
# Use this method whenever you wish to assign to the @short_name variable.
|
343
480
|
#
|
344
481
|
# This variable is allowed to keep '-' and '_' entries, but some
|
345
482
|
# settings may also modify this.
|
346
|
-
#
|
483
|
+
# ========================================================================== #
|
347
484
|
def set_short_name(i)
|
348
485
|
i = i.dup
|
349
486
|
# ======================================================================= #
|
@@ -372,9 +509,9 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
372
509
|
end; alias set_name set_short_name # === set_name
|
373
510
|
alias set_program_name set_short_name # === set_program_name
|
374
511
|
|
375
|
-
#
|
512
|
+
# ========================================================================== #
|
376
513
|
# === remove_source_like_strings
|
377
|
-
#
|
514
|
+
# ========================================================================== #
|
378
515
|
def remove_source_like_strings(i)
|
379
516
|
# ======================================================================= #
|
380
517
|
# i.gsub!(/--/,'-') if i.include? '--' # Replace '--' with '-'.
|
@@ -386,26 +523,26 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
386
523
|
return i
|
387
524
|
end
|
388
525
|
|
389
|
-
#
|
526
|
+
# ========================================================================== #
|
390
527
|
# === remove_archive_type
|
391
|
-
#
|
528
|
+
# ========================================================================== #
|
392
529
|
def remove_archive_type(i)
|
393
530
|
::ProgramInformation.remove_archive_type(i)
|
394
531
|
return i
|
395
532
|
end
|
396
533
|
|
397
|
-
#
|
534
|
+
# ========================================================================== #
|
398
535
|
# === e
|
399
|
-
#
|
536
|
+
# ========================================================================== #
|
400
537
|
def e(i = '')
|
401
538
|
::ProgramInformation.e(i)
|
402
539
|
end
|
403
540
|
|
404
|
-
#
|
541
|
+
# ========================================================================== #
|
405
542
|
# === real_short_name?
|
406
543
|
#
|
407
544
|
# Keep in mind that @real_short_name does not have any '-' tokens.
|
408
|
-
#
|
545
|
+
# ========================================================================== #
|
409
546
|
def real_short_name?
|
410
547
|
@real_short_name
|
411
548
|
end; alias real_name? real_short_name? # === real_name?
|
@@ -413,13 +550,13 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
413
550
|
alias real_short_name real_short_name? # === real_short_name
|
414
551
|
alias name_of_the_program? real_short_name? # === name_of_the_program?
|
415
552
|
|
416
|
-
#
|
553
|
+
# ========================================================================== #
|
417
554
|
# === short_name?
|
418
555
|
#
|
419
556
|
# Reader method for the @short_name instance variable.
|
420
557
|
#
|
421
558
|
# short_name is an alias to @short_name.
|
422
|
-
#
|
559
|
+
# ========================================================================== #
|
423
560
|
def short_name?
|
424
561
|
@short_name
|
425
562
|
end; alias program_name short_name? # === program_name
|
@@ -432,11 +569,11 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
432
569
|
alias first short_name? # === first
|
433
570
|
alias return_program_real_name short_name? # === return_program_real_name
|
434
571
|
|
435
|
-
#
|
572
|
+
# ========================================================================== #
|
436
573
|
# === program_version?
|
437
574
|
#
|
438
575
|
# Getter method for the @program_version variable.
|
439
|
-
#
|
576
|
+
# ========================================================================== #
|
440
577
|
def program_version?
|
441
578
|
@program_version
|
442
579
|
end; alias program_version program_version? # === program_version
|
@@ -446,14 +583,14 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
446
583
|
alias last program_version? # === last?
|
447
584
|
alias version_of_the_program? program_version? # === version_of_the_program?
|
448
585
|
|
449
|
-
#
|
450
|
-
# === show_help
|
586
|
+
# ========================================================================== #
|
587
|
+
# === show_help (help tag)
|
451
588
|
#
|
452
589
|
# To invoke this method, try:
|
453
590
|
#
|
454
591
|
# pinfo --show-help
|
455
592
|
#
|
456
|
-
#
|
593
|
+
# ========================================================================== #
|
457
594
|
def show_help
|
458
595
|
e
|
459
596
|
e 'This class is able to split a given input (a string) into'
|
@@ -475,18 +612,19 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
475
612
|
e
|
476
613
|
end
|
477
614
|
|
478
|
-
#
|
615
|
+
# ========================================================================== #
|
479
616
|
# === set_input
|
480
617
|
#
|
481
618
|
# This method will, after performing some sanitize-operations, assign
|
482
619
|
# to the @input variable.
|
483
|
-
#
|
620
|
+
# ========================================================================== #
|
484
621
|
def set_input(i)
|
485
622
|
if i.is_a? Array
|
486
623
|
menu(i)
|
487
624
|
i = i.join(' ').strip
|
488
625
|
end
|
489
626
|
i = i.to_s.dup if i.frozen?
|
627
|
+
original_input = i.dup
|
490
628
|
i = File.basename(i)
|
491
629
|
# ======================================================================= #
|
492
630
|
# We .squeeze away '--' tokens.
|
@@ -548,9 +686,21 @@ class ProgramInformation # === ProgramInformation::ProgramInformation
|
|
548
686
|
i.delete!('+') if i.include? '+'
|
549
687
|
end
|
550
688
|
i = return_proper_pipe_token_to_this_input(i)
|
689
|
+
case i
|
690
|
+
when '|' # Sanitize it in this case.
|
691
|
+
i = original_input
|
692
|
+
set_be_verbose(:be_quiet)
|
693
|
+
end
|
551
694
|
@input = i
|
552
695
|
end
|
553
696
|
|
697
|
+
# ========================================================================== #
|
698
|
+
# === run (run tag)
|
699
|
+
# ========================================================================== #
|
700
|
+
def run
|
701
|
+
determine_the_three_main_variables
|
702
|
+
end
|
703
|
+
|
554
704
|
end
|
555
705
|
|
556
706
|
# =========================================================================== #
|
@@ -11,12 +11,12 @@ class ProgramInformation
|
|
11
11
|
# ========================================================================= #
|
12
12
|
# === VERSION
|
13
13
|
# ========================================================================= #
|
14
|
-
VERSION = '1.2.
|
14
|
+
VERSION = '1.2.7'
|
15
15
|
DEFAULT_VERSION = VERSION # Use an "alias" to the above constant.
|
16
16
|
|
17
17
|
# ========================================================================= #
|
18
18
|
# === LAST_UPDATE
|
19
19
|
# ========================================================================= #
|
20
|
-
LAST_UPDATE = '
|
20
|
+
LAST_UPDATE = '04.04.2024'
|
21
21
|
|
22
22
|
end; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: program_information
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert A. Heiler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colours
|
@@ -51,6 +51,7 @@ extra_rdoc_files: []
|
|
51
51
|
files:
|
52
52
|
- README.md
|
53
53
|
- bin/program_information
|
54
|
+
- bin/program_information_version
|
54
55
|
- doc/CONVENTIONS.md
|
55
56
|
- doc/README.gen
|
56
57
|
- lib/program_information.rb
|
@@ -58,14 +59,9 @@ files:
|
|
58
59
|
- lib/program_information/constants/colours.rb
|
59
60
|
- lib/program_information/constants/constants.rb
|
60
61
|
- lib/program_information/constants/regex.rb
|
61
|
-
- lib/program_information/initialize.rb
|
62
|
-
- lib/program_information/menu.rb
|
63
62
|
- lib/program_information/program_information.rb
|
64
63
|
- lib/program_information/project/project.rb
|
65
|
-
- lib/program_information/report.rb
|
66
64
|
- lib/program_information/requires/require_the_program_information_project.rb
|
67
|
-
- lib/program_information/reset.rb
|
68
|
-
- lib/program_information/run.rb
|
69
65
|
- lib/program_information/toplevel_methods.rb
|
70
66
|
- lib/program_information/toplevel_methods/e.rb
|
71
67
|
- lib/program_information/toplevel_methods/opnn.rb
|
@@ -93,9 +89,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
89
|
requirements:
|
94
90
|
- - ">="
|
95
91
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.5.
|
92
|
+
version: 3.5.7
|
97
93
|
requirements: []
|
98
|
-
rubygems_version: 3.5.
|
94
|
+
rubygems_version: 3.5.7
|
99
95
|
signing_key:
|
100
96
|
specification_version: 4
|
101
97
|
summary: This library is called program_information. It allows you to return the
|
@@ -1,43 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
module ProgramInformation
|
6
|
-
|
7
|
-
class ProgramInformation # === ProgramInformation::ProgramInformation
|
8
|
-
|
9
|
-
# ========================================================================= #
|
10
|
-
# === initialize
|
11
|
-
#
|
12
|
-
# Specific usage example:
|
13
|
-
#
|
14
|
-
# ProgramInformation::ProgramInformation.new('util-linux-ng-2.15')
|
15
|
-
#
|
16
|
-
# ========================================================================= #
|
17
|
-
def initialize(
|
18
|
-
i = ARGV,
|
19
|
-
run_already = true,
|
20
|
-
optional_be_verbose = false
|
21
|
-
)
|
22
|
-
reset
|
23
|
-
set_input(i)
|
24
|
-
if optional_be_verbose
|
25
|
-
set_be_verbose(optional_be_verbose)
|
26
|
-
end
|
27
|
-
case run_already
|
28
|
-
# ======================================================================= #
|
29
|
-
# === :do_run_already
|
30
|
-
# ======================================================================= #
|
31
|
-
when :do_run_already
|
32
|
-
run_already = true
|
33
|
-
# ======================================================================= #
|
34
|
-
# === :dont_run_already
|
35
|
-
# ======================================================================= #
|
36
|
-
when :dont_run_already,
|
37
|
-
:do_not_run_already
|
38
|
-
run_already = false
|
39
|
-
end
|
40
|
-
run if run_already
|
41
|
-
end
|
42
|
-
|
43
|
-
end; end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'program_information/menu.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module ProgramInformation
|
8
|
-
|
9
|
-
class ProgramInformation # === ProgramInformation::ProgramInformation
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === menu (menu tag)
|
13
|
-
# ========================================================================= #
|
14
|
-
def menu(i)
|
15
|
-
if i.is_a? Array
|
16
|
-
i.each {|entry| menu(entry) }
|
17
|
-
else
|
18
|
-
case i
|
19
|
-
# ===================================================================== #
|
20
|
-
# === help
|
21
|
-
# ===================================================================== #
|
22
|
-
when /-?-?help$/i
|
23
|
-
show_help
|
24
|
-
exit
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
end; end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
module ProgramInformation
|
6
|
-
|
7
|
-
class ProgramInformation
|
8
|
-
|
9
|
-
# ========================================================================= #
|
10
|
-
# === report (debug tag, report tag)
|
11
|
-
# ========================================================================= #
|
12
|
-
def report(
|
13
|
-
be_verbose = be_verbose?
|
14
|
-
)
|
15
|
-
case be_verbose
|
16
|
-
when :do_report, :be_verbose
|
17
|
-
be_verbose = true
|
18
|
-
end
|
19
|
-
lpad = 90
|
20
|
-
rpad = 49
|
21
|
-
if be_verbose
|
22
|
-
inner_ljust = 28
|
23
|
-
# ===================================================================== #
|
24
|
-
# === real short name
|
25
|
-
# ===================================================================== #
|
26
|
-
e (NAME_OF_CLASS+(' Program real short name ').ljust(inner_ljust)+'('+
|
27
|
-
yellow?+'@real_short_name'+rev+') is: ').ljust(lpad)+
|
28
|
-
(apostroph?+real_short_name?+apostroph?).
|
29
|
-
ljust(rpad)
|
30
|
-
# ===================================================================== #
|
31
|
-
# === short name
|
32
|
-
# ===================================================================== #
|
33
|
-
e (
|
34
|
-
NAME_OF_CLASS+(' Program name').ljust(inner_ljust)+'('+
|
35
|
-
yellow?+'@short_name'+rev+' ) is: '
|
36
|
-
).ljust(lpad)+(apostroph?+short_name?+apostroph?).
|
37
|
-
ljust(rpad)
|
38
|
-
# ===================================================================== #
|
39
|
-
# === program version
|
40
|
-
# ===================================================================== #
|
41
|
-
e (NAME_OF_CLASS+(' Program version ').ljust(inner_ljust)+'('+
|
42
|
-
yellow?+'@program_version'+rev+') is: ').ljust(lpad)+
|
43
|
-
(apostroph?+version?+apostroph?).
|
44
|
-
ljust(rpad)
|
45
|
-
end
|
46
|
-
end; alias report_result report # === report_result
|
47
|
-
|
48
|
-
end; end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'program_information/reset.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module ProgramInformation
|
8
|
-
|
9
|
-
class ProgramInformation # === ProgramInformation::ProgramInformation
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === reset
|
13
|
-
# ========================================================================= #
|
14
|
-
def reset
|
15
|
-
# ======================================================================= #
|
16
|
-
# === @short_name
|
17
|
-
# ======================================================================= #
|
18
|
-
@short_name = nil
|
19
|
-
# ======================================================================= #
|
20
|
-
# === @real_short_name
|
21
|
-
# ======================================================================= #
|
22
|
-
@real_short_name = nil
|
23
|
-
# ======================================================================= #
|
24
|
-
# === @program_version
|
25
|
-
# ======================================================================= #
|
26
|
-
@program_version = nil
|
27
|
-
set_shall_we_downcase # Should become before set_input().
|
28
|
-
set_be_verbose
|
29
|
-
# ======================================================================= #
|
30
|
-
# === @remove_plus_and_minus
|
31
|
-
# ======================================================================= #
|
32
|
-
@remove_plus_and_minus = REMOVE_PLUS_AND_MINUS
|
33
|
-
# ======================================================================= #
|
34
|
-
# === @replace_plus_with_long_name
|
35
|
-
# ======================================================================= #
|
36
|
-
@replace_plus_with_long_name = REPLACE_PLUS_WITH_LONG_NAME
|
37
|
-
@remove_plus_token = REMOVE_PLUS_TOKEN
|
38
|
-
if @remove_plus_and_minus # Overrule always in this case.
|
39
|
-
@replace_plus_with_long_name = false
|
40
|
-
end
|
41
|
-
if @remove_plus_and_minus
|
42
|
-
@remove_plus_token = false
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end; end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# Encoding: UTF-8
|
3
|
-
# frozen_string_literal: true
|
4
|
-
# =========================================================================== #
|
5
|
-
# require 'program_information/run.rb'
|
6
|
-
# =========================================================================== #
|
7
|
-
module ProgramInformation
|
8
|
-
|
9
|
-
class ProgramInformation
|
10
|
-
|
11
|
-
# ========================================================================= #
|
12
|
-
# === run
|
13
|
-
# ========================================================================= #
|
14
|
-
def run
|
15
|
-
determine_the_three_main_variables
|
16
|
-
end
|
17
|
-
|
18
|
-
end; end
|