rcfiles 1.2.150
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rcfiles might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +555 -0
- data/bin/rcfiles +12 -0
- data/bin/rcfiles_run_it +7 -0
- data/doc/README.gen +516 -0
- data/img/LOGO_FOR_THE_RCFILES_PROJECT.png +0 -0
- data/lib/rcfiles/aggregate_all_rcfiles/aggregate_all_rcfiles.rb +137 -0
- data/lib/rcfiles/class/colours.rb +54 -0
- data/lib/rcfiles/class/initialize.rb +66 -0
- data/lib/rcfiles/class/misc.rb +300 -0
- data/lib/rcfiles/class/rcfiles.rb +31 -0
- data/lib/rcfiles/class/reset.rb +26 -0
- data/lib/rcfiles/class/run.rb +17 -0
- data/lib/rcfiles/colours/colours.rb +111 -0
- data/lib/rcfiles/commandline/commandline.rb +187 -0
- data/lib/rcfiles/constants/constants.rb +253 -0
- data/lib/rcfiles/directory_aliases/README.md +2 -0
- data/lib/rcfiles/directory_aliases/directory_aliases.rb +647 -0
- data/lib/rcfiles/directory_aliases/toplevel_stored_dataset.rb +177 -0
- data/lib/rcfiles/directory_aliases/yaml_file_used_by_class_directory_aliases.rb +67 -0
- data/lib/rcfiles/files/file_aliases.rb +78 -0
- data/lib/rcfiles/files/file_cd_aliases.rb +85 -0
- data/lib/rcfiles/files/file_ls_colours.rb +76 -0
- data/lib/rcfiles/files/file_path_variable.rb +74 -0
- data/lib/rcfiles/files/file_pkgconfig.rb +74 -0
- data/lib/rcfiles/files/file_programs_aliases.rb +68 -0
- data/lib/rcfiles/files/file_ps1.rb +80 -0
- data/lib/rcfiles/files/file_system_settings.rb +66 -0
- data/lib/rcfiles/help/help.rb +47 -0
- data/lib/rcfiles/no_colours.rb +13 -0
- data/lib/rcfiles/project/project.rb +45 -0
- data/lib/rcfiles/rcfiles/README.md +5 -0
- data/lib/rcfiles/rcfiles/aliases_rc +21877 -0
- data/lib/rcfiles/rcfiles/cd_aliases_rc +15582 -0
- data/lib/rcfiles/rcfiles/cflags_rc +9 -0
- data/lib/rcfiles/rcfiles/compile_rc +11 -0
- data/lib/rcfiles/rcfiles/file_information_rc +16 -0
- data/lib/rcfiles/rcfiles/gnome_rc +10 -0
- data/lib/rcfiles/rcfiles/kde_rc +17 -0
- data/lib/rcfiles/rcfiles/kernel_rc +12 -0
- data/lib/rcfiles/rcfiles/lang_rc +9 -0
- data/lib/rcfiles/rcfiles/ldflags_rc +8 -0
- data/lib/rcfiles/rcfiles/ls_colours_rc +9 -0
- data/lib/rcfiles/rcfiles/network_rc +37 -0
- data/lib/rcfiles/rcfiles/path_variable_rc +9 -0
- data/lib/rcfiles/rcfiles/pkgconfig_rc +9 -0
- data/lib/rcfiles/rcfiles/programs_aliases_rc +18151 -0
- data/lib/rcfiles/rcfiles/ps1_rc +9 -0
- data/lib/rcfiles/rcfiles/special_aliases_rc +8 -0
- data/lib/rcfiles/rcfiles/system_rc +13 -0
- data/lib/rcfiles/rcfiles/system_settings_rc +192 -0
- data/lib/rcfiles/rcfiles/term_rc +9 -0
- data/lib/rcfiles/rcfiles/video_rc +24 -0
- data/lib/rcfiles/requires/require_the_directory_aliases.rb +7 -0
- data/lib/rcfiles/requires/require_the_rcfiles_constants.rb +18 -0
- data/lib/rcfiles/requires/require_the_rcfiles_project.rb +67 -0
- data/lib/rcfiles/requires/try_to_require_syck_and_psych.rb +18 -0
- data/lib/rcfiles/toplevel_methods/autogenerate_rc_file_from_this_yaml_file.rb +102 -0
- data/lib/rcfiles/toplevel_methods/change_directory.rb +16 -0
- data/lib/rcfiles/toplevel_methods/convert.rb +118 -0
- data/lib/rcfiles/toplevel_methods/convert_global_variables_in_the_cd_aliases_file_to_a_standalone_yaml_file.rb +50 -0
- data/lib/rcfiles/toplevel_methods/create_windows_cd_aliases_bat_file.rb +51 -0
- data/lib/rcfiles/toplevel_methods/e.rb +16 -0
- data/lib/rcfiles/toplevel_methods/esystem.rb +19 -0
- data/lib/rcfiles/toplevel_methods/generate_yaml_files.rb +148 -0
- data/lib/rcfiles/toplevel_methods/infer.rb +83 -0
- data/lib/rcfiles/toplevel_methods/is_on_roebe.rb +16 -0
- data/lib/rcfiles/toplevel_methods/main_directory.rb +108 -0
- data/lib/rcfiles/toplevel_methods/misc.rb +341 -0
- data/lib/rcfiles/toplevel_methods/n_registered_aliases_in_total.rb +55 -0
- data/lib/rcfiles/toplevel_methods/no_file_exists_at.rb +19 -0
- data/lib/rcfiles/toplevel_methods/notifications.rb +35 -0
- data/lib/rcfiles/toplevel_methods/rds.rb +16 -0
- data/lib/rcfiles/toplevel_methods/remove_newlines.rb +29 -0
- data/lib/rcfiles/toplevel_methods/report.rb +53 -0
- data/lib/rcfiles/toplevel_methods/return_standard_header.rb +36 -0
- data/lib/rcfiles/toplevel_methods/run_it.rb +46 -0
- data/lib/rcfiles/toplevel_methods/save_file.rb +27 -0
- data/lib/rcfiles/toplevel_methods/use_psych_or_syck.rb +50 -0
- data/lib/rcfiles/toplevel_methods/use_quotes.rb +68 -0
- data/lib/rcfiles/toplevel_methods/verbosity.rb +28 -0
- data/lib/rcfiles/version/version.rb +26 -0
- data/lib/rcfiles/yaml/aliases.yml +24690 -0
- data/lib/rcfiles/yaml/cd_aliases.yml +16308 -0
- data/lib/rcfiles/yaml/global_variables/README.md +3 -0
- data/lib/rcfiles/yaml/global_variables/global_variables_extracted_from_the_file_cd_aliases.yml +121 -0
- data/lib/rcfiles/yaml/ls_colours.yml +128 -0
- data/lib/rcfiles/yaml/path_variable.yml +14 -0
- data/lib/rcfiles/yaml/pkgconfig.yml +46 -0
- data/lib/rcfiles/yaml/programs_aliases.yml +19808 -0
- data/lib/rcfiles/yaml/ps1.yml +82 -0
- data/lib/rcfiles/yaml/store_into_this_directory.yml +1 -0
- data/lib/rcfiles/yaml/system_settings.yml +526 -0
- data/lib/rcfiles/yaml/use_psych_or_syck.yml +1 -0
- data/lib/rcfiles.rb +1 -0
- data/rcfiles.gemspec +57 -0
- data/test/testing_directory_aliases.rb +47 -0
- data/test/testing_using_another_path_to_directory_aliases.rb +17 -0
- data/test/testing_yaml_to_rcfiles.rb +9 -0
- metadata +204 -0
@@ -0,0 +1,187 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === Rcfiles.parse_commandline
|
6
|
+
#
|
7
|
+
# The code in this file here handles commandline-arguments.
|
8
|
+
#
|
9
|
+
# Usage example:
|
10
|
+
#
|
11
|
+
# Rcfiles.parse_commandline(ARGV)
|
12
|
+
#
|
13
|
+
# =========================================================================== #
|
14
|
+
# require 'rcfiles/commandline/commandline.rb'
|
15
|
+
# =========================================================================== #
|
16
|
+
module Rcfiles
|
17
|
+
|
18
|
+
require 'rcfiles/help/help.rb'
|
19
|
+
require 'rcfiles/toplevel_methods/main_directory.rb'
|
20
|
+
require 'rcfiles/toplevel_methods/misc.rb'
|
21
|
+
require 'rcfiles/toplevel_methods/use_quotes.rb'
|
22
|
+
require 'rcfiles/toplevel_methods/create_windows_cd_aliases_bat_file.rb'
|
23
|
+
|
24
|
+
begin
|
25
|
+
require 'opn'
|
26
|
+
rescue LoadError; end
|
27
|
+
|
28
|
+
# ========================================================================= #
|
29
|
+
# === Rcfiles.parse_commandline
|
30
|
+
# ========================================================================= #
|
31
|
+
def self.parse_commandline(
|
32
|
+
i = ARGV
|
33
|
+
)
|
34
|
+
if i.is_a? Array
|
35
|
+
if i.empty?
|
36
|
+
run_default_action
|
37
|
+
elsif i.join(' ').include?('set ')
|
38
|
+
i =~ /^-?-?set (.+)$/
|
39
|
+
set_store_into_this_directory($1.to_s.dup)
|
40
|
+
else
|
41
|
+
i.each {|entry| parse_commandline(entry)}
|
42
|
+
end
|
43
|
+
else
|
44
|
+
case i # case tag
|
45
|
+
# ===================================================================== #
|
46
|
+
# === rcfiles --sitelibdir
|
47
|
+
# ===================================================================== #
|
48
|
+
when /^-?-?sitelibdir$/
|
49
|
+
require 'rbconfig'
|
50
|
+
e 'The sitelibdir can be found at:'
|
51
|
+
e
|
52
|
+
e " #{RbConfig::CONFIG['sitelibdir']}"
|
53
|
+
e
|
54
|
+
exit
|
55
|
+
# ===================================================================== #
|
56
|
+
# === rcfiles --help
|
57
|
+
# ===================================================================== #
|
58
|
+
when /help$/
|
59
|
+
show_help
|
60
|
+
# ===================================================================== #
|
61
|
+
# === rcfiles --aggregate
|
62
|
+
# ===================================================================== #
|
63
|
+
when /^-?-?aggregate$/
|
64
|
+
require 'rcfiles/aggregate_all_rcfiles/aggregate_all_rcfiles.rb'
|
65
|
+
::Rcfiles::AggregateAllRcfiles.new
|
66
|
+
exit
|
67
|
+
# ===================================================================== #
|
68
|
+
# === rcfiles --windows-cd-aliases
|
69
|
+
# ===================================================================== #
|
70
|
+
when /^-?-?windows(-|_)?cd(-|_)?aliases$/
|
71
|
+
create_windows_cd_aliases_bat_file
|
72
|
+
# ===================================================================== #
|
73
|
+
# === rcfiles --set foobar
|
74
|
+
#
|
75
|
+
# or
|
76
|
+
#
|
77
|
+
# rcfiles --populate-this-dir=/Depot/Chroot/AUTOGENERATED/
|
78
|
+
#
|
79
|
+
# ===================================================================== #
|
80
|
+
when /^-?-?set (.+)$/,
|
81
|
+
/^-?-?populate-this-dir=(.+)$/
|
82
|
+
set_store_into_this_directory($1.to_s.dup)
|
83
|
+
# ===================================================================== #
|
84
|
+
# === rcfiles --copy-rcfiles
|
85
|
+
# === rcfiles --copy
|
86
|
+
# === rcfiles --cp
|
87
|
+
# ===================================================================== #
|
88
|
+
when /^-?-?copy(-|_)?rcfiles$/i,
|
89
|
+
/^-?-?copy$/i,
|
90
|
+
/^-?-?cp$/i
|
91
|
+
copy_the_rcfiles
|
92
|
+
# ===================================================================== #
|
93
|
+
# === rcfiles --n_aliases?
|
94
|
+
# ===================================================================== #
|
95
|
+
when /^-?-?n(-|_)?aliases\??$/i,
|
96
|
+
/^-?-?n(-|_)?entries\??$/i
|
97
|
+
show_how_many_aliases_are_registered_in_this_project_in_total
|
98
|
+
# ===================================================================== #
|
99
|
+
# === rcfiles --aliases
|
100
|
+
# ===================================================================== #
|
101
|
+
when /^-?-?aliases$/i
|
102
|
+
require 'rcfiles/files/file_aliases.rb'
|
103
|
+
generate_aliases_rcfile
|
104
|
+
# ===================================================================== #
|
105
|
+
# === rcfiles --programs-aliases
|
106
|
+
# ===================================================================== #
|
107
|
+
when /^-?-?programs(_|-)?aliases$/i
|
108
|
+
require 'rcfiles/files/file_programs_aliases.rb'
|
109
|
+
generate_programs_aliases_rcfile
|
110
|
+
# ===================================================================== #
|
111
|
+
# === rcfiles --ps1
|
112
|
+
# ===================================================================== #
|
113
|
+
when /^-?-?ps1$/i
|
114
|
+
require 'rcfiles/files/file_ps1.rb'
|
115
|
+
generate_ps1_rcfile
|
116
|
+
# ===================================================================== #
|
117
|
+
# === rcfiles --report
|
118
|
+
# ===================================================================== #
|
119
|
+
when /^-?-?report$/i
|
120
|
+
::Rcfiles.report
|
121
|
+
# ===================================================================== #
|
122
|
+
# === rcfiles --utf8
|
123
|
+
# ===================================================================== #
|
124
|
+
when /^-?-?utf8$/
|
125
|
+
opn(namespace: 'Rcfiles')
|
126
|
+
e 'Will generate Unicode-conforming (UTF8) yaml files.'
|
127
|
+
set_use_this_encoding(:utf8)
|
128
|
+
generate_yaml_files
|
129
|
+
# ===================================================================== #
|
130
|
+
# === rcfiles --no-quotes
|
131
|
+
# ===================================================================== #
|
132
|
+
when /^-?-?no(-|_)?quotes$/
|
133
|
+
disable_quotes_then_generate_the_files
|
134
|
+
# ===================================================================== #
|
135
|
+
# === rcfiles --directory?
|
136
|
+
# ===================================================================== #
|
137
|
+
when /^-?-?directory\??$/ # yrcfile --directory?
|
138
|
+
e sdir(CREATE_RCFILES_WHERE)
|
139
|
+
# ===================================================================== #
|
140
|
+
# === rcfiles --cmder-target
|
141
|
+
# ===================================================================== #
|
142
|
+
when /^-?-?cmder(-|_)?target$/i,
|
143
|
+
/^-?-?cmder$/,
|
144
|
+
/^-?-?cmd$/
|
145
|
+
opn; e 'Generating cmder-conforming rc-files next.'
|
146
|
+
disable_quotes_then_generate_the_files
|
147
|
+
else # This is the default.
|
148
|
+
# =================================================================== #
|
149
|
+
# First, handle directly passing existing yaml files into the
|
150
|
+
# rcfiles project here.
|
151
|
+
#
|
152
|
+
# Usage example:
|
153
|
+
#
|
154
|
+
# rcfiles cd_aliases.yml
|
155
|
+
#
|
156
|
+
# =================================================================== #
|
157
|
+
if File.exist?(i) and
|
158
|
+
(File.extname(i).delete('.') == 'yml')
|
159
|
+
autogenerate_rc_file_from_this_yaml_file(i)
|
160
|
+
# =================================================================== #
|
161
|
+
# Else, autogenerate all the various rc-files.
|
162
|
+
# =================================================================== #
|
163
|
+
else
|
164
|
+
run_default_action # === rcfiles
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end; self.instance_eval { alias menu parse_commandline } # === Rcfiles.menu
|
169
|
+
self.instance_eval { alias handle_commandline parse_commandline } # === Rcfiles.handle_commandline
|
170
|
+
|
171
|
+
# ========================================================================= #
|
172
|
+
# === Rcfiles.show_how_many_aliases_are_registered_in_this_project_in_total
|
173
|
+
#
|
174
|
+
# To run this method, try:
|
175
|
+
#
|
176
|
+
# rcfiles --n_aliases?
|
177
|
+
#
|
178
|
+
# ========================================================================= #
|
179
|
+
def self.show_how_many_aliases_are_registered_in_this_project_in_total
|
180
|
+
n_aliases = 0
|
181
|
+
n_aliases += YAML.load_file(file_aliases?).keys.size
|
182
|
+
n_aliases += YAML.load_file(file_cd_aliases?).keys.size
|
183
|
+
n_aliases += YAML.load_file(file_programs_aliases?).keys.size
|
184
|
+
e "#{n_aliases} aliases are available in this project."
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
@@ -0,0 +1,253 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This file contains a few encoding-specific constants as well. That way
|
6
|
+
# we can quickly change the main encoding for the rcfiles-gem.
|
7
|
+
#
|
8
|
+
# This file here also contains some constants that are only useful on my
|
9
|
+
# home system, e. g. for my home directory, aka when IS_ROEBE is set to
|
10
|
+
# 1 (true).
|
11
|
+
#
|
12
|
+
# One goal of the rcfiles project is to auto-generate my various
|
13
|
+
# shell-rc files, which is why the file here has been added. For other
|
14
|
+
# uses this file is evidently not too terribly useful, so it will not
|
15
|
+
# be used on these other systems.
|
16
|
+
# =========================================================================== #
|
17
|
+
# require 'rcfiles/constants/constants.rb'
|
18
|
+
# Rcfiles.ensure_main_encoding
|
19
|
+
# =========================================================================== #
|
20
|
+
module Rcfiles
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# === NAMESPACE
|
24
|
+
# ========================================================================= #
|
25
|
+
NAMESPACE = inspect
|
26
|
+
|
27
|
+
require 'rcfiles/project/project.rb'
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'roebe/project/project.rb'
|
31
|
+
rescue LoadError; end
|
32
|
+
|
33
|
+
# ========================================================================= #
|
34
|
+
# === HASH_CUSTOM_FILES
|
35
|
+
#
|
36
|
+
# The following Hash has two important entries:
|
37
|
+
#
|
38
|
+
# (1) The file path where the file exists locally
|
39
|
+
# (2) How to generate the rc-file at hand, e. g. if it is a file
|
40
|
+
# with aliases (then the key :aliases should be used), or
|
41
|
+
# whether it is a file that makes use of export-statements
|
42
|
+
# (then :export should be used as second value).
|
43
|
+
#
|
44
|
+
# Do note that the first entry, aka file path, does not necessarily
|
45
|
+
# have to be the full path per se. Code has been added to allow
|
46
|
+
# me to just give the name, and let ruby search for the local
|
47
|
+
# file at hand instead.
|
48
|
+
# ========================================================================= #
|
49
|
+
HASH_CUSTOM_FILES = {
|
50
|
+
# ======================================================================= #
|
51
|
+
# Not sure if roeberia should be included. Guess it would have to
|
52
|
+
# be changed before it can be included, so it was removed on 10.04.2019
|
53
|
+
# 'roeberia_settings.yml' => :export,
|
54
|
+
# ======================================================================= #
|
55
|
+
# 'special_aliases.yml' => :aliases,
|
56
|
+
# ^^^ this was merged back on 04.07.2021 so it is no longer needed here.
|
57
|
+
# 'german_umlaute.yml' => :aliases,
|
58
|
+
# ^^^ this was merged back on 24.06.2021 because now unicode works
|
59
|
+
# properly.
|
60
|
+
# 'colours.yml' => :aliases,
|
61
|
+
# ^^^ colours.yml is dysfunct since 2018 or so - I am not sure if
|
62
|
+
# it will make a comeback.
|
63
|
+
Roebe.project_yaml_directory?+'file_information.yml' => :export,
|
64
|
+
Roebe.project_yaml_directory?+'gnome/gnome.yml' => :export,
|
65
|
+
Roebe.project_yaml_directory?+'kde/kde.yml' => :export,
|
66
|
+
Roebe.project_yaml_directory?+'kernel/kernel.yml' => :export,
|
67
|
+
Roebe.project_yaml_directory?+'system/system.yml' => :export,
|
68
|
+
Roebe.project_yaml_directory?+'compile/compile.yml' => :export,
|
69
|
+
'/home/x/data/personal/yaml/network/network.yml' => :export,
|
70
|
+
'/home/x/programming/ruby/src/multimedia_paradise/lib/multimedia_paradise/yaml/video/video.yml' => :export,
|
71
|
+
# ======================================================================= #
|
72
|
+
# Next, entries under individual_environment_variables/
|
73
|
+
# ======================================================================= #
|
74
|
+
Roebe.project_yaml_directory?+'individual_environment_variables/ldflags.yml' => :export,
|
75
|
+
Roebe.project_yaml_directory?+'individual_environment_variables/cflags.yml' => :export,
|
76
|
+
Roebe.project_yaml_directory?+'individual_environment_variables/lang.yml' => :export,
|
77
|
+
Roebe.project_yaml_directory?+'individual_environment_variables/term.yml' => :export
|
78
|
+
} if Object.const_defined?(:Roebe)
|
79
|
+
|
80
|
+
# ========================================================================= #
|
81
|
+
# The following .yml file is special:
|
82
|
+
# directory_layout.yml
|
83
|
+
# ========================================================================= #
|
84
|
+
|
85
|
+
# ========================================================================= #
|
86
|
+
# === N
|
87
|
+
# ========================================================================= #
|
88
|
+
N = "\n"
|
89
|
+
|
90
|
+
# ========================================================================= #
|
91
|
+
# === HOME_DIR
|
92
|
+
# ========================================================================= #
|
93
|
+
HOME_DIR = '/home/'
|
94
|
+
|
95
|
+
# ========================================================================= #
|
96
|
+
# === DIRECTORY_CONTAINING_THE_RC_FILES_ON_MY_HOME_SYSTEM
|
97
|
+
#
|
98
|
+
# This constant is obviously not so useful for other people - it is
|
99
|
+
# for my home system only. The target is, in that case, hardcoded.
|
100
|
+
# ========================================================================= #
|
101
|
+
DIRECTORY_CONTAINING_THE_RC_FILES_ON_MY_HOME_SYSTEM =
|
102
|
+
"#{HOME_DIR}x/DATA/PC/OS/LINUX/yaml/"
|
103
|
+
|
104
|
+
# ========================================================================= #
|
105
|
+
# === LINUX_YAML_BASE_DIRECTORY
|
106
|
+
#
|
107
|
+
# Simply point to the environment variable $LINUX_YAML.
|
108
|
+
#
|
109
|
+
# cd $LINUX_YAML
|
110
|
+
#
|
111
|
+
# ========================================================================= #
|
112
|
+
if ENV['LINUX_YAML']
|
113
|
+
LINUX_YAML_BASE_DIRECTORY = "#{ENV['LINUX_YAML']}/"
|
114
|
+
else
|
115
|
+
LINUX_YAML_BASE_DIRECTORY = DIRECTORY_CONTAINING_THE_RC_FILES_ON_MY_HOME_SYSTEM
|
116
|
+
end
|
117
|
+
|
118
|
+
# ========================================================================= #
|
119
|
+
# === Rcfiles::FILE_STORE_INTO_THIS_DIRECTORY
|
120
|
+
# ========================================================================= #
|
121
|
+
FILE_STORE_INTO_THIS_DIRECTORY =
|
122
|
+
"#{project_yaml_dir?}store_into_this_directory.yml"
|
123
|
+
|
124
|
+
# ========================================================================= #
|
125
|
+
# === CREATE_RCFILES_WHERE
|
126
|
+
#
|
127
|
+
# Where to put the RC files by default. Must be a directory. But,
|
128
|
+
# we must first check whether the file exists.
|
129
|
+
# ========================================================================= #
|
130
|
+
_ = FILE_STORE_INTO_THIS_DIRECTORY
|
131
|
+
if File.exist? _
|
132
|
+
# ======================================================================= #
|
133
|
+
# This clause is the default one.
|
134
|
+
# ======================================================================= #
|
135
|
+
CREATE_RCFILES_WHERE = File.read(_).strip # '/AUTOGENERATED/'
|
136
|
+
else
|
137
|
+
# ======================================================================= #
|
138
|
+
# This one is just a rescued-variant defaulting to the home directory
|
139
|
+
# as base-directory.
|
140
|
+
# ======================================================================= #
|
141
|
+
CREATE_RCFILES_WHERE = File.expand_path('~/AUTOGENERATED/')
|
142
|
+
end
|
143
|
+
|
144
|
+
# ========================================================================= #
|
145
|
+
# === RUBY_SRC_DIR_AT_HOME
|
146
|
+
# ========================================================================= #
|
147
|
+
RUBY_SRC_DIR_AT_HOME =
|
148
|
+
"#{HOME_DIR}x/programming/ruby/src/"
|
149
|
+
|
150
|
+
# ========================================================================= #
|
151
|
+
# === UTF_ENCODING
|
152
|
+
# ========================================================================= #
|
153
|
+
UTF_ENCODING = 'utf-8'
|
154
|
+
UTF8_ENCODING = UTF_ENCODING # === UTF8_ENCODING
|
155
|
+
|
156
|
+
# ========================================================================= #
|
157
|
+
# === ISO_ENCODING
|
158
|
+
# ========================================================================= #
|
159
|
+
ISO_ENCODING = 'ISO-8859-1'
|
160
|
+
ENCODING_ISO = ISO_ENCODING # === ENCODING_ISO
|
161
|
+
|
162
|
+
# ========================================================================= #
|
163
|
+
# === MAIN_ENCODING_TO_USE
|
164
|
+
#
|
165
|
+
# This constant is very important - it denotes which is the main
|
166
|
+
# encoding for the rcfiles-project.
|
167
|
+
# ========================================================================= #
|
168
|
+
MAIN_ENCODING_TO_USE = UTF_ENCODING # === MAIN_ENCODING_TO_USE
|
169
|
+
USE_THIS_ENCODING = UTF_ENCODING # === USE_THIS_ENCODING
|
170
|
+
|
171
|
+
# ========================================================================= #
|
172
|
+
# === Rcfiles.set_use_this_encoding
|
173
|
+
#
|
174
|
+
# This toplevel-method can be used to assign to another encoding
|
175
|
+
# set that is to be used.
|
176
|
+
# ========================================================================= #
|
177
|
+
def self.set_use_this_encoding(
|
178
|
+
i = MAIN_ENCODING_TO_USE
|
179
|
+
)
|
180
|
+
case i
|
181
|
+
when :default
|
182
|
+
i = MAIN_ENCODING_TO_USE
|
183
|
+
when :utf, :utf8
|
184
|
+
i = UTF8_ENCODING
|
185
|
+
end
|
186
|
+
@use_this_encoding = i
|
187
|
+
end
|
188
|
+
|
189
|
+
# ========================================================================= #
|
190
|
+
# Initialize it to the default.
|
191
|
+
# ========================================================================= #
|
192
|
+
set_use_this_encoding(:default)
|
193
|
+
|
194
|
+
# ========================================================================= #
|
195
|
+
# === Rcfiles.use_this_encoding?
|
196
|
+
# ========================================================================= #
|
197
|
+
def self.use_this_encoding?
|
198
|
+
@use_this_encoding
|
199
|
+
end; self.instance_eval { alias use_this_encoding use_this_encoding? } # === Rcfiles.use_this_encoding
|
200
|
+
self.instance_eval { alias main_encoding? use_this_encoding? } # === Rcfiles.main_encoding?
|
201
|
+
|
202
|
+
# ========================================================================= #
|
203
|
+
# === Rcfiles.ensure_main_encoding
|
204
|
+
#
|
205
|
+
# The second argument to this method specifies which encoding we will
|
206
|
+
# use by default.
|
207
|
+
# ========================================================================= #
|
208
|
+
def self.ensure_main_encoding(
|
209
|
+
i,
|
210
|
+
use_this_encoding = @use_this_encoding
|
211
|
+
)
|
212
|
+
i = i.dup if i.frozen?
|
213
|
+
case use_this_encoding
|
214
|
+
when :utf,
|
215
|
+
:utf8
|
216
|
+
use_this_encoding = UTF8_ENCODING
|
217
|
+
end
|
218
|
+
i = i.dup if i.frozen?
|
219
|
+
i.force_encoding(use_this_encoding) # Return this value here.
|
220
|
+
end; self.instance_eval { alias ensure_proper_encoding_for ensure_main_encoding } # === Rcfiles.ensure_proper_encoding_for
|
221
|
+
|
222
|
+
# ========================================================================= #
|
223
|
+
# === FILE_ROEBERIA_SETTINGS
|
224
|
+
#
|
225
|
+
# The next constant is only useful on my home setup:
|
226
|
+
# ========================================================================= #
|
227
|
+
FILE_ROEBERIA_SETTINGS =
|
228
|
+
"/home/x/data/personal/yaml/roeberia_settings.yml"
|
229
|
+
|
230
|
+
# ========================================================================= #
|
231
|
+
# === Rcfiles.file_global_variables
|
232
|
+
#
|
233
|
+
# On my home system, in May 2022, this method yielded the following
|
234
|
+
# String:
|
235
|
+
#
|
236
|
+
# /usr/lib/ruby/site_ruby/3.1.0/rcfiles/yaml/global_variables/global_variables_extracted_from_the_file_cd_aliases.yml
|
237
|
+
#
|
238
|
+
# ========================================================================= #
|
239
|
+
def self.file_global_variables
|
240
|
+
"#{project_yaml_directory?}"\
|
241
|
+
"global_variables/global_variables_extracted_from_the_file_cd_aliases.yml"
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
if __FILE__ == $PROGRAM_NAME
|
247
|
+
alias e puts
|
248
|
+
e '='*80
|
249
|
+
p Rcfiles.constants.sort
|
250
|
+
e '='*80
|
251
|
+
pp Rcfiles::HASH_CUSTOM_FILES
|
252
|
+
e '='*80
|
253
|
+
end
|