environment_information 1.4.29

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.

Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1061 -0
  3. data/bin/envi +7 -0
  4. data/bin/fast_envi +7 -0
  5. data/doc/README.gen +893 -0
  6. data/doc/TODO_FOR_THE_ENVIRONMENT_INFORMATION_PROJECT.md +54 -0
  7. data/environment_information.gemspec +130 -0
  8. data/lib/environment_information/base/base.rb +113 -0
  9. data/lib/environment_information/class/add.rb +186 -0
  10. data/lib/environment_information/class/colours.rb +283 -0
  11. data/lib/environment_information/class/constants.rb +35 -0
  12. data/lib/environment_information/class/environment_information.rb +51 -0
  13. data/lib/environment_information/class/help.rb +86 -0
  14. data/lib/environment_information/class/html.rb +78 -0
  15. data/lib/environment_information/class/initialize.rb +178 -0
  16. data/lib/environment_information/class/menu.rb +436 -0
  17. data/lib/environment_information/class/misc.rb +821 -0
  18. data/lib/environment_information/class/opn.rb +33 -0
  19. data/lib/environment_information/class/register_sigint.rb +20 -0
  20. data/lib/environment_information/class/reset.rb +213 -0
  21. data/lib/environment_information/class/ruby.rb +79 -0
  22. data/lib/environment_information/class/run.rb +61 -0
  23. data/lib/environment_information/class/show_display_and_report.rb +310 -0
  24. data/lib/environment_information/colours/colours.rb +150 -0
  25. data/lib/environment_information/colours/sfancy.rb +19 -0
  26. data/lib/environment_information/colours/simp.rb +19 -0
  27. data/lib/environment_information/constants/array_tracked_components.rb +207 -0
  28. data/lib/environment_information/constants/constants.rb +17 -0
  29. data/lib/environment_information/constants/encoding.rb +21 -0
  30. data/lib/environment_information/constants/error_line.rb +17 -0
  31. data/lib/environment_information/constants/file_constants.rb +102 -0
  32. data/lib/environment_information/constants/misc.rb +86 -0
  33. data/lib/environment_information/constants/namespace.rb +14 -0
  34. data/lib/environment_information/constants/newline.rb +16 -0
  35. data/lib/environment_information/constants/regex.rb +30 -0
  36. data/lib/environment_information/constants/temp_directory.rb +52 -0
  37. data/lib/environment_information/gui/gtk/bindings.rb +300 -0
  38. data/lib/environment_information/misc_components/README.md +3 -0
  39. data/lib/environment_information/misc_components/cflags.rb +36 -0
  40. data/lib/environment_information/misc_components/cpuinfo.rb +64 -0
  41. data/lib/environment_information/misc_components/operating_system.rb +54 -0
  42. data/lib/environment_information/misc_components/operating_system_bit_type.rb +42 -0
  43. data/lib/environment_information/misc_components/ram.rb +30 -0
  44. data/lib/environment_information/misc_components/rubygems_installation_directory.rb +54 -0
  45. data/lib/environment_information/misc_components/screen_resolution.rb +50 -0
  46. data/lib/environment_information/project/project.rb +27 -0
  47. data/lib/environment_information/queries/README.md +2 -0
  48. data/lib/environment_information/queries/complex_version.rb +263 -0
  49. data/lib/environment_information/queries/pkg_config.rb +125 -0
  50. data/lib/environment_information/queries/simple_version.rb +211 -0
  51. data/lib/environment_information/requires/require_asciitable.rb +15 -0
  52. data/lib/environment_information/requires/require_the_constants.rb +7 -0
  53. data/lib/environment_information/requires/require_the_environment_information_project.rb +23 -0
  54. data/lib/environment_information/requires/require_the_individual_misc_components.rb +30 -0
  55. data/lib/environment_information/requires/require_the_toplevel_methods.rb +22 -0
  56. data/lib/environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb +152 -0
  57. data/lib/environment_information/toplevel_methods/cd.rb +16 -0
  58. data/lib/environment_information/toplevel_methods/e.rb +30 -0
  59. data/lib/environment_information/toplevel_methods/hash.rb +60 -0
  60. data/lib/environment_information/toplevel_methods/internet_is_available.rb +30 -0
  61. data/lib/environment_information/toplevel_methods/is_on_roebe.rb +16 -0
  62. data/lib/environment_information/toplevel_methods/menu.rb +90 -0
  63. data/lib/environment_information/toplevel_methods/misc.rb +264 -0
  64. data/lib/environment_information/toplevel_methods/n_subcommands.rb +31 -0
  65. data/lib/environment_information/toplevel_methods/prefix_to_use.rb +39 -0
  66. data/lib/environment_information/toplevel_methods/register_this_component_is_missing.rb +61 -0
  67. data/lib/environment_information/toplevel_methods/remote_url_of_this_program.rb +45 -0
  68. data/lib/environment_information/toplevel_methods/replay_from_the_stored_file.rb +84 -0
  69. data/lib/environment_information/toplevel_methods/return_pkgconfig_based_programs.rb +28 -0
  70. data/lib/environment_information/toplevel_methods/return_remote_gtk2_version.rb +54 -0
  71. data/lib/environment_information/toplevel_methods/return_simple_version_based_programs.rb +28 -0
  72. data/lib/environment_information/toplevel_methods/return_version_of_this_program.rb +186 -0
  73. data/lib/environment_information/toplevel_methods/show_all_available_components.rb +192 -0
  74. data/lib/environment_information/toplevel_methods/write_what_into.rb +24 -0
  75. data/lib/environment_information/version/version.rb +25 -0
  76. data/lib/environment_information/www/sinatra_interface.rb +213 -0
  77. data/lib/environment_information/www/webobject_interface.cgi +29 -0
  78. data/lib/environment_information/yaml/array_default_programs_on_linux.yml +14 -0
  79. data/lib/environment_information/yaml/array_lfs_core_programs.yml +35 -0
  80. data/lib/environment_information/yaml/array_science_cluster.yml +12 -0
  81. data/lib/environment_information/yaml/array_tracked_non_programs.yml +13 -0
  82. data/lib/environment_information/yaml/array_tracked_programs.yml +165 -0
  83. data/lib/environment_information/yaml/array_tracked_xorg_components.yml +34 -0
  84. data/lib/environment_information/yaml/query_to_use_for_the_individual_components.yml +215 -0
  85. data/lib/environment_information.rb +5 -0
  86. data/test/testing_environment_information.rb +26 -0
  87. data/test/testing_missing_components.rb +9 -0
  88. data/test/testing_prefix_for_the_environment_information_project.rb +20 -0
  89. metadata +195 -0
