environment_information 1.4.99
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of environment_information might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +1287 -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 +166 -0
- data/lib/environment_information/class/class.rb +2829 -0
- data/lib/environment_information/colours/colours.rb +224 -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 +273 -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 +322 -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 +215 -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 +264 -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 +177 -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,166 @@
|
|
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
|
+
# === report_left_right
|
98
|
+
# ========================================================================= #
|
99
|
+
def report_left_right(
|
100
|
+
left = program_name?,
|
101
|
+
right = program_version?,
|
102
|
+
colour_for_the_left_side = ::EnvironmentInformation.colour_for_the_left_side,
|
103
|
+
colour_for_the_right_side = ::EnvironmentInformation.colour_for_the_right_side,
|
104
|
+
colour_for_program_not_found = ::EnvironmentInformation.colour_for_program_not_found,
|
105
|
+
use_padding = true
|
106
|
+
)
|
107
|
+
case colour_for_the_left_side
|
108
|
+
# ======================================================================= #
|
109
|
+
# === :default_colour
|
110
|
+
# ======================================================================= #
|
111
|
+
when :default_colour
|
112
|
+
colour_for_the_left_side = ::EnvironmentInformation.colour_for_the_left_side
|
113
|
+
end
|
114
|
+
case colour_for_the_right_side
|
115
|
+
# ======================================================================= #
|
116
|
+
# === :default_colour
|
117
|
+
# ======================================================================= #
|
118
|
+
when :default_colour
|
119
|
+
colour_for_the_right_side = ::EnvironmentInformation.colour_for_the_right_side
|
120
|
+
end
|
121
|
+
case colour_for_program_not_found
|
122
|
+
# ======================================================================= #
|
123
|
+
# === :default_colour
|
124
|
+
# ======================================================================= #
|
125
|
+
when :default_colour
|
126
|
+
colour_for_program_not_found = ::EnvironmentInformation.colour_for_program_not_found
|
127
|
+
end
|
128
|
+
case right
|
129
|
+
when nil
|
130
|
+
right = NOT_INSTALLED_OR_NOT_FOUND
|
131
|
+
end
|
132
|
+
right = right.dup if right.frozen?
|
133
|
+
right.strip!
|
134
|
+
if right.include? 'not found'
|
135
|
+
right = ::EnvironmentInformation.send(
|
136
|
+
colour_for_program_not_found, right
|
137
|
+
)
|
138
|
+
end
|
139
|
+
colourized_right_side = ::EnvironmentInformation.send(
|
140
|
+
colour_for_the_right_side,
|
141
|
+
right
|
142
|
+
)
|
143
|
+
modified_left = "#{left}:"
|
144
|
+
modified_left = modified_left.ljust(32) if use_padding
|
145
|
+
e ::EnvironmentInformation.send(
|
146
|
+
colour_for_the_left_side,
|
147
|
+
modified_left
|
148
|
+
)+
|
149
|
+
" #{colourized_right_side}"
|
150
|
+
end
|
151
|
+
|
152
|
+
# ========================================================================= #
|
153
|
+
# === lightblue
|
154
|
+
# ========================================================================= #
|
155
|
+
def lightblue(i = '')
|
156
|
+
return ::Colours.lightblue(i)
|
157
|
+
end
|
158
|
+
|
159
|
+
# ========================================================================= #
|
160
|
+
# === mediumaquamarine
|
161
|
+
# ========================================================================= #
|
162
|
+
def mediumaquamarine(i = '')
|
163
|
+
return ::EnvironmentInformation.mediumaquamarine(i)
|
164
|
+
end
|
165
|
+
|
166
|
+
end; end
|