roebe 0.5.191 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +89 -41
  3. data/bin/create_my_directories +2 -2
  4. data/bin/{ruby_dhcpcd → dhcpcd_wrapper} +1 -1
  5. data/bin/start_lighty +1 -1
  6. data/doc/README.gen +78 -15
  7. data/doc/core/array.md +24 -23
  8. data/doc/core/gem_and_gemspec.md +12 -11
  9. data/doc/core/hash.md +6 -0
  10. data/doc/core/misc.md +23 -20
  11. data/doc/core/regex.md +1 -1
  12. data/doc/core/stderr.md +16 -0
  13. data/doc/deprecations/deprecations.md +2 -1
  14. data/doc/statistics/statistics.md +1 -0
  15. data/lib/roebe/actions/actions.rb +80 -0
  16. data/lib/roebe/base/colours.rb +52 -19
  17. data/lib/roebe/base/misc.rb +30 -1
  18. data/lib/roebe/base/opnn.rb +7 -0
  19. data/lib/roebe/browser/output_url_then_open_in_browser.rb +18 -15
  20. data/lib/roebe/classes/alltagsgeschichte.rb +1 -1
  21. data/lib/roebe/classes/at.rb +2 -2
  22. data/lib/roebe/classes/auto_rename_file_based_on_its_creation_date.rb +24 -12
  23. data/lib/roebe/classes/books/books.rb +234 -142
  24. data/lib/roebe/classes/books/finished_books/finished_books.rb +10 -3
  25. data/lib/roebe/classes/books/menu.rb +25 -16
  26. data/lib/roebe/classes/books/sanitize_this_book_path/sanitize_this_book_path.rb +0 -1
  27. data/lib/roebe/classes/check_yaml.rb +15 -11
  28. data/lib/roebe/classes/compile_kernel.rb +3 -1
  29. data/lib/roebe/classes/contacts/contacts.rb +104 -0
  30. data/lib/roebe/classes/contacts/gui/universal_widgets/contacts.rb +168 -0
  31. data/lib/roebe/classes/contacts/shared_code.rb +344 -0
  32. data/lib/roebe/classes/copy_kernel_config.rb +5 -3
  33. data/lib/roebe/classes/create_desktop_file.rb +1 -1
  34. data/lib/roebe/classes/create_file_skeleton/constants.rb +1 -1
  35. data/lib/roebe/classes/create_file_skeleton/generate_ruby_string.rb +20 -20
  36. data/lib/roebe/classes/create_file_skeleton/reset.rb +19 -16
  37. data/lib/roebe/classes/create_my_directories.rb +12 -10
  38. data/lib/roebe/classes/dhcpcd/{dhcpcd.rb → dhcpcd_wrapper.rb} +137 -95
  39. data/lib/roebe/classes/dhcpcd/kill_dhcpcd.rb +2 -2
  40. data/lib/roebe/classes/do_install.rb +7 -6
  41. data/lib/roebe/classes/done.rb +1 -1
  42. data/lib/roebe/classes/downcase_extension.rb +4 -4
  43. data/lib/roebe/classes/email.rb +44 -40
  44. data/lib/roebe/classes/enable.rb +1 -1
  45. data/lib/roebe/classes/generate_alsa_conf.rb +4 -4
  46. data/lib/roebe/classes/generate_overview_of_the_locally_available_books.rb +5 -3
  47. data/lib/roebe/classes/github.rb +1 -1
  48. data/lib/roebe/classes/kde/install_this_konsole_theme.rb +1 -1
  49. data/lib/roebe/classes/{handle_lighttpd.rb → lighttpd/lighttpd_wrapper.rb} +55 -47
  50. data/lib/roebe/classes/make_gem.rb +49 -35
  51. data/lib/roebe/classes/mbl.rb +6 -4
  52. data/lib/roebe/classes/readme_generator/readme_generator.rb +597 -1
  53. data/lib/roebe/classes/remove_trailing_newline.rb +82 -0
  54. data/lib/roebe/classes/report_how_many_files_are_in_this_directory.rb +83 -0
  55. data/lib/roebe/classes/rxinitrc/constants.rb +7 -5
  56. data/lib/roebe/classes/rxinitrc/rxinitrc.rb +8 -4
  57. data/lib/roebe/classes/set_background.rb +14 -0
  58. data/lib/roebe/classes/show_ten_aliases.rb +15 -3
  59. data/lib/roebe/classes/simple_boot_script.rb +1 -1
  60. data/lib/roebe/classes/size_of.rb +9 -7
  61. data/lib/roebe/classes/tales_from_the_crypt.rb +1 -1
  62. data/lib/roebe/classes/update.rb +4 -11
  63. data/lib/roebe/classes/upload_to_imgur.rb +64 -35
  64. data/lib/roebe/commandline/misc.rb +28 -28
  65. data/lib/roebe/constants/array_install_these_gem_projects.rb +1 -1
  66. data/lib/roebe/constants/constants.rb +8 -1
  67. data/lib/roebe/constants/emojis.rb +0 -19
  68. data/lib/roebe/constants/file_and_directory_constants.rb +2 -2
  69. data/lib/roebe/constants/misc.rb +10 -2
  70. data/lib/roebe/constants/roebe.rb +2 -0
  71. data/lib/roebe/custom_methods/module.rb +45 -16
  72. data/lib/roebe/fonts/fonts.rb +39 -0
  73. data/lib/roebe/gui/universal_widgets/books/books.rb +232 -0
  74. data/lib/roebe/hello_world/hello_world.rb +0 -0
  75. data/lib/roebe/irb/clean_irbrc +1 -0
  76. data/lib/roebe/math/log10.rb +3 -3
  77. data/lib/roebe/math/the_collatz_problem.rb +104 -0
  78. data/lib/roebe/{toplevel_methods/lighttpd.rb → requires/require_lighttpd.rb} +2 -2
  79. data/lib/roebe/shell/shell/shell.rb +6 -6
  80. data/lib/roebe/shell_scripts/README.md +0 -0
  81. data/lib/roebe/shell_scripts/bashrc +0 -0
  82. data/lib/roebe/shell_scripts/konsole_tabs.sh +6 -0
  83. data/lib/roebe/shell_scripts/lfs/001_binutils_1.sh +10 -2
  84. data/lib/roebe/shell_scripts/lfs/002_gcc_1.sh +33 -3
  85. data/lib/roebe/shell_scripts/lfs/003_linux_1.sh +1 -0
  86. data/lib/roebe/shell_scripts/lfs/004_glibc_1.sh +5 -2
  87. data/lib/roebe/shell_scripts/lfs/005_libstdc++_1.sh +8 -1
  88. data/lib/roebe/shell_scripts/lfs/007_ncurses_2.sh +5 -2
  89. data/lib/roebe/shell_scripts/lfs/020_xz_2.sh +5 -4
  90. data/lib/roebe/shell_scripts/lfs/022_gcc_2.sh +15 -1
  91. data/lib/roebe/shell_scripts/lfs/025_ruby_2.sh +13 -0
  92. data/lib/roebe/shell_scripts/lfs/README.md +0 -0
  93. data/lib/roebe/shell_scripts/lfs/lfs_build_variables.sh +56 -16
  94. data/lib/roebe/toplevel_methods/module_methods.rb +5 -3
  95. data/lib/roebe/toplevel_methods/to_mp3.rb +1 -1
  96. data/lib/roebe/version/version.rb +2 -2
  97. data/lib/roebe/wasm/README.md +7 -0
  98. data/lib/roebe/wasm/enable_simple_puts_output.rb +9 -0
  99. data/lib/roebe/wasm/wasm_examples.html +43 -0
  100. data/lib/roebe/www/LEDS/LEDS.rb +35 -25
  101. data/lib/roebe/www/RNA/RNA.cgi +42 -1
  102. data/lib/roebe/www/algorithms/algorithms.rb +40 -0
  103. data/lib/roebe/www/analytical_chemistry/content.md +6 -0
  104. data/lib/roebe/www/animals/animals.cgi +25 -0
  105. data/lib/roebe/www/bioanalytik/bioanalytik.cgi +90 -0
  106. data/lib/roebe/www/biotechnology/biotechnology.rb +39 -3
  107. data/lib/roebe/www/cellbiology/cellbiology.rb +19 -2
  108. data/lib/roebe/www/chemistry/S/303/244uren_Basen_und_der_pH_Wert/S/303/244uren_Basen_und_der_pH_Wert.cgi +242 -0
  109. data/lib/roebe/www/chemistry/chemistry.rb +10 -258
  110. data/lib/roebe/www/chemistry/css_rules.css +67 -0
  111. data/lib/roebe/www/chemistry/die_quantenzahlen/die_quantenzahlen.cgi +123 -0
  112. data/lib/roebe/www/chemistry/funktionelle_gruppen_in_der_chemie/funktionelle_gruppen_in_der_chemie.cgi +52 -0
  113. data/lib/roebe/www/chrome_and_chromium/chrome_and_chromium.rb +37 -42
  114. data/lib/roebe/www/chromium +1 -0
  115. data/lib/roebe/www/cognitive_biology/cognitive_biology.cgi +18 -3
  116. data/lib/roebe/www/erste_hilfe/erste_hilfe.cgi +215 -62
  117. data/lib/roebe/www/fonts/fonts.cgi +245 -0
  118. data/lib/roebe/www/genomics/genomics.rb +4 -0
  119. data/lib/roebe/www/hardware/computersysteme/computersysteme.rb +117 -102
  120. data/lib/roebe/www/hardware/netzteile/netzteile.cgi +94 -0
  121. data/lib/roebe/www/immunology/immunology.rb +131 -7
  122. data/lib/roebe/www/insekten/insekten.md +27 -0
  123. data/lib/roebe/www/lighttpd/autogenerated_lighttpd.conf +7 -3
  124. data/lib/roebe/www/lighttpd/configuration/index.conf +7 -4
  125. data/lib/roebe/www/lighttpd/lighttpd.rb +6 -6
  126. data/lib/roebe/www/linux/antiX/antiX.rb +7 -4
  127. data/lib/roebe/www/linux/linux.rb +9 -11
  128. data/lib/roebe/www/linux/linuxmint/linuxmint.rb +33 -0
  129. data/lib/roebe/www/linux/slackware/slackware.rb +136 -27
  130. data/lib/roebe/www/linux/void/void.rb +34 -8
  131. data/lib/roebe/www/linux_commands/linux_commands.rb +6 -6
  132. data/lib/roebe/www/lyrics/lyrics.rb +1 -1
  133. data/lib/roebe/www/metabolic_pathways/metabolic_pathways.rb +5 -1
  134. data/lib/roebe/www/microbiology/microbiology.rb +17 -2
  135. data/lib/roebe/www/mikrobielle_physiologie/mikrobielle_physiologie.cgi +1086 -2
  136. data/lib/roebe/www/mitochondria/mitochondria.cgi +16 -2
  137. data/lib/roebe/www/module_www.rb +2 -3
  138. data/lib/roebe/www/neurobiology/neurobiology.rb +20 -3
  139. data/lib/roebe/www/pdf/pdf.rb +13 -0
  140. data/lib/roebe/www/physics/physics.rb +20 -4
  141. data/lib/roebe/www/physiology/physiology.rb +5 -1
  142. data/lib/roebe/www/play_this_video_file/play_this_video_file.cgi +1 -1
  143. data/lib/roebe/www/programming_advice/programming_advice.cgi +36 -0
  144. data/lib/roebe/www/programming_advice/programming_advice.md +358 -0
  145. data/lib/roebe/www/psychologie/psychologie.rb +7 -1
  146. data/lib/roebe/www/science/science.rb +6 -0
  147. data/lib/roebe/www/sex_and_reproduction/sex_and_reproduction.cgi +18 -2
  148. data/lib/roebe/www/statistik/statistik.rb +6 -1
  149. data/lib/roebe/www/structural_biology/structural_biology.cgi +18 -0
  150. data/lib/roebe/www/the_cell_cycle/the_cell_cycle.cgi +27 -0
  151. data/lib/roebe/www/video/video.rb +1 -1
  152. data/lib/roebe/www/virology/virology.rb +12 -1
  153. data/lib/roebe/www/war_in_Ukraine_2022/war_in_Ukraine_2022.rb +70 -28
  154. data/lib/roebe/www/waschmaschinen/waschmaschinen.rb +5 -4
  155. data/lib/roebe/www/xfce/xfce.cgi +5 -4
  156. data/lib/roebe/www/xorg/xorg.rb +3 -202
  157. data/lib/roebe/www/yeast/yeast.rb +4 -2
  158. data/lib/roebe/www/yubiko/yubiko.cgi +49 -0
  159. data/lib/roebe/yaml/{autostart_these_programs.yml → autostart_these_programs/autostart_these_programs.yml} +7 -6
  160. data/lib/roebe/yaml/books/favourite_books.yml +11 -9
  161. data/lib/roebe/yaml/directory_structure.yml +2 -0
  162. data/lib/roebe/yaml/use_this_editor/use_this_editor.yml +1 -0
  163. metadata +39 -20
  164. data/lib/roebe/classes/readme_generator/constants.rb +0 -21
  165. data/lib/roebe/classes/readme_generator/initialize.rb +0 -38
  166. data/lib/roebe/classes/readme_generator/misc.rb +0 -548
  167. data/lib/roebe/classes/readme_generator/reset.rb +0 -28
  168. data/lib/roebe/classes/readme_generator/run.rb +0 -20
  169. data/lib/roebe/shell_scripts/lfs/lfs_variables.sh +0 -31
  170. data/lib/roebe/www/cognitive_biology/cognitive_biology.html +0 -40634
  171. data/lib/roebe/www/mikrobielle_physiologie/mikrobielle_physiologie.rb +0 -1055
  172. data/lib/roebe/www/programming_advice/programming_advice.yml +0 -31
  173. data/lib/roebe/yaml/main_editor.yml +0 -1
