roebe 0.5.191 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +23 -26
  3. data/bin/create_my_directories +2 -2
  4. data/bin/{ruby_dhcpcd → dhcpcd_wrapper} +1 -1
  5. data/doc/README.gen +12 -0
  6. data/doc/core/array.md +24 -23
  7. data/doc/core/gem_and_gemspec.md +12 -11
  8. data/doc/core/misc.md +23 -20
  9. data/doc/statistics/statistics.md +1 -0
  10. data/lib/roebe/actions/actions.rb +68 -0
  11. data/lib/roebe/base/misc.rb +14 -1
  12. data/lib/roebe/browser/output_url_then_open_in_browser.rb +8 -6
  13. data/lib/roebe/classes/alltagsgeschichte.rb +1 -1
  14. data/lib/roebe/classes/at.rb +2 -2
  15. data/lib/roebe/classes/auto_rename_file_based_on_its_creation_date.rb +24 -12
  16. data/lib/roebe/classes/books/books.rb +159 -117
  17. data/lib/roebe/classes/books/menu.rb +8 -7
  18. data/lib/roebe/classes/books/sanitize_this_book_path/sanitize_this_book_path.rb +0 -1
  19. data/lib/roebe/classes/check_yaml.rb +15 -11
  20. data/lib/roebe/classes/compile_kernel.rb +3 -1
  21. data/lib/roebe/classes/copy_kernel_config.rb +5 -3
  22. data/lib/roebe/classes/create_desktop_file.rb +1 -1
  23. data/lib/roebe/classes/create_my_directories.rb +12 -10
  24. data/lib/roebe/classes/dhcpcd/{dhcpcd.rb → dhcpcd_wrapper.rb} +137 -95
  25. data/lib/roebe/classes/dhcpcd/kill_dhcpcd.rb +2 -2
  26. data/lib/roebe/classes/do_install.rb +7 -6
  27. data/lib/roebe/classes/done.rb +1 -1
  28. data/lib/roebe/classes/downcase_extension.rb +4 -4
  29. data/lib/roebe/classes/email.rb +44 -40
  30. data/lib/roebe/classes/enable.rb +1 -1
  31. data/lib/roebe/classes/github.rb +1 -1
  32. data/lib/roebe/classes/kde/install_this_konsole_theme.rb +1 -1
  33. data/lib/roebe/classes/make_gem.rb +29 -27
  34. data/lib/roebe/classes/readme_generator/readme_generator.rb +597 -1
  35. data/lib/roebe/classes/report_how_many_files_are_in_this_directory.rb +83 -0
  36. data/lib/roebe/classes/set_background.rb +14 -0
  37. data/lib/roebe/classes/show_ten_aliases.rb +15 -3
  38. data/lib/roebe/classes/tales_from_the_crypt.rb +1 -1
  39. data/lib/roebe/classes/update.rb +2 -1
  40. data/lib/roebe/constants/array_install_these_gem_projects.rb +1 -1
  41. data/lib/roebe/constants/roebe.rb +2 -0
  42. data/lib/roebe/custom_methods/module.rb +16 -0
  43. data/lib/roebe/fonts/fonts.rb +39 -0
  44. data/lib/roebe/hello_world/hello_world.rb +0 -0
  45. data/lib/roebe/math/log10.rb +3 -3
  46. data/lib/roebe/math/the_collatz_problem.rb +104 -0
  47. data/lib/roebe/shell/shell/shell.rb +6 -6
  48. data/lib/roebe/shell_scripts/lfs/002_gcc_1.sh +13 -1
  49. data/lib/roebe/shell_scripts/lfs/003_linux_1.sh +1 -0
  50. data/lib/roebe/shell_scripts/lfs/007_ncurses_2.sh +4 -1
  51. data/lib/roebe/shell_scripts/lfs/020_xz_2.sh +5 -5
  52. data/lib/roebe/shell_scripts/lfs/021_binutils_2.sh +1 -0
  53. data/lib/roebe/shell_scripts/lfs/022_gcc_2.sh +12 -1
  54. data/lib/roebe/shell_scripts/lfs/025_ruby_2.sh +13 -0
  55. data/lib/roebe/shell_scripts/lfs/lfs_build_variables.sh +48 -8
  56. data/lib/roebe/toplevel_methods/to_mp3.rb +1 -1
  57. data/lib/roebe/version/version.rb +2 -2
  58. data/lib/roebe/wasm/README.md +7 -0
  59. data/lib/roebe/wasm/enable_simple_puts_output.rb +9 -0
  60. data/lib/roebe/wasm/wasm_examples.html +43 -0
  61. data/lib/roebe/www/RNA/RNA.cgi +42 -1
  62. data/lib/roebe/www/algorithms/algorithms.rb +22 -0
  63. data/lib/roebe/www/analytical_chemistry/content.md +3 -0
  64. data/lib/roebe/www/animals/animals.cgi +25 -0
  65. data/lib/roebe/www/bioanalytik/bioanalytik.cgi +90 -0
  66. data/lib/roebe/www/cellbiology/cellbiology.rb +16 -2
  67. data/lib/roebe/www/chemistry/S/303/244uren_Basen_und_der_pH_Wert/S/303/244uren_Basen_und_der_pH_Wert.cgi +242 -0
  68. data/lib/roebe/www/chemistry/chemistry.rb +10 -258
  69. data/lib/roebe/www/chemistry/css_rules.css +67 -0
  70. data/lib/roebe/www/chemistry/die_quantenzahlen/die_quantenzahlen.cgi +123 -0
  71. data/lib/roebe/www/chemistry/funktionelle_gruppen_in_der_chemie/funktionelle_gruppen_in_der_chemie.cgi +52 -0
  72. data/lib/roebe/www/erste_hilfe/erste_hilfe.cgi +212 -62
  73. data/lib/roebe/www/fonts/fonts.cgi +245 -0
  74. data/lib/roebe/www/hardware/computersysteme/computersysteme.rb +117 -102
  75. data/lib/roebe/www/hardware/netzteile/netzteile.cgi +94 -0
  76. data/lib/roebe/www/immunology/immunology.rb +101 -7
  77. data/lib/roebe/www/linux/antiX/antiX.rb +7 -4
  78. data/lib/roebe/www/linux/linux.rb +9 -11
  79. data/lib/roebe/www/linux/linuxmint/linuxmint.rb +33 -0
  80. data/lib/roebe/www/linux/slackware/slackware.rb +136 -27
  81. data/lib/roebe/www/lyrics/lyrics.rb +1 -1
  82. data/lib/roebe/www/microbiology/microbiology.rb +17 -2
  83. data/lib/roebe/www/mikrobielle_physiologie/mikrobielle_physiologie.cgi +1086 -2
  84. data/lib/roebe/www/mitochondria/mitochondria.cgi +16 -2
  85. data/lib/roebe/www/module_www.rb +2 -3
  86. data/lib/roebe/www/neurobiology/neurobiology.rb +20 -3
  87. data/lib/roebe/www/pdf/pdf.rb +13 -0
  88. data/lib/roebe/www/physics/physics.rb +20 -4
  89. data/lib/roebe/www/physiology/physiology.rb +5 -1
  90. data/lib/roebe/www/play_this_video_file/play_this_video_file.cgi +1 -1
  91. data/lib/roebe/www/programming_advice/programming_advice.cgi +36 -0
  92. data/lib/roebe/www/programming_advice/programming_advice.md +349 -0
  93. data/lib/roebe/www/psychologie/psychologie.rb +7 -1
  94. data/lib/roebe/www/science/science.rb +6 -0
  95. data/lib/roebe/www/sex_and_reproduction/sex_and_reproduction.cgi +18 -2
  96. data/lib/roebe/www/structural_biology/structural_biology.cgi +16 -0
  97. data/lib/roebe/www/the_cell_cycle/the_cell_cycle.cgi +27 -0
  98. data/lib/roebe/www/video/video.rb +1 -1
  99. data/lib/roebe/www/virology/virology.rb +12 -1
  100. data/lib/roebe/www/war_in_Ukraine_2022/war_in_Ukraine_2022.rb +26 -8
  101. data/lib/roebe/www/xorg/xorg.rb +3 -202
  102. data/lib/roebe/yaml/books/favourite_books.yml +6 -8
  103. data/lib/roebe/yaml/directory_structure.yml +1 -0
  104. metadata +26 -15
  105. data/lib/roebe/classes/readme_generator/constants.rb +0 -21
  106. data/lib/roebe/classes/readme_generator/initialize.rb +0 -38
  107. data/lib/roebe/classes/readme_generator/misc.rb +0 -548
  108. data/lib/roebe/classes/readme_generator/reset.rb +0 -28
  109. data/lib/roebe/classes/readme_generator/run.rb +0 -20
  110. data/lib/roebe/shell_scripts/lfs/lfs_variables.sh +0 -31
  111. data/lib/roebe/www/mikrobielle_physiologie/mikrobielle_physiologie.rb +0 -1055
  112. data/lib/roebe/www/programming_advice/programming_advice.yml +0 -31
