environment_information 1.4.124 → 1.5.5

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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +91 -15
  3. data/doc/README.gen +42 -14
  4. data/doc/todo/TODO_FOR_THE_ENVIRONMENT_INFORMATION_PROJECT.md +16 -12
  5. data/lib/environment_information/base/base.rb +483 -99
  6. data/lib/environment_information/colours/colours.rb +92 -66
  7. data/lib/environment_information/commandline/commandline.rb +137 -0
  8. data/lib/environment_information/constants/constants.rb +372 -11
  9. data/lib/environment_information/project/project.rb +1 -1
  10. data/lib/environment_information/query/constants.rb +46 -0
  11. data/lib/environment_information/query/help.rb +88 -0
  12. data/lib/environment_information/query/menu.rb +487 -0
  13. data/lib/environment_information/query/misc.rb +2006 -0
  14. data/lib/environment_information/query/query.rb +245 -0
  15. data/lib/environment_information/query/reset.rb +202 -0
  16. data/lib/environment_information/query/run.rb +70 -0
  17. data/lib/environment_information/requires/require_the_environment_information_project.rb +2 -7
  18. data/lib/environment_information/requires/require_the_toplevel_methods.rb +1 -3
  19. data/lib/environment_information/toplevel_methods/toplevel_methods.rb +2258 -0
  20. data/lib/environment_information/version/version.rb +2 -2
  21. data/lib/environment_information/www/sinatra_interface.rb +20 -17
  22. data/lib/environment_information/www/webobject_interface.cgi +6 -7
  23. data/lib/environment_information/yaml/colours.yml +3 -3
  24. data/lib/environment_information/yaml/query_to_use_for_all_components.yml +284 -0
  25. data/lib/environment_information/yaml/{array_tracked_programs.yml → track_these_components.yml} +77 -11
  26. metadata +18 -60
  27. data/lib/environment_information/class/class.rb +0 -2580
  28. data/lib/environment_information/class/colours.rb +0 -282
  29. data/lib/environment_information/colours/sfancy.rb +0 -19
  30. data/lib/environment_information/colours/simp.rb +0 -19
  31. data/lib/environment_information/constants/array_tracked_components.rb +0 -210
  32. data/lib/environment_information/constants/encoding.rb +0 -21
  33. data/lib/environment_information/constants/error_line.rb +0 -17
  34. data/lib/environment_information/constants/file_constants.rb +0 -102
  35. data/lib/environment_information/constants/misc.rb +0 -86
  36. data/lib/environment_information/constants/namespace.rb +0 -14
  37. data/lib/environment_information/constants/newline.rb +0 -16
  38. data/lib/environment_information/constants/regex.rb +0 -30
  39. data/lib/environment_information/constants/temp_directory.rb +0 -52
  40. data/lib/environment_information/misc_components/README.md +0 -3
  41. data/lib/environment_information/misc_components/cflags.rb +0 -36
  42. data/lib/environment_information/misc_components/cpuinfo.rb +0 -64
  43. data/lib/environment_information/misc_components/operating_system.rb +0 -54
  44. data/lib/environment_information/misc_components/operating_system_bit_type.rb +0 -42
  45. data/lib/environment_information/misc_components/ram.rb +0 -30
  46. data/lib/environment_information/misc_components/rubygems_installation_directory.rb +0 -54
  47. data/lib/environment_information/misc_components/screen_resolution.rb +0 -50
  48. data/lib/environment_information/queries/README.md +0 -2
  49. data/lib/environment_information/queries/complex_version.rb +0 -273
  50. data/lib/environment_information/queries/pkg_config.rb +0 -125
  51. data/lib/environment_information/queries/simple_version.rb +0 -272
  52. data/lib/environment_information/requires/require_the_individual_misc_components.rb +0 -30
  53. data/lib/environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb +0 -153
  54. data/lib/environment_information/toplevel_methods/cd.rb +0 -16
  55. data/lib/environment_information/toplevel_methods/e.rb +0 -43
  56. data/lib/environment_information/toplevel_methods/hash.rb +0 -65
  57. data/lib/environment_information/toplevel_methods/internet_is_available.rb +0 -30
  58. data/lib/environment_information/toplevel_methods/is_on_roebe.rb +0 -16
  59. data/lib/environment_information/toplevel_methods/menu.rb +0 -90
  60. data/lib/environment_information/toplevel_methods/misc.rb +0 -324
  61. data/lib/environment_information/toplevel_methods/n_subcommands.rb +0 -31
  62. data/lib/environment_information/toplevel_methods/prefix_to_use.rb +0 -39
  63. data/lib/environment_information/toplevel_methods/register_this_component_is_missing.rb +0 -61
  64. data/lib/environment_information/toplevel_methods/remote_url_of_this_program.rb +0 -45
  65. data/lib/environment_information/toplevel_methods/replay_from_the_stored_file.rb +0 -84
  66. data/lib/environment_information/toplevel_methods/return_alias_to.rb +0 -30
  67. data/lib/environment_information/toplevel_methods/return_pkgconfig_based_programs.rb +0 -28
  68. data/lib/environment_information/toplevel_methods/return_remote_gtk2_version.rb +0 -54
  69. data/lib/environment_information/toplevel_methods/return_simple_version_based_programs.rb +0 -28
  70. data/lib/environment_information/toplevel_methods/return_version_of_this_program.rb +0 -182
  71. data/lib/environment_information/toplevel_methods/show_all_available_components.rb +0 -192
  72. data/lib/environment_information/toplevel_methods/write_what_into.rb +0 -24
  73. data/lib/environment_information/yaml/array_default_programs_on_linux.yml +0 -15
  74. data/lib/environment_information/yaml/array_lfs_core_programs.yml +0 -37
  75. data/lib/environment_information/yaml/array_science_cluster.yml +0 -12
  76. data/lib/environment_information/yaml/array_tracked_non_programs.yml +0 -13
  77. data/lib/environment_information/yaml/array_tracked_xorg_components.yml +0 -37
  78. data/lib/environment_information/yaml/query_to_use_for_the_individual_components.yml +0 -284