@@ -29,14 +29,14 @@ class CreateFileSkeleton < Roebe::Base
29
29
  _ '#'
30
30
  _ add_comment ''
31
31
 
32
- # ======================================================================= #
32
+ # ======================================================================== #
33
33
  # Next, show how to require this file normally.
34
- # ======================================================================= #
34
+ # ======================================================================== #
35
35
  _ "# require '"+real_filename?+".rb'"
36
36
  _ add_comment ''
37
- # ======================================================================= #
37
+ # ======================================================================== #
38
38
  # Which libraries to require, will be handled next:
39
- # ======================================================================= #
39
+ # ======================================================================== #
40
40
  ARRAY_REQUIRE_THESE_LIBRARIES_FOR_RB_FILES.sort.each {|entry|
41
41
  if entry.start_with? 'begin'
42
42
  _ entry
@@ -44,18 +44,18 @@ class CreateFileSkeleton < Roebe::Base
44
44
  _ "require '#{entry}'"
45
45
  end
46
46
  }
47
- # ======================================================================= #
47
+ # ======================================================================== #
48
48
  # The comment in the following line begins at the '#' token.
49
- # ======================================================================= #
49
+ # ======================================================================== #
50
50
  _ N+'class '+classname+" # < Base # === Foo::"+classname+N