@@ -154,7 +154,7 @@ class MakeGem < Base # === Roebe::MakeGem
154
154
  # ===================================================================== #
155
155
  # (4) We will also publish the gem at once next.
156
156
  # ===================================================================== #
157
- e 'We will also automatically publish this gem at once.'
157
+ e "#{rev}We will also automatically publish this gem at once."
158
158
  e "#{rev}This is "+orange('necessary')+rev+' so that we can '\
159
159
  'restore the old file called'
160
160
  e "#{sfile('lecture_information')} #{rev}again."
@@ -209,32 +209,6 @@ class MakeGem < Base # === Roebe::MakeGem
209
209
  esystem 'gem build *.gemspec'
210
210
  end
211
211
 
212
- # ========================================================================= #
213
- # === prepare_the_gem_for_the_rbt_project
214
- #
215
- # This method will publish the rbt project.
216
- # ========================================================================= #
217
- def prepare_the_gem_for_the_rbt_project
218
- return unless @may_we_prepare_the_gem_for_the_rbt_project
219
- if is_on_roebe?
220
- require 'rbt/version/version.rb'
221
- rename_kde_konsole_tab(
222
- "Updating RBT to Version #{RBT.version?}",
223
- :be_quiet
224
- )
225
- end
226
- require 'rbt'
227
- e orange('(1) RBT.save_the_available_programs_versions:')
228
- if RBT.respond_to? :save_the_available_programs_versions
229
- RBT.save_the_available_programs_versions
230
- else
231
- e "#{rev}RBT.save_the_available_programs_versions does not work."
232
- end
233
- if is_on_roebe?
234
- rename_kde_konsole_tab('', :be_quiet)
235
- end
236
- end
237
-
238
212
  # ========================================================================= #
