rcfiles 1.3.55

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +562 -0
  3. data/bin/rcfiles +12 -0
  4. data/bin/rcfiles_run_it +7 -0
  5. data/doc/README.gen +515 -0
  6. data/img/LOGO_FOR_THE_RCFILES_PROJECT.png +0 -0
  7. data/lib/rcfiles/aggregate_all_rcfiles/aggregate_all_rcfiles.rb +137 -0
  8. data/lib/rcfiles/class/colours.rb +54 -0
  9. data/lib/rcfiles/class/initialize.rb +66 -0
  10. data/lib/rcfiles/class/misc.rb +300 -0
  11. data/lib/rcfiles/class/rcfiles.rb +31 -0
  12. data/lib/rcfiles/class/reset.rb +26 -0
  13. data/lib/rcfiles/class/run.rb +17 -0
  14. data/lib/rcfiles/colours/colours.rb +137 -0
  15. data/lib/rcfiles/commandline/commandline.rb +190 -0
  16. data/lib/rcfiles/constants/constants.rb +253 -0
  17. data/lib/rcfiles/directory_aliases/README.md +2 -0
  18. data/lib/rcfiles/directory_aliases/directory_aliases.rb +868 -0
  19. data/lib/rcfiles/files/file_aliases.rb +78 -0
  20. data/lib/rcfiles/files/file_cd_aliases.rb +85 -0
  21. data/lib/rcfiles/files/file_ls_colours.rb +76 -0
  22. data/lib/rcfiles/files/file_path_variable.rb +74 -0
  23. data/lib/rcfiles/files/file_pkgconfig.rb +74 -0
  24. data/lib/rcfiles/files/file_programs_aliases.rb +68 -0
  25. data/lib/rcfiles/files/file_ps1.rb +80 -0
  26. data/lib/rcfiles/files/file_system_settings.rb +75 -0
  27. data/lib/rcfiles/help/help.rb +48 -0
  28. data/lib/rcfiles/no_colours.rb +13 -0
  29. data/lib/rcfiles/project/project.rb +45 -0
  30. data/lib/rcfiles/rcfiles/README.md +5 -0
  31. data/lib/rcfiles/rcfiles/aliases_rc +25089 -0
  32. data/lib/rcfiles/rcfiles/cd_aliases_rc +17150 -0
  33. data/lib/rcfiles/rcfiles/cflags_rc +9 -0
  34. data/lib/rcfiles/rcfiles/compile_rc +11 -0
  35. data/lib/rcfiles/rcfiles/file_information_rc +16 -0
  36. data/lib/rcfiles/rcfiles/gnome_rc +10 -0
  37. data/lib/rcfiles/rcfiles/kde_rc +17 -0
  38. data/lib/rcfiles/rcfiles/kernel_rc +12 -0
  39. data/lib/rcfiles/rcfiles/lang_rc +9 -0
  40. data/lib/rcfiles/rcfiles/ldflags_rc +8 -0
  41. data/lib/rcfiles/rcfiles/ls_colours_rc +9 -0
  42. data/lib/rcfiles/rcfiles/network_rc +37 -0
  43. data/lib/rcfiles/rcfiles/path_variable_rc +9 -0
  44. data/lib/rcfiles/rcfiles/pkgconfig_rc +9 -0
  45. data/lib/rcfiles/rcfiles/programs_aliases_rc +19016 -0
  46. data/lib/rcfiles/rcfiles/ps1_rc +9 -0
  47. data/lib/rcfiles/rcfiles/special_aliases_rc +8 -0
  48. data/lib/rcfiles/rcfiles/system_rc +13 -0
  49. data/lib/rcfiles/rcfiles/system_settings_rc +192 -0
  50. data/lib/rcfiles/rcfiles/term_rc +9 -0
  51. data/lib/rcfiles/rcfiles/video_rc +24 -0
  52. data/lib/rcfiles/requires/require_the_directory_aliases.rb +7 -0
  53. data/lib/rcfiles/requires/require_the_rcfiles_constants.rb +18 -0
  54. data/lib/rcfiles/requires/require_the_rcfiles_project.rb +67 -0
  55. data/lib/rcfiles/requires/try_to_require_syck_and_psych.rb +18 -0
  56. data/lib/rcfiles/toplevel_methods/autogenerate_rc_file_from_this_yaml_file.rb +102 -0
  57. data/lib/rcfiles/toplevel_methods/change_directory.rb +16 -0
  58. data/lib/rcfiles/toplevel_methods/convert.rb +118 -0
  59. data/lib/rcfiles/toplevel_methods/convert_global_variables_in_the_cd_aliases_file_to_a_standalone_yaml_file.rb +50 -0
  60. data/lib/rcfiles/toplevel_methods/create_windows_cd_aliases_bat_file.rb +51 -0
  61. data/lib/rcfiles/toplevel_methods/e.rb +16 -0
  62. data/lib/rcfiles/toplevel_methods/esystem.rb +19 -0
  63. data/lib/rcfiles/toplevel_methods/generate_yaml_files.rb +148 -0
  64. data/lib/rcfiles/toplevel_methods/infer.rb +83 -0
  65. data/lib/rcfiles/toplevel_methods/is_on_roebe.rb +16 -0
  66. data/lib/rcfiles/toplevel_methods/main_directory.rb +108 -0
  67. data/lib/rcfiles/toplevel_methods/misc.rb +343 -0
  68. data/lib/rcfiles/toplevel_methods/n_registered_aliases_in_total.rb +55 -0
  69. data/lib/rcfiles/toplevel_methods/no_file_exists_at.rb +19 -0
  70. data/lib/rcfiles/toplevel_methods/notifications.rb +35 -0
  71. data/lib/rcfiles/toplevel_methods/rds.rb +16 -0
  72. data/lib/rcfiles/toplevel_methods/remove_newlines.rb +29 -0
  73. data/lib/rcfiles/toplevel_methods/report.rb +53 -0
  74. data/lib/rcfiles/toplevel_methods/return_standard_header.rb +36 -0
  75. data/lib/rcfiles/toplevel_methods/run_it.rb +46 -0
  76. data/lib/rcfiles/toplevel_methods/save_file.rb +27 -0
  77. data/lib/rcfiles/toplevel_methods/use_psych_or_syck.rb +50 -0
  78. data/lib/rcfiles/toplevel_methods/use_quotes.rb +68 -0
  79. data/lib/rcfiles/toplevel_methods/verbosity.rb +28 -0
  80. data/lib/rcfiles/version/version.rb +26 -0
  81. data/lib/rcfiles/yaml/aliases.yml +28004 -0
  82. data/lib/rcfiles/yaml/cd_aliases.yml +17951 -0
  83. data/lib/rcfiles/yaml/global_variables/README.md +3 -0
  84. data/lib/rcfiles/yaml/global_variables/global_variables_extracted_from_the_file_cd_aliases.yml +125 -0
  85. data/lib/rcfiles/yaml/ls_colours.yml +128 -0
  86. data/lib/rcfiles/yaml/path_variable.yml +15 -0
  87. data/lib/rcfiles/yaml/pkgconfig.yml +46 -0
  88. data/lib/rcfiles/yaml/programs_aliases.yml +20720 -0
  89. data/lib/rcfiles/yaml/ps1.yml +82 -0
  90. data/lib/rcfiles/yaml/store_into_this_directory.yml +1 -0
  91. data/lib/rcfiles/yaml/system_settings.yml +526 -0
  92. data/lib/rcfiles/yaml/use_psych_or_syck.yml +1 -0
  93. data/lib/rcfiles.rb +1 -0
  94. data/rcfiles.gemspec +57 -0
  95. data/test/testing_directory_aliases.rb +62 -0
  96. data/test/testing_using_another_path_to_directory_aliases.rb +17 -0
  97. data/test/testing_yaml_to_rcfiles.rb +9 -0
  98. metadata +202 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dbf39bf00945d09e1a142c1388b77551791331d70503bb680dc1895e48aa7031