51
- # ======================================================================= #
51
+ # ======================================================================== #
52
52
  # Next come the various includes - sort this alphabetically please.
53
- # ======================================================================= #
53
+ # ======================================================================== #
54
54
  _ ' include Colours'+N
55
55
  # _ ' include SaveFile' # If we want to add SaveFile functionality.'+N
56
- _ ' # ========================================================================= #'
56
+ _ ' # ========================================================================== #'
57
57
  _ ' # === NAMESPACE'
58
- _ ' # ========================================================================= #'
58
+ _ ' # ========================================================================== #'
59
59
  _ ' NAMESPACE = inspect'
60
60
 
61
61
  add_header :initialize
@@ -72,34 +72,34 @@ class CreateFileSkeleton < Roebe::Base
72
72
  add_header(:reset, pad: '(reset tag)') # reset tag
73
73
  _ ' def reset'
74
74
  _ ' super() if respond_to?(:super)' # Changed this in May 2023.
75
- _ ' # ======================================================================= #'
75
+ _ ' # ======================================================================== #'
76
76
  _ ' # === @namespace'
77
- _ ' # ======================================================================= #'
77
+ _ ' # ======================================================================== #'
78
78
  _ ' @namespace = NAMESPACE'
79
79
  _ ' # infer_the_namespace'