239
213
  # === check_for_readme_gen
240
214
  #
@@ -262,6 +236,34 @@ class MakeGem < Base # === Roebe::MakeGem
262
236
  end
263
237
  end
264
238
 
239
+ # ========================================================================= #
240
+ # === prepare_the_gem_for_the_rbt_project
241
+ #
242
+ # This method will publish the rbt project.
243
+ # ========================================================================= #
244
+ def prepare_the_gem_for_the_rbt_project
245
+ return unless @may_we_prepare_the_gem_for_the_rbt_project
246
+ if is_on_roebe?
247
+ require 'rbt/requires/require_actions.rb'
248
+ require 'rbt/version/version.rb'
249
+ rename_kde_konsole_tab(
250
+ "Updating RBT to Version #{RBT.version?}",
251
+ :be_quiet
252
+ )
253
+ end
254
+ require 'rbt'
255
+ RBT.action(:save_available_programs)
256
+ e orange('(1) RBT.save_the_available_programs_versions:')
257
+ if RBT.respond_to? :save_the_available_programs_versions
258
+ RBT.save_the_available_programs_versions
259
+ else
260
+ e "#{rev}RBT.save_the_available_programs_versions does not work."
261
+ end
262
+ if is_on_roebe?
263
+ rename_kde_konsole_tab('', :be_quiet)
264
+ end
265
+ end
266
+
265
267
  # ========================================================================= #
266
268
  # === run (run tag)
267
269
  # ========================================================================= #
@@ -2,9 +2,605 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
+ # === Roebe::ReadmeGenerator
6
+ #
7
+ # This class can be used to generate a README.md file. Input-templates
8
+ # can also be used, such as README.gen. From such a template file, we
9
+ # can autogenerate a README file.
10
+ #
11
+ # Usage example:
12
+ #
13
+ # Roebe::ReadmeGenerator.new(ARGV)
14
+ #
15
+ # =========================================================================== #
5
16
  # require 'roebe/classes/readme_generator/readme_generator.rb'
6
17
  # =========================================================================== #