@@ -9,86 +9,91 @@ module EnvironmentInformation
9
9
 
10
10
  require 'environment_information/project/project.rb'
11
11
 
12
+ begin # This block should come early on.
13
+ require 'colours/html_colours'
14
+ # ======================================================================== #
15
+ # === @use_colours
16
+ #
17
+ # By default this project will try to make use of colours. This has
18
+ # be protected by a rescue clause, as not every user may have the
19
+ # gem called "colours" installed.
20
+ # ======================================================================== #
21
+ @use_colours = true
22
+ rescue LoadError
23
+ # ======================================================================== #
24
+ # If the colours-gem is not available then we will not use colours.
25
+ # The user could still overrule this at a later time, though.
26
+ # ======================================================================== #
27
+ @use_colours = false
28
+ end
29
+
30
+ # ========================================================================= #
31
+ # === EnvironmentInformation.use_colours?
12
32
  # ========================================================================= #
33
+ def self.use_colours?
34
+ @use_colours
35
+ end
36
+
37
+ # ========================================================================== #
38
+ # === Support for yaml/colours.yml
39
+ #
13
40
  # First the code here will determine which colours are to be used. If
14
41
  # a .yml file can be found as part of this project then it will override
15
42
  # the default values given here; otherwise the default values will be
16
43
  # used, consequently.
17
- # ========================================================================= #
18
-
19
- yaml_file = EnvironmentInformation.project_base_directory?+'yaml/colours.yml'
44
+ # ========================================================================== #
45
+ yaml_file = "#{EnvironmentInformation.project_base_directory?}yaml/colours.yml"
20
46
  if File.exist? yaml_file
47
+ # ======================================================================== #
48
+ # The .yml file exists, so we can use the colours defined in that
49
+ # .yml file:
50
+ # ======================================================================== #
21
51
  dataset = YAML.load_file(yaml_file) # These should be a Symbol.
22
52
  @colour_for_the_left_side = dataset['left_side'].to_sym
23
53
  @colour_for_the_right_side = dataset['right_side'].to_sym