80
80
  _ ' end'
81
- # ======================================================================= #
81
+ # ======================================================================== #
82
82
  # Add the method called set_commandline_arguments() next:
83
- # ======================================================================= #
83
+ # ======================================================================== #
84
84
  add_header :set_commandline_arguments # Next, add the method set_commandline_arguments().
85
85
  _ " def set_commandline_arguments(i = '')"
86
86
  _ ' i = [i].flatten.compact'
87
87
  _ ' @commandline_arguments = i'
88
88
  _ ' end'
89
- # ======================================================================= #
89
+ # ======================================================================== #
90
90
  # === commandline_arguments?
91
91
  #
92
92
  # Add the commandline_arguments? method next:
93
- # ======================================================================= #
93
+ # ======================================================================== #
94
94
  add_header :commandline_arguments?
95
95
  _ ' def commandline_arguments?'
96
96
  _ ' @commandline_arguments'
97
97
  _ ' end'
98
- # ======================================================================= #
98
+ # ======================================================================== #
99
99
  # === first_argument?
100
100
  #
101
101
  # Add the first_argument? method next:
102
- # ======================================================================= #
102
+ # ======================================================================== #
103
103
  add_header :first_argument?
104
104
  _ ' def first_argument?'
105
105
  _ ' @commandline_arguments.first'
@@ -108,9 +108,9 @@ class CreateFileSkeleton < Roebe::Base
108
108
  _ ' def run'
109
109
  _ 'pp self # For debugging. Should be removed / replaced.'
110
110
  _ ' end'
111
- # ======================================================================= #
111
+ # ======================================================================== #
112
112
  # Add the [] method next:
113
- # ======================================================================= #
113
+ # ======================================================================== #
114
114
  add_header classname+'[]'
115
115
  _ " def self.[](i = '')"
116
116
  _ ' new(i)'
@@ -8,45 +8,48 @@ module Roebe
8
8
 
9
9
  class CreateFileSkeleton < Roebe::Base
10
10
 
11
- # ========================================================================= #
11
+ # ========================================================================== #
12
12
  # === reset (reset tag)
13
- # ========================================================================= #
13
+ # ========================================================================== #
14
14
  def reset
15
15
  super()
16
16
  infer_the_namespace
17
+ # ======================================================================== #
18
+ # === @editor
19
+ # ======================================================================== #
17
20
  if ENV['EDITOR']
18
21
  @editor = ENV['EDITOR'].dup
19
22
  else
20
23
  @editor = 'vim'
21
24
  end
22
- # ======================================================================= #
25
+ # ======================================================================== #
26
+ # === @padding
27
+ # ======================================================================== #
28
+ @padding = ' '
29
+ # ======================================================================== #
23
30
  # === @use_colours
24
- # ======================================================================= #
31
+ # ======================================================================== #
25
32
  @use_colours = true
26
- # ======================================================================= #
33
+ # ======================================================================== #
27
34
  # === @shall_we_also_open_the_created_file
28
- # ======================================================================= #
35
+ # ======================================================================== #
29
36
  @shall_we_also_open_the_created_file =
30
37
  SHALL_WE_ALSO_OPEN_THE_CREATED_FILE
31
- # ======================================================================= #
32
- # === @padding
33
- # ======================================================================= #
34
- @padding = ' '
35
- # ======================================================================= #
38
+ # ======================================================================== #
36
39
  # === @save_file
37
- # ======================================================================= #
40
+ # ======================================================================== #
38
41
  @save_file = true
39
- # ======================================================================= #
42
+ # ======================================================================== #
40
43
  # === @use_this_encoding
41
44
  #
42
45
  # This can be 'UTF-8' or 'ISO-8859-1'.
43
- # ======================================================================= #
46
+ # ======================================================================== #
44
47
  @use_this_encoding = 'UTF-8'
45
- # ======================================================================= #
48
+ # ======================================================================== #
46
49
  # === @use_this_encoding
47
50
  #
48
51
  # Specify which encoding to use, when autogenerating a file.
49
- # ======================================================================= #
52
+ # ======================================================================== #
50
53
  @use_this_encoding = USE_THIS_ENCODING
51
54
  empty_main_string
52
55
  set_be_verbose