@@ -0,0 +1,54 @@
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
+
33
+ in envi: add
34
+
35
+ --scan-this-directory=/Programs
36
+ ^^^ this shall check for each directory there, if it is NOT empty,
37
+ and then to find out what to use to determine the version
38
+ dynamically.
39
+ but before we do so, perhaps add a way to query the binary
40
+ from any path... e. g. /Programs/Htop/Current/ or so
41
+ ------------------------------------------------------------------------------
42
+
43
+ - if we rewrite the project, properly add disabling of saving
44
+ files AND checking permissions
45
+
46
+
47
+
48
+ ------------------------------------------------------------------------------
49
+
50
+ test absolute prefixes again
51
+
52
+ ---------------------
53
+ envi --brotli
54
+ ^^^ support this too.
@@ -0,0 +1,130 @@
1
+ # =========================================================================== #
2
+ # Gemspec for Project EnvironmentInformation.
3
+ # =========================================================================== #
4
+ require 'environment_information/version/version.rb'
5
+
6
+ Gem::Specification.new { |s|
7
+
8
+ s.name = 'environment_information'
9
+ s.version = EnvironmentInformation::VERSION
10
+ s.date = Time.now.strftime('%Y-%m-%d')
11
+
12
+ DESCRIPTION = <<-EOF
13
+
14
+ The gem environment_information is able to provide information about the
15
+ computer host system, in particular on Linux systems, if ruby is available
16
+ on that computer. Commonly used programs will be queried for their current
17
+ version number (and whether they exist) on the target computer. If these
18
+ programs do happen to exist then the corresponding version will be
19
+ displayed, on the commandline.
20
+
21
+ This is somewhat similar to the "Linux from Scratch" project, which uses
22
+ a shell script to display the version of many commonly used programs.
23
+ As I prefer ruby over shell scripts, I wrote this somewhat equivalent
24
+ project.
25
+
26
+ For more information and documentation about this project, consider
27
+ looking at the homepage of this gem, at
28
+
29
+ https://rubygems.org/gems/environment_information
30
+
31
+ and look at the documentation on the bottom right side,
32
+ called "Documentation".
33
+
34
+ EOF
35
+
36
+ s.summary = DESCRIPTION
37
+ s.description = DESCRIPTION
38
+
39
+ # =============================================================== #
40
+ # Show this when a user installs this project.
41
+ # =============================================================== #
42
+ s.post_install_message = <<-EOF
43
+
44
+ You can run this little script by issuing:
45
+
46
+ envi
47
+
48
+ on the commandline. (The script envi is part of this gem and can
49
+ be found at the subdirectory bin/envi of the gem.)
50
+
51
+ Within ruby code, you can require the project and then display
52
+ information too, via:
53
+
54
+ require 'environment_information'
55
+ EnvironmentInformation.run
56
+
57
+ For the (documented) options, you can do either of the following:
58
+
59
+ envi --help
60
+ envi HELP
61
+
62
+ This will feedback the options that are available.
63
+
64
+ To get the full output of just about every program that is checked
65
+ by this gem, try any of the following invocation:
66
+
67
+ envi --all
68
+ envi ALL
69
+
70
+ (Lowercase works fine just as well. The commandline options that
71
+ include two '-' characters are, internally, the preferred variants.)
72
+
73
+ To obtain an individual entry, do something such as this:
74
+
75
+ envi gtk
76
+ envi pango
77
+ envi gcr
78
+
79
+ To disable colours, do either one of these:
80
+
81
+ envi --nocolours
82
+ envi --no-colours
83
+ envi --no-colors
84
+ envi --nocolors
85
+ envi nocolours
86
+ envi NOCOLOURS
87
+
88
+ (Both UK and US spelling is supported, so colour works just as
89
+ well as color.)
90
+
91
+ If all of this may become too tedious to type, I just use an
92
+ alias called ALL, which stands short for "envi all" or
93
+ "envi show_all".
94
+
95
+ Another option, both of which are synonymous to each other,
96
+ is to compare all existing programs on a given host system
97
+ with the version registered in the RBT project:
98
+
99
+ envi ALL REALLY_ALL
100
+ envi --compare_programs
101
+ envi compare_programs
102
+
103
+ If you wish to show only the OS information, do:
104
+
105
+ envi --os?
106
+
107
+ For more documentation about the project, have a look at:
108
+
109
+ #{EnvironmentInformation::URL_TO_THE_DOCUMENTATION}
110
+
111
+ EOF
112
+
113
+ s.authors = ['Robert A. Heiler']
114
+ s.email = 'shevegen@gmail.com'
115
+ s.files = Dir['**/*']
116
+ s.licenses = 'GPL-2.0'
117
+ s.homepage = 'http://rubygems.org/gems/environment_information'
118
+ s.executables = Dir['bin/*'].map { |f| File.basename(f) }
119
+
120
+ s.required_ruby_version = '>= '+RUBY_VERSION
121
+ s.required_rubygems_version = '>= '+Gem::VERSION
122
+ s.rubygems_version = '>= '+Gem::VERSION
123
+
124
+ # ========================================================================= #
125
+ # Dependencies of this project:
126
+ # ========================================================================= #
127
+ s.add_dependency 'colours'
128
+ # s.add_dependency 'opn' # ← An optional dependency since as of 10.03.2020
129
+
130
+ }
@@ -0,0 +1,113 @@
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
+ # === report_left_right
83
+ # ========================================================================= #
84
+ def report_left_right(
85
+ left = program_name?,
86
+ right = program_version?,
87
+ colour_for_the_left_side = ::EnvironmentInformation.colour_for_the_left_side,
88
+ colour_for_the_right_side = ::EnvironmentInformation.colour_for_the_right_side,
89
+ colour_for_program_not_found = ::EnvironmentInformation.colour_for_program_not_found
90
+ )
91
+ case right
92
+ when nil
93
+ right = NOT_INSTALLED_OR_NOT_FOUND
94
+ end
95
+ right = right.dup if right.frozen?
96
+ right.strip!
97
+ if right.include? 'not found'
98
+ right = ::EnvironmentInformation.send(
99
+ colour_for_program_not_found, right
100
+ )
101
+ end
102
+ colourized_right_side = ::EnvironmentInformation.send(
103
+ colour_for_the_right_side,
104
+ right
105
+ )
106
+ e ::EnvironmentInformation.send(colour_for_the_left_side,
107
+ ("#{left}:").ljust(32)
108
+ )+
109
+ ' '+
110
+ colourized_right_side
111
+ end
112
+
113
+ end; end
@@ -0,0 +1,186 @@
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
+
157
+ # ========================================================================= #
158
+ # === add_the_default_programs_on_a_linux_computer
159
+ # ========================================================================= #
160
+ def add_the_default_programs_on_a_linux_computer
161
+ # ======================================================================= #
162
+ # Add the default programs on a linux computer.
163
+ # ======================================================================= #
164
+ add(
165
+ return_default_programs_on_a_linux_computer
166
+ )
167
+ end; alias add_default_linux_programs add_the_default_programs_on_a_linux_computer # === add_default_linux_programs
168
+
169
+ # ========================================================================= #
170
+ # === add_ruby_and_rubygems
171
+ # ========================================================================= #
172
+ def add_ruby_and_rubygems
173
+ add(:ruby)
174
+ add(:rubygems)
175
+ add(:rubygems_installation_directory)
176
+ end
177
+
178
+ # ========================================================================= #
179
+ # === add_this_to_the_toplevel_hash
180
+ # ========================================================================= #
181
+ def add_this_to_the_toplevel_hash(a, b)
182
+ a = a.to_sym unless a.is_a? Symbol
183
+ ::EnvironmentInformation.hash?[a] = b
184
+ end; alias register_onto_the_main_hash add_this_to_the_toplevel_hash # === register_onto_the_main_hash
185
+
186
+ end; end