24
54
  @colour_for_program_not_found = dataset['program_not_found'].to_sym
25
55
  else # else use default values here
26
- # ========================================================================= #
56
+ # ======================================================================== #
27
57
  # === @colour_for_the_left_side
28
- # ========================================================================= #
58
+ # ======================================================================== #
29
59
  @colour_for_the_left_side = :forestgreen
30
60
 
31
- # ========================================================================= #
61
+ # ======================================================================== #
32
62
  # === @colour_for_the_right_side
33
- # ========================================================================= #
63
+ # ======================================================================== #
34
64
  @colour_for_the_right_side = :steelblue
35
65
 
36
- # ========================================================================= #
66
+ # ======================================================================== #
37
67
  # === @colour_for_program_not_found
38
- # ========================================================================= #
68
+ # ======================================================================== #
39
69
  @colour_for_program_not_found = :lightslategrey
40
70
  end
41
71
 
42
- begin
43
- require 'colours/html_colours'
44
- # ======================================================================= #
45
- # === @use_colours
46
- #
47
- # By default this project will try to make use of colours. This has
48
- # be protected by a rescue clause, as not every user may have the
49
- # gem called "colours" installed.
50
- # ======================================================================= #
51
- @use_colours = true
52
- rescue LoadError
53
- # ======================================================================= #
54
- # If the colours-gem is not available then we will not use colours.
55
- # The user could still overrule this at a later time, though.
56
- # ======================================================================= #
57
- @use_colours = false
58
- end
59
-
60
- # ========================================================================= #
72
+ # ========================================================================== #
61
73
  # === EnvironmentInformation.colour_for_the_left_side (left tag)
62
74
  #
63
75
  # This method will return the colour
64
76
  #
65
77
  # This could also be :limegreen rather than :forestgreen or vice versa.
66
- # ========================================================================= #
78
+ # ========================================================================== #
67
79
  def self.colour_for_the_left_side
68
80
  @colour_for_the_left_side
69
81
  end
70
82
 
71
- # ========================================================================= #
83
+ # ========================================================================== #
72
84
  # === EnvironmentInformation.colour_for_the_right_side (right tag)
73
- # ========================================================================= #
85
+ # ========================================================================== #
74
86
  def self.colour_for_the_right_side
75
87
  @colour_for_the_right_side
76
88
  end
77
89
 
78
- # ========================================================================= #
90
+ # ========================================================================== #
79
91
  # === EnvironmentInformation.colour_for_program_not_found
80
- # ========================================================================= #
92
+ # ========================================================================== #
81
93
  def self.colour_for_program_not_found
82
94
  @colour_for_program_not_found
83
95
  end
84
96
 
85
- # ========================================================================= #
86
- # === EnvironmentInformation.use_colours?
87
- # ========================================================================= #
88
- def self.use_colours?
89
- @use_colours
90
- end
91
-
92
97
  # ========================================================================= #
93
98
  # === EnvironmentInformation.set_use_colours
94
99
  #
@@ -109,8 +114,11 @@ module EnvironmentInformation
109
114
  # ========================================================================= #
110
115
  # === EnvironmentInformation.mediumpurple
111
116
  # ========================================================================= #
112
- def self.mediumpurple(i = '')
113
- if @use_colours
117
+ def self.mediumpurple(
118
+ i = '',
119
+ use_colours = @use_colours
120
+ )
121
+ if use_colours
114
122
  return ::Colours.mediumpurple(i)
115
123
  end
116
124
  return i
@@ -119,10 +127,10 @@ module EnvironmentInformation
119
127
  # ========================================================================= #
120
128
  # === EnvironmentInformation.lightslategrey
121
129
  # ========================================================================= #
122
- def self.lightslategrey(i = '')
123
- if @use_colours
124
- return ::Colours.lightslategrey(i)
125
- end
130
+ def self.lightslategrey(
131
+ i = '', use_colours = @use_colours
132
+ )
133
+ return ::Colours.lightslategrey(i) if use_colours
126
134
  return i
127
135
  end
128
136
 