@@ -69,21 +69,23 @@ class CreateMyDirectories < Base # === Roebe::CreateMyDirectories
69
69
  #
70
70
  # The input should be an Array.
71
71
  # ========================================================================= #
72
- def create_these_directories(these_directories)
72
+ def create_these_directories(
73
+ these_directories
74
+ )
73
75
  if these_directories
74
76
  these_directories.each { |directory|
75
77
  # =================================================================== #
76
78
  # Only create directories if they do not yet exist.
77
79
  # =================================================================== #
78
- this_dir = (@base_prefix+directory).squeeze('/')
80
+ this_dir = ("#{@base_prefix}#{directory}").squeeze('/')
79
81
  unless File.exist?(this_dir)
80
82
  if File.directory?(this_dir)
81
83
  # =============================================================== #
82
84
  # Be quiet in this case, as the directory already exists.
83
85
  # =============================================================== #
84
86
  elsif File.file?(this_dir)
85
- opne "Can not create a directory a #{sfile(this_dir)}"
86
- opne 'as a file already exists at that location.'
87
+ opne "#{rev}Can not create a directory a #{sfile(this_dir)}"
88
+ opne "#{rev}as a file already exists at that location."
87
89
  else
88
90
  begin
89
91
  opne "#{rev}Creating a directory at `#{sdir(this_dir)}#{rev}`."
@@ -101,11 +103,12 @@ class CreateMyDirectories < Base # === Roebe::CreateMyDirectories
101
103
  end
102
104
 
103
105
  # ========================================================================= #
104
- # === show_help
106
+ # === show_help (help tag)
105
107
  # ========================================================================= #
106
108
  def show_help
107
109
  e
108
- e 'You can also specify the location where to create the directory layout.'
110
+ e 'You can also specify the location where to create '\
111
+ 'the directory layout.'
109
112
  e
110
113
  e 'Example:'
111
114
  e
@@ -133,9 +136,8 @@ class CreateMyDirectories < Base # === Roebe::CreateMyDirectories
133
136
  # === menu (menu tag)
134
137
  # ========================================================================= #
135
138
  def menu(
136
- i = @commandline_arguments
139
+ i = commandline_arguments?
137
140
  )
138
- pp i
139
141
  if i.is_a? Array
140
142
  i.each {|entry| menu(entry) }
141
143
  else
@@ -164,7 +166,7 @@ pp i
164
166
  # ========================================================================= #
165
167
  def consider_notifying_the_user_how_many_directories_have_been_created
166
168
  if @created_n_directories == 0
167
- e 'No directory has been created, which usually means that all'
169
+ e "#{rev}No directory has been created, which usually means that all"
168
170
  e 'directories already exist. '+slateblue(cheerful_guy)
169
171
  end
170
172
  end
@@ -177,7 +179,7 @@ pp i
177
179
  menu
178
180
  my_directories = nil # Safeguard.
179
181
  file_directory_structure = @use_this_file
180
- e 'Creating my directories next by loading the dataset from'
182
+ e "#{rev}Creating my directories next by loading the dataset from"
181
183
  e
182
184
  e " #{sdir(file_directory_structure)}"
183
185
  e
@@ -2,47 +2,58 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
- # === Roebe::Dhcpcd
5
+ # === Roebe::DhcpcdWrapper
6
+ #
7
+ # This class was added on the 14.02.2024. It replaced the old dhcpcd wrapper
8
+ # class that was confusing me before.
6
9
  #
7
10
  # This is the base class for all dhcpcd-related activities - a small
8
11
  # wrapper over dhcpcd.
9
12
  #
10
13
  # Usage example:
11
14
  #
12
- # Roebe::Dhcpcd.new(ARGV)
15
+ # Roebe::DhcpcdWrapper.new(ARGV)
13
16
  #
14
17
  # =========================================================================== #
15
- # require 'roebe/classes/dhcpcd/dhcpcd.rb'
18
+ # require 'roebe/classes/dhcpcd/dhcpcd_wrapper.rb'
19
+ # Roebe::DhcpcdWrapper.new(ARGV)
16
20
  # =========================================================================== #
17
21
  require 'roebe/base/base.rb'
18
22
 
19
23
  module Roebe
20
24
 
21
- class Dhcpcd < Base # === Roebe::Dhcpcd
25
+ class DhcpcdWrapper < Base # === Roebe::DhcpcdWrapper
22
26
 
23
27
  # ========================================================================= #
24
- # === BASE_DIRECTORY
28
+ # === DIRECTORY_CONTAINING_THE_PID_OF_DHCPCD
25
29
  #
26
30
  # This is the directory where we may find the .pid of dhcpcd.
27
31
  # ========================================================================= #
28
- BASE_DIRECTORY = '/var/run/'
32
+ DIRECTORY_CONTAINING_THE_PID_OF_DHCPCD = '/var/run/'
29
33
 
30
34
  # ========================================================================= #
31
35
  # === ALL_PIDS
32
36
  #
33
37
  # The full name may be 'dhcpcd-enp5s0.pid'.
34
38
  # ========================================================================= #
35
- ALL_PIDS = BASE_DIRECTORY+'dhcpcd*.pid'
39
+ ALL_PIDS = "#{DIRECTORY_CONTAINING_THE_PID_OF_DHCPCD}dhcpcd*.pid"
40
+
41
+ # ========================================================================= #
42
+ # === KILLALL_DHCPCD
43
+ # ========================================================================= #
44
+ KILLALL_DHCPCD = 'killall dhcpcd'
36
45
 
37
46
  # ========================================================================= #
38
47
  # === initialize
39
48
  # ========================================================================= #
40
49
  def initialize(
41
- i = ARGV,
42
- run_already = true
50
+ commandline_arguments = nil,
51
+ run_already = true
43
52
  )
44
53
  reset
45
- set_commandline_arguments(i)
54
+ set_commandline_arguments(
55
+ commandline_arguments
56
+ )
46
57
  run if run_already
47
58
  end
48
59
 
@@ -52,36 +63,62 @@ class Dhcpcd < Base # === Roebe::Dhcpcd
52
63
  def reset
53
64
  super()
54
65
  infer_the_namespace
55
- @target_device = nil
66
+ infer_the_target_device
56
67
  end
57
68
 
58
69
  # ========================================================================= #
59
- # === set_target_device
70
+ # === the_target_device?
71
+ # ========================================================================= #
72
+ def the_target_device?
73
+ @internal_hash[:the_target_device]
74
+ end; alias target_device? the_target_device? # === target_device?
75
+
76
+ # ========================================================================= #
77
+ # === set_the_target_device
60
78
  # ========================================================================= #
61
- def set_target_device(i = 'enp5s0')
79
+ def set_the_target_device(
80
+ i = 'enp5s0'
81
+ )
62
82
  i = i.join(' ').strip if i.is_a? Array
63
- @target_device = i
83
+ if i.is_a?(String) and i.frozen?
84
+ i = i.dup
85
+ end
86
+ i.tr!('ß','0') if i.is_a?(String) and i.include?('ß')
87
+ @internal_hash[:the_target_device] = i.to_sym
88
+ end; alias set_target_device set_the_target_device # === set_target_device
89
+
90
+ # ========================================================================= #
91
+ # === process_id_of_dhcpcd?
92
+ #
93
+ # This method will yield the process-id of dhcpcd; or "unknown" if
94
+ # dhcpcd is not running.
95
+ # ========================================================================= #
96
+ def process_id_of_dhcpcd?
97
+ result = `ps ax #{ERROR_LINE}`
98
+ result = result.split(N).select {|line|
99
+ line.include?('dhcpcd: ')
100
+ }
101
+ if result and result.is_a?(Array)
102
+ result = result.first
103
+ if result.is_a?(String) and result.include?(' ')
104
+ return result.split(' ').first.to_s
105
+ end
106
+ end
107
+ return 'unknown' # Default return value.
64
108
  end
65
109
 
66
110
  # ========================================================================= #
67
- # === target_device?
111
+ # === use_enp5s0
68
112
  # ========================================================================= #
69
- def target_device?
70
- @target_device
113
+ def use_enp5s0
114
+ set_the_target_device('enp5s0') # Hardcoded default works fine here.
71
115
  end
72
116
 
73
117
  # ========================================================================= #
74
- # === sanitize_the_commandline
118
+ # === infer_the_target_device
75
119
  # ========================================================================= #
76
- def sanitize_the_commandline
77
- if commandline_arguments?.empty?
78
- set_target_device('enp5s0') # Hardcoded default for now.
79
- end
80
- commandline_arguments?.map! {|entry|
81
- entry = entry.dup if entry.frozen?
82
- entry.tr!('ß','0') if entry.include? 'ß'
83
- entry
84
- }
120
+ def infer_the_target_device
121
+ set_the_target_device(:eth0)
85
122
  end
86
123
 
87
124
  # ========================================================================= #
@@ -94,12 +131,26 @@ class Dhcpcd < Base # === Roebe::Dhcpcd
94
131
  result.include? ' dhcpcd' # We must exclude 'ruby_dhcpcd' here.
95
132
  end
96
133
 
134
+ # ========================================================================= #
135
+ # === verbose_is_dhcpcd_running?
136
+ # ========================================================================= #
137
+ def verbose_is_dhcpcd_running?
138
+ case is_dhcpcd_running?
139
+ when true
140
+ opne 'dhcpcd is currently running.'
141
+ when false
142
+ opne 'dhcpcd is currently NOT running.'
143
+ end
144
+ end
145
+
97
146
  # ========================================================================= #
98
147
  # === kill_the_old_dhcpcd_processes
148
+ #
149
+ # This method will kill any running dhcpcd process.
99
150
  # ========================================================================= #
100
151
  def kill_the_old_dhcpcd_processes
101
152
  if is_dhcpcd_running?
102
- esystem('killall dhcpcd') { :do_colourize_and_pad_the_system_command }
153
+ esystem(KILLALL_DHCPCD) { :do_colourize_and_pad_the_system_command }
103
154
  end
104
155
  end; alias kill_old_dhcpcd_processes kill_the_old_dhcpcd_processes # === kill_old_dhcpcd_processes
105
156
  alias kill_dhcpcd kill_the_old_dhcpcd_processes # === kill_dhcpcd
@@ -112,37 +163,65 @@ class Dhcpcd < Base # === Roebe::Dhcpcd
112
163
  return Dir[ALL_PIDS]
113
164
  end
114
165
 
166
+ # ========================================================================= #
167
+ # === show_help (help tag)
168
+ # ========================================================================= #
169
+ def show_help
170
+ e
171
+ e 'No help options are documented so far for this class.'
172
+ e
173
+ end
174
+
175
+ # ========================================================================= #
176
+ # === start_the_dhcpcd_command (start tag)
177
+ #
178
+ # This method will start the actual dhcpcd command.
179
+ #
180
+ # The argument that should be passed to this method is the actual
181
+ # target device, such as 'enp5s0'.
182
+ # ========================================================================= #
183
+ def start_the_dhcpcd_command(
184
+ i = target_device?
185
+ )
186
+ opne "#{rev}Now starting the #{steelblue('dhcpcd')} #{rev}command "\
187
+ "at #{sfancy(i)}#{rev}."
188
+ _ = " dhcpcd #{i}"
189
+ e
190
+ e steelblue(_)
191
+ e
192
+ system _
193
+ end; alias start_dhcpcd start_the_dhcpcd_command # === start_dhcpcd
194
+
115
195
  # ========================================================================= #
116
196
  # === purge_old_entries
117
197
  # ========================================================================= #
118
- def purge_old_entries
119
- get_matches.each {|entry|
198
+ def purge_old_entries(
199
+ matches = get_matches
200
+ )
201
+ matches.each {|entry|
120
202
  if File.exist? entry
121
- opne "Purging old entry `#{sfile(entry)}"\
122
- "` (Filesize: #{sfancy(File.size(entry).to_s)})."
203
+ opne "#{rev}Purging the old entry at `#{sfile(entry)}"\
204
+ "#{rev}` (Filesize: #{sfancy(File.size(entry).to_s)}#{rev})#{rev}."
123
205
  delete(entry)
124
206
  end
125
207
  }
126
208
  end
127
209
 
128
210
  # ========================================================================= #
129
- # === process_id_of_dhcpcd?
130
- #
131
- # This method will yield the process-id of dhcpcd; or "unknown" if
132
- # dhcpcd is not running.
211
+ # === do_run_the_default_actions
133
212
  # ========================================================================= #
134
- def process_id_of_dhcpcd?
135
- result = `ps ax #{ERROR_LINE}`
136
- result = result.split(N).select {|line|
137
- line.include?('dhcpcd: ')
138
- }
139
- if result and result.is_a?(Array)
140
- result = result.first
141
- if result and result.include?(' ')
142
- return
143
- end
144
- end
145
- return 'unknown'
213
+ def do_run_the_default_actions
214
+ kill_old_dhcpcd_processes
215
+ purge_old_entries
216
+ start_the_dhcpcd_command
217
+ end
218
+
219
+ # ========================================================================= #
220
+ # === run (run tag)
221
+ # ========================================================================= #
222
+ def run
223
+ menu
224
+ do_run_the_default_actions
146
225
  end
147
226
 
148
227
  # ========================================================================= #
@@ -153,12 +232,15 @@ class Dhcpcd < Base # === Roebe::Dhcpcd
153
232
  )
154
233
  if i.is_a? Array
155
234
  if i.empty?
156
- do_run_the_default_actions
235
+ show_help
157
236
  else
158
237
  i.each {|entry| menu(entry) }
159
238
  end
160
239
  else
161
240
  case i # case tag
241
+ # ===================================================================== #
242
+ # === mydhcpcd --help
243
+ # ===================================================================== #
162
244
  when /help$/i
163
245
  show_help
164
246
  end
@@ -166,47 +248,7 @@ class Dhcpcd < Base # === Roebe::Dhcpcd
166
248
  end
167
249
 
168
250
  # ========================================================================= #
169
- # === show_help (help tag)
170
- # ========================================================================= #
171
- def show_help
172
- e 'No help options are documented so far for this class.'
173
- end
174
-
175
- # ========================================================================= #
176
- # === do_run_the_default_actions
177
- # ========================================================================= #
178
- def do_run_the_default_actions
179
- kill_old_dhcpcd_processes
180
- purge_old_entries
181
- start_the_dhcpcd_command
182
- end
183
-
184
- # ========================================================================= #
185
- # === start_the_dhcpcd_command
186
- #
187
- # This method will start the actual dhcpcd command.
188
- #
189
- # The argument that should be passed to this method is the actual
190
- # target device, such as 'enp5s0'.
191
- # ========================================================================= #
192
- def start_the_dhcpcd_command(
193
- i = target_device?
194
- )
195
- opne "Now starting the #{steelblue('dhcpcd')} command at #{sfancy(i)}."
196
- _ = " dhcpcd #{i}"
197
- esystem _, :do_colourize
198
- end; alias start_dhcpcd start_the_dhcpcd_command # === start_dhcpcd
199
-
200
- # ========================================================================= #
201
- # === run (run tag)
202
- # ========================================================================= #
203
- def run
204
- sanitize_the_commandline
205
- menu
206
- end
207
-
208
- # ========================================================================= #
209
- # === Roebe::Dhcpcd[]
251
+ # === Roebe::DhcpcdWrapper[]
210
252
  # ========================================================================= #
211
253
  def self.[](i = ARGV)
212
254
  new(i)
@@ -218,15 +260,15 @@ end
218
260
  # === Roebe.dhcpcd
219
261
  # =========================================================================== #
220
262
  def self.dhcpcd(i = ARGV)
221
- Dhcpcd.new(i)
222
- end
263
+ Roebe::DhcpcdWrapper.new(i)
264
+ end; self.instance_eval { alias dhcpcd_wrapper dhcpcd } # === Roebe.dhcpcd_wrapper
223
265
 
224
266
  end
225
267
 
226
268
  if __FILE__ == $PROGRAM_NAME
227
269
  alias e puts
228
- dhcpcd = Roebe::Dhcpcd.new(ARGV)
270
+ dhcpcd = Roebe.dhcpcd(ARGV)
229
271
  e 'Is dhcpcd running right now? '+
230
272
  dhcpcd.is_dhcpcd_running?.to_s
231
- end # my_dhcpcd eth0
232
- # my_dhcpcd enp5s0
273
+ end # mydhcpcd eth0
274
+ # mydhcpcd enp5s0
@@ -13,11 +13,11 @@
13
13
  # =========================================================================== #
14
14
  # require 'roebe/classes/dhcpcd/kill_dhcpcd.rb'
15
15
  # =========================================================================== #
16
- require 'roebe/classes/dhcpcd/dhcpcd.rb'
16
+ require 'roebe/classes/dhcpcd/dhcpcd_wrapper.rb'
17
17
 
18
18
  module Roebe
19
19
 
20
- class KillDhcpcd < ::Roebe::Dhcpcd # === Roebe::KillDhcpcd
20
+ class KillDhcpcd < ::Roebe::DhcpcdWrapper # === Roebe::KillDhcpcd
21
21
 
22
22
  # ========================================================================= #
23
23
  # === initialize
@@ -22,7 +22,7 @@ module Roebe
22
22
  class DoInstall < ::Roebe::Base # === Roebe::DoInstall
23
23
 
24
24
  begin
25
- require 'rbt/toplevel_methods/misc.rb'
25
+ require 'rbt/toplevel_methods/toplevel_methods.rb'
26
26
  rescue LoadError; end
27
27
 
28
28
  # ========================================================================= #
@@ -69,12 +69,13 @@ class DoInstall < ::Roebe::Base # === Roebe::DoInstall
69
69
  !can_we_use_meson_in_the_current_directory? and # If we can not run meson.
70
70
  !can_we_use_cmake_in_the_current_directory? and # If we can not run cmake either.
71
71
  !File.exist?('configure') # And there is no file called "configure" yet.
72
- opne 'No file called '+sfile('configure')+' was found. Neither could a '\
73
- 'meson-file'
72
+ opne "#{rev}No file called #{sfile('configure')} #{rev}was found. "\
73
+ "Neither could a meson-file"
74
74
  opne 'or a cmake-file be found.'
75
- opne 'Thus, since a file called '+sfile('autogen.sh')+' was '\
76
- 'actually found, it will be run next.'
77
- opne 'If all goes well then a file called '+sfile('configure')+' will be'
75
+ opne 'Thus, since a file called '+sfile('autogen.sh')+rev+
76
+ ' was actually found, it will be run next.'
77
+ opne 'If all goes well then a file called '+sfile('configure')+rev+
78
+ ' will be'
78
79
  opne 'created, which can then be used to compile the given program.'
79
80
  do_invoke_autogen_sh
80
81
  end
@@ -104,7 +104,7 @@ class Done < ::Roebe::Base # === Roebe::Done
104
104
  is_on_roebe? and
105
105
  is_in_studium_dir? and
106
106
  pdf_has_no_title?(i)
107
- require 'pdf_paradise/toplevel_methods/automatic_pdf_title.rb'
107
+ require 'pdf_paradise/utility_scripts/automatic_pdf_title.rb'
108
108
  # =================================================================== #
109
109
  # Set an autotitle in this case.
110
110
  # =================================================================== #
@@ -55,8 +55,8 @@ class DowncaseExtension < Base # === Roebe::DowncaseExtension
55
55
  # ======================================================================= #
56
56
  i.map! {|entry|
57
57
  if File.directory? entry
58
- opne 'Expanding the directory '+sdir(entry)+' to all '\
59
- 'files within that directory.'
58
+ opne 'Expanding the directory '+sdir(entry)+
59
+ rev+' to all files within that directory.'
60
60
  entry = Dir[(entry+'/*').squeeze('/')].select {|inner_entry|
61
61
  File.file? inner_entry
62
62
  }
@@ -93,8 +93,8 @@ class DowncaseExtension < Base # === Roebe::DowncaseExtension
93
93
  extension_type = File.extname(entry)
94
94
  new_name = entry.gsub(/#{extension_type}/,'')+extension_type.downcase
95
95
  unless new_name == entry
96
- opne "Working now on `#{sfile(entry)}`. Its file extension"
97
- opne "will be downcased towards #{sfile(new_name)}."
96
+ opne "#{rev}Working now on `#{sfile(entry)}#{rev}`. Its file extension"
97
+ opne "#{rev}will be downcased towards #{sfile(new_name)}#{rev}."
98
98
  rename(entry, new_name)
99
99
  end
100
100
  }