7
- require 'roebe/classes/readme_generator/misc.rb'
18
+ require 'roebe/base/base.rb'
19
+
20
+ module Roebe
21
+
22
+ class ReadmeGenerator < Base # === Roebe::ReadmeGenerator
23
+
24
+ # ========================================================================= #
25
+ # === FILE_DOC_README_GEN
26
+ # ========================================================================= #
27
+ FILE_DOC_README_GEN = 'doc/README.gen'
28
+
29
+ # ========================================================================= #
30
+ # === NAME_OF_THE_FILE_THAT_IS_AUTOGENERATED
31
+ # ========================================================================= #
32
+ NAME_OF_THE_FILE_THAT_IS_AUTOGENERATED = 'README.md'
33
+
34
+ # ========================================================================= #
35
+ # === initialize
36
+ # ========================================================================= #
37
+ def initialize(
38
+ input_gen_file = FILE_DOC_README_GEN,
39
+ run_already = true
40
+ )
41
+ reset
42
+ set_input_gen_file(input_gen_file)
43
+ # ======================================================================= #
44
+ # === Handle blocks next
45
+ # ======================================================================= #
46
+ if block_given?
47
+ yielded = yield
48
+ case yielded
49
+ # ===================================================================== #
50
+ # === :do_not_open_in_the_browser
51
+ # ===================================================================== #
52
+ when :do_not_open_in_the_browser
53
+ @internal_hash[:open_in_browser] = false
54
+ end
55
+ end
56
+ run if run_already
57
+ end
58
+
59
+ # ========================================================================= #
60
+ # === reset (reset tag)
61
+ # ========================================================================= #
62
+ def reset
63
+ super()
64
+ infer_the_namespace
65
+ try_to_require_the_open_gem
66
+ # ======================================================================= #
67
+ # === :open_in_browser
68
+ # ======================================================================= #
69
+ @internal_hash[:open_in_browser] = true
70
+ # ======================================================================= #
71
+ # === @_
72
+ # ======================================================================= #
73
+ @_ = ''.dup
74
+ end
75
+
76
+ # ========================================================================= #
77
+ # === main_file?
78
+ # ========================================================================= #
79
+ def main_file?
80
+ NAME_OF_THE_FILE_THAT_IS_AUTOGENERATED
81
+ end
82
+
83
+ # ========================================================================= #
84
+ # === set_input_gen_file
85
+ # ========================================================================= #
86
+ def set_input_gen_file(
87
+ i = FILE_DOC_README_GEN
88
+ )
89
+ i = i.first if i.is_a? Array
90
+ i = i.to_s.dup
91
+ if i.empty?
92
+ i = FILE_DOC_README_GEN
93
+ end
94
+ # ======================================================================= #
95
+ # Next, quickly see whether a file called "README.gen" exists in
96
+ # the current directory but not at e. g. doc/README.gen. In this
97
+ # case we will use that file instead.
98
+ # ======================================================================= #
99
+ if File.exist?('README.gen') and !File.exist?(i)
100
+ i = 'README.gen'
101
+ end
102
+ @input_gen_file = i
103
+ end
104
+
105
+ # ========================================================================= #
106
+ # === input_gen_file?
107
+ # ========================================================================= #
108
+ def input_gen_file?
109
+ @input_gen_file
110
+ end; alias gen_file? input_gen_file? # === gen_file?
111
+
112
+ # ========================================================================= #
113
+ # === try_to_embed_this_file
114
+ # ========================================================================= #
115
+ def try_to_embed_this_file(this_file)
116
+ # ======================================================================= #
117
+ # Turn it into an absolute path for now.
118
+ # ======================================================================= #
119
+ this_file = File.absolute_path(this_file)
120
+ if File.exist? this_file
121
+ # ===================================================================== #
122
+ # Read in the file then.
123
+ # ===================================================================== #
124
+ opne "Reading in the content of the file `#{sfile(this_file)}`."
125
+ add(
126
+ N+'<pre>'+N+File.read(this_file)+N+'</pre>'+N
127
+ )
128
+ else
129
+ opne "No file called #{sfile(this_file)} exists."
130
+ end
131
+ end
132
+
133
+ # ========================================================================= #
134
+ # === add_text_for_the_donate_macro
135
+ #
136
+ # This is the text that will be added for the donation-macro in a
137
+ # README.gen file.
138
+ # ========================================================================= #
139
+ def add_text_for_the_donate_macro
140
+ add('Currently this project does not accept donations, but')
141
+ add('in the future this may be subject to change, including')
142
+ add('more information in how folks could support the project,')
143
+ add('if they would like to.')
144
+ add
145
+ add('Of course **documentation**, **patches**, **bug fixes** and so')
146
+ add('forth are **always** appreciated.')
147
+ end
148
+
149
+ # ========================================================================= #
150
+ # === open_in_browser
151
+ # ========================================================================= #
152
+ def open_in_browser(i)
153
+ if File.exist?(i) and !(File.size(i) == 0)
154
+ Open.in_browser(i) if Object.const_defined? :Open
155
+ else
156
+ opne "No file exists at `#{sfile(i)}` - or "\
157
+ "has a file size larger than 0."
158
+ end
159
+ end
160
+
161
+ # ========================================================================= #
162
+ # === store_the_string
163
+ # ========================================================================= #
164
+ def store_the_string
165
+ what = @_
166
+ into = main_file?
167
+ opne 'Storing the dataset into the file `'+sfile(into)+'`.'
168
+ write_what_into(what, into)
169
+ end
170
+
171
+ # ========================================================================= #
172
+ # === return_name_of_the_project
173
+ #
174
+ # This method will return the name of the project at hand. Note that
175
+ # this functionality depends on guessing the directory name, so
176
+ # we need to have cd-ed to the correct directory prior to making
177
+ # use of this method here.
178
+ # ========================================================================= #
179
+ def return_name_of_the_project
180
+ File.basename(Dir.pwd)
181
+ end
182
+
183
+ # ========================================================================= #
184
+ # === try_to_add_the_content_of_this_file
185
+ #
186
+ # This method will try to add the file-content of an existing file,
187
+ # into the newly generated README.md file.
188
+ # ========================================================================= #
189
+ def try_to_add_the_content_of_this_file(this_file)
190
+ if File.exist? this_file
191
+ # ===================================================================== #
192
+ # Read in the file then.
193
+ # ===================================================================== #
194
+ opne "Reading in the content of the file `#{sfile(this_file)}`."
195
+ add(File.read(this_file))
196
+ else
197
+ e
198
+ opne crimson("No file called #{sfile(this_file)} exists.")
199
+ e
200
+ if is_on_roebe?
201
+ e 'Please fix the above error first.'
202
+ # =================================================================== #
203
+ # And using zenity to fix that, too.
204
+ # =================================================================== #
205
+ esystem "zenity --list --column='#{this_file}'"
206
+ end
207
+ end
208
+ end
209
+
210
+ # ========================================================================= #
211
+ # === generate_html_file_via_kramdown
212
+ # ========================================================================= #
213
+ def generate_html_file_via_kramdown
214
+ store_here = '/Depot/Information/foobar.html'
215
+ if File.exist? main_file?
216
+ _ = "kramdown #{main_file?} > #{store_here}"
217
+ esystem _
218
+ if File.exist? store_here
219
+ open_in_browser(store_here) if open_in_browser?
220
+ end
221
+ else
222
+ opne "No file exists at #{sfile(main_file?)}#{rev} "\
223
+ "- thus, kramdown can not be used."
224
+ if is_on_roebe?
225
+ opne 'This is a problem on my home system, as I tend to generate'
226
+ opne 'readme files. Hence, we will now exit, and hope that the'
227
+ opne 'problem will be corrected by roebe.'
228
+ end
229
+ end
230
+ end
231
+
232
+ # ========================================================================= #
233
+ # === open_in_browser?
234
+ # ========================================================================= #
235
+ def open_in_browser?
236
+ @internal_hash[:open_in_browser]
237
+ end
238
+
239
+ # ========================================================================= #
240
+ # === add_string_showing_the_last_updated_programs
241
+ #
242
+ # Note that we will modify this String by replacing all
243
+ # newlines via HTML <br> tags.
244
+ # ========================================================================= #
245
+ def add_string_showing_the_last_updated_programs
246
+ require 'rbt/toplevel_methods/toplevel_methods.rb'
247
+ begin
248
+ add(
249
+ RBT.return_string_showing_the_last_updated_programs.
250
+ gsub("\n","<br>\n")
251
+ )
252
+ rescue Exception => error
253
+ pp error
254
+ end
255
+ if is_on_roebe?
256
+ # ===================================================================== #
257
+ # Also remove the file if it exists.
258
+ # ===================================================================== #
259
+ begin
260
+ require 'rbt/toplevel_methods/files_and_directories_related_methods.rb'
261
+ rescue LoadError => error; pp error; end
262
+ this_file = "#{RBT.log_dir?}these_programs_were_updated_copy.yml"
263
+ if File.exist? this_file
264
+ remove_file(this_file)
265
+ this_file = "/home/x/programming/ruby/src/rbt/lib/rbt/yaml/these_programs_were_updated_copy.yml"
266
+ if File.exist?(this_file)
267
+ remove_file(this_file)
268
+ end
269
+ else
270
+ e rev+'Can not remove file '+sfile(this_file)+
271
+ rev+' because it does not exist.'
272
+ end
273
+ end
274
+ end
275
+
276
+ # ========================================================================= #
277
+ # === add (add tag)
278
+ # ========================================================================= #
279
+ def add(i = '')
280
+ i = i.join(N) if i.is_a? Array
281
+ @_ << "#{i}#{N}"
282
+ end
283
+
284
+ # ========================================================================= #
285
+ # === add_badge (badge tag)
286
+ #
287
+ # This will add the two main badges that I usually use in ruby projects.
288
+ #
289
+ # The first badge, to the left, is a link to the distribution called
290
+ # GoboLinux; the second badge, to the right of it, is a link to the
291
+ # official ruby-lang site.
292
+ #
293
+ # Note that since as of August 2019, a third badge will be shown -
294
+ # the badge that tags the gem-version onto the markdown file. This
295
+ # badge is special in that we need to attach the name of the project
296
+ # at hand.
297
+ # ========================================================================= #
298
+ def add_badge
299
+ homepage2 = 'https://www.ruby-lang.org/en/'.dup
300
+ name_of_the_project = return_name_of_the_project
301
+ add_gobolinux_badge
302
+ @_ << "[![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](#{homepage2})#{N}"
303
+ # ======================================================================= #
304
+ # Next add the gem-version to the ruby-project at hand:
305
+ # ======================================================================= #
306
+ @_ << '[![Gem Version](https://badge.fury.io/rb/'+name_of_the_project+'.svg)](https://badge.fury.io/rb/'+name_of_the_project+')'+N
307
+ end; alias add_ruby_badge add_badge # === add_ruby_badge
308
+
309
+ # ========================================================================= #
310
+ # === add_gobolinux_badge
311
+ # ========================================================================= #
312
+ def add_gobolinux_badge(
313
+ homepage = 'https://www.gobolinux.org/'
314
+ )
315
+ @_ << "[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](#{homepage})#{N}"
316
+ end; alias add_gobolinux_logo add_gobolinux_badge # === add_gobolinux_logo
317
+
318
+ # ========================================================================= #
319
+ # === add_environment_information_properly_formatted_array
320
+ # ========================================================================= #
321
+ def add_environment_information_properly_formatted_array
322
+ require 'environment_information/constants/array_tracked_components.rb'
323
+ EnvironmentInformation::ARRAY_TRACKED_PROGRAMS.each {|entry|
324
+ @_ << " #{entry}\n"
325
+ }
326
+ @_ << "\n"
327
+ end
328
+
329
+ # ========================================================================= #
330
+ # === add_time_stamp
331
+ #
332
+ # Add information to the README when this gem was last updated.
333
+ # ========================================================================= #
334
+ def add_time_stamp
335
+ add(
336
+ "\nThis gem was <b>last updated</b> on the "\
337
+ "<span style=\"color: darkblue; font-weight: bold\">#{dd_mm_yyyy}</span> "\
338
+ "(dd.mm.yyyy notation), at "\
339
+ "<span style=\"color: steelblue; font-weight: bold\">#{hh_mm_ss}</span> o'clock."
340
+ )
341
+ end
342
+
343
+ # ========================================================================= #
344
+ # === read_dataset_from_gen_file
345
+ # ========================================================================= #
346
+ def read_dataset_from_gen_file
347
+ _ = gen_file?
348
+ if File.exist? _
349
+ readlines_with_proper_encoding(_).each {|line|
350
+ line.chomp!
351
+ # =================================================================== #
352
+ # Process each line next.
353
+ # =================================================================== #
354
+ case line # case tag
355
+ # =================================================================== #
356
+ # === Handle files that begin with MACRO
357
+ #
358
+ # Several "aliases" exist to this entry point, such as
359
+ # INCLUDE_THIS_FILE or EMBED_THIS_FILE.
360
+ #
361
+ # Keep in mind that the file at hand should, ideally, exist. :)
362
+ # =================================================================== #
363
+ when /^MACRO read_file_as_pre_tag (.+)$/,
364
+ /^INCLUDE_THIS_FILE (.+)$/,
365
+ /^EMBED_THIS_FILE (.+)$/,
366
+ /^READ_AND_DISPLAY_THIS_FILE (.+)$/,
367
+ /^DISPLAY_THIS_FILE (.+)$/
368
+ this_file = $1.to_s.dup
369
+ try_to_embed_this_file(this_file)
370
+ # =================================================================== #
371
+ # === Add the default ruby header
372
+ # =================================================================== #
373
+ when /^RUBY_BADGE_AND_TIME_STAMP$/i,
374
+ /^DEFAULT_HEADER$/i
375
+ add_ruby_badge # <- This method will also invoke the method add_gobolinux_badge().
376
+ add_time_stamp
377
+ # =================================================================== #
378
+ # === ADD_CONTEXTFREE_ART_DISCLAIMER
379
+ #
380
+ # This entry point was specifically added in order to be used
381
+ # for linking to the fine contextfreedesign project (cfdg).
382
+ # =================================================================== #
383
+ when /ADD(_|-)?CONTEXTFREE(_|-)?ART(_|-)?DISCLAIMER$/
384
+ add_contextfree_art_disclaimer
385
+ # =================================================================== #
386
+ # === ADD_TIME_STAMP
387
+ #
388
+ # Add a time stamp, aka the current time, in combination with a
389
+ # "This gem was last updated on xyz." notification.
390
+ # =================================================================== #
391
+ when /^ADD_TIME_STAMP$/,
392
+ /^ADD_LAST_UPDATE$/,
393
+ /^ADD_MAIN_TIMESTAMP$/,
394
+ /^ADD_LAST_UPDATED_WHEN$/
395
+ add_time_stamp
396
+ # =================================================================== #
397
+ # === LICENCE_IS_MIT
398
+ # =================================================================== #
399
+ when /LICENCE_?IS_?MIT/,
400
+ /USE_?THE_?MIT_?LICENCE/
401
+ add_licence_is_MIT
402
+ # =================================================================== #
403
+ # === ADD_CONTACT_INFORMATION
404
+ #
405
+ # Add the default email address in use.
406
+ # =================================================================== #
407
+ when /ADD_?CONTACT_?INFORMATION/,
408
+ /ADD_?CONTACT_?DETAILS/,
409
+ /ADD_?EMAIL/,
410
+ /ADD_?MY_?EMAIL/,
411
+ /CONTACT_?INFORMATION/
412
+ add_contact_information
413
+ # =================================================================== #
414
+ # === ADD_GOBOLINUX_LINK
415
+ # =================================================================== #
416
+ when /^ADD_GOBOLINUX_LINK$/,
417
+ /^GOBOLINUX_IS_AWESOME$/
418
+ add_gobolinux_badge
419
+ # =================================================================== #
420
+ # === ADD_RUBY_LOGO_AND_TIMESTAMP
421
+ #
422
+ # This entry point combines two method-calls. This is the correct
423
+ # combination and order, too.
424
+ # =================================================================== #
425
+ when /^ADD_RUBY_LOGO_AND_TIMESTAMP$/,
426
+ /^MY_MAIN_HEADER$/,
427
+ /^ADD_DEFAULT_HEADER$/
428
+ add_badge
429
+ add_time_stamp
430
+ # =================================================================== #
431
+ # === ADD_BADGE
432
+ #
433
+ # Add a ruby badge to the autogenerated README.md file.
434
+ # =================================================================== #
435
+ when 'ADD_BADGE',
436
+ 'DEFAULT_RUBY_HEADER',
437
+ 'ADD_RUBY_HEADER',
438
+ 'ADD_RUBY_BADGE',
439
+ /ADD_?RUBY_?BADGES/,
440
+ /ADD_?GOBOLINUX_?AND_?RUBY_?HEADER/,
441
+ /ADD_?DEFAULT_?HEADER/,
442
+ /RUBY_?HEADER/,
443
+ /ADD_?RUBY_?HEAD/,
444
+ /GOBOLINUX_?IS_?GREAT/,
445
+ /ADD(_|-)?MAIN(_|-)?HEADER/i
446
+ add_badge
447
+ # =================================================================== #
448
+ # === This will tap into RBT, to show which programs were last
449
+ # updated.
450
+ # =================================================================== #
451
+ when /^INSERT_THE_LAST_UPDATED_PROGRAMS_HERE$/
452
+ add_string_showing_the_last_updated_programs
453
+ # =================================================================== #
454
+ # === Handle files that begin with MACRO or INCLUDE_FILE
455
+ # =================================================================== #
456
+ when /^MACRO read_file (.+)$/,
457
+ /^INCLUDE_FILE (.+)$/,
458
+ /^embed_this_file (.+)$/
459
+ this_file = $1.to_s.dup
460
+ try_to_add_the_content_of_this_file(this_file)
461
+ # =================================================================== #
462
+ # === Handle the donate-macro next
463
+ # =================================================================== #
464
+ when /^DONATE_MACRO$/
465
+ add_text_for_the_donate_macro
466
+ # =================================================================== #
467
+ # === ADD_ENVIRONMENT_INFORMATION_PROPERLY_FORMATTED_ARRAY
468
+ # =================================================================== #
469
+ when /^ADD_?ENVIRONMENT_?INFORMATION_?PROPERLY_?FORMATTED_?ARRAY$/i
470
+ add_environment_information_properly_formatted_array
471
+ # =================================================================== #
472
+ # === Handle RBT-specific macros next
473
+ # =================================================================== #
474
+ when /^MACRO RBT\.(.+)$/
475
+ require 'rbt' # In this case, just load the whole RBT project.
476
+ # ================================================================= #
477
+ # The next line of code is equivalent to:
478
+ # RBT.will_install_which_binaries?
479
+ # ================================================================= #
480
+ if RBT.respond_to? $1.to_s.to_sym
481
+ result = RBT.send($1.to_s.to_sym)
482
+ if result.is_a? Array # ← should always be an Array, but still, if check seems fine
483
+ result = result.map {|entry| entry.prepend(' ') }.join(N)
484
+ end
485
+ add(result) # ← Add it here.
486
+ else
487
+ e 'RBT does not respond to '+$1.to_s.to_sym.to_s+'().'
488
+ end
489
+ else
490
+ add(line)
491
+ end
492
+ }
493
+ else
494
+ opne "No file called #{sfile(_)} could be found."
495
+ end
496
+ end
497
+
498
+ # ========================================================================= #
499
+ # === add_contextfree_art_disclaimer
500
+ # ========================================================================= #
501
+ def add_contextfree_art_disclaimer
502
+ @_ << "(The <b>above image</b> was <b>partially autogenerated</b> "\
503
+ "using <b>cfdg rules</b>. See this fine project here for "\
504
+ "more information pertaining to the <b>autogeneration</b> of "\
505
+ "such - or similar - images: "\
506
+ "**https://www.contextfreeart.org/gallery/**)\n"
507
+ end
508
+
509
+ # ========================================================================= #
510
+ # === add_licence_is_MIT (MIT tag)
511
+ #
512
+ # This will add the MIT licence to the readme.
513
+ # ========================================================================= #
514
+ def add_licence_is_MIT
515
+ @_ << "
516
+ ## Licence
517
+
518
+ The licence for this gem is the MIT licence.
519
+
520
+ Basically the most important part of the MIT licence is that, aside
521
+ from you being able to use the project as you see fit, is the no
522
+ warranty disclaimer to avoid any potential misuse from the use
523
+ of the software at hand.
524
+
525
+ You can read up on this licence here:
526
+
527
+ https://opensource.org/licenses/MIT
528
+
529
+ The usual copyright assignment is:
530
+
531
+ Copyright #{current_year?} Robert Heiler
532
+
533
+ "
534
+ end; alias use_the_mit_licence add_licence_is_MIT # === use_the_mit_licence
535
+
536
+ # ========================================================================= #
537
+ # === add_contact_information
538
+ # ========================================================================= #
539
+ def add_contact_information
540
+ @_ << "
541
+ ## Contact information and mandatory 2FA (no longer) coming up in 2022 / 2023
542
+
543
+ If your creative mind has ideas and specific suggestions to make this gem
544
+ more useful in general, feel free to drop me an email at any time, via:
545
+
546
+ shevy@inbox.lt
547
+
548
+ Before that email I used an email account at Google gmail, but in **2021** I
549
+ decided to slowly abandon gmail, for various reasons. In order to limit the
550
+ explanation here, allow me to just briefly state that I do not feel as if I
551
+ want to promote any Google service anymore when the user becomes the end
552
+ product (such as via data collection by upstream services, including other
553
+ proxy-services). My feeling is that this is a hugely flawed business model
554
+ to begin with, and I no longer wish to support this in any way, even if
555
+ only indirectly so, such as by using services of companies that try to
556
+ promote this flawed model.
557
+
558
+ In regards to responding to emails: please keep in mind that responding
559
+ may take some time, depending on the amount of work I may have at that
560
+ moment. So it is not that emails are ignored; it is more that I have not
561
+ (yet) found the time to read and reply. This means there may be a delay
562
+ of days, weeks and in some instances also months. There is, unfortunately,
563
+ not much I can do when I need to prioritise my time investment, but I try
564
+ to consider <b>all</b> feedback as an opportunity to improve my projects
565
+ nonetheless.
566
+
567
+ In <b>2022</b> rubygems.org decided to make 2FA mandatory for every
568
+ gem owner eventually:
569
+
570
+ see
571
+ https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
572
+
573
+ However had, that has been reverted again, so I decided to shorten
574
+ this paragraph. Mandatory 2FA may exclude users who do not have a
575
+ smartphone device or other means to 'identify'. I do not feel it is
576
+ a fair assumption by others to be made that non-identified people may
577
+ not contribute code, which is why I reject it. Mandatory 2FA would mean
578
+ an end to all my projects on rubygems.org, so let's hope it will never
579
+ happen. (Keep in mind that I refer to mandatory 2FA; I have no qualms
580
+ for people who use 2FA on their own, but this carrot-and-stick strategy
581
+ by those who control the rubygems infrastructure is a very bad one to
582
+ pursue.
583
+
584
+ "
585
+ end
586
+
587
+ # ========================================================================= #
588
+ # === run (run tag)
589
+ # ========================================================================= #
590
+ def run
591
+ read_dataset_from_gen_file
592
+ store_the_string
593
+ generate_html_file_via_kramdown
594
+ end
595
+
596
+ # ========================================================================= #
597
+ # === Roebe::ReadmeGenerator[]
598
+ # ========================================================================= #
599
+ def self.[](i = ARGV)
600
+ new(i)
601
+ end
602
+
603
+ end; end
8
604
 
9
605
  if __FILE__ == $PROGRAM_NAME
10
606
  Roebe::ReadmeGenerator.new(ARGV)