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,48 @@
|
|
|
1
|
+
------------------------------------------------------------------------------
|
|
2
|
+
- add in envi the ability to query from another base-prefix
|
|
3
|
+
e. g. /home/Programs/.
|
|
4
|
+
|
|
5
|
+
Invocation example:
|
|
6
|
+
|
|
7
|
+
envi --work-on-programs-directory-only
|
|
8
|
+
|
|
9
|
+
and then explain this too.
|
|
10
|
+
|
|
11
|
+
So the idea is to first ONLY consider
|
|
12
|
+
checking the programs that are registered
|
|
13
|
+
and THEn to check inside of these directories,
|
|
14
|
+
e. g. for pkgconfig, or for --version or whatever
|
|
15
|
+
only there
|
|
16
|
+
also ewe will use only those directories
|
|
17
|
+
with "Current" symlink pointing to EXISTING directories.
|
|
18
|
+
^^^
|
|
19
|
+
THEN also
|
|
20
|
+
make it available on /home/Programs/Toolchain
|
|
21
|
+
|
|
22
|
+
then upload
|
|
23
|
+
|
|
24
|
+
^^^ this works now with the first variant but only for
|
|
25
|
+
"bison --version" programs; need to add support
|
|
26
|
+
for pkg-config programs too, at a later time.
|
|
27
|
+
|
|
28
|
+
^^^ also has to then add it onto --help to show it
|
|
29
|
+
once it works properly.
|
|
30
|
+
|
|
31
|
+
------------------------------------------------------------------------------
|
|
32
|
+
(7) in envi: add
|
|
33
|
+
|
|
34
|
+
--scan-this-directory=/Programs
|
|
35
|
+
^^^ this shall check for each directory there, if it is NOT empty,
|
|
36
|
+
and then to find out what to use to determine the version
|
|
37
|
+
dynamically.
|
|
38
|
+
but before we do so, perhaps add a way to query the binary
|
|
39
|
+
from any path... e. g. /Programs/Htop/Current/ or so
|
|
40
|
+
------------------------------------------------------------------------------
|
|
41
|
+
(8)
|
|
42
|
+
|
|
43
|
+
- if we rewrite the project, properly add disabling of saving
|
|
44
|
+
files AND checking permissions
|
|
45
|
+
------------------------------------------------------------------------------
|
|
46
|
+
test absolute prefixes again
|
|
47
|
+
------------------------------------------------------------------------------
|
|
48
|
+
(10) add a new log for environment information
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# =========================================================================== #
|
|
2
|
+
# Gemspec for Project EnvironmentInformation.
|
|
3
|
+
# =========================================================================== #
|
|
4
|
+
require 'environment_information'
|
|
5
|
+
require 'roebe'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new { |s|
|
|
8
|
+
|
|
9
|
+
s.name = 'environment_information'
|
|
10
|
+
s.version = EnvironmentInformation::VERSION
|
|
11
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
|
12
|
+
|
|
13
|
+
DESCRIPTION = <<-EOF
|
|
14
|
+
|
|
15
|
+
The gem environment_information is able to provide information about the
|
|
16
|
+
computer host system, in particular on Linux systems, if ruby is available
|
|
17
|
+
on that computer. Commonly used programs will be queried for their current
|
|
18
|
+
version number (and whether they exist) on the target computer. If these
|
|
19
|
+
programs do happen to exist then the corresponding version will be
|
|
20
|
+
displayed, on the commandline.
|
|
21
|
+
|
|
22
|
+
This is somewhat similar to the "Linux from Scratch" project, which uses
|
|
23
|
+
a shell script to display the version of many commonly used programs.
|
|
24
|
+
As I prefer to use ruby rather than shell scripts, I wrote this somewhat
|
|
25
|
+
equivalent project.
|
|
26
|
+
|
|
27
|
+
This project currently tracks the version of
|
|
28
|
+
#{::EnvironmentInformation.tracked_programs?.size}
|
|
29
|
+
different programs.
|
|
30
|
+
|
|
31
|
+
For more information and documentation about this project, consider
|
|
32
|
+
looking at the homepage of this gem, at
|
|
33
|
+
|
|
34
|
+
https://rubygems.org/gems/environment_information
|
|
35
|
+
|
|
36
|
+
and look at the documentation on the bottom right side,
|
|
37
|
+
called "Documentation".
|
|
38
|
+
|
|
39
|
+
EOF
|
|
40
|
+
|
|
41
|
+
s.summary = DESCRIPTION
|
|
42
|
+
s.description = DESCRIPTION
|
|
43
|
+
|
|
44
|
+
# =============================================================== #
|
|
45
|
+
# Show this when a user installs this project.
|
|
46
|
+
# =============================================================== #
|
|
47
|
+
s.post_install_message = <<-EOF
|
|
48
|
+
|
|
49
|
+
You can run this little script by issuing:
|
|
50
|
+
|
|
51
|
+
envi
|
|
52
|
+
|
|
53
|
+
on the commandline. (The script envi is part of this gem and can
|
|
54
|
+
be found at the subdirectory bin/envi of the gem.)
|
|
55
|
+
|
|
56
|
+
Within ruby code, you can require the project and then display
|
|
57
|
+
information too, via:
|
|
58
|
+
|
|
59
|
+
require 'environment_information'
|
|
60
|
+
EnvironmentInformation.run
|
|
61
|
+
|
|
62
|
+
For the (documented) options, you can do either of the following:
|
|
63
|
+
|
|
64
|
+
envi --help
|
|
65
|
+
envi HELP
|
|
66
|
+
|
|
67
|
+
This will feedback the options that are available.
|
|
68
|
+
|
|
69
|
+
To get the full output of just about every program that is checked
|
|
70
|
+
by this gem, try any of the following invocation:
|
|
71
|
+
|
|
72
|
+
envi --all
|
|
73
|
+
envi ALL
|
|
74
|
+
|
|
75
|
+
(Lowercase works fine just as well. The commandline options that
|
|
76
|
+
include two '-' characters are, internally, the preferred variants.)
|
|
77
|
+
|
|
78
|
+
To obtain an individual entry, do something such as this:
|
|
79
|
+
|
|
80
|
+
envi gtk
|
|
81
|
+
envi pango
|
|
82
|
+
envi gcr
|
|
83
|
+
|
|
84
|
+
To disable colours, do either one of these:
|
|
85
|
+
|
|
86
|
+
envi --nocolours
|
|
87
|
+
envi --no-colours
|
|
88
|
+
envi --no-colors
|
|
89
|
+
envi --nocolors
|
|
90
|
+
envi nocolours
|
|
91
|
+
envi NOCOLOURS
|
|
92
|
+
|
|
93
|
+
(Both UK and US spelling is supported, so colour works just as
|
|
94
|
+
well as color.)
|
|
95
|
+
|
|
96
|
+
If all of this may become too tedious to type, I just use an
|
|
97
|
+
alias called ALL, which stands short for "envi all" or
|
|
98
|
+
"envi show_all".
|
|
99
|
+
|
|
100
|
+
Another option, both of which are synonymous to each other,
|
|
101
|
+
is to compare all existing programs on a given host system
|
|
102
|
+
with the version registered in the RBT project:
|
|
103
|
+
|
|
104
|
+
envi ALL REALLY_ALL
|
|
105
|
+
envi --compare_programs
|
|
106
|
+
envi compare_programs
|
|
107
|
+
|
|
108
|
+
If you wish to show only the OS information, do:
|
|
109
|
+
|
|
110
|
+
envi --os?
|
|
111
|
+
|
|
112
|
+
For more documentation about the project, have a look at:
|
|
113
|
+
|
|
114
|
+
#{EnvironmentInformation::URL_TO_THE_DOCUMENTATION}
|
|
115
|
+
|
|
116
|
+
EOF
|
|
117
|
+
|
|
118
|
+
s.authors = ['Robert A. Heiler']
|
|
119
|
+
s.email = Roebe.email?
|
|
120
|
+
s.files = Dir['**/*']
|
|
121
|
+
s.licenses = 'MIT'
|
|
122
|
+
s.homepage = 'https://rubygems.org/gems/environment_information'
|
|
123
|
+
s.executables = Dir['bin/*'].map { |f| File.basename(f) }
|
|
124
|
+
|
|
125
|
+
s.required_ruby_version = '>= '+Roebe.third_most_stable_version_of_ruby
|
|
126
|
+
s.required_rubygems_version = '>= '+Gem::VERSION
|
|
127
|
+
s.rubygems_version = '>= '+Gem::VERSION
|
|
128
|
+
|
|
129
|
+
# ========================================================================= #
|
|
130
|
+
# Dependencies of this project:
|
|
131
|
+
# ========================================================================= #
|
|
132
|
+
s.add_dependency 'colours'
|
|
133
|
+
# s.add_dependency 'opn' # ← An optional dependency since as of 10.03.2020
|
|
134
|
+
|
|
135
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'environment_information/base/base.rb'
|
|
6
|
+
# < ::EnvironmentInformation::Base
|
|
7
|
+
# =========================================================================== #
|
|
8
|
+
module EnvironmentInformation
|
|
9
|
+
|
|
10
|
+
class Base
|
|
11
|
+
|
|
12
|
+
require 'environment_information/requires/require_the_constants.rb'
|
|
13
|
+
require 'environment_information/colours/colours.rb'
|
|
14
|
+
require 'environment_information/toplevel_methods/e.rb'
|
|
15
|
+
require 'environment_information/toplevel_methods/misc.rb'
|
|
16
|
+
|
|
17
|
+
require 'environment_information/toplevel_methods/is_on_roebe.rb'
|
|
18
|
+
# ========================================================================= #
|
|
19
|
+
# === is_on_roebe?
|
|
20
|
+
# ========================================================================= #
|
|
21
|
+
def is_on_roebe?
|
|
22
|
+
::EnvironmentInformation.is_on_roebe?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# ========================================================================= #
|
|
26
|
+
# === e
|
|
27
|
+
# ========================================================================= #
|
|
28
|
+
def e(i = '')
|
|
29
|
+
::EnvironmentInformation.e(i)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# ========================================================================= #
|
|
33
|
+
# === set_commandline_arguments
|
|
34
|
+
# ========================================================================= #
|
|
35
|
+
def set_commandline_arguments(i = '')
|
|
36
|
+
i = [i].flatten.compact
|
|
37
|
+
@commandline_arguments = i
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# ========================================================================= #
|
|
41
|
+
# === commandline_arguments?
|
|
42
|
+
# ========================================================================= #
|
|
43
|
+
def commandline_arguments?
|
|
44
|
+
@commandline_arguments
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# ========================================================================= #
|
|
48
|
+
# === first_argument?
|
|
49
|
+
# ========================================================================= #
|
|
50
|
+
def first_argument?
|
|
51
|
+
@commandline_arguments.first
|
|
52
|
+
end; alias first? first_argument? # === first?
|
|
53
|
+
|
|
54
|
+
# ========================================================================= #
|
|
55
|
+
# === is_rbt_available? (rbt tag)
|
|
56
|
+
#
|
|
57
|
+
# Query whether the user has the necessary code from the RBT project
|
|
58
|
+
# installed.
|
|
59
|
+
# ========================================================================= #
|
|
60
|
+
def is_rbt_available?
|
|
61
|
+
Object.const_defined? :RBT
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# ========================================================================= #
|
|
65
|
+
# === log_dir?
|
|
66
|
+
# ========================================================================= #
|
|
67
|
+
def log_dir?
|
|
68
|
+
::EnvironmentInformation.temp_directory?
|
|
69
|
+
end; alias log_directory? log_dir? # === log_directory?
|
|
70
|
+
|
|
71
|
+
require 'environment_information/toplevel_methods/cd.rb'
|
|
72
|
+
# ========================================================================= #
|
|
73
|
+
# === cd (cd tag)
|
|
74
|
+
#
|
|
75
|
+
# A shorter variant for the change-directory action.
|
|
76
|
+
# ========================================================================= #
|
|
77
|
+
def cd(i)
|
|
78
|
+
::EnvironmentInformation.cd(i)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# ========================================================================= #
|
|
82
|
+
# === esystem
|
|
83
|
+
# ========================================================================= #
|
|
84
|
+
def esystem(i)
|
|
85
|
+
e i
|
|
86
|
+
system i
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# ========================================================================= #
|
|
90
|
+
# === gold
|
|
91
|
+
# ========================================================================= #
|
|
92
|
+
def gold(i = '')
|
|
93
|
+
return ::Colours.gold(i)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# ========================================================================= #
|
|
97
|
+
# === lightblue
|
|
98
|
+
# ========================================================================= #
|
|
99
|
+
def lightblue(i = '')
|
|
100
|
+
return ::Colours.lightblue(i)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# ========================================================================= #
|
|
104
|
+
# === report_left_right
|
|
105
|
+
# ========================================================================= #
|
|
106
|
+
def report_left_right(
|
|
107
|
+
left = program_name?,
|
|
108
|
+
right = program_version?,
|
|
109
|
+
colour_for_the_left_side = ::EnvironmentInformation.colour_for_the_left_side,
|
|
110
|
+
colour_for_the_right_side = ::EnvironmentInformation.colour_for_the_right_side,
|
|
111
|
+
colour_for_program_not_found = ::EnvironmentInformation.colour_for_program_not_found,
|
|
112
|
+
use_padding = true
|
|
113
|
+
)
|
|
114
|
+
case colour_for_the_left_side
|
|
115
|
+
# ======================================================================= #
|
|
116
|
+
# === :default_colour
|
|
117
|
+
# ======================================================================= #
|
|
118
|
+
when :default_colour
|
|
119
|
+
colour_for_the_left_side = ::EnvironmentInformation.colour_for_the_left_side
|
|
120
|
+
end
|
|
121
|
+
case colour_for_the_right_side
|
|
122
|
+
# ======================================================================= #
|
|
123
|
+
# === :default_colour
|
|
124
|
+
# ======================================================================= #
|
|
125
|
+
when :default_colour
|
|
126
|
+
colour_for_the_right_side = ::EnvironmentInformation.colour_for_the_right_side
|
|
127
|
+
end
|
|
128
|
+
case colour_for_program_not_found
|
|
129
|
+
# ======================================================================= #
|
|
130
|
+
# === :default_colour
|
|
131
|
+
# ======================================================================= #
|
|
132
|
+
when :default_colour
|
|
133
|
+
colour_for_program_not_found = ::EnvironmentInformation.colour_for_program_not_found
|
|
134
|
+
end
|
|
135
|
+
case right
|
|
136
|
+
when nil
|
|
137
|
+
right = NOT_INSTALLED_OR_NOT_FOUND
|
|
138
|
+
end
|
|
139
|
+
right = right.dup if right.frozen?
|
|
140
|
+
right.strip!
|
|
141
|
+
if right.include? 'not found'
|
|
142
|
+
right = ::EnvironmentInformation.send(
|
|
143
|
+
colour_for_program_not_found, right
|
|
144
|
+
)
|
|
145
|
+
end
|
|
146
|
+
colourized_right_side = ::EnvironmentInformation.send(
|
|
147
|
+
colour_for_the_right_side,
|
|
148
|
+
right
|
|
149
|
+
)
|
|
150
|
+
modified_left = "#{left}:"
|
|
151
|
+
modified_left = modified_left.ljust(32) if use_padding
|
|
152
|
+
e ::EnvironmentInformation.send(
|
|
153
|
+
colour_for_the_left_side,
|
|
154
|
+
modified_left
|
|
155
|
+
)+
|
|
156
|
+
" #{colourized_right_side}"
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
end; end
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/ruby -w
|
|
2
|
+
# Encoding: UTF-8
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
# =========================================================================== #
|
|
5
|
+
# require 'environment_information/class/add.rb'
|
|
6
|
+
# =========================================================================== #
|
|
7
|
+
require 'environment_information/base/base.rb'
|
|
8
|
+
|
|
9
|
+
module EnvironmentInformation
|
|
10
|
+
|
|
11
|
+
class EnvironmentInformation < ::EnvironmentInformation::Base # === EnvironmentInformation::EnvironmentInformation
|
|
12
|
+
|
|
13
|
+
# ========================================================================= #
|
|
14
|
+
# === add (add tag)
|
|
15
|
+
#
|
|
16
|
+
# This method can be used to add individual entries to the main array
|
|
17
|
+
# called @array_report_these_programs.
|
|
18
|
+
#
|
|
19
|
+
# The format for add() contains only one component, which appears on
|
|
20
|
+
# the left side, and denotes the name of the program or component
|
|
21
|
+
# that we wish to query, such as "php" or "ruby" and so forth.
|
|
22
|
+
#
|
|
23
|
+
# Some Symbols will be used as a "pointer" towards an Array of
|
|
24
|
+
# registered programs.
|
|
25
|
+
#
|
|
26
|
+
# Note that (1) will be converted into a Symbol if it is a String.
|
|
27
|
+
#
|
|
28
|
+
# If the second entry (2) is nil, then the version will be inferred
|
|
29
|
+
# at "runtime" within the method display(). Otherwise display()
|
|
30
|
+
# will simply use the passed version (which should be a String in
|
|
31
|
+
# that case, then).
|
|
32
|
+
#
|
|
33
|
+
# Before we can add an entry to the main dataset, we have to check
|
|
34
|
+
# whether it is a registered entry altogether. If it is not
|
|
35
|
+
# registered, the user has to be notified about this fact.
|
|
36
|
+
# This notification will ONLY happen if the associated version is nil;
|
|
37
|
+
# if a specific version is supplied then this method will assume
|
|
38
|
+
# that the program should be displayed anyway.
|
|
39
|
+
#
|
|
40
|
+
# An Array can also be supplied to this method, if necessary.
|
|
41
|
+
# ========================================================================= #
|
|
42
|
+
def add(
|
|
43
|
+
i
|
|
44
|
+
)
|
|
45
|
+
if i.is_a?(String) and i.include?(',')
|
|
46
|
+
# ===================================================================== #
|
|
47
|
+
# Strings containing ',' will be split accordingly.
|
|
48
|
+
# ===================================================================== #
|
|
49
|
+
i = i.split(',')
|
|
50
|
+
elsif i.is_a?(String) and i.include?('-')
|
|
51
|
+
# ===================================================================== #
|
|
52
|
+
# Strings containing '-' will lose that '-'.
|
|
53
|
+
# ===================================================================== #
|
|
54
|
+
i = i.dup if i.frozen?
|
|
55
|
+
i.delete!('-')
|
|
56
|
+
end
|
|
57
|
+
[i].flatten.compact.each {|entry|
|
|
58
|
+
case entry
|
|
59
|
+
# ===================================================================== #
|
|
60
|
+
# === :everything
|
|
61
|
+
#
|
|
62
|
+
# This entry point is meant for simply adding everything.
|
|
63
|
+
# ===================================================================== #
|
|
64
|
+
when :everything
|
|
65
|
+
entry = return_every_registered_component
|
|
66
|
+
# ===================================================================== #
|
|
67
|
+
# === Rubygems installation directory
|
|
68
|
+
# ===================================================================== #
|
|
69
|
+
when :rubygems_installation_directory,
|
|
70
|
+
/^rubygems( |_)?installation( |_)?directory\??$/i
|
|
71
|
+
entry = 'rubygems_installation_directory'
|
|
72
|
+
# ===================================================================== #
|
|
73
|
+
# === cflags
|
|
74
|
+
# ===================================================================== #
|
|
75
|
+
when :cflags,
|
|
76
|
+
/^cflags$/i
|
|
77
|
+
entry = 'CFLAGS in use'
|
|
78
|
+
# ===================================================================== #
|
|
79
|
+
# === screen_resolution
|
|
80
|
+
# ===================================================================== #
|
|
81
|
+
when :screen_resolution,
|
|
82
|
+
/^screen( |_)?resolution$/i
|
|
83
|
+
entry = 'Screen Resolution'
|
|
84
|
+
# ===================================================================== #
|
|
85
|
+
# === ram
|
|
86
|
+
# ===================================================================== #
|
|
87
|
+
when :ram,
|
|
88
|
+
/^ram$/i
|
|
89
|
+
entry = 'RAM'
|
|
90
|
+
# ===================================================================== #
|
|
91
|
+
# === cpuinfo
|
|
92
|
+
# ===================================================================== #
|
|
93
|
+
when :cpuinfo,
|
|
94
|
+
/^cpuinfo$/i
|
|
95
|
+
entry = 'CPU Model'
|
|
96
|
+
# ===================================================================== #
|
|
97
|
+
# === operating_system_bit_type
|
|
98
|
+
# ===================================================================== #
|
|
99
|
+
when :operating_system_bit_type,
|
|
100
|
+
/^operating(_|-)?system(_|-)?bit(_|-)?type$/i
|
|
101
|
+
entry = 'Operating system bit type'
|
|
102
|
+
# ===================================================================== #
|
|
103
|
+
# === :operating_system
|
|
104
|
+
# ===================================================================== #
|
|
105
|
+
when :operating_system,
|
|
106
|
+
/^operating(_|-)?system$/i,
|
|
107
|
+
/^operating(_|-)?system(_|-)?in(_|-)?use$/i
|
|
108
|
+
entry = 'Operating system'
|
|
109
|
+
# ===================================================================== #
|
|
110
|
+
# === cpflags
|
|
111
|
+
# ===================================================================== #
|
|
112
|
+
when /^cflags$/i,
|
|
113
|
+
/^CFLAGS in use$/i
|
|
114
|
+
entry = 'CFLAGS in use'
|
|
115
|
+
# ===================================================================== #
|
|
116
|
+
# === :pkgconfig_entries
|
|
117
|
+
# ===================================================================== #
|
|
118
|
+
when :pkgconfig_entries
|
|
119
|
+
entry = ::EnvironmentInformation.return_pkgconfig_based_programs
|
|
120
|
+
# ===================================================================== #
|
|
121
|
+
# === :all_xorg_components
|
|
122
|
+
# ===================================================================== #
|
|
123
|
+
when :all_xorg_components
|
|
124
|
+
entry = return_all_xorg_components
|
|
125
|
+
# ===================================================================== #
|
|
126
|
+
# === envi --science
|
|
127
|
+
# ===================================================================== #
|
|
128
|
+
when :science_cluster
|
|
129
|
+
entry = ARRAY_SCIENCE_CLUSTER
|
|
130
|
+
# ===================================================================== #
|
|
131
|
+
# === envi --lfs_core_programs
|
|
132
|
+
# ===================================================================== #
|
|
133
|
+
when :lfs,
|
|
134
|
+
:lfs_core_programs
|
|
135
|
+
entry = ::EnvironmentInformation.lfs_core_programs?
|
|
136
|
+
# ===================================================================== #
|
|
137
|
+
# === :linux_kernel
|
|
138
|
+
# ===================================================================== #
|
|
139
|
+
when :linux_kernel
|
|
140
|
+
i = :linux
|
|
141
|
+
# ===================================================================== #
|
|
142
|
+
# === :RAM
|
|
143
|
+
# ===================================================================== #
|
|
144
|
+
when :RAM
|
|
145
|
+
entry = :ram # Just the "alias" to the real entry.
|
|
146
|
+
end
|
|
147
|
+
unless @array_report_these_programs.include? entry
|
|
148
|
+
@array_report_these_programs << entry
|
|
149
|
+
@array_report_these_programs.flatten!
|
|
150
|
+
end
|
|
151
|
+
}
|
|
152
|
+
end; alias update_version_for add # === add
|
|
153
|
+
alias append add # === append
|
|
154
|
+
alias append_this_to_main_string add # === append_this_to_main_string
|
|
155
|
+
alias show_these_entries add # === show_these_entries
|
|
156
|
+
alias set_additional add # === set_additional
|
|
157
|
+
|
|
158
|
+
# ========================================================================= #
|
|
159
|
+
# === add_the_default_programs_on_a_linux_computer
|
|
160
|
+
# ========================================================================= #
|
|
161
|
+
def add_the_default_programs_on_a_linux_computer
|
|
162
|
+
# ======================================================================= #
|
|
163
|
+
# Add the default programs on a linux computer.
|
|
164
|
+
# ======================================================================= #
|
|
165
|
+
add(
|
|
166
|
+
return_default_programs_on_a_linux_computer
|
|
167
|
+
)
|
|
168
|
+
end; alias add_default_linux_programs add_the_default_programs_on_a_linux_computer # === add_default_linux_programs
|
|
169
|
+
|
|
170
|
+
# ========================================================================= #
|
|
171
|
+
# === add_ruby_and_rubygems
|
|
172
|
+
# ========================================================================= #
|
|
173
|
+
def add_ruby_and_rubygems
|
|
174
|
+
add(:ruby)
|
|
175
|
+
add(:rubygems)
|
|
176
|
+
add(:rubygems_installation_directory)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# ========================================================================= #
|
|
180
|
+
# === add_this_to_the_toplevel_hash
|
|
181
|
+
# ========================================================================= #
|
|
182
|
+
def add_this_to_the_toplevel_hash(a, b)
|
|
183
|
+
a = a.to_sym unless a.is_a? Symbol
|
|
184
|
+
::EnvironmentInformation.hash?[a] = b
|
|
185
|
+
end; alias register_onto_the_main_hash add_this_to_the_toplevel_hash # === register_onto_the_main_hash
|
|
186
|
+
|
|
187
|
+
end; end
|