@@ -130,7 +138,8 @@ module EnvironmentInformation
130
138
  # === EnvironmentInformation.tomato
131
139
  # ========================================================================= #
132
140
  def self.tomato(
133
- i = '', use_colours = @use_colours
141
+ i = '',
142
+ use_colours = @use_colours
134
143
  )
135
144
  return ::Colours.tomato(i) if use_colours
136
145
  return i
@@ -140,7 +149,8 @@ module EnvironmentInformation
140
149
  # === EnvironmentInformation.pink
141
150
  # ========================================================================= #
142
151
  def self.pink(
143
- i = '', use_colours = @use_colours
152
+ i = '',
153
+ use_colours = @use_colours
144
154
  )
145
155
  return ::Colours.pink(i) if use_colours
146
156
  return i
@@ -150,7 +160,8 @@ module EnvironmentInformation
150
160
  # === EnvironmentInformation.forestgreen
151
161
  # ========================================================================= #
152
162
  def self.forestgreen(
153
- i = '', use_colours = @use_colours
163
+ i = '',
164
+ use_colours = @use_colours
154
165
  )
155
166
  return ::Colours.forestgreen(i) if use_colours
156
167
  return i
@@ -159,7 +170,10 @@ module EnvironmentInformation
159
170
  # ========================================================================= #
160
171
  # === EnvironmentInformation.lightseagreen
161
172
  # ========================================================================= #
162
- def self.lightseagreen(i = '', use_colours = @use_colours)
173
+ def self.lightseagreen(
174
+ i = '',
175
+ use_colours = @use_colours
176
+ )
163
177
  if use_colours
164
178
  return ::Colours.lightseagreen(i)
165
179
  end
@@ -183,9 +197,7 @@ module EnvironmentInformation
183
197
  i = '',
184
198
  use_colours = @use_colours
185
199
  )
186
- if use_colours
187
- return ::Colours.royalblue(i)
188
- end
200
+ return ::Colours.royalblue(i) if use_colours
189
201
  return i
190
202
  end
191
203
 
@@ -196,29 +208,43 @@ module EnvironmentInformation
196
208
  i = '',
197
209
  use_colours = @use_colours
198
210
  )
199
- if use_colours
200
- return ::Colours.mediumaquamarine(i)
201
- end
211
+ return ::Colours.mediumaquamarine(i) if use_colours
202
212
  return i
203
213
  end
204
214
 
205
215
  # ========================================================================= #
206
216
  # === EnvironmentInformation.sfile
207
217
  # ========================================================================= #
208
- def self.sfile(i = '')
209
- if @use_colours
210
- ::Colours.sfile(i)
211
- else
212
- i
213
- end
218
+ def self.sfile(
219
+ i = '',
220
+ use_colours = @use_colours
221
+ )
222
+ return ::Colours.sfile(i) if use_colours
223
+ return i
214
224
  end
215
225
 
216
226
  # ========================================================================= #
217
227
  # === EnvironmentInformation.rev (rev tag)
218
228
  # ========================================================================= #
219
- def self.rev
220
- return ::Colours.rev if @use_colours
221
- '' # Else return an empty String.
229
+ def self.rev(use_colours = @use_colours)
230
+ return ::Colours.rev if use_colours
231
+ return '' # Else return an empty String.
232
+ end
233
+
234
+ # ========================================================================= #
235
+ # === EnvironmentInformation.simp
236
+ # ========================================================================= #
237
+ def self.simp(i = '')
238
+ return ::Colours.simp(i) if Object.const_defined? :Colours
239
+ return i
240
+ end
241
+
242
+ # ========================================================================= #
243
+ # === EnvironmentInformation
244
+ # ========================================================================= #
245
+ def self.sfancy(i = '')
246
+ return ::Colours.sfancy(i) if Object.const_defined? :Colours
247
+ return i
222
248
  end
223
249
 
