environment_information 1.4.99
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 +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,217 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === EnvironmentInformation::Queries::SimpleVersion
|
6
|
+
#
|
7
|
+
# This class will try to do a query based on the main binary at hand.
|
8
|
+
#
|
9
|
+
# It is only a wrapper over "--version" and nothing else.
|
10
|
+
# =========================================================================== #
|
11
|
+
# require 'environment_information/queries/simple_version.rb'
|
12
|
+
# EnvironmentInformation::Queries::SimpleVersion.new
|
13
|
+
# =========================================================================== #
|
14
|
+
require 'environment_information/base/base.rb'
|
15
|
+
|
16
|
+
module EnvironmentInformation
|
17
|
+
|
18
|
+
module Queries
|
19
|
+
|
20
|
+
class SimpleVersion < ::EnvironmentInformation::Base # === EnvironmentInformation::Queries::SimpleVersion
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# === initialize
|
24
|
+
#
|
25
|
+
# The first argument is mandatory.
|
26
|
+
# ========================================================================= #
|
27
|
+
def initialize(
|
28
|
+
for_this_program = nil,
|
29
|
+
run_already = true
|
30
|
+
)
|
31
|
+
reset
|
32
|
+
set_program_name(
|
33
|
+
for_this_program
|
34
|
+
)
|
35
|
+
# ======================================================================= #
|
36
|
+
# === Handle blocks given next
|
37
|
+
# ======================================================================= #
|
38
|
+
if block_given?
|
39
|
+
yielded = yield
|
40
|
+
if yielded.is_a? Hash
|
41
|
+
if yielded.has_key? :prefix_to_use
|
42
|
+
@prefix_to_use << yielded.delete(:prefix_to_use)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
run if run_already
|
47
|
+
end
|
48
|
+
|
49
|
+
# ========================================================================= #
|
50
|
+
# === reset
|
51
|
+
# ========================================================================= #
|
52
|
+
def reset
|
53
|
+
# ======================================================================= #
|
54
|
+
# === @program_name
|
55
|
+
# ======================================================================= #
|
56
|
+
@program_name = ''.dup
|
57
|
+
# ======================================================================= #
|
58
|
+
# === @program_version
|
59
|
+
# ======================================================================= #
|
60
|
+
@program_version = nil
|
61
|
+
# ======================================================================= #
|
62
|
+
# === @prefix_to_use
|
63
|
+
# ======================================================================= #
|
64
|
+
@prefix_to_use = ''.dup
|
65
|
+
end
|
66
|
+
|
67
|
+
# ========================================================================= #
|
68
|
+
# === set_program_name
|
69
|
+
# ========================================================================= #
|
70
|
+
def set_program_name(i)
|
71
|
+
@program_name = i.to_sym if i
|
72
|
+
end
|
73
|
+
|
74
|
+
# ========================================================================= #
|
75
|
+
# === program_name?
|
76
|
+
# ========================================================================= #
|
77
|
+
def program_name?
|
78
|
+
@program_name
|
79
|
+
end
|
80
|
+
|
81
|
+
# ========================================================================= #
|
82
|
+
# === program_version?
|
83
|
+
# ========================================================================= #
|
84
|
+
def program_version?
|
85
|
+
@program_version
|
86
|
+
end; alias version? program_version? # === version?
|
87
|
+
|
88
|
+
# ========================================================================= #
|
89
|
+
# === run
|
90
|
+
# ========================================================================= #
|
91
|
+
def run
|
92
|
+
return_version_of
|
93
|
+
end
|
94
|
+
|
95
|
+
# ========================================================================= #
|
96
|
+
# === return_version_of
|
97
|
+
# ========================================================================= #
|
98
|
+
def return_version_of(this_program = @program_name)
|
99
|
+
_ = ::EnvironmentInformation.query_to_use_for_the_individual_components?
|
100
|
+
if _.nil?
|
101
|
+
_ = ::EnvironmentInformation.load_file_query_to_use_for_the_individual_components
|
102
|
+
end
|
103
|
+
if _.has_key?(this_program)
|
104
|
+
result = _[this_program]
|
105
|
+
case result
|
106
|
+
when :version
|
107
|
+
@program_version = `#{@prefix_to_use}#{this_program} --version #{ERROR_LINE}`.strip
|
108
|
+
end
|
109
|
+
end
|
110
|
+
if @program_version
|
111
|
+
if @program_version.include? N
|
112
|
+
@program_version = @program_version.split(N).first
|
113
|
+
end
|
114
|
+
if @program_version.include? '--'
|
115
|
+
@program_version.gsub!(/--/,'') # For strace specifically.
|
116
|
+
end
|
117
|
+
# if @program_version.include? 'GNOME Document Viewer'
|
118
|
+
# @program_version.sub!(/GNOME Document Viewer/,'') # For evince specifically.
|
119
|
+
# end
|
120
|
+
if @program_version.include? 'GNU'
|
121
|
+
@program_version.gsub!(/GNU/,'')
|
122
|
+
end
|
123
|
+
if @program_version.include? ' built on linux-gnu.'
|
124
|
+
@program_version.gsub!(/ built on linux-gnu\./, '') # Fixing wget specifically.
|
125
|
+
end
|
126
|
+
if @program_version.include?('Midnight Commander')
|
127
|
+
@program_version.gsub!(/Midnight Commander/, '')
|
128
|
+
end
|
129
|
+
if @program_version.include?('[') and @program_version.include?(']')
|
130
|
+
@program_version.gsub!(/\[.+\]/, '')
|
131
|
+
end
|
132
|
+
@program_version.strip!
|
133
|
+
if @program_version.start_with? "#{this_program} "
|
134
|
+
# For example: "ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]"
|
135
|
+
@program_version.sub!(/#{this_program} /, '')
|
136
|
+
elsif @program_version.start_with? "#{this_program.capitalize} "
|
137
|
+
# For example: "Wget 1.20.3 built on linux-gnu."
|
138
|
+
@program_version.sub!(/#{this_program.capitalize} /, '')
|
139
|
+
elsif @program_version.start_with? "#{this_program.upcase} "
|
140
|
+
# For example: "NASM version 2.15.04 compiled on Aug 27 2020"
|
141
|
+
@program_version.sub!(/#{this_program.upcase} /, '')
|
142
|
+
elsif @program_version.downcase.start_with? "#{this_program.downcase} "
|
143
|
+
# For example: "IceWM", has a unusual start.
|
144
|
+
@program_version.sub!(/#{this_program} /i, '')
|
145
|
+
elsif @program_version.start_with? 'Awk'
|
146
|
+
@program_version.sub!(/Awk /i, '') # Ad-hox fix here.
|
147
|
+
end
|
148
|
+
if @program_version.include? '- Vi IMproved '
|
149
|
+
@program_version.sub!(/- Vi IMproved /, '') # Fixing vim specifically.
|
150
|
+
end
|
151
|
+
if @program_version.include? '(v'
|
152
|
+
# This is specifically for perl:
|
153
|
+
# "This is perl 5, version 32, subversion 0 (v5.32.0) built for x86_64-linux-thread-multi"
|
154
|
+
@program_version = @program_version.scan(
|
155
|
+
/\(v(\d{0,2}\.?\d{0,2}\.\d{0,2})\)/
|
156
|
+
).flatten.first.to_s.dup
|
157
|
+
end
|
158
|
+
# ===================================================================== #
|
159
|
+
# The next check for "Version" should come after we eliminated
|
160
|
+
# the leading program name.
|
161
|
+
# ===================================================================== #
|
162
|
+
if @program_version.include? 'Version '
|
163
|
+
@program_version = @program_version.scan(
|
164
|
+
/Version (\d{0,2}\.?\d{0,2}\.\d{0,2})/
|
165
|
+
).flatten.first.to_s.dup
|
166
|
+
elsif @program_version.include? 'version '
|
167
|
+
# This here should work for most programs, save for perl.
|
168
|
+
@program_version = @program_version.scan(
|
169
|
+
/version (\d{0,2}\.?\d{0,2}\.\d{0,2})/
|
170
|
+
).flatten.first.to_s.dup
|
171
|
+
end
|
172
|
+
if @program_version.include? ' patchlevel '
|
173
|
+
# =================================================================== #
|
174
|
+
# Gnuplot has this specifically: "5.4 patchlevel 0"
|
175
|
+
# =================================================================== #
|
176
|
+
@program_version = @program_version.sub(/ patchlevel /,'.').strip
|
177
|
+
end
|
178
|
+
# ===================================================================== #
|
179
|
+
# Next we kill everything inside (). This may sometimes be
|
180
|
+
# problematic, which is why this check comes quite late.
|
181
|
+
# ===================================================================== #
|
182
|
+
if @program_version.include?('(') and @program_version.include?(')')
|
183
|
+
@program_version.gsub!(/\(.+\)/, '')
|
184
|
+
end
|
185
|
+
# ===================================================================== #
|
186
|
+
# Handle: "IceWM 1.8.0, Copyright 1997-2003 Marko Macek, 2001 Mathias Hasselmann."
|
187
|
+
# ===================================================================== #
|
188
|
+
if @program_version.include?(',')
|
189
|
+
@program_version = @program_version.split(',').first
|
190
|
+
end
|
191
|
+
# ===================================================================== #
|
192
|
+
# Next, if a '-' is included, we split it and use the last part.
|
193
|
+
# This handles cases such as "valgrind-3.16.0".
|
194
|
+
# ===================================================================== #
|
195
|
+
if @program_version.include?('-')
|
196
|
+
@program_version = @program_version.split('-').last
|
197
|
+
end
|
198
|
+
# ===================================================================== #
|
199
|
+
# Last but not least, for "node" specifically.
|
200
|
+
# ===================================================================== #
|
201
|
+
if @program_version.start_with? 'v'
|
202
|
+
@program_version[0,1] = ''
|
203
|
+
end
|
204
|
+
if @program_version.include? COMMAND_NOT_FOUND
|
205
|
+
@program_version = nil
|
206
|
+
end
|
207
|
+
end
|
208
|
+
return @program_version
|
209
|
+
end
|
210
|
+
|
211
|
+
end; end; end
|
212
|
+
|
213
|
+
if __FILE__ == $PROGRAM_NAME
|
214
|
+
seek_this_program = :gnuplot # :lftp
|
215
|
+
_ = EnvironmentInformation::Queries::SimpleVersion.new(seek_this_program)
|
216
|
+
_.report_left_right
|
217
|
+
end # rb simple_version
|
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/requires/require_asciitable.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
begin
|
8
|
+
class EnvironmentInformation::EnvironmentInformation; end # Define a prototype here.
|
9
|
+
require 'ascii_paradise/requires/require_asciitable_namespace.rb'
|
10
|
+
EnvironmentInformation::ASCIITABLE_IS_AVAILABLE = true
|
11
|
+
rescue LoadError
|
12
|
+
# puts 'asciitable is not available, consider installing it.'
|
13
|
+
# puts 'We will, however, continue, as it is not a mandatory package.'
|
14
|
+
EnvironmentInformation::ASCIITABLE_IS_AVAILABLE = false
|
15
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/requires/require_the_constants.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'environment_information/constants/constants.rb'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/requires/require_the_environment_information_project.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'environment_information/requires/require_the_constants.rb'
|
8
|
+
require 'environment_information/colours/sfancy.rb'
|
9
|
+
require 'environment_information/colours/simp.rb'
|
10
|
+
require 'environment_information/version/version.rb'
|
11
|
+
# =========================================================================== #
|
12
|
+
# Next, require the individual components:
|
13
|
+
# =========================================================================== #
|
14
|
+
require 'environment_information/requires/require_the_individual_misc_components.rb'
|
15
|
+
# =========================================================================== #
|
16
|
+
# Next, require the toplevel-methods of environment_information/:
|
17
|
+
# =========================================================================== #
|
18
|
+
require 'environment_information/requires/require_the_toplevel_methods.rb'
|
19
|
+
# =========================================================================== #
|
20
|
+
# And then we will require the main class of the environment information
|
21
|
+
# project:
|
22
|
+
# =========================================================================== #
|
23
|
+
require 'environment_information/class/class.rb'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/requires/require_the_individual_misc_components.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module EnvironmentInformation
|
8
|
+
|
9
|
+
require 'environment_information/constants/array_tracked_components.rb'
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === EnvironmentInformation.require_all_individual_misc_components
|
13
|
+
#
|
14
|
+
# This method can be used to load all the individual misc-components
|
15
|
+
# that are part of the EnvironmentInformation project.
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.require_all_individual_misc_components
|
18
|
+
|
19
|
+
# ======================================================================= #
|
20
|
+
# Batch-require the components in the misc_components/ directory next:
|
21
|
+
# ======================================================================= #
|
22
|
+
tracked_non_programs?.each {|this_component|
|
23
|
+
require "environment_information/misc_components/#{this_component}.rb"
|
24
|
+
}
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
require_all_individual_misc_components
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/requires/require_the_toplevel_methods.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module EnvironmentInformation
|
8
|
+
|
9
|
+
require 'environment_information/project/project.rb'
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === EnvironmentInformation.require_the_toplevel_methods
|
13
|
+
# ========================================================================= #
|
14
|
+
def self.require_the_toplevel_methods
|
15
|
+
Dir["#{PROJECT_BASE_DIRECTORY}toplevel_methods/*.rb"].each {|this_file|
|
16
|
+
require "environment_information/toplevel_methods/#{File.basename(this_file)}"
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
require_the_toplevel_methods # And require them at once.
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# Code in this file is tasked to autogenerate the relevant methods for use
|
6
|
+
# in the toplevel EnvironmentInformation namespace.
|
7
|
+
# =========================================================================== #
|
8
|
+
# require 'environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb'
|
9
|
+
# =========================================================================== #
|
10
|
+
module EnvironmentInformation
|
11
|
+
|
12
|
+
require 'environment_information/constants/array_tracked_components.rb'
|
13
|
+
require 'environment_information/toplevel_methods/return_version_of_this_program.rb'
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === EnvironmentInformation.autogenerate_all_relevant_methods
|
17
|
+
#
|
18
|
+
# By default this method will scan for all tracked programs, and
|
19
|
+
# for the xorg-components.
|
20
|
+
# ========================================================================= #
|
21
|
+
def self.autogenerate_all_relevant_methods(
|
22
|
+
i = ARRAY_TRACKED_PROGRAMS+
|
23
|
+
ARRAY_XORG_COMPONENTS
|
24
|
+
)
|
25
|
+
i.flatten!
|
26
|
+
# ======================================================================= #
|
27
|
+
# Add some aliases which will be defined next.
|
28
|
+
# ======================================================================= #
|
29
|
+
hash_aliases = {
|
30
|
+
atk: :libatk, # === EnvironmentInformation.return_version_of_libatk
|
31
|
+
pcre2: :libpcre2, # === EnvironmentInformation.return_version_of_libpcre2
|
32
|
+
pcre: :libpcre, # === EnvironmentInformation.return_version_of_libpcre
|
33
|
+
zlib: :libzlib # === EnvironmentInformation.return_version_of_libzlib
|
34
|
+
}
|
35
|
+
# ======================================================================= #
|
36
|
+
# Iterate over our Array next:
|
37
|
+
# ======================================================================= #
|
38
|
+
i.each {|this_program|
|
39
|
+
case this_program
|
40
|
+
when :kde
|
41
|
+
this_program = :kde_frameworks
|
42
|
+
end
|
43
|
+
self.class.instance_eval {
|
44
|
+
# =================================================================== #
|
45
|
+
# To test this method, try to do:
|
46
|
+
#
|
47
|
+
# EnvironmentInformation.return_version_of_valgrind # => "3.15.0"
|
48
|
+
#
|
49
|
+
# =================================================================== #
|
50
|
+
this_method = "return_version_of_#{this_program}"
|
51
|
+
define_method(this_method) {
|
52
|
+
return_version_of_this_program(this_program)
|
53
|
+
}
|
54
|
+
if hash_aliases.has_key?(this_program)
|
55
|
+
# ================================================================= #
|
56
|
+
# To test this, try:
|
57
|
+
#
|
58
|
+
# EnvironmentInformation.return_version_of_libzlib
|
59
|
+
#
|
60
|
+
# ================================================================= #
|
61
|
+
use_this_as_the_alias_target = "return_version_of_#{hash_aliases[this_program]}"
|
62
|
+
define_method(use_this_as_the_alias_target) {
|
63
|
+
return_version_of_this_program(this_program)
|
64
|
+
}
|
65
|
+
end
|
66
|
+
}
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
autogenerate_all_relevant_methods # ← And call it at once.
|
71
|
+
|
72
|
+
# ========================================================================= #
|
73
|
+
# And add a few more aliases.
|
74
|
+
# ========================================================================= #
|
75
|
+
self.instance_eval { alias add_xz_information return_version_of_xz } # === EnvironmentInformation.add_xz_information
|
76
|
+
self.instance_eval { alias append_xz_version return_version_of_xz } # === EnvironmentInformation.append_xz_version
|
77
|
+
self.instance_eval { alias return_sed_version return_version_of_sed } # === EnvironmentInformation.return_sed_version
|
78
|
+
self.instance_eval { alias return_version_of_makeinfo return_version_of_texinfo } # === EnvironmentInformation.return_version_of_makeinfo
|
79
|
+
self.instance_eval { alias xfsprogs? return_version_of_xfsprogs } # === EnvironmentInformation.xfsprogs?
|
80
|
+
self.instance_eval { alias add_xfsprogs_information return_version_of_xfsprogs } # === EnvironmentInformation.add_xfsprogs_information
|
81
|
+
self.instance_eval { alias return_version_of_lftp? return_version_of_lftp } # === EnvironmentInformation.return_version_of_lftp?
|
82
|
+
self.instance_eval { alias add_llvm_information return_version_of_llvm } # === EnvironmentInformation.add_llvm_information
|
83
|
+
self.instance_eval { alias append_llvm_version return_version_of_llvm } # === EnvironmentInformation.append_llvm_version
|
84
|
+
self.instance_eval { alias add_mpc_information return_version_of_mpc } # === EnvironmentInformation.add_mpc_information
|
85
|
+
self.instance_eval { alias append_mpc_version return_version_of_mpc } # === EnvironmentInformation.append_mpc_version
|
86
|
+
self.instance_eval { alias try_to_show_re2c_version return_version_of_re2c } # === EnvironmentInformation.try_to_show_re2c_version
|
87
|
+
self.instance_eval { alias append_re2c_version return_version_of_re2c } # === EnvironmentInformation.append_nasm_version
|
88
|
+
self.instance_eval { alias return_version_of_pkg_config return_version_of_pkgconfig } # === EnvironmentInformation.return_version_of_pkg_config
|
89
|
+
self.instance_eval { alias add_readline_information return_version_of_readline } # === EnvironmentInformation.add_readline_information
|
90
|
+
self.instance_eval { alias append_readline_version return_version_of_readline } # === EnvironmentInformation.add_readline_information
|
91
|
+
self.instance_eval { alias return_version_of_liblibtasn1 return_version_of_libtasn1 } # === EnvironmentInformation.return_version_of_liblibtasn1
|
92
|
+
self.instance_eval { alias return_version_of_liblibtasn return_version_of_libtasn1 } # === EnvironmentInformation.return_version_of_liblibtasn
|
93
|
+
self.instance_eval { alias return_version_of_grep? return_version_of_grep } # === EnvironmentInformation.return_version_of_grep?
|
94
|
+
self.instance_eval { alias return_version_of_intltool? return_version_of_intltool } # === EnvironmentInformation.return_version_of_intltool?
|
95
|
+
self.instance_eval { alias glib? return_version_of_glib } # === EnvironmentInformation.glib?
|
96
|
+
self.instance_eval { alias add_gmp_information return_version_of_gmp } # === EnvironmentInformation.add_gmp_information
|
97
|
+
self.instance_eval { alias append_gmp_version return_version_of_gmp } # === EnvironmentInformation.append_gmp_version
|
98
|
+
self.instance_eval { alias kernel return_version_of_linux } # === EnvironmentInformation.kernel
|
99
|
+
self.instance_eval { alias linux_kernel return_version_of_linux } # === EnvironmentInformation.linux_kernel
|
100
|
+
self.instance_eval { alias linux_kernel? return_version_of_linux } # === EnvironmentInformation.linux_kernel?
|
101
|
+
self.instance_eval { alias return_information_about_the_component_called_linux_kernel return_version_of_linux } # === EnvironmentInformation.return_information_about_the_component_called_linux_kernel
|
102
|
+
self.instance_eval { alias append_kernel_version return_version_of_linux } # === EnvironmentInformation.append_kernel_version
|
103
|
+
self.instance_eval { alias add_kernel_information return_version_of_linux } # === EnvironmentInformation.add_kernel_information
|
104
|
+
self.instance_eval { alias return_version_of_linux_kernel return_version_of_linux } # === EnvironmentInformation.return_version_of_linux_kernel
|
105
|
+
self.instance_eval { alias return_version_of_linux_kernel? return_version_of_linux } # === EnvironmentInformation.return_version_of_linux_kernel?
|
106
|
+
self.instance_eval { alias boost? return_version_of_boost } # === EnvironmentInformation.boost?
|
107
|
+
self.instance_eval { alias return_version_of_boost? return_version_of_boost } # === EnvironmentInformation.return_version_of_boost?
|
108
|
+
self.instance_eval { alias return_version_of_find return_version_of_findutils } # === EnvironmentInformation.return_version_of_find
|
109
|
+
self.instance_eval { alias findutils? return_version_of_findutils } # === EnvironmentInformation.findutils?
|
110
|
+
self.instance_eval { alias awk? return_version_of_gawk } # === EnvironmentInformation.awk?
|
111
|
+
self.instance_eval { alias gawk? return_version_of_gawk } # === EnvironmentInformation.gawk?
|
112
|
+
self.instance_eval { alias return_information_about_the_component_called_awk return_version_of_gawk } # === EnvironmentInformation.return_information_about_the_component_called_awk
|
113
|
+
self.instance_eval { alias return_version_of_awk? return_version_of_gawk } # === EnvironmentInformation.return_version_of_awk?
|
114
|
+
self.instance_eval { alias return_version_of_awk return_version_of_gawk } # === EnvironmentInformation.return_version_of_awk
|
115
|
+
self.instance_eval { alias append_gdkpixbuf_version return_version_of_gdkpixbuf } # === EnvironmentInformation.append_gdkpixbuf_version
|
116
|
+
self.instance_eval { alias glibc? return_version_of_glibc } # === EnvironmentInformation.glibc?
|
117
|
+
self.instance_eval { alias glibc_version? return_version_of_glibc } # === EnvironmentInformation.glibc_version?
|
118
|
+
self.instance_eval { alias return_version_of_glibc? return_version_of_glibc } # === EnvironmentInformation.return_version_of_glibc?
|
119
|
+
self.instance_eval { alias ruby? return_version_of_ruby } # === EnvironmentInformation.ruby?
|
120
|
+
self.instance_eval { alias return_information_about_the_component_called_ruby return_version_of_ruby } # === EnvironmentInformation.return_information_about_the_component_called_ruby
|
121
|
+
self.instance_eval { alias return_version_of_ruby? return_version_of_ruby } # === EnvironmentInformation.return_version_of_ruby?
|
122
|
+
self.instance_eval { alias binutils? return_version_of_binutils } # === EnvironmentInformation.binutils?
|
123
|
+
self.instance_eval { alias return_version_of_binutils? return_version_of_binutils } # === EnvironmentInformation.return_version_of_binutils?
|
124
|
+
self.instance_eval { alias bison? return_version_of_bison } # === EnvironmentInformation.bison?
|
125
|
+
self.instance_eval { alias return_version_of_bison? return_version_of_bison } # === EnvironmentInformation.return_version_of_bison?
|
126
|
+
self.instance_eval { alias return_version_of_flex? return_version_of_flex } # === EnvironmentInformation.return_version_of_flex?
|
127
|
+
self.instance_eval { alias return_version_of_freetype2 return_version_of_freetype } # === EnvironmentInformation.return_version_of_freetype2
|
128
|
+
self.instance_eval { alias evince? return_version_of_evince } # === EnvironmentInformation.evince?
|
129
|
+
self.instance_eval { alias return_version_of_evince? return_version_of_evince } # === EnvironmentInformation.return_version_of_evince?
|
130
|
+
self.instance_eval { alias gcc? return_version_of_gcc } # === EnvironmentInformation.gcc?
|
131
|
+
self.instance_eval { alias return_information_about_the_component_called_gcc return_version_of_gcc } # === EnvironmentInformation.return_information_about_the_component_called_gcc
|
132
|
+
self.instance_eval { alias return_version_of_gcc? return_version_of_gcc } # === EnvironmentInformation.return_version_of_gcc?
|
133
|
+
self.instance_eval { alias return_version_of_R return_version_of_r } # === EnvironmentInformation.return_version_of_R
|
134
|
+
self.instance_eval { alias coreutils? return_version_of_coreutils } # === EnvironmentInformation.coreutils?
|
135
|
+
self.instance_eval { alias return_version_of_coreutils? return_version_of_coreutils } # === EnvironmentInformation.return_version_of_coreutils
|
136
|
+
self.instance_eval { alias return_version_of_diffutils? return_version_of_diffutils } # === EnvironmentInformation.return_version_of_diffutils?
|
137
|
+
self.instance_eval { alias return_version_of_libexempi return_version_of_exempi } # === EnvironmentInformation.return_version_of_libexempi
|
138
|
+
self.instance_eval { alias return_version_of_gpg return_version_of_gnupg } # === EnvironmentInformation.return_version_of_gpg
|
139
|
+
self.instance_eval { alias return_version_of_gnupg? return_version_of_gnupg } # === EnvironmentInformation.return_version_of_gnupg?
|
140
|
+
self.instance_eval { alias return_version_of_bzip return_version_of_bzip2 } # === EnvironmentInformation.return_version_of_bzip
|
141
|
+
self.instance_eval { alias return_version_of_llvm return_version_of_clang } # === EnvironmentInformation.return_version_of_llvm
|
142
|
+
self.instance_eval { alias return_clang_version return_version_of_clang } # === EnvironmentInformation.return_clang_version
|
143
|
+
self.instance_eval { alias kde5? return_version_of_kde_frameworks } # === EnvironmentInformation.kde5?
|
144
|
+
self.instance_eval { alias add_kde5_information return_version_of_kde_frameworks } # === EnvironmentInformation.add_kde5_information
|
145
|
+
self.instance_eval { alias add_kde_information return_version_of_kde_frameworks } # === EnvironmentInformation.add_kde_information
|
146
|
+
self.instance_eval { alias return_information_about_the_component_called_rubygems return_version_of_rubygems } # === EnvironmentInformation.return_information_about_the_component_called_rubygems
|
147
|
+
self.instance_eval { alias rubygems? return_version_of_rubygems } # === EnvironmentInformation.rubygems?
|
148
|
+
self.instance_eval { alias return_version_of_rubygems? return_version_of_rubygems } # === EnvironmentInformation.return_version_of_rubygems?
|
149
|
+
self.instance_eval { alias gtk3? return_version_of_gtk3 } # === EnvironmentInformation.gtk3?
|
150
|
+
self.instance_eval { alias gtk2? return_version_of_gtk2 } # === EnvironmentInformation.gtk2?
|
151
|
+
|
152
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/toplevel_methods/cd.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module EnvironmentInformation
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === EnvironmentInformation.cd (cd tag)
|
11
|
+
# ========================================================================= #
|
12
|
+
def self.cd(i)
|
13
|
+
Dir.chdir(i) if File.directory? i
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/toplevel_methods/e.rb'
|
6
|
+
# EnvironmentInformation.e
|
7
|
+
# =========================================================================== #
|
8
|
+
module EnvironmentInformation
|
9
|
+
|
10
|
+
# ========================================================================= #
|
11
|
+
# === EnvironmentInformation.e
|
12
|
+
# ========================================================================= #
|
13
|
+
def self.e(
|
14
|
+
i = '', hash = {}
|
15
|
+
)
|
16
|
+
if hash and
|
17
|
+
hash.has_key?(:display_everything_in_short_format) and
|
18
|
+
hash[:display_everything_in_short_format]
|
19
|
+
# ===================================================================== #
|
20
|
+
# Display the results in a single line in this case.
|
21
|
+
# ===================================================================== #
|
22
|
+
print "#{i}, "
|
23
|
+
else
|
24
|
+
puts i
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# ========================================================================= #
|
29
|
+
# === EnvironmentInformation.ee
|
30
|
+
#
|
31
|
+
# This is simply a wrapper over print, as well as adding a ', ' to that.
|
32
|
+
# ========================================================================= #
|
33
|
+
def self.ee(
|
34
|
+
i = ''
|
35
|
+
)
|
36
|
+
print "#{i}, "
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
if __FILE__ == $PROGRAM_NAME
|
42
|
+
EnvironmentInformation.e('Hello world!')
|
43
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/toplevel_methods/hash.rb'
|
6
|
+
# EnvironmentInformation.hash?
|
7
|
+
# =========================================================================== #
|
8
|
+
module EnvironmentInformation
|
9
|
+
|
10
|
+
require 'environment_information/toplevel_methods/register_this_component_is_missing.rb'
|
11
|
+
|
12
|
+
# ========================================================================= #
|
13
|
+
# === @hash_available_programs
|
14
|
+
#
|
15
|
+
# This hash stores the available programs.
|
16
|
+
#
|
17
|
+
# We need to use a Hash, rather than an Array, because we may save
|
18
|
+
# the result into a file, such as a yaml file. It is then more
|
19
|
+
# convenient to have the names of the program appear on the left
|
20
|
+
# side directoy, and the version on the right side.
|
21
|
+
#
|
22
|
+
# This Hash will hold the program name on the left side, and the
|
23
|
+
# program version on the right side. A nil value on the right
|
24
|
+
# side indicates that this program is NOT installed - which
|
25
|
+
# makes this the default value.
|
26
|
+
# ========================================================================= #
|
27
|
+
@hash_available_programs = {}
|
28
|
+
|
29
|
+
# ========================================================================= #
|
30
|
+
# === EnvironmentInformation.hash?
|
31
|
+
#
|
32
|
+
# This method will return the Hash of all available programs.
|
33
|
+
# ========================================================================= #
|
34
|
+
def self.hash?
|
35
|
+
@hash_available_programs
|
36
|
+
end; self.instance_eval { alias hash hash? } # === EnvironmentInformation.hash
|
37
|
+
self.instance_eval { alias dataset? hash? } # === EnvironmentInformation.dataset?
|
38
|
+
|
39
|
+
# ========================================================================= #
|
40
|
+
# === EnvironmentInformation.add_to_hash
|
41
|
+
# ========================================================================= #
|
42
|
+
def self.add_to_hash(a, b)
|
43
|
+
b.strip! if b.is_a? String
|
44
|
+
if b.nil?
|
45
|
+
::EnvironmentInformation.register_this_component_is_missing(a)
|
46
|
+
end
|
47
|
+
@hash_available_programs[a] = b
|
48
|
+
end
|
49
|
+
|
50
|
+
# ========================================================================= #
|
51
|
+
# === EnvironmentInformation.clear_hash
|
52
|
+
#
|
53
|
+
# This method can be used to clear the main (toplevel) Hash.
|
54
|
+
# ========================================================================= #
|
55
|
+
def self.clear_hash
|
56
|
+
@hash_available_programs.clear
|
57
|
+
end; self.instance_eval { alias clear_toplevel_hash clear_hash } # === EnvironmentInformation.clear_toplevel_hash
|
58
|
+
self.instance_eval { alias clear_main_hash clear_hash } # === EnvironmentInformation.clear_main_hash
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/toplevel_methods/internet_is_available.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module EnvironmentInformation
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === EnvironmentInformation.internet_is_available?
|
11
|
+
# ========================================================================= #
|
12
|
+
def self.internet_is_available?
|
13
|
+
require 'resolv'
|
14
|
+
dns_resolver = Resolv::DNS.new
|
15
|
+
begin
|
16
|
+
# ===================================================================== #
|
17
|
+
# The first domain name ever. Will probably not be removed.
|
18
|
+
# ===================================================================== #
|
19
|
+
dns_resolver.getaddress('symbolics.com')
|
20
|
+
return true
|
21
|
+
rescue Resolv::ResolvError => _error
|
22
|
+
return false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
if __FILE__ == $PROGRAM_NAME
|
29
|
+
puts EnvironmentInformation.internet_is_available?
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'environment_information/toplevel_methods/is_on_roebe.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module EnvironmentInformation
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === EnvironmentInformation.is_on_roebe?
|
11
|
+
# ========================================================================= #
|
12
|
+
def self.is_on_roebe?
|
13
|
+
ENV['IS_ROEBE'].to_i == 1
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|