4
+ data.tar.gz: cefdaf7349d54f3d0fdd70e7b0d43881e0f037b19f554d199b226603c93cfc11
5
+ SHA512:
6
+ metadata.gz: 2e0a0284b7945922a21b3fa95aa713e62019a1cece72e947977e85412946d88c9a4a9b8b035a785c16173d4fcbdb911aa9d340de27a150dfef0dd36aa18e8172
7
+ data.tar.gz: 1cafd72d82bcb47bb0af0dcbf23f5dd80a0dd3cefb83f1a0bebd0fcbb6efc4dc6185544c5193572795d4a4940a11550336e6469f8c4e7e96a2541228b57b4341
data/README.md ADDED
@@ -0,0 +1,562 @@
1
+ [![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
2
+ [![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
3
+ [![Gem Version](https://badge.fury.io/rb/rcfiles.svg)](https://badge.fury.io/rb/rcfiles)
4
+
5
+ This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">20.04.2024</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">20:17:25</span> o'clock.
6
+
7
+ ![logo](https://i.imgur.com/Mf9u97a.png)
8
+
9
+ ## Goals for the rcfiles project
10
+
11
+ This project will try to automatically generate valid rc-files for shells
12
+ such as bash or zsh. **rc-files** are resource-files typically used by
13
+ shells, which can be sourced in that shell. The default use case will
14
+ refer to the **bash** shell since that is the shell that I do happen
15
+ to use most of the time.
16
+
17
+ These **rc-files** are generated from yaml files. These yaml files in turn
18
+ are, mostly, also distributed with this project, but of course you can use
19
+ your own yaml files as well. More on this elsewhere in this document, but
20
+ in principle the rcfiles project could also autogenerate various .rb files
21
+ rather than rc-files, or depend on yaml files alone. This will be considered
22
+ in the long run, but for the time being (written in **April 2019**) this
23
+ is not yet a possibility.
24
+
25
+ The main idea for this project is, evidently, my own use case, which is
26
+ to primarily make my aliases, custom export settings in shells, and so
27
+ forth, available for other/new computers quickly.
28
+
29
+ ## Requiring the rcfiles project
30
+
31
+ The project is required via this way:
32
+
33
+ require 'rcfiles'
34
+
35
+ Of course you could use **load** too, but require is more common and,
36
+ in my opinion, better, unless you need the behaviour of **load**
37
+ exactly.
38
+
39
+ ## The main directory
40
+
41
+ The **main directory**, as far as the project here is concerned,
42
+ is simply the directory into which the various rc-files will be
43
+ autogenerated.
44
+
45
+ On my **home system**, this is usually the directory called
46
+ <b>/AUTOGENERATED/</b>.
47
+
48
+ The reason as to why I am using such a short, top-level directory is
49
+ that it is quite convenient for me to navigate to it or source the
50
+ various rc-files generated from that directory, such as in:
51
+
52
+ . /AUTOGENERATED/aliases_rc
53
+
54
+ However had, there is one **obvious drawback** with this approach - you
55
+ need to have write permission into that directory close to the **root**
56
+ of the filesystem, if you wish to auto-generate rc-files into that
57
+ directory. And this is not always possible, such as when you are in
58
+ a **restricted environment** (workspace-computers in a university, for
59
+ example). Or it may be unwanted by you, anyway.
60
+
61
+ Thus, it must be possible to specify another directory that is to
62
+ be used here.
63
+
64
+ If you want to **query the current main directory** in use then you
65
+ can use the following **toplevel API**:
66
+
67
+ Rcfiles.main_directory?
68
+
69
+ If you want to set towards a **new main directory**, then you can
70
+ use the **set_main_directory()** method:
71
+
72
+ Rcfiles.set_main_directory
73
+
74
+ As argument to this method simply pass the directory that you wish
75
+ to use to that method.
76
+
77
+ So, for example, say that your name is john, and you want to
78
+ keep the rc-files in your home directory on a Linux system, so
79
+ you may want to do this:
80
+
81
+ Rcfiles.set_main_directory('/home/john/rcfiles/')
82
+
83
+ Ideally make sure that the directory already exists, and that
84
+ you can write/read in/from that directory. But if this is your
85
+ home directory then you will typically have this access-permission,
86
+ anyway. Same with **/tmp/** on most linux distributions.
87
+
88
+ You can also use a simpler toplevel API such as:
89
+
90
+ Rcfiles.set_path
91
+
92
+ ## Commandline usage of this project:
93
+
94
+ If you do not want to auto-generate rc-files that have a "" quote, as
95
+ part of its value setting (the part on the right side of an alias),
96
+ such as for use in projects such as <b>cmder</b>, then you can use
97
+ this option:
98
+
99
+ --no-quotes
100
+
101
+ This may also be useful if you have to use a shell such as <b>cmder</b>
102
+ which appears to only support unquoted aliases.
103
+
104
+ So invoke the executable in bin/ like this:
105
+
106
+ rcfile --cmder-target
107
+ rcfile --cmder
108
+
109
+ To see where the main .yml files are, do this:
110
+
111
+ rcfiles --report
112
+
113
+ To find out hwo many aliases are part of this project, do:
114
+
115
+ rcfiles --n_aliases? # 46337 aliases are available in this project (28.08.2020).
116
+
117
+ ## How to use this project from within ruby-code
118
+
119
+ You first have to require this project, obviously:
120
+
121
+ require 'rcfiles'
122
+
123
+ Now - in order to batch-generate the various rc-files, you can use
124
+ an API such as the following one:
125
+
126
+ Rcfiles.run
127
+ Rcfiles.new
128
+
129
+ This defaults to my own aliases. For now this is how it is but in
130
+ future releases, people will be able to use their own custom
131
+ aliases.
132
+
133
+ If you want to store at the rc-files at a specific location,
134
+ such as a certain <b>directory</b>, then you can use the
135
+ symbol :store_at such as in the following example:
136
+
137
+ Rcfiles.new(store_at: Dir.pwd)
138
+
139
+ The second argument, in this case Dir.pwd, shall denote the
140
+ directory that you wish to use here.
141
+
142
+ This may be especially useful if you have no access to
143
+ the base directory at / e. g. when you are in a restricted
144
+ environment (like workstations in a university) or when
145
+ you simply want to use another directory name altogether.
146
+
147
+ The above API is a bit cumbersome, though, so you can use
148
+ any of the following toplevel APIs instead:
149
+
150
+ Rcfiles.set_store_into_this_directory
151
+ Rcfiles.set_main_directory
152
+ Rcfiles.set_path
153
+ Rcfiles.store_at=
154
+ Rcfiles.store_at=
155
+ Rcfiles.set_store_here
156
+ Rcfiles.set_store_into
157
+
158
+ ## Generating individual rc-aliases
159
+
160
+ There are several ways how to generate individual rc-aliases,
161
+ such as via <b>Rcfiles.new(:cd_aliases)</b>.
162
+
163
+ But there are other toplevel module-methods as well, such as the
164
+ following variants:
165
+
166
+ Rcfiles.generate :cd_aliases
167
+ Rcfiles.generate :aliases
168
+ Rcfiles.generate :program_aliases
169
+
170
+ And numbers as input as well, if one wants to be even shorter:
171
+
172
+ Rcfiles.generate 1
173
+ Rcfiles.generate 2
174
+ Rcfiles.generate 3
175
+
176
+ Why so many different ways? I simply just want to auto-generate
177
+ these aliases, no matter the given input. These shortcuts generate my
178
+ bash-specific aliases, but since as of March 2018, I also changed the
179
+ code to generate aliases that work on Windows in the <b>cmder</b>
180
+ shell. **cmder** is a bit different in that it requires aliases without
181
+ quotes (aka no '' or "" may be used there).
182
+
183
+ ## Determining the project's base directory
184
+
185
+ The toplevel "namespace" contains an instance variable called
186
+ **@project_base_directory**. This variable should point to
187
+ where the .rb files of this project are kept. Additionally
188
+ it will load up the .yml files that reside within the
189
+ **yml/** subdirectory there.
190
+
191
+ On my Linux home system, this works as-is, but other systems
192
+ may need to be a bit more flexible here, such as windows
193
+ perhaps, or systems where you may have no control over where
194
+ the .rb files may be placed (perhaps in a restricted
195
+ environment such as university campus).
196
+
197
+ Thus, you can modify the path to this directory via:
198
+
199
+ Rcfiles.set_project_base_directory()
200
+
201
+ You can also query the current path in use via:
202
+
203
+ Rcfiles.project_base_dir?
204
+ Rcfiles.project_base_directory?
205
+
206
+ ## Using quotes in the generated shell-rc files
207
+
208
+ The toplevel API **Rcfiles.use_quotes?** is
209
+ used to determine whether quotes will be used or not. Some
210
+ programs, such as **cmder**, need quotes.
211
+
212
+ You can toggle this behaviour like so:
213
+
214
+ Rcfiles.use_quotes = true
215
+ Rcfiles.use_quotes = false
216
+
217
+ Or simply:
218
+
219
+ Rcfiles.toggle_quotes # <- I prefer the long variant
220
+ Rcfiles.toggle # <- But the short variant is also a possibility.
221
+
222
+ The latter method will flip the state, from true to false
223
+ or from false to true.
224
+
225
+ ## Determining the file location of the different aliases in the project
226
+
227
+ Sometimes it may be necessary to set the path to yaml files, e. g. in
228
+ particular if you wish to make use of other .yml files that do **not**
229
+ come distributed with this project. That was the major reason why code
230
+ was added here, so that users can adapt the project to their use
231
+ cases.
232
+
233
+ Have a look at the following API, each one corresponding to the particular
234
+ .yml file (e. g. set_file_aliases() would denote the path to the file
235
+ called **aliases.yml**, whereas set_file_programs_aliases() would modify
236
+ the path to the file called **programs_aliases.yml** and so forth):
237
+
238
+ Rcfiles.set_file_aliases()
239
+ Rcfiles.set_programs_aliases()
240
+ Rcfiles.set_cd_aliases()
241
+
242
+ ## Rcfiles.report
243
+
244
+ You can use the toplevel method **Rcfiles.report** to report
245
+ some information about the Rcfiles project, such as from
246
+ which paths it will obtain information.
247
+
248
+ This functionality was necessary because we can re-define the paths
249
+ that are used to generate rc-files at any time; thus, we needed a
250
+ way to **query** the full path to these different files.
251
+
252
+ ## Rcfiles.infer
253
+
254
+ The toplevel method **Rcfiles.infer** can be called to
255
+ designate the path to one of the three main .yml files of this
256
+ project. It is thus similar to the three variants documented
257
+ above in this file, such as **Rcfiles.set_file_aliases()**,
258
+ **Rcfiles.set_programs_aliases()** and
259
+ **Rcfiles.set_cd_aliases()**. The difference is that
260
+ **infer()** is a lot shorter - and a lot simpler, too.
261
+
262
+ You only have to provide the path to this .yml file at hand.
263
+
264
+ Generic usage examples:
265
+
266
+ Rcfiles.infer 'aliases.yml'
267
+ Rcfiles.infer 'cd_aliases.yml'
268
+ Rcfiles.infer 'programs_aliases.yml'
269
+
270
+ In these cases these files will be automatically used, with
271
+ the path designed here. I recommend to first copy the .yml
272
+ files to e. g. your working home directory, and then call
273
+ the three .infer methods. That should help if for whatever
274
+ reason your ruby installation is unable to find the
275
+ path - or if you simply wish to use other .yml files, too.
276
+
277
+ ## Colours
278
+
279
+ By default, **Rcfiles** will make use of **colours**, as defined by
280
+ the 'colours' gem.
281
+
282
+ However had, this is **optional** and ultimately not really necessary -
283
+ it is just a convenience feature.
284
+ everyone.
285
+
286
+ If you would rather **NOT** want to use the **colours gem**, or may
287
+ encounter an error related to colours, you can change this either by
288
+ requiring the rcfiles-project a bit differently, such as through
289
+ either of these two ways (which are the same):
290
+
291
+ require 'rcfiles/no_colours'
292
+ require 'rcfiles/no_colours.rb'
293
+
294
+ This will automatically disable colours support for the **Rcfiles**
295
+ namespace.
296
+
297
+ The **first** variant is preferred, in my opinion, since it is
298
+ <b>shorter</b> - but use whatever you prefer, anyway.
299
+
300
+ You can also use the following code to generate the rc-files
301
+ without making use of colours:
302
+
303
+ Rcfiles.run { :disable_colours }
304
+
305
+ ## The directory rcfiles/
306
+
307
+ Since as of 07.04.2019 this project also includes all auto-generated
308
+ rcfiles, in the subdirectory called **rcfiles/**.
309
+
310
+ The primary reason as to why these files are distributed with this
311
+ project is so that:
312
+
313
+ a) they are available as-is when the gem is downloaded
314
+
315
+ and, even more importantly than that
316
+
317
+ b) because **psych** sometimes has problems with the main encoding used,
318
+ which means that the rc-files may not be generated on a given
319
+ computer system as-such. Hence why bundling these files into the
320
+ project directly makes this potential problem a non-issue (excluding
321
+ projects such as cmder, which require aliases to be defined without
322
+ quotes).
323
+
324
+ If you wish to copy these bundled rc-files via ruby, then you can
325
+ use the following toplevel method:
326
+
327
+ Rcfiles.copy_rcfiles_to_the_current_directory
328
+
329
+ ## Copying the rc-files via the commandline
330
+
331
+ Sometimes it may be useful to quickly copy the rc-files into your
332
+ current working directory, rather than generate them anew.
333
+
334
+ You can use the following commandline switch in order to achieve
335
+ this, and copy the registered rc-files into the current working
336
+ directory:
337
+
338
+ rcfiles --copy-rcfiles
339
+ rcfiles --copy
340
+ rcfiles --cp
341
+
342
+ I needed this functionality so that I could quickly copy the
343
+ rc-files, source them in bash, and continue working from here
344
+ past that point - mostly for convenience.
345
+
346
+ As stated elsewhere in this document, if you need to use this
347
+ functionality from ruby then you can use **Rcfiles.copy_rcfiles_to_the_current_directory**
348
+ or just **Rcfiles.copy_rcfiles**.
349
+
350
+ ## The PS1 path variable
351
+
352
+ If you wish to quickly generate a new rc-file with a default
353
+ PS1 (defaulting to my PS that is), the following commandline
354
+ variant can be used:
355
+
356
+ rcfiles --ps1
357
+
358
+ ## Generating other rc-files
359
+
360
+ You can either batch-generate all -rc files, or also cherry-pick
361
+ some of them.
362
+
363
+ Example:
364
+
365
+ rcfiles --programs-aliases
366
+
367
+ This will generate the **programs_aliases_rc file**.
368
+
369
+ ## Generating a .bat file for the cd-aliases on Windows
370
+
371
+ Certain windows-related shells, such as the fairly new
372
+ **windows-terminal**, make use of a fairly ... obscure
373
+ syntax for a cd-alias.
374
+
375
+ For example:
376
+
377
+ function pwdhome { set-location "c:\home\x" }
378
+
379
+ This would assign pwdhome to become a cd-alias to
380
+ /home/x. (Weird syntax.)
381
+
382
+ If you wish to generate such a .bat file with all
383
+ the cd-aliases available in this project, consider
384
+ using the following commandline variant:
385
+
386
+ rcfiles --windows-cd-aliases
387
+
388
+ Internally the method that is doing this is:
389
+
390
+ Rcfiles.create_windows_cd_aliases_bat_file
391
+
392
+ ## Obtaining all aliases, as a Hash
393
+
394
+ If you need to return all aliases registered in this
395
+ project, as a Hash, then you can use this toplevel
396
+ method:
397
+
398
+ Rcfiles.aliases?
399
+
400
+ In **January 2021** this gem contained 47088 entries (key→value pairs).
401
+ In **April 2021** this gem contained 47661 entries (key→value pairs).
402
+
403
+ ## doskey
404
+
405
+ **doskey** is an old DOS program (I think; at the least it was
406
+ available on DOS back in the days) that allows you to use aliases
407
+ on windows.
408
+
409
+ For a better explanation, have a look at the following link:
410
+
411
+ https://kunalspathak.github.io/2020-11-21-About-doskeys/
412
+
413
+ The **rcfiles** gem contains tons of aliases. Perhaps you have
414
+ lots of aliases as well and would like to re-use them on
415
+ windows.
416
+
417
+ You can use the **roebe** gem for that, in particular:
418
+
419
+ roebe/classes/doskey_generator.rb
420
+
421
+ Afterwards you may have to replace the global environment
422
+ variables. You can probably adapt this class/file:
423
+
424
+ roebe/classes/replace_global_variables_in_this_file.rb
425
+
426
+ At any rate, this subsection really just tries to contain
427
+ some helpful **hints** for those who want to make use of
428
+ doskey. You may have to adjust it to your own preference.
429
+
430
+ ## DirectoryAliases respectively Rcfiles::DirectoryAliases
431
+
432
+ In <b>May 2022</b> the old class called <b>Rcfiles::ExpandCdAliases</b>
433
+ was renamed into <b>Rcfiles::DirectoryAliases</b>. The old functionality
434
+ was retained for the most part, but some parts were changed or even
435
+ removed.
436
+
437
+ The primary reason for the rewrite was that the old logic of
438
+ ExpandCdAlias was very convoluted and complicated. I wanted to
439
+ extend it in <b>May 2022</b> but got frustrated with the old
440
+ design; some parts of the code base were +10 years old already,
441
+ and not that well designed.
442
+
443
+ Thus, I decided to rather than maintain the old code, to
444
+ just create a new class, with a cleaner design from the
445
+ get go.
446
+
447
+ The basic idea behind class Rcfiles::DirectoryAliases is that
448
+ an <b>input string</b> such as '<b>pwdj</b>' can be turned into
449
+ the corresponding aliased string, which would be '<b>/Depot/j/</b>'
450
+ instead.
451
+
452
+ The way how to do so would go like this:
453
+
454
+ Rcfiles::DirectoryAliases['pwdj'] # => '/Depot/j/'
455
+
456
+ This can then be used by a shell, such as <b>Roebe::Shell</b>
457
+ in particular - another project I maintain. The idea here
458
+ is to quickly navigate a local file system without having
459
+ to type the full paths whatsoever.
460
+
461
+ The class has been written with some flexibility in mind.
462
+ For instance, the main .yml file that it uses can be
463
+ queried via the following method:
464
+
465
+ Rcfiles::DirectoryAliases.yaml_file?
466
+
467
+ On my home system this defaults to:
468
+
469
+ /usr/lib/ruby/site_ruby/3.1.0/rcfiles/yaml/cd_aliases.yml
470
+
471
+ This .yml file, called **cd_aliases.yml**, is also distributed
472
+ by the <b>rcfiles</b> gem. This has been done mostly for
473
+ reasons of convenience - other users can use this .yml file
474
+ if they'd like to, but be aware that this defaults to my
475
+ home setup, so it may be utterly useless to you. Nonetheless,
476
+ you could maintain your own dataset - all you have to provide
477
+ is a similar .yml file. You can store it somewhere else on
478
+ your own local system.
479
+
480
+ You can specify the path to such a .yml file via:
481
+
482
+ Rcfiles::DirectoryAliases.set_yaml_file_used_by_class_directory_aliases(path_goes_here)
483
+
484
+ This method is called initially via:
485
+
486
+ Rcfiles::DirectoryAliases.set_yaml_file_used_by_class_directory_aliases(:default_yaml_file)
487
+
488
+ The symbol ::default_yaml_file will refer to the already mentioned
489
+ file called <b>/usr/lib/ruby/site_ruby/3.1.0/rcfiles/yaml/cd_aliases.yml</b>.
490
+
491
+ Note that this merely specifies the path to the file; it does not
492
+ yet load this file.
493
+
494
+ To load from this file have a look at the method called
495
+ <b>load_the_dataset_from_the_file_cd_aliases()</b>. This is
496
+ automatically called whenever <b>Rcfiles::DirectoryAliases.new</b>
497
+ is called. Have a look at the file at
498
+ <b>rcfiles/test/testing_using_another_path_to_directory_aliases.rb</b>
499
+ to see how you can load your own .yml file specifically.
500
+
501
+ ## Licence
502
+
503
+ Since as of <b>April 2021</b>, this project is using the MIT licence.
504
+ It is not a hugely important project, so using a less stringent
505
+ version was fine by me.
506
+
507
+ Copyright 2021-2023 Robert A. Heiler
508
+
509
+ You can read up on the MIT licence here:
510
+
511
+ https://opensource.org/licenses/MIT
512
+
513
+ The most important requirement (in my own parlance) is the
514
+ "no-warranty disclaimer", aka legalese to "use at your own
515
+ discretion and risk-analysis, without holding the author
516
+ or anyone else responsible for issues potentially
517
+ originating from using this software".
518
+
519
+
520
+ ## Contact information and mandatory 2FA (no longer) coming up in 2022 / 2023
521
+
522
+ If your creative mind has ideas and specific suggestions to make this gem
523
+ more useful in general, feel free to drop me an email at any time, via:
524
+
525
+ shevy@inbox.lt
526
+
527
+ Before that email I used an email account at Google gmail, but in **2021** I
528
+ decided to slowly abandon gmail, for various reasons. In order to limit the
529
+ explanation here, allow me to just briefly state that I do not feel as if I
530
+ want to promote any Google service anymore when the user becomes the end
531
+ product (such as via data collection by upstream services, including other
532
+ proxy-services). My feeling is that this is a hugely flawed business model
533
+ to begin with, and I no longer wish to support this in any way, even if
534
+ only indirectly so, such as by using services of companies that try to
535
+ promote this flawed model.
536
+
537
+ In regards to responding to emails: please keep in mind that responding
538
+ may take some time, depending on the amount of work I may have at that
539
+ moment. So it is not that emails are ignored; it is more that I have not
540
+ (yet) found the time to read and reply. This means there may be a delay
541
+ of days, weeks and in some instances also months. There is, unfortunately,
542
+ not much I can do when I need to prioritise my time investment, but I try
543
+ to consider <b>all</b> feedback as an opportunity to improve my projects
544
+ nonetheless.
545
+
546
+ In <b>2022</b> rubygems.org decided to make 2FA mandatory for every
547
+ gem owner eventually:
548
+
549
+ see
550
+ https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html
551
+
552
+ However had, that has been reverted again, so I decided to shorten
553
+ this paragraph. Mandatory 2FA may exclude users who do not have a
554
+ smartphone device or other means to 'identify'. I do not feel it is
555
+ a fair assumption by others to be made that non-identified people may
556
+ not contribute code, which is why I reject it. Mandatory 2FA would mean
557
+ an end to all my projects on rubygems.org, so let's hope it will never
558
+ happen. (Keep in mind that I refer to mandatory 2FA; I have no qualms
559
+ for people who use 2FA on their own, but this carrot-and-stick strategy
560
+ by those who control the rubygems infrastructure is a very bad one to
561
+ pursue.
562
+
data/bin/rcfiles ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'rcfiles'
6
+
7
+ Rcfiles.parse_commandline(ARGV)
8
+
9
+ if Rcfiles.is_on_roebe? and (ARGV.first and !ARGV.first.include?('help') )
10
+ require 'rcfiles/aggregate_all_rcfiles/aggregate_all_rcfiles.rb'
11
+ Rcfiles::AggregateAllRcfiles.new
12
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'rcfiles'
6
+
7
+ Rcfiles.run_it(ARGV)