program_information 1.2.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.

Potentially problematic release.


This version of program_information might be problematic. Click here for more details.

Files changed (29) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +80 -0
  3. data/bin/program_information +14 -0
  4. data/doc/CONVENTIONS.md +22 -0
  5. data/doc/README.gen +37 -0
  6. data/lib/program_information/constants/array_test_with_this_as_input.rb +121 -0
  7. data/lib/program_information/constants/colours.rb +42 -0
  8. data/lib/program_information/constants/constants.rb +55 -0
  9. data/lib/program_information/constants/regex.rb +87 -0
  10. data/lib/program_information/initialize.rb +43 -0
  11. data/lib/program_information/menu.rb +29 -0
  12. data/lib/program_information/program_information.rb +569 -0
  13. data/lib/program_information/project/project.rb +22 -0
  14. data/lib/program_information/report.rb +48 -0
  15. data/lib/program_information/requires/require_the_program_information_project.rb +9 -0
  16. data/lib/program_information/reset.rb +46 -0
  17. data/lib/program_information/run.rb +18 -0
  18. data/lib/program_information/toplevel_methods/e.rb +14 -0
  19. data/lib/program_information/toplevel_methods/opnn.rb +27 -0
  20. data/lib/program_information/toplevel_methods/remove_archive_type.rb +32 -0
  21. data/lib/program_information/toplevel_methods/return_proper_pipe_token_to_this_input.rb +169 -0
  22. data/lib/program_information/toplevel_methods/return_short_name.rb +38 -0
  23. data/lib/program_information/toplevel_methods.rb +164 -0
  24. data/lib/program_information/version/version.rb +22 -0
  25. data/lib/program_information/www/embeddable_interface.rb +61 -0
  26. data/lib/program_information.rb +5 -0
  27. data/program_information.gemspec +52 -0
  28. data/test/testing_program_information.rb +49 -0
  29. metadata +107 -0
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/reset.rb'
6
+ # =========================================================================== #
7
+ module ProgramInformation
8
+
9
+ class ProgramInformation # === ProgramInformation::ProgramInformation
10
+
11
+ # ========================================================================= #
12
+ # === reset
13
+ # ========================================================================= #
14
+ def reset
15
+ # ======================================================================= #
16
+ # === @short_name
17
+ # ======================================================================= #
18
+ @short_name = nil
19
+ # ======================================================================= #
20
+ # === @real_short_name
21
+ # ======================================================================= #
22
+ @real_short_name = nil
23
+ # ======================================================================= #
24
+ # === @program_version
25
+ # ======================================================================= #
26
+ @program_version = nil
27
+ set_shall_we_downcase # Should become before set_input().
28
+ set_be_verbose
29
+ # ======================================================================= #
30
+ # === @remove_plus_and_minus
31
+ # ======================================================================= #
32
+ @remove_plus_and_minus = REMOVE_PLUS_AND_MINUS
33
+ # ======================================================================= #
34
+ # === @replace_plus_with_long_name
35
+ # ======================================================================= #
36
+ @replace_plus_with_long_name = REPLACE_PLUS_WITH_LONG_NAME
37
+ @remove_plus_token = REMOVE_PLUS_TOKEN
38
+ if @remove_plus_and_minus # Overrule always in this case.
39
+ @replace_plus_with_long_name = false
40
+ end
41
+ if @remove_plus_and_minus
42
+ @remove_plus_token = false
43
+ end
44
+ end
45
+
46
+ end; end
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/run.rb'
6
+ # =========================================================================== #
7
+ module ProgramInformation
8
+
9
+ class ProgramInformation
10
+
11
+ # ========================================================================= #
12
+ # === run
13
+ # ========================================================================= #
14
+ def run
15
+ determine_the_three_main_variables
16
+ end
17
+
18
+ end; end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ module ProgramInformation
6
+
7
+ # ========================================================================= #
8
+ # === ProgramInformation.e
9
+ # ========================================================================= #
10
+ def self.e(i = '')
11
+ puts i
12
+ end
13
+
14
+ end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/toplevel_methods/opnn.rb'
6
+ # =========================================================================== #
7
+ require 'program_information/toplevel_methods/e.rb'
8
+
9
+ module ProgramInformation
10
+
11
+ begin
12
+ require 'opn'
13
+ rescue LoadError; end
14
+
15
+ # ========================================================================= #
16
+ # === ProgramInformation.e
17
+ # ========================================================================= #
18
+ def self.opnn(
19
+ i = 'ProgramInformation'
20
+ )
21
+ if i.is_a? String
22
+ i = { namespace: i }
23
+ end
24
+ Opn.opn(i) if Object.const_defined? :Opn
25
+ end
26
+
27
+ end
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/toplevel_methods/remove_archive_type.rb'
6
+ # =========================================================================== #
7
+ module ProgramInformation
8
+
9
+ # ========================================================================= #
10
+ # === ProgramInformation.remove_archive_type
11
+ #
12
+ # This method will remove the "archive type", e. g. ".tar.xz" or
13
+ # ".tar.bz2" or ".tar.lz".
14
+ # ========================================================================= #
15
+ def self.remove_archive_type(i)
16
+ i = i.dup if i.frozen?
17
+ i.sub!(/\.tar\.gz$/,'')
18
+ i.sub!(/\.tar\.xz$/,'')
19
+ i.sub!(/\.tar\.bz2$/,'')
20
+ i.sub!(/\.run$/,'') if i.end_with? '.run'
21
+ i.sub!(/\.bz2$/,'') if i.end_with? '.bz2'
22
+ i.sub!(/\.tar\.lz$/,'') if i.end_with? '.tar.lz'
23
+ i.sub!(/\.gem$/,'')
24
+ i.sub!(/\.tgz$/,'')
25
+ i.sub!(/\.zip$/,'')
26
+ i.sub!(/\.jar$/,'')
27
+ i.sub!(/\.js$/,'')
28
+ i.sub!(/\.stable$/,'')
29
+ return i
30
+ end
31
+
32
+ end
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/toplevel_methods/return_proper_pipe_token_to_this_input.rb'
6
+ # =========================================================================== #
7
+ module ProgramInformation
8
+
9
+ require 'program_information/constants/regex.rb'
10
+ require 'program_information/toplevel_methods/opnn.rb'
11
+ require 'program_information/toplevel_methods/remove_archive_type.rb'
12
+
13
+ # ========================================================================= #
14
+ # === ProgramInformation.return_proper_pipe_token_to_this_input
15
+ #
16
+ # Most of the content of this method has to be put into a begin/require
17
+ # clause, as errors may happen, which could propagate downstream,
18
+ # leading to confusion. So we will rescue the error, and notify the
19
+ # user as to what has happened.
20
+ # ========================================================================= #
21
+ def self.return_proper_pipe_token_to_this_input(
22
+ entry
23
+ )
24
+ if entry.is_a? Array
25
+ entry = entry.first
26
+ end
27
+ entry = remove_archive_type(entry)
28
+ use_this_replacement_token = '|'
29
+ return if entry.to_s.empty?
30
+ begin
31
+ # ===================================================================== #
32
+ # === Check for input such as 'unieject-6', containing one '-' and 0 '_'
33
+ # ===================================================================== #
34
+ if (entry.count('-') == 1) and
35
+ (entry.count('_') == 0)
36
+ entry[entry.index('-'),1] = use_this_replacement_token
37
+ # ===================================================================== #
38
+ # === Check for input such as 'p7zip_16.02_src_all.tar.bz2' with
39
+ # 3 '_' and at the least one '.' and no '-'
40
+ # ===================================================================== #
41
+ elsif (entry.count('_') == 3) and
42
+ (entry.count('.') > 0) and
43
+ (!entry.include?('-'))
44
+ entry[entry.index('_'),1] = use_this_replacement_token
45
+ # ===================================================================== #
46
+ # === Input such as 'mod_python_3.3.1', with two '_' and no '-'.
47
+ # ===================================================================== #
48
+ elsif (entry.count('_') == 2) and
49
+ (entry.count('-') == 0)
50
+ entry[entry.rindex('_'),1] = use_this_replacement_token
51
+ # ===================================================================== #
52
+ # === Input such as 'unzip60' without any '-' or '_'
53
+ # ===================================================================== #
54
+ elsif (entry.count('-') == 0) and
55
+ (entry.count('_') == 0) and
56
+ (!entry.include?('.'))
57
+ entry[entry.index(/\d/), 0] = '|'
58
+ # ===================================================================== #
59
+ # === Check for input such as 'artemis_v16.0.11' or 'dpkg_1.18.22'
60
+ # with one '_' and no '-'.
61
+ # ===================================================================== #
62
+ elsif (entry.count('_') == 1) and
63
+ (entry.count('-') == 0)
64
+ entry[entry.index('_'),1] = use_this_replacement_token
65
+ # ===================================================================== #
66
+ # === Input such as 'sendmail.8.15.2' or 'expect5.45.3', without
67
+ # any '-' or '_'.
68
+ # ===================================================================== #
69
+ elsif (entry.count('-') == 0) and
70
+ (entry.count('_') == 0) and
71
+ (entry.include?('.'))
72
+ entry =~ REGEX_FOR_INPUT_HAVING_ONLY_DOTS
73
+ entry = $1.to_s.dup+use_this_replacement_token+$2.to_s.dup
74
+ # ===================================================================== #
75
+ # For input such as 'boost-1_54_0' or 'ncbi_cxx-12_0_0' or
76
+ # 'boost_1.56.6'. So it contains exactly one '-' character.
77
+ # ===================================================================== #
78
+ elsif ((entry.count('-') == 1) and
79
+ (entry.count('_') > 1) and # More than 1 '_'
80
+ (entry =~ REGEX_FOR_BOOST_LIKE_INPUT)) or # or the second condition.
81
+ ((entry.count('_') == 3) and
82
+ (entry.count('-') == 0) and
83
+ (entry =~ REGEX_FOR_BOOST_LIKE_INPUT))
84
+ entry =~ REGEX_FOR_BOOST_LIKE_INPUT
85
+ # =================================================================== #
86
+ # We here need only the first and the third match.
87
+ # =================================================================== #
88
+ entry = "#{$1.to_s.dup}#{use_this_replacement_token}#{$3.to_s.dup}"
89
+ # ===================================================================== #
90
+ # For input such as 'acl_2.2.47-1' or 'e_dbus-1.7.10' or
91
+ # 'SDL2_gfx-1.0.1' or 'domain_name-0.5.20170404.gem' or
92
+ # 'libatomic_ops-7.4.2' or 'icu4c-62_1'.
93
+ # ===================================================================== #
94
+ elsif (entry.count('_') == 1) and
95
+ (entry.count('-') == 1) and
96
+ (entry =~ REGEX_FOR_ACL_LIKE_INPUT)
97
+ regex_to_use = REGEX_FOR_ACL_LIKE_INPUT
98
+ entry =~ regex_to_use
99
+ # =================================================================== #
100
+ # Here we also only need to match towards the first and the third
101
+ # entry.
102
+ # =================================================================== #
103
+ entry = $1.to_s.dup+
104
+ use_this_replacement_token+
105
+ $3.to_s.dup
106
+ # ===================================================================== #
107
+ # === Input such as 'did_you_mean-1.1.2' with one '-' and two '_'
108
+ # ===================================================================== #
109
+ elsif (entry.count('-') == 1) and
110
+ (entry.count('_') == 2)
111
+ entry[entry.index('-'),1] = use_this_replacement_token
112
+ # ===================================================================== #
113
+ # === Input such as 'ntfs-3g_ntfsprogs-2017.3.23' for 2 '-' and
114
+ # 1 '_'.
115
+ # ===================================================================== #
116
+ elsif (entry.count('-') == 2) and
117
+ (entry.count('_') == 1)
118
+ regex_to_use = REGEX_FOR_INPUT_CONTAINING_TWO_HYPHENS_AND_ONE_UNDERSCORE
119
+ entry =~ regex_to_use
120
+ entry = $1.to_s.dup+use_this_replacement_token+$3.to_s.dup
121
+ # ===================================================================== #
122
+ # For input such as 'lynx-2.8.8-rel2' or 'subtle-0.11.3224-xi' or
123
+ # 'gobject-introspection-1.53.4' or 'dvd+rw-tools-7.1' or
124
+ # 'Archive-Zip-1.46' or 'b43-fwcutter-015' or 'wcd-6.0.1-beta3'
125
+ # or 'oxygen-icons5-5.37.0'. These entries have two '-' and zero
126
+ # '_'.
127
+ # ===================================================================== #
128
+ elsif (entry.count('-') == 2) and
129
+ (entry.count('_') == 0)
130
+ regex_to_use = REGEX_FOR_TWO_HYPHENS
131
+ entry =~ regex_to_use
132
+ entry = $1.to_s.dup+use_this_replacement_token+$2.to_s.dup
133
+ # ===================================================================== #
134
+ # For input such as 'polkit-qt-1-0.112.0' or
135
+ # 'font-bitstream-75dpi-1.0.3' or 'boost-build-2014-10' or
136
+ # 'xf86-video-i810-1.7.4' or 'gnome-internet-radio-locator-0.9.0'
137
+ # or 'mime-types-data-3.2016.0521' or 'polkit-kde-agent-1-5.15.2'
138
+ # or 'xf86-video-amd-2.7.7.7'.
139
+ #
140
+ # This input will NOT have any '_' token; and at the least 3
141
+ # '-' tokens.
142
+ # ===================================================================== #
143
+ elsif (!entry.include?('_')) and
144
+ (entry.count('-') >= 3)
145
+ regex_to_use = REGEX_FOR_THREE_OR_MORE_HYPHENS
146
+ entry =~ regex_to_use
147
+ entry = $1.to_s.dup+
148
+ use_this_replacement_token+
149
+ $2.to_s.dup
150
+ else
151
+ e 'ERROR in program_information.rb! This should never happen.'
152
+ e "The input was: #{entry}"
153
+ end
154
+ rescue Exception => error
155
+ opnn; e 'An error happened (line: '+__LINE__.to_s+'), for '\
156
+ 'the entry `'+entry.to_s+'`.'
157
+ pp error
158
+ pp error.class
159
+ opnn; e 'The caller stack was:'
160
+ pp caller()
161
+ end
162
+ return entry
163
+ end
164
+
165
+ end
166
+
167
+ if __FILE__ == $PROGRAM_NAME
168
+ ProgramInformation.return_proper_pipe_token_to_this_input(ARGV)
169
+ end # rb return_proper*rb icu4c-61_1
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/toplevel_methods/return_short_name.rb'
6
+ # =========================================================================== #
7
+ require 'program_information/program_information.rb'
8
+
9
+ module ProgramInformation
10
+
11
+ # ========================================================================= #
12
+ # === ProgramInformation.return_short_name
13
+ #
14
+ # This method will ultimately return the value of @short_name value.
15
+ #
16
+ # Usage examples:
17
+ #
18
+ # ProgramInformation.return_short_name('ffmpeg-2.1.tar.xz') # => "ffmpeg"
19
+ # ProgramInformation.return_short_name('/Users/x/SRC/gobjectintrospection/gobject-introspection-1.53.4.tar.xz') # => "gobjectintrospection"
20
+ #
21
+ # In the first example, it will return 'ffmpeg', but keep in mind that
22
+ # we allow to keep '-' characters. In the second example, the '-'
23
+ # MUST be preserved.
24
+ # ========================================================================= #
25
+ def self.return_short_name(
26
+ of_this_program = ''
27
+ )
28
+ if of_this_program.nil? or of_this_program.empty?
29
+ opnn; e 'Please provide some input to the method '\
30
+ 'ProgramInformation.return_short_name.'
31
+ else
32
+ _ = ::ProgramInformation::ProgramInformation.new(of_this_program)
33
+ _.short_name?
34
+ end
35
+ end; self.instance_eval { alias return_name return_short_name } # === ProgramInformation.return_name
36
+ self.instance_eval { alias return_program_real_name return_short_name } # === ProgramInformation.return_program_real_name
37
+
38
+ end
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/toplevel_methods.rb'
6
+ # =========================================================================== #
7
+ module ProgramInformation
8
+
9
+ require 'program_information/toplevel_methods/e.rb'
10
+ require 'program_information/toplevel_methods/opnn.rb'
11
+ require 'program_information/toplevel_methods/return_short_name.rb'
12
+ require 'program_information/program_information.rb'
13
+
14
+ # ========================================================================= #
15
+ # === ProgramInformation.return_program_version
16
+ #
17
+ # This module-method will return the program version of a given input.
18
+ #
19
+ # For example, if the input to this method is
20
+ # 'gobject-introspection-1.52.1.tar.xz', then this method will
21
+ # return the String '1.52.1'.
22
+ #
23
+ # We must also handle the case when the version passed to us is incomplete
24
+ # or wrong, such as "2.1.0-source". In that case, the proper program
25
+ # version would be 2.1.0.
26
+ #
27
+ # Usage examples, using the shorter variant instead:
28
+ #
29
+ # ProgramInformation.return_version('/opt/ffmpeg-2.3.tar.xz') # => "2.3"
30
+ # ProgramInformation.return_version 'ophcrack-3.6.0' # => "3.6.0"
31
+ # ProgramInformation.return_version 'gobject-introspection-1.52.1.tar.xz' # => "1.52.1"
32
+ #
33
+ # ========================================================================= #
34
+ def self.return_program_version(of_this_program = '')
35
+ if of_this_program.nil? or of_this_program.empty?
36
+ opnn; e 'Please provide some input to the method '\
37
+ 'ProgramInformation.return_program_version.'
38
+ else
39
+ _ = ::ProgramInformation::ProgramInformation.new(of_this_program)
40
+ _.program_version?
41
+ end
42
+ end; self.instance_eval { alias return_version return_program_version } # === ProgramInformation.return_version
43
+ self.instance_eval { alias return_version_of return_program_version } # === ProgramInformation.return_version_of
44
+ self.instance_eval { alias program_version return_program_version } # === ProgramInformation.program_version
45
+
46
+ # ========================================================================= #
47
+ # === ProgramInformation.return_real_short_name
48
+ #
49
+ # This method will return the real short name.
50
+ #
51
+ # Usage example:
52
+ #
53
+ # ProgramInformation.return_real_short_name('iso-codes-3.50.tar.xz')
54
+ #
55
+ # The above would return "isocodes".
56
+ # ========================================================================= #
57
+ def self.return_real_short_name(of_this_program = '')
58
+ if of_this_program.nil? or of_this_program.empty?
59
+ opnn; e 'Please provide some input to the method '\
60
+ 'ProgramInformation.return_real_short_name.'
61
+ else
62
+ _ = ::ProgramInformation::ProgramInformation.new(of_this_program)
63
+ _.real_short_name?
64
+ end
65
+ end; self.instance_eval { alias real_short_name return_real_short_name } # === ProgramInformation.real_short_name
66
+ self.instance_eval { alias return_real_name return_real_short_name } # === ProgramInformation.return_real_name
67
+ self.instance_eval { alias return_program_name return_real_short_name } # === ProgramInformation.return_program_name
68
+ self.instance_eval { alias program_name? return_real_short_name } # === ProgramInformation.program_name?
69
+ self.instance_eval { alias program_name return_real_short_name } # === ProgramInformation.program_name
70
+
71
+ # ========================================================================= #
72
+ # === ProgramInformation.return_short_name_and_program_version
73
+ #
74
+ # This will return an Array with two entries - the short name,
75
+ # and the program version.
76
+ # ========================================================================= #
77
+ def self.return_short_name_and_program_version(
78
+ i,
79
+ replace_input = true
80
+ )
81
+ case replace_input
82
+ # ======================================================================= #
83
+ # === :do_not_modify_input
84
+ # ======================================================================= #
85
+ when :do_not_modify_input
86
+ replace_input = false
87
+ end
88
+ _ = ::ProgramInformation::ProgramInformation.new(i, :dont_run_yet)
89
+ _.do_not_replace_anything unless replace_input
90
+ _.run
91
+ # ======================================================================= #
92
+ # Assemble the Array here.
93
+ # ======================================================================= #
94
+ array = [ _.short_name?, _.program_version? ]
95
+ return array
96
+ end; self.instance_eval { alias return_short_name_and_version return_short_name_and_program_version } # === ProgramInformation.return_short_name_and__version
97
+
98
+ # ========================================================================= #
99
+ # === ProgramInformation.return_array_name_and_version
100
+ #
101
+ # This will return the short_name and the version, as Array.
102
+ #
103
+ # Usage example:
104
+ #
105
+ # ProgramInformation::ProgramInformation.return_array_name_and_version(
106
+ # "font-sony-misc-1.0.3") => ["font-sony-misc", "1.0.3"]
107
+ #
108
+ # ========================================================================= #
109
+ def self.return_array_name_and_version(i)
110
+ array = [
111
+ ::ProgramInformation.return_short_name(i),
112
+ ::ProgramInformation.return_program_version(i)
113
+ ]
114
+ return array
115
+ end; self.instance_eval { alias return_array_program_name_and_program_version return_array_name_and_version } # === ProgramInformation.return_array_program_name_and_program_version
116
+
117
+ # ========================================================================= #
118
+ # === ProgramInformation.return_real_short_name_and_version
119
+ #
120
+ # This method will return two results, in Array form:
121
+ #
122
+ # The @real_short_name and
123
+ # the @program_version
124
+ #
125
+ # The optional second argument can be used to downcase the program
126
+ # name that is returned.
127
+ # ========================================================================= #
128
+ def self.return_real_short_name_and_version(
129
+ i, optional_downcase = false
130
+ )
131
+ case optional_downcase
132
+ when :downcase
133
+ optional_downcase = true
134
+ end
135
+ real_short_name = ::ProgramInformation.return_real_short_name(i)
136
+ if optional_downcase
137
+ real_short_name.downcase!
138
+ end
139
+ program_version = ::ProgramInformation.return_program_version(i)
140
+ return [
141
+ real_short_name, program_version
142
+ ]
143
+ end; self.instance_eval { alias return_real_name_and_version return_real_short_name_and_version } # === ProgramInformation.return_real_name_and_version
144
+ self.instance_eval { alias return_real_short_name_and_program_version return_real_short_name_and_version } # === ProgramInformation.return_real_short_name_and_program_version
145
+ self.instance_eval { alias return_name_and_version return_real_short_name_and_version } # === ProgramInformation.return_name_and_version
146
+ self.instance_eval { alias return_name_and_version_of return_real_short_name_and_version } # === ProgramInformation.return_name_and_version_of
147
+
148
+ end
149
+
150
+ if __FILE__ == $PROGRAM_NAME
151
+ # ========================================================================= #
152
+ # Some testing code follows next:
153
+ # ========================================================================= #
154
+ if ARGV.empty?
155
+ _ = 'gobject-introspection-1.52.1.tar.xz'
156
+ p ProgramInformation.return_program_version(_)
157
+ p ProgramInformation.return_short_name(_)
158
+ p ProgramInformation.return_real_short_name(_)
159
+ else
160
+ p ProgramInformation.return_program_version(ARGV.first)
161
+ p ProgramInformation.return_short_name(ARGV.first)
162
+ p ProgramInformation.return_real_short_name(ARGV.first)
163
+ end
164
+ end # rb toplevel_methods.rb /Users/x/SRC/gobjectintrospection/gobject-introspection-1.52.1.tar.xz
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/version/version.rb'
6
+ # =========================================================================== #
7
+ module ProgramInformation
8
+
9
+ class ProgramInformation
10
+
11
+ # ========================================================================= #
12
+ # === VERSION
13
+ # ========================================================================= #
14
+ VERSION = '1.2.5'
15
+ DEFAULT_VERSION = VERSION # Use an "alias" to the above constant.
16
+
17
+ # ========================================================================= #
18
+ # === LAST_UPDATE
19
+ # ========================================================================= #
20
+ LAST_UPDATE = '11.06.2023'
21
+
22
+ end; end
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/www/embeddable_interface.rb'
6
+ # include ProgramInformation::EmbeddableInterface
7
+ # =========================================================================== #
8
+ module ProgramInformation
9
+
10
+ module EmbeddableInterface
11
+
12
+ # ========================================================================= #
13
+ # === ProgramInformation::EmbeddableInterface.routes?
14
+ #
15
+ # Define all legal routes via this Array. This Array will then be used
16
+ # to add more routes to any sinatra-application that needs it.
17
+ # ========================================================================= #
18
+ def self.routes?
19
+ [
20
+ 'program_information',
21
+ 'program_information/*'
22
+ ]
23
+ end
24
+
25
+ # ========================================================================= #
26
+ # === return_sinatra_program_information
27
+ # ========================================================================= #
28
+ def return_sinatra_program_information
29
+ 'Please provide the name of the target program that is to be split.'
30
+ end
31
+
32
+ # ========================================================================= #
33
+ # === return_sinatra_repackage_with_arguments
34
+ # ========================================================================= #
35
+ def return_sinatra_program_information_with_arguments(
36
+ i = web_params_as_string?
37
+ )
38
+ i = i.dup if i.frozen?
39
+ _ = ''.dup
40
+ _ << 'The program information for: <b style="darkblue">'+i+'</b> is:<br>'
41
+ i.prepend('/') unless i.start_with? '/'
42
+ program_information = ::ProgramInformation.new(i)
43
+ program_name = program_information.name?
44
+ program_version = program_information.version?
45
+ _ << 'Program name: <b>'+program_name.to_s+'</b><br>'
46
+ _ << 'Program version: <b>'+program_version.to_s+'</b><br>'
47
+ return _
48
+ end
49
+
50
+ end
51
+
52
+ # =========================================================================== #
53
+ # === ProgramInformation.embeddable_interface
54
+ # =========================================================================== #
55
+ def self.embeddable_interface
56
+ object = Object.new
57
+ object.extend(::ProgramInformation::EmbeddableInterface)
58
+ return object
59
+ end
60
+
61
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'program_information/requires/require_the_program_information_project.rb'
@@ -0,0 +1,52 @@
1
+ # =========================================================================== #
2
+ # Gemspec for Project ProgramInformation.
3
+ # =========================================================================== #
4
+ require 'program_information'
5
+ require 'roebe/toplevel_methods/misc.rb'
6
+
7
+ Gem::Specification.new { |s|
8
+
9
+ s.name = 'program_information'
10
+ s.version = ProgramInformation::ProgramInformation::VERSION
11
+ s.date = Time.now.strftime('%Y-%m-%d')
12
+
13
+ DESCRIPTION = <<-EOF
14
+
15
+ This library is called program_information.
16
+
17
+ It allows you to return the real name and the version of strings
18
+ such as "htop-1.0.2.tar.xz".
19
+
20
+ The name would be "htop" and the version would be "1.0.2".
21
+
22
+ This project here was needed for the Cookbooks project and the
23
+ RBT project.
24
+
25
+ It has since then become somewhat useful on its own - at
26
+ the least for projects that need to parse the name and
27
+ program version of given Strings.
28
+
29
+ EOF
30
+
31
+ s.summary = DESCRIPTION
32
+ s.description = DESCRIPTION
33
+
34
+ s.extra_rdoc_files = %w()
35
+
36
+ s.authors = ['Robert A. Heiler']
37
+ s.email = Roebe.email?
38
+ s.files = Dir['**/*']
39
+ s.license = 'MIT'
40
+ s.homepage = 'https://rubygems.org/gems/program_information'
41
+
42
+ s.required_ruby_version = '>= '+Roebe.third_most_stable_version_of_ruby
43
+ s.required_rubygems_version = '>= '+Gem::VERSION
44
+ s.rubygems_version = '>= '+Gem::VERSION
45
+
46
+ # ========================================================================= #
47
+ # Add the dependencies next:
48
+ # ========================================================================= #
49
+ s.add_dependency 'colours'
50
+ s.add_dependency 'remove_file_suffix'
51
+
52
+ }