Class: EnvironmentInformation::Base
- Inherits:
-
Object
- Object
- EnvironmentInformation::Base
show all
- Defined in:
- lib/environment_information/base/base.rb
Constant Summary
collapse
- TRY_TO_USE_HTML_COLOURS =
#
TRY_TO_USE_HTML_COLOURS
If true then we will try to use the konsole-colours, when possible.
These are part of the colours gem, so this adds a dependency on the colours gem.
#
true
Instance Method Summary
collapse
-
#be_silent ⇒ Object
(also: #be_quiet)
# === be_silent ========================================================================== #.
-
#be_silent? ⇒ Boolean
# === be_silent? ========================================================================== #.
-
#be_verbose? ⇒ Boolean
# === be_verbose? ========================================================================== #.
-
#blue(i = '', use_colours = use_colours? ) ⇒ Object
# === blue ========================================================================== #.
-
#cd(i) ⇒ Object
# === cd (cd tag).
-
#col1 ⇒ Object
# === col1.
-
#commandline_arguments? ⇒ Boolean
# === commandline_arguments? ========================================================================== #.
-
#crimson(i = '', use_colours = use_colours? ) ⇒ Object
# === crimson ========================================================================== #.
-
#cyan(i = '', use_colours = use_colours? ) ⇒ Object
# === cyan ========================================================================== #.
-
#darkgreen(i = '', use_colours = use_colours? ) ⇒ Object
# === darkgreen ========================================================================== #.
-
#darkolivegreen(i = '', use_colours = use_colours? ) ⇒ Object
# === darkolivegreen ========================================================================== #.
-
#dimgray(i = '', use_colours = use_colours? ) ⇒ Object
# === dimgray ========================================================================== #.
-
#disable_colours ⇒ Object
(also: #no_colours)
# === disable_colours ========================================================================== #.
-
#e(i = '') ⇒ Object
# === e (e tag) ========================================================================== #.
-
#enable_colours ⇒ Object
# === enable_colours ========================================================================== #.
-
#esystem(i) ⇒ Object
# === esystem ========================================================================== #.
-
#first_argument? ⇒ Boolean
(also: #first?)
# === first_argument? ========================================================================== #.
-
#gold(i = '') ⇒ Object
# === gold ========================================================================== #.
-
#is_on_roebe? ⇒ Boolean
# === is_on_roebe? ========================================================================== #.
-
#is_rbt_available? ⇒ Boolean
# === is_rbt_available? (rbt tag).
-
#lightblue(i = '') ⇒ Object
# === lightblue ========================================================================== #.
-
#lightgreen(i = '', use_colours = use_colours? ) ⇒ Object
# === lightgreen ========================================================================== #.
-
#lightseagreen(i = '', use_colours = use_colours? ) ⇒ Object
# === lightseagreen ========================================================================== #.
-
#limegreen(i = '', use_colours = use_colours? ) ⇒ Object
# === limegreen ========================================================================== #.
-
#load_dataset_from_this_file(i) ⇒ Object
(also: #try_to_load_dataset_from_this_file, #try_to_read_content_from_this_file)
# === load_dataset_from_this_file.
-
#log_dir? ⇒ Boolean
(also: #log_directory?, #temp_dir?, #temp_directory?)
# === log_dir? ========================================================================== #.
-
#mediumaquamarine(i = '') ⇒ Object
# === mediumaquamarine ========================================================================== #.
-
#mediumpurple(i = '', use_colours = use_colours? ) ⇒ Object
# === mediumpurple ========================================================================== #.
-
#olive(i = '', use_colours = use_colours? ) ⇒ Object
# === olive ========================================================================== #.
-
#olivedrab(i = '', use_colours = use_colours? ) ⇒ Object
# === olivedrab ========================================================================== #.
-
#opne(i = '') ⇒ Object
(also: #opnne)
# === opne ========================================================================== #.
-
#orange(i = '', use_colours = use_colours? ) ⇒ Object
# === orange ========================================================================== #.
-
#register_sigint ⇒ Object
# === register_sigint ========================================================================== #.
-
#reset ⇒ Object
# === reset ========================================================================== #.
-
#return_very_silent_system_output_from(use_this_query) ⇒ Object
(also: #default_query, #silent_sys_command, #silent_query, #swift_query)
# === return_very_silent_system_output_from (query tag) ========================================================================== #.
-
#rev(use_colours = use_colours? ) ⇒ Object
# === rev (rev tag) ========================================================================== #.
-
#royalblue(i = '', use_colours = use_colours? ) ⇒ Object
# === royalblue ========================================================================== #.
-
#sanitize_this_version_string(i) ⇒ Object
# === sanitize_this_version_string ========================================================================== #.
-
#seagreen(i = '', use_colours = use_colours? ) ⇒ Object
# === seagreen ========================================================================== #.
-
#set_be_silent(i = true) ⇒ Object
# === set_be_silent ========================================================================== #.
-
#set_be_verbose(i = true) ⇒ Object
# === set_be_verbose ========================================================================== #.
-
#set_commandline_arguments(i = '') ⇒ Object
# === set_commandline_arguments ========================================================================== #.
-
#set_use_colours(i = true) ⇒ Object
# === set_use_colours ========================================================================== #.
-
#sfancy(i = '', use_colours = use_colours? ) ⇒ Object
# === sfancy ========================================================================== #.
-
#sfile(i = '', use_colours = use_colours? ) ⇒ Object
# === sfile ========================================================================== #.
-
#simp(i, use_colours = use_colours? ) ⇒ Object
# === simp ========================================================================== #.
-
#slateblue(i = '', use_colours = use_colours? ) ⇒ Object
# === slateblue ========================================================================== #.
-
#steelblue(i = '', use_colours = use_colours? ) ⇒ Object
# === steelblue ========================================================================== #.
-
#teal(i = '', use_colours = use_colours? ) ⇒ Object
# === teal ========================================================================== #.
-
#tomato(i = '') ⇒ Object
# === tomato ========================================================================== #.
-
#tracked_programs? ⇒ Boolean
# === tracked_programs? ========================================================================== #.
-
#true_rev ⇒ Object
# === true_rev ========================================================================== #.
-
#use_colours? ⇒ Boolean
# === use_colours? ========================================================================== #.
-
#write_what_into(what, into) ⇒ Object
# === write_what_into ========================================================================== #.
Instance Method Details
#be_silent ⇒ Object
Also known as:
be_quiet
499
500
501
|
# File 'lib/environment_information/base/base.rb', line 499
def be_silent
@internal_hash[:be_verbose] = false
end
|
#be_silent? ⇒ Boolean
513
514
515
|
# File 'lib/environment_information/base/base.rb', line 513
def be_silent?
!be_verbose?
end
|
#be_verbose? ⇒ Boolean
492
493
494
|
# File 'lib/environment_information/base/base.rb', line 492
def be_verbose?
@internal_hash[:be_verbose]
end
|
#blue(i = '', use_colours = use_colours?
) ⇒ Object
299
300
301
302
303
304
305
|
# File 'lib/environment_information/base/base.rb', line 299
def blue(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.blue(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#cd(i) ⇒ Object
#
cd (cd tag)
A shorter variant for the change-directory action.
#
#col1 ⇒ Object
#
col1
The “first” colour to be used.
#
466
467
468
469
|
# File 'lib/environment_information/base/base.rb', line 466
def col1
return Colours::BOLD_BLUE if use_colours?
return ''
end
|
#commandline_arguments? ⇒ Boolean
#
commandline_arguments?
#
79
80
81
|
# File 'lib/environment_information/base/base.rb', line 79
def commandline_arguments?
@commandline_arguments
end
|
#crimson(i = '', use_colours = use_colours?
) ⇒ Object
310
311
312
313
314
315
316
|
# File 'lib/environment_information/base/base.rb', line 310
def crimson(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.crimson(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#cyan(i = '', use_colours = use_colours?
) ⇒ Object
203
204
205
206
207
208
209
|
# File 'lib/environment_information/base/base.rb', line 203
def cyan(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.cyan(i) if use_colours and TRY_TO_USE_HTML_COLOURS
return i
end
|
#darkgreen(i = '', use_colours = use_colours?
) ⇒ Object
453
454
455
456
457
458
459
|
# File 'lib/environment_information/base/base.rb', line 453
def darkgreen(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.darkgreen(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#darkolivegreen(i = '', use_colours = use_colours?
) ⇒ Object
365
366
367
368
369
370
371
|
# File 'lib/environment_information/base/base.rb', line 365
def darkolivegreen(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.darkolivegreen(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#dimgray(i = '', use_colours = use_colours?
) ⇒ Object
442
443
444
445
446
447
448
|
# File 'lib/environment_information/base/base.rb', line 442
def dimgray(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.dimgray(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#disable_colours ⇒ Object
Also known as:
no_colours
261
262
263
|
# File 'lib/environment_information/base/base.rb', line 261
def disable_colours
set_use_colours(false)
end
|
#e(i = '') ⇒ Object
119
120
121
|
# File 'lib/environment_information/base/base.rb', line 119
def e(i = '')
puts i
end
|
#enable_colours ⇒ Object
254
255
256
|
# File 'lib/environment_information/base/base.rb', line 254
def enable_colours
set_use_colours(true)
end
|
#esystem(i) ⇒ Object
126
127
128
129
|
# File 'lib/environment_information/base/base.rb', line 126
def esystem(i)
e i
system i
end
|
#first_argument? ⇒ Boolean
Also known as:
first?
86
87
88
|
# File 'lib/environment_information/base/base.rb', line 86
def first_argument?
@commandline_arguments.first
end
|
#gold(i = '') ⇒ Object
182
183
184
|
# File 'lib/environment_information/base/base.rb', line 182
def gold(i = '')
return ::Colours::HtmlColoursMethods.gold(i)
end
|
#is_rbt_available? ⇒ Boolean
#
is_rbt_available? (rbt tag)
Query whether the user has the necessary code from the RBT project installed.
#
96
97
98
|
# File 'lib/environment_information/base/base.rb', line 96
def is_rbt_available?
Object.const_defined? :RBT
end
|
#lightblue(i = '') ⇒ Object
196
197
198
|
# File 'lib/environment_information/base/base.rb', line 196
def lightblue(i = '')
return ::Colours::HtmlColoursMethods.lightblue(i)
end
|
#lightgreen(i = '', use_colours = use_colours?
) ⇒ Object
354
355
356
357
358
359
360
|
# File 'lib/environment_information/base/base.rb', line 354
def lightgreen(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.lightgreen(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#lightseagreen(i = '', use_colours = use_colours?
) ⇒ Object
277
278
279
280
281
282
283
|
# File 'lib/environment_information/base/base.rb', line 277
def lightseagreen(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.lightseagreen(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#limegreen(i = '', use_colours = use_colours?
) ⇒ Object
376
377
378
379
380
381
382
|
# File 'lib/environment_information/base/base.rb', line 376
def limegreen(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.limegreen(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#load_dataset_from_this_file(i) ⇒ Object
Also known as:
try_to_load_dataset_from_this_file, try_to_read_content_from_this_file
#
load_dataset_from_this_file
This method can be used to read which programs will be displayed from a local file, rather than rely on the pre-set default.
#
539
540
541
542
543
544
545
546
547
|
# File 'lib/environment_information/base/base.rb', line 539
def load_dataset_from_this_file(i)
if File.exist? i
File.readlines(i).map {|entry|
entry.delete('-').strip }
else
opne "No file exists at `#{sfile(i)}`."
end
end
|
#log_dir? ⇒ Boolean
Also known as:
log_directory?, temp_dir?, temp_directory?
#mediumaquamarine(i = '') ⇒ Object
189
190
191
|
# File 'lib/environment_information/base/base.rb', line 189
def mediumaquamarine(i = '')
return ::Colours::HtmlColoursMethods.mediumaquamarine(i)
end
|
#mediumpurple(i = '', use_colours = use_colours?
) ⇒ Object
321
322
323
324
325
326
327
|
# File 'lib/environment_information/base/base.rb', line 321
def mediumpurple(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.mediumpurple(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#olive(i = '', use_colours = use_colours?
) ⇒ Object
387
388
389
390
391
392
393
|
# File 'lib/environment_information/base/base.rb', line 387
def olive(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.olive(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#olivedrab(i = '', use_colours = use_colours?
) ⇒ Object
398
399
400
401
402
403
404
|
# File 'lib/environment_information/base/base.rb', line 398
def olivedrab(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.olivedrab(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#opne(i = '') ⇒ Object
Also known as:
opnne
520
521
522
|
# File 'lib/environment_information/base/base.rb', line 520
def opne(i = '')
opnn; e i
end
|
#orange(i = '', use_colours = use_colours?
) ⇒ Object
343
344
345
346
347
348
349
|
# File 'lib/environment_information/base/base.rb', line 343
def orange(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.orange(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#register_sigint ⇒ Object
233
234
235
|
# File 'lib/environment_information/base/base.rb', line 233
def register_sigint
Signal.trap('SIGINT') { e; exit }
end
|
#reset ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/environment_information/base/base.rb', line 30
def reset
@internal_hash = {}
set_use_colours(TRY_TO_USE_HTML_COLOURS)
set_be_verbose
end
|
#return_very_silent_system_output_from(use_this_query) ⇒ Object
Also known as:
default_query, silent_sys_command, silent_query, swift_query
#
return_very_silent_system_output_from (query tag)
#
#rev(use_colours = use_colours?
) ⇒ Object
268
269
270
271
272
|
# File 'lib/environment_information/base/base.rb', line 268
def rev(
use_colours = use_colours?
)
return ::EnvironmentInformation.rev(use_colours)
end
|
#royalblue(i = '', use_colours = use_colours?
) ⇒ Object
431
432
433
434
435
436
437
|
# File 'lib/environment_information/base/base.rb', line 431
def royalblue(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.royalblue(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#sanitize_this_version_string(i) ⇒ Object
#
sanitize_this_version_string
#
#seagreen(i = '', use_colours = use_colours?
) ⇒ Object
288
289
290
291
292
293
294
|
# File 'lib/environment_information/base/base.rb', line 288
def seagreen(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.seagreen(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#set_be_silent(i = true) ⇒ Object
506
507
508
|
# File 'lib/environment_information/base/base.rb', line 506
def set_be_silent(i = true)
@internal_hash[:be_verbose] = !i
end
|
#set_be_verbose(i = true) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/environment_information/base/base.rb', line 48
def set_be_verbose(
i = true
)
case i
when :be_quiet
i = false
end
@internal_hash[:be_verbose] = i
end
|
#set_commandline_arguments(i = '') ⇒ Object
#
set_commandline_arguments
#
71
72
73
74
|
# File 'lib/environment_information/base/base.rb', line 71
def set_commandline_arguments(i = '')
i = [i].flatten.compact
@commandline_arguments = i
end
|
#set_use_colours(i = true) ⇒ Object
247
248
249
|
# File 'lib/environment_information/base/base.rb', line 247
def set_use_colours(i = true)
@use_colours = i
end
|
#sfancy(i = '', use_colours = use_colours?
) ⇒ Object
474
475
476
477
478
479
480
|
# File 'lib/environment_information/base/base.rb', line 474
def sfancy(
i = '',
use_colours = use_colours?
)
return ::Colours.sfancy(i) if use_colours
return i
end
|
#sfile(i = '', use_colours = use_colours?
) ⇒ Object
157
158
159
160
161
162
163
|
# File 'lib/environment_information/base/base.rb', line 157
def sfile(
i = '',
use_colours = use_colours?
)
return ::EnvironmentInformation.sfile(i, use_colours) if use_colours
return i
end
|
#simp(i, use_colours = use_colours?
) ⇒ Object
222
223
224
225
226
227
228
|
# File 'lib/environment_information/base/base.rb', line 222
def simp(
i,
use_colours = use_colours?
)
return ::Colours.simp(i) if use_colours
return i
end
|
#slateblue(i = '', use_colours = use_colours?
) ⇒ Object
420
421
422
423
424
425
426
|
# File 'lib/environment_information/base/base.rb', line 420
def slateblue(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.slateblue(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#steelblue(i = '', use_colours = use_colours?
) ⇒ Object
409
410
411
412
413
414
415
|
# File 'lib/environment_information/base/base.rb', line 409
def steelblue(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.steelblue(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#teal(i = '', use_colours = use_colours?
) ⇒ Object
332
333
334
335
336
337
338
|
# File 'lib/environment_information/base/base.rb', line 332
def teal(
i = '',
use_colours = use_colours?
)
return ::Colours::HtmlColoursMethods.teal(i) if use_colours? and TRY_TO_USE_HTML_COLOURS
return i
end
|
#tomato(i = '') ⇒ Object
175
176
177
|
# File 'lib/environment_information/base/base.rb', line 175
def tomato(i = '')
return ::Colours::HtmlColoursMethods.tomato(i)
end
|
#tracked_programs? ⇒ Boolean
240
241
242
|
# File 'lib/environment_information/base/base.rb', line 240
def tracked_programs?
ARRAY_TRACKED_PROGRAMS
end
|
#true_rev ⇒ Object
214
215
216
217
|
# File 'lib/environment_information/base/base.rb', line 214
def true_rev
return Colours.rev if use_colours?
return ''
end
|
#use_colours? ⇒ Boolean
168
169
170
|
# File 'lib/environment_information/base/base.rb', line 168
def use_colours?
@use_colours
end
|
#write_what_into(what, into) ⇒ Object