program_information 1.2.6

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 (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 +165 -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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c2617208ef9fa70961acf4153a404c136f1b4364d64a12178037819909d5c35b
4
+ data.tar.gz: bbb7289a5306d918eaf85fc38de85e131527342c8ce0db83e43811f694175414
5
+ SHA512:
6
+ metadata.gz: fdf51dc3e64b3bbc4c32aef4ed0a4c0ed5e8c314025f288471d2df0649c106bfa8438ea91457d696c858723d94d4325419649fffaca8bfd6014ea9823e20d054
7
+ data.tar.gz: cc16f4e64ea82647d50e856e5d356576bce50c4ae884d4105b7a13cfbee281b6989969e6dc6b9ee98f802c70433b5deec14fa807dcd96eb3356f2ec08fd41801
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ [![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
2
+
3
+ ## Welcome to the ProgramInformation gem
4
+
5
+ <img src="https://i.imgur.com/q4VfoHv.png">
6
+
7
+ This is really a tiny gem. <b>Do one thing well.</b>
8
+
9
+ ## The two methods .first and .last
10
+
11
+ You can obtain the name of the program at hand, and the associated
12
+ version, like so:
13
+
14
+ require 'program_information'
15
+
16
+ x = ProgramInformation.new('ruby-2.5.0')
17
+ puts x.first
18
+ puts x.last
19
+
20
+ Note that other toplevel variants exist such as:
21
+
22
+ ProgramInformation.return_name()
23
+ ProgramInformation.return_version()
24
+
25
+ The idea here is to be as flexible as possible, so
26
+ that you can cherry-pick what you prefer.
27
+
28
+ ## Tests
29
+
30
+ The tests are stored mostly in the file
31
+ <b>array_test_with_this_as_input.rb</b>.
32
+
33
+ Not all tests may work perfectly well, but for the
34
+ most likely input it should work fine. So like
35
+ 98% of all use cases the gem should do well.
36
+
37
+
38
+ ## Contact information and mandatory 2FA (no longer) coming up in 2022 / 2023
39
+
40
+ If your creative mind has ideas and specific suggestions to make this gem
41
+ more useful in general, feel free to drop me an email at any time, via:
42
+
43
+ shevy@inbox.lt
44
+
45
+ Before that email I used an email account at Google gmail, but in **2021** I
46
+ decided to slowly abandon gmail, for various reasons. In order to limit the
47
+ explanation here, allow me to just briefly state that I do not feel as if I
48
+ want to promote any Google service anymore when the user becomes the end
49
+ product (such as via data collection by upstream services, including other
50
+ proxy-services). My feeling is that this is a hugely flawed business model
51
+ to begin with, and I no longer wish to support this in any way, even if
52
+ only indirectly so, such as by using services of companies that try to
53
+ promote this flawed model.
54
+
55
+ In regards to responding to emails: please keep in mind that responding
56
+ may take some time, depending on the amount of work I may have at that
57
+ moment. So it is not that emails are ignored; it is more that I have not
58
+ (yet) found the time to read and reply. This means there may be a delay
59
+ of days, weeks and in some instances also months. There is, unfortunately,
60
+ not much I can do when I need to prioritise my time investment, but I try
61
+ to consider <b>all</b> feedback as an opportunity to improve my projects
62
+ nonetheless.
63
+
64
+ In <b>2022</b> rubygems.org decided to make 2FA mandatory for every
65
+ gem owner eventually:
66
+
67
+ see
68
+ https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
69
+
70
+ However had, that has been reverted again, so I decided to shorten
71
+ this paragraph. Mandatory 2FA may exclude users who do not have a
72
+ smartphone device or other means to 'identify'. I do not feel it is
73
+ a fair assumption by others to be made that non-identified people may
74
+ not contribute code, which is why I reject it. Mandatory 2FA would mean
75
+ an end to all my projects on rubygems.org, so let's hope it will never
76
+ happen. (Keep in mind that I refer to mandatory 2FA; I have no qualms
77
+ for people who use 2FA on their own, but this carrot-and-stick strategy
78
+ by those who control the rubygems infrastructure is a very bad one to
79
+ pursue.
80
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'program_information'
6
+
7
+ if ARGV.first
8
+ ProgramInformation::ProgramInformation.new(ARGV).report(:be_verbose)
9
+ else # "Normal" tests here.
10
+ _ = ProgramInformation.parse 'http://downloads.sourceforge.net/boost/boost_1_54_0.tar.bz2'
11
+ p ProgramInformation.parse('http://downloads.sourceforge.net/boost/boost_1_54_0.tar.bz2', false)
12
+ end
13
+ # p _.original_program_name
14
+ # pii
@@ -0,0 +1,22 @@
1
+ Any given input can have three components:
2
+
3
+ (1) real_short_name
4
+ (2) short_name
5
+ (3) program_version
6
+
7
+ real_short_name depends on short_name. It simply is short_name with all
8
+ instances of the '_' character removed. It is thus a dependent variable.
9
+
10
+ The three numbers above also correspond to respective @instance_variables,
11
+ so in other words we have @real_short_name, @short_name and
12
+ @program_version.
13
+
14
+ The input passed to the main class may be "unclean". The class will try
15
+ # to get the "best" result out of any given input that was supplied, no
16
+ matter how unclean this input was.
17
+
18
+ It is recommended to use this class when wanting to determine the
19
+ short_name and the program version of any given program.
20
+
21
+ Note that short_name is allowed to include '-' characters whereas
22
+ real_short_name will strip '-' characters.
data/doc/README.gen ADDED
@@ -0,0 +1,37 @@
1
+ GOBOLINUX_IS_AWESOME
2
+
3
+ ## Welcome to the ProgramInformation gem
4
+
5
+ <img src="https://i.imgur.com/q4VfoHv.png">
6
+
7
+ This is really a tiny gem. <b>Do one thing well.</b>
8
+
9
+ ## The two methods .first and .last
10
+
11
+ You can obtain the name of the program at hand, and the associated
12
+ version, like so:
13
+
14
+ require 'program_information'
15
+
16
+ x = ProgramInformation.new('ruby-2.5.0')
17
+ puts x.first
18
+ puts x.last
19
+
20
+ Note that other toplevel variants exist such as:
21
+
22
+ ProgramInformation.return_name()
23
+ ProgramInformation.return_version()
24
+
25
+ The idea here is to be as flexible as possible, so
26
+ that you can cherry-pick what you prefer.
27
+
28
+ ## Tests
29
+
30
+ The tests are stored mostly in the file
31
+ <b>array_test_with_this_as_input.rb</b>.
32
+
33
+ Not all tests may work perfectly well, but for the
34
+ most likely input it should work fine. So like
35
+ 98% of all use cases the gem should do well.
36
+
37
+ ADD_MY_EMAIL
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # This is the input that can be used by the testing file.
6
+ # =========================================================================== #
7
+ # require 'program_information/constants/array_test_with_this_as_input.rb'
8
+ # =========================================================================== #
9
+ module ProgramInformation
10
+
11
+ require 'program_information/constants/regex.rb'
12
+ require 'program_information/toplevel_methods/return_proper_pipe_token_to_this_input.rb'
13
+
14
+ # ========================================================================= #
15
+ # === ProgramInformation::ARRAY_TEST_THIS_AS_INPUT
16
+ #
17
+ # The character '|' is not allowed to be part of any program name,
18
+ # so we wil use this as special token.
19
+ #
20
+ # We will insert it at the boundary level.
21
+ # ========================================================================= #
22
+ ARRAY_TEST_THIS_AS_INPUT = %w(
23
+ unieject-6
24
+ acl_2.2.47-1
25
+ ncbi_cxx-12_0_0
26
+ lynx-2.8.8-rel2
27
+ subtle-0.11.3224-xi
28
+ font-bitstream-75dpi-1.0.3
29
+ xf86-input-elographics-1.4.1
30
+ zope.interface-4.2.0
31
+ CrownCutlass-Alpha1.4
32
+ gobject-introspection-1.53.4
33
+ dvd+rw-tools-7.1
34
+ font-xfree86-type1-1.0.4
35
+ lshw-B.02.08.01
36
+ e_dbus-1.7.10
37
+ xf86-video-omap-0.4.2
38
+ at-spi2-core-2.19.2
39
+ xfce4-dev-tools-4.8.0
40
+ WebKit-r174650
41
+ akonadi-calendar-tools-17.08.1
42
+ Archive-Zip-1.46
43
+ did_you_mean-1.1.2
44
+ artemis_v16.0.11
45
+ chunky_png-1.3.8
46
+ libedit-20170329-3.1
47
+ font-adobe-utopia-type1-1.0.4
48
+ wpa_supplicant-2.6
49
+ dpkg_1.18.22
50
+ ncbi-blast-2.6.0+
51
+ ntfs-3g_ntfsprogs-2017.3.23
52
+ b43-fwcutter-015
53
+ wcd-6.0.1-beta3
54
+ xf86-video-i810-1.7.4
55
+ gnome-internet-radio-locator-0.9.0
56
+ SDL2_gfx-1.0.1
57
+ boost-1_54_0
58
+ boost_1_65_1.tar.bz2
59
+ boost_1_65_1
60
+ oxygen-icons5-5.37.0
61
+ artemis_v16.0.11.jar
62
+ mod_python_3.3.1
63
+ xfce4-statusnotifier-plugin-0.2.0
64
+ p7zip_16.02_src_all.tar.bz2
65
+ mime-types-data-3.2016.0521.gem
66
+ domain_name-0.5.20170404.gem
67
+ ftp://ftp.alsa-project.org/pub/plugins/alsa-plugins-1.0.29.tar.bz2
68
+ alsa-plugins-1.0.29.tar.bz2
69
+ alsa-plugins-1.0.29
70
+ libquvi-scripts-0.9.20131130
71
+ btrfs-progs-v4.13.2.tar.xz
72
+ btrfs-progs-v4.13.2
73
+ ImageMagick-7.0.7-7
74
+ Archive-Zip-1.46
75
+ loop-AES-v3.7d
76
+ boost-build-2014-10
77
+ openobex-1.7.1-Source
78
+ /Users/x/SRC/zope.interface/zope.interface-4.4.2.tar.gz
79
+ libatomic_ops-7.4.2.tar.gz
80
+ mod_python-11.10.2017
81
+ expect5.45.3
82
+ http://search.cpan.org/CPAN/authors/id/M/MA/MARKOV/XML-LibXML-Simple-0.98.tar.gz
83
+ https://rubygems.org/downloads/mini_portile2-2.3.0.gem
84
+ kismet-2016-07-R1.tar.xz
85
+ nana%201.5.4.zip
86
+ http://download.icu-project.org/files/icu4c/61.1/icu4c-61_1-src.tgz
87
+ XML-NamespaceSupport-1.09.tar.xz
88
+ XML-NamespaceSupport-1.09
89
+ icu4c-62_1
90
+ polkit-kde-agent-1-5.15.2
91
+ polkit-kde-agent-1-5.10.95
92
+ polkit-qt-1-0.112.0
93
+ xf86-video-amd-2.7.7.7
94
+ NVIDIA-Linux-x86-352.63.run
95
+ xf86-video-s3virge-1.11.0
96
+ youtube-dl-2019.06.27
97
+ dvd+rw-tools-7.1
98
+ SDL_Pango-0.1.2.tar.xz
99
+ )
100
+
101
+ end
102
+
103
+ if __FILE__ == $PROGRAM_NAME
104
+ require 'colours/autoinclude'
105
+ # ========================================================================= #
106
+ # This is colourized in more detail because it makes it easier to
107
+ # visualize what is going on, on the commandline.
108
+ # ========================================================================= #
109
+ ProgramInformation::ARRAY_TEST_THIS_AS_INPUT.each {|entry|
110
+ original_entry = entry.dup
111
+ entry = File.basename(entry)
112
+ entry = ProgramInformation.return_proper_pipe_token_to_this_input(entry)
113
+ use_sfancy_colour = Colours.colour_methods_to_specific_colour?[:sfancy]
114
+ e "#{simp(original_entry.ljust(38))}"\
115
+ " → "\
116
+ "#{sfancy(
117
+ entry.sub(/\|/, Colours.orange('|')+
118
+ Colours.send(use_sfancy_colour))
119
+ )}"
120
+ }
121
+ end
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ module ProgramInformation
6
+
7
+ class ProgramInformation
8
+
9
+ begin
10
+ require 'colours'
11
+ rescue LoadErrors; end
12
+
13
+ # ========================================================================= #
14
+ # === rev
15
+ # ========================================================================= #
16
+ def rev
17
+ Colours.rev
18
+ end
19
+
20
+ # ========================================================================= #
21
+ # === COLOUR_FOR_REVERT
22
+ # ========================================================================= #
23
+ COLOUR_FOR_REVERT = Colours::WHITE # WHITE is defined in the colours project.
24
+
25
+ # ========================================================================= #
26
+ # === APOSTROPH
27
+ # ========================================================================= #
28
+ APOSTROPH = Colours::TEAL+'`'+COLOUR_FOR_REVERT # +Colours.rev
29
+
30
+ # ========================================================================= #
31
+ # === NAME_OF_CLASS
32
+ # ========================================================================= #
33
+ NAME_OF_CLASS = Colours::CGREY+'ProgramInformation:'+COLOUR_FOR_REVERT
34
+
35
+ # ========================================================================= #
36
+ # === yellow?
37
+ # ========================================================================= #
38
+ def yellow?
39
+ Colours::BOLD_YELLOW
40
+ end
41
+
42
+ end; end
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/constants/constants.rb'
6
+ # =========================================================================== #
7
+ require 'program_information/constants/regex.rb'
8
+ require 'program_information/constants/colours.rb'
9
+
10
+ module ProgramInformation
11
+
12
+ class ProgramInformation
13
+
14
+ # ========================================================================= #
15
+ # === SHALL_WE_DOWNCASE
16
+ #
17
+ # So that input such as "Libgnome" can become "libgnome".
18
+ # ========================================================================= #
19
+ SHALL_WE_DOWNCASE = false
20
+
21
+ # ========================================================================= #
22
+ # === REMOVE_PLUS_AND_MINUS
23
+ #
24
+ # If true then we will remove plus '+' and minus '-' from the program name.
25
+ # ========================================================================= #
26
+ REMOVE_PLUS_AND_MINUS = false
27
+
28
+ # ========================================================================= #
29
+ # === REPLACE_PLUS_WITH_LONG_NAME
30
+ #
31
+ # If this constant is true then we will replace all '+' with the
32
+ # string 'plus' as part of the issued name. Note that remove-actions
33
+ # are stronger, so if the constant REMOVE_PLUS_AND_MINUS was also
34
+ # set to true, then the constant here will not be honoured at all.
35
+ # ========================================================================= #
36
+ REPLACE_PLUS_WITH_LONG_NAME = false
37
+
38
+ # ========================================================================= #
39
+ # === REMOVE_PLUS_TOKEN
40
+ #
41
+ # If this constant is true then we will eliminate '+' in the input.
42
+ #
43
+ # This overrules the replace-constant called REPLACE_PLUS_WITH_LONG_NAME.
44
+ #
45
+ # Also note that if the constant REMOVE_PLUS_AND_MINUS is set to true
46
+ # then this setting here will always be set to false.
47
+ # ========================================================================= #
48
+ REMOVE_PLUS_TOKEN = false
49
+
50
+ # ========================================================================= #
51
+ # === BE_VERBOSE
52
+ # ========================================================================= #
53
+ BE_VERBOSE = false
54
+
55
+ end; end
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/constants/regex.rb'
6
+ # =========================================================================== #
7
+ module ProgramInformation
8
+
9
+ # ========================================================================= #
10
+ # === REGEX_FOR_TWO_HYPHENS
11
+ #
12
+ # This is valid for input such as 'lynx-2.8.8-rel2' or
13
+ # 'gobject-introspection-1.53.4' or 'subtle-0.11.3224-xi' or
14
+ # 'dvd+rw-tools-7.1' or 'Archive-Zip-1.46' or 'btrfs-progs-v4.12.1'
15
+ # or 'color-tools-1.3.0' or 'libedit-20170329-3.1' or
16
+ # 'ncbi-blast-2.6.0+' or 'b43-fwcutter-015' or 'wcd-6.0.1-beta3'
17
+ # or 'oxygen-icons5-5.37.0' or 'btrfs-progs-v4.13.2' or
18
+ # 'Archive-Zip-1.46' or 'wcd-6.0.1-beta3' or 'openobex-1.7.1-Source'
19
+ # or 'youtube-dl-2019.06.27'.
20
+ #
21
+ # See:
22
+ #
23
+ # https://rubular.com/r/u9Yy3qcxrlp5uG
24
+ #
25
+ # ========================================================================= #
26
+ REGEX_FOR_TWO_HYPHENS =
27
+ /([A-Za-z+]{0,12}-?[a-z0-9]{0,9}-?[A-Za-z]{0,14}\d{0,4}-?[A-Za-z0-9]{0,12})-(\d{0,2}\.?[a-z]{0,1}\d{0,2}\.?[a-z]{0,1}\d{0,4}[.|-]?\d{0,8}[A-Za-z]{0,9}\d?\+?)$/
28
+
29
+ # ========================================================================= #
30
+ # === REGEX_FOR_THREE_OR_MORE_HYPHENS
31
+ #
32
+ # This is for input such as 'akonadi-calendar-tools-17.08.1' or
33
+ # 'boost-build-2014-10' or 'xf86-video-i810-1.7.4' or
34
+ # or 'xfce4-statusnotifier-plugin-0.2.0' or 'mime-types-data-3.2016.0521'
35
+ # or 'XML-LibXML-Simple-0.98' or 'kismet-2016-07-R1.tar.xz' or
36
+ # 'polkit-kde-agent-1-5.15.2' or 'xf86-video-amd-2.7.7.7'
37
+ # or 'xf86-video-s3virge-1.11.0'.
38
+ #
39
+ # See: https://rubular.com/r/lCrdU01HE7MRV4
40
+ # ========================================================================= #
41
+ REGEX_FOR_THREE_OR_MORE_HYPHENS =
42
+ /^([A-Za-z]{0,9}\d{0,2}-?[A-Za-z]{0,12}\d{0,2}-?[a-z]{0,9}\d{0,1}-?[A-Za-z]{0,8}-?1?\d{0,3}[a-z]{0,3})-(\d{0,4}\.?\d{0,4}\.?-?[A-Z]{0,1}\d{0,4}\.?\d{0,4})$/
43
+
44
+ # ========================================================================= #
45
+ # === REGEX_FOR_INPUT_HAVING_ONLY_DOTS
46
+ #
47
+ # This is valid for strange input such as 'expect5.45.3' or
48
+ # 'sendmail.8.15.2'. These have no '-' and no '_'.
49
+ #
50
+ # See: https://rubular.com/r/KVePR7ShX3
51
+ # ========================================================================= #
52
+ REGEX_FOR_INPUT_HAVING_ONLY_DOTS =
53
+ /([a-z]{1,10})\.?(\d+\.?\d{1,2}\.?\d{0,2})/
54
+
55
+ # ========================================================================= #
56
+ # === REGEX_FOR_BOOST_LIKE_INPUT
57
+ #
58
+ # Valid input should be 'ncbi_cxx-12_0_0' or 'icu4c-61_1'.
59
+ #
60
+ # See: https://rubular.com/r/CyNqJbCMR2
61
+ # ========================================================================= #
62
+ REGEX_FOR_BOOST_LIKE_INPUT =
63
+ /([a-z]{0,3}\d{0,1}[a-z]{0,5}_?[a-z]{0,3})([-|_]{1})(\d{1,2}_\d{1,2}_?\d*)/
64
+
65
+ # ========================================================================= #
66
+ # === REGEX_FOR_ACL_LIKE_INPUT
67
+ #
68
+ # Valid input should be 'acl_2.2.47-1' or 'e_dbus-1.7.10' or
69
+ # 'wpa_supplicant-2.6' or 'SDL2_gfx-1.0.1' or 'libatomic_ops-7.4.2'
70
+ # or 'mod_python-11.10.2017' or 'mini_portile2-2.3.0.gem'.
71
+ #
72
+ # See: https://rubular.com/r/gLysRUCwPNGAe1
73
+ # ========================================================================= #
74
+ REGEX_FOR_ACL_LIKE_INPUT =
75
+ /([A-Za-z]{0,10}[0-9]{0,1}_?[0-9]{0,1}[A-Za-z]{1,12}[0-9]{0,1})(_|-)([0-9]{0,2}\.?[0-9]{0,2}\.?[0-9]{0,2}-?[0-9]{0,2}_?[0-9]{0,4})/
76
+
77
+ # ========================================================================= #
78
+ # === REGEX_FOR_INPUT_CONTAINING_TWO_HYPHENS_AND_ONE_UNDERSCORE
79
+ #
80
+ # This is input for programs such as 'ntfs-3g_ntfsprogs-2017.3.23'.
81
+ #
82
+ # See: https://rubular.com/r/15pAuHKxt5
83
+ # ========================================================================= #
84
+ REGEX_FOR_INPUT_CONTAINING_TWO_HYPHENS_AND_ONE_UNDERSCORE =
85
+ /([a-z]{1}.+)(-)(\d{1,4}\.\d\.\d{1,2})/
86
+
87
+ end
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ module ProgramInformation
6
+
7
+ class ProgramInformation # === ProgramInformation::ProgramInformation
8
+
9
+ # ========================================================================= #
10
+ # === initialize
11
+ #
12
+ # Specific usage example:
13
+ #
14
+ # ProgramInformation::ProgramInformation.new('util-linux-ng-2.15')
15
+ #
16
+ # ========================================================================= #
17
+ def initialize(
18
+ i = ARGV,
19
+ run_already = true,
20
+ optional_be_verbose = false
21
+ )
22
+ reset
23
+ set_input(i)
24
+ if optional_be_verbose
25
+ set_be_verbose(optional_be_verbose)
26
+ end
27
+ case run_already
28
+ # ======================================================================= #
29
+ # === :do_run_already
30
+ # ======================================================================= #
31
+ when :do_run_already
32
+ run_already = true
33
+ # ======================================================================= #
34
+ # === :dont_run_already
35
+ # ======================================================================= #
36
+ when :dont_run_already,
37
+ :do_not_run_already
38
+ run_already = false
39
+ end
40
+ run if run_already
41
+ end
42
+
43
+ end; end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'program_information/menu.rb'
6
+ # =========================================================================== #
7
+ module ProgramInformation
8
+
9
+ class ProgramInformation # === ProgramInformation::ProgramInformation
10
+
11
+ # ========================================================================= #
12
+ # === menu (menu tag)
13
+ # ========================================================================= #
14
+ def menu(i)
15
+ if i.is_a? Array
16
+ i.each {|entry| menu(entry) }
17
+ else
18
+ case i
19
+ # ===================================================================== #
20
+ # === help
21
+ # ===================================================================== #
22
+ when /-?-?help$/i
23
+ show_help
24
+ exit
25
+ end
26
+ end
27
+ end
28
+
29
+ end; end