224
- end
250
+ end
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # ============================================================================ #
5
+ # === EnvironmentInformation::Commandline
6
+ #
7
+ # Usage example:
8
+ #
9
+ # EnvironmentInformation::Commandline.new(ARGV)
10
+ #
11
+ # ============================================================================ #
12
+ # require 'environment_information/commandline/commandline.rb'
13
+ # ============================================================================ #
14
+ require 'environment_information/base/base.rb'
15
+
16
+ module EnvironmentInformation
17
+
18
+ class Commandline < ::EnvironmentInformation::Base # === EnvironmentInformation::Commandline
19
+
20
+ require 'environment_information/version/version.rb'
21
+
22
+ # ========================================================================= #
23
+ # === NAMESPACE
24
+ # ========================================================================= #
25
+ NAMESPACE = inspect
26
+
27
+ # ========================================================================= #
28
+ # === initialize
29
+ # ========================================================================= #
30
+ def initialize(
31
+ commandline_arguments = nil,
32
+ run_already = true
33
+ )
34
+ reset
35
+ set_commandline_arguments(
36
+ commandline_arguments
37
+ )
38
+ run if run_already
39
+ end
40
+
41
+ # ========================================================================= #
42
+ # === reset (reset tag)
43
+ # ========================================================================= #
44
+ def reset
45
+ super() if respond_to?(:super)
46
+ # ======================================================================= #
47
+ # === @namespace
48
+ # ======================================================================= #
49
+ @namespace = NAMESPACE
50
+ end
51
+
52
+ # ========================================================================= #
53
+ # === menu
54
+ # ========================================================================= #
55
+ def menu(
56
+ i = commandline_arguments?
57
+ )
58
+ if i.is_a? Array
59
+ i.each {|entry| menu(entry) }
60
+ else
61
+ case i # case tag
62
+ # ====================================================================== #
63
+ # === envi --gui
64
+ # ====================================================================== #
65
+ when /^-?-?gui$/i,
66
+ /^-?-?gtk$/i,
67
+ /^-?-?start(-|_)?gtk$/i
68
+ start_gtk_component
69
+ # ====================================================================== #
70
+ # === envi --compare
71
+ # ====================================================================== #
72
+ when *ARRAY_COMPARE_PROGRAM_VERSIONS
73
+ ::EnvironmentInformation.show_all_available_components(
74
+ ['--compare-program-versions']
75
+ )
76
+ # ====================================================================== #
77
+ # === envi --version?
78
+ # ====================================================================== #
79
+ when *ARRAY_VERSION
80
+ report_version
81
+ # ====================================================================== #
82
+ # === envi --replay
83
+ #
84
+ # The replay-functionality can be used to display information
85
+ # quickly, by reading the dataset from a local file.
86
+ # ====================================================================== #
87
+ when /^-?-?replay$/i
88
+ replay_from_the_stored_file
89
+ else
90
+ EnvironmentInformation.test
91
+ end
92
+ end
93
+ end
94
+
95
+ # ========================================================================= #
96
+ # === run (run tag)
97
+ # ========================================================================= #
98
+ def run
99
+ menu
100
+ end
101
+
102
+ # ========================================================================= #
103
+ # === report_version
104
+ # ========================================================================= #
105
+ def report_version
106
+ ::EnvironmentInformation.report_version
107
+ end
108
+
109
+ # ========================================================================= #
110
+ # === EnvironmentInformation::Commandline[]
111
+ # ========================================================================= #
112
+ def self.[](i = ARGV)
113
+ new(i)
114
+ end
115
+
116
+ end
117
+
118
+ # ============================================================================ #
119
+ # === EnvironmentInformation.menu
120
+ # ============================================================================ #
121
+ def self.menu(i = ARGV)
122
+ EnvironmentInformation::Commandline.new(i)
123
+ end
124
+
125
+ # ============================================================================ #
126
+ # === EnvironmentInformation.report_version
127
+ # ============================================================================ #
128
+ def self.report_version
129
+ e "#{rev}The version of the EnvironmentInformation project "\
130
+ "in use is: #{simp(VERSION)}#{rev}"
131
+ end
132
+
133
+ end
134
+
135
+ if __FILE__ == $PROGRAM_NAME
136
+ EnvironmentInformation::Commandline.new(ARGV)
137
+ end # commandline.rb