rcfiles 1.1.1137
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 +401 -0
- data/bin/rcfiles +7 -0
- data/bin/rcfiles_run_it +7 -0
- data/doc/README.gen +384 -0
- data/lib/rcfiles.rb +1 -0
- data/lib/rcfiles/class/colours.rb +54 -0
- data/lib/rcfiles/class/initialize.rb +66 -0
- data/lib/rcfiles/class/misc.rb +299 -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 +107 -0
- data/lib/rcfiles/commandline/commandline.rb +170 -0
- data/lib/rcfiles/constants/custom_files.rb +80 -0
- data/lib/rcfiles/constants/encodings.rb +85 -0
- data/lib/rcfiles/constants/misc.rb +75 -0
- data/lib/rcfiles/constants/namespace.rb +18 -0
- data/lib/rcfiles/expand_cd_aliases/constants.rb +50 -0
- data/lib/rcfiles/expand_cd_aliases/expand_cd_aliases.rb +626 -0
- data/lib/rcfiles/expand_cd_aliases/run.rb +18 -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 +46 -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 +18526 -0
- data/lib/rcfiles/rcfiles/cd_aliases_rc +13313 -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/german_umlaute_rc +264 -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 +15597 -0
- data/lib/rcfiles/rcfiles/ps1_rc +9 -0
- data/lib/rcfiles/rcfiles/special_aliases_rc +23 -0
- data/lib/rcfiles/rcfiles/system_rc +13 -0
- data/lib/rcfiles/rcfiles/system_settings_rc +191 -0
- data/lib/rcfiles/rcfiles/term_rc +9 -0
- data/lib/rcfiles/rcfiles/video_rc +24 -0
- data/lib/rcfiles/requires/require_the_expand_cd_aliases.rb +7 -0
- data/lib/rcfiles/requires/require_the_rcfiles_constants.rb +21 -0
- data/lib/rcfiles/requires/require_the_rcfiles_project.rb +66 -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/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 +304 -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 +33 -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 +20991 -0
- data/lib/rcfiles/yaml/cd_aliases.yml +13970 -0
- data/lib/rcfiles/yaml/ls_colours.yml +128 -0
- data/lib/rcfiles/yaml/path_variable.yml +12 -0
- data/lib/rcfiles/yaml/pkgconfig.yml +46 -0
- data/lib/rcfiles/yaml/programs_aliases.yml +17081 -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 +513 -0
- data/lib/rcfiles/yaml/use_psych_or_syck.yml +1 -0
- data/rcfiles.gemspec +56 -0
- data/test/testing_expand_cd_aliases.rb +47 -0
- data/test/testing_yaml_to_rcfiles.rb +9 -0
- metadata +201 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/class/reset.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Rcfiles
|
8
|
+
|
9
|
+
class Rcfiles
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === reset (reset tag)
|
13
|
+
# ========================================================================= #
|
14
|
+
def reset
|
15
|
+
# ======================================================================= #
|
16
|
+
# By default this class will be verbose, aka it will "output its
|
17
|
+
# findings to the end user".
|
18
|
+
# ======================================================================= #
|
19
|
+
@be_verbose = true
|
20
|
+
set_create_rcfiles_where # Define where to store the rc-files.
|
21
|
+
set_current_date
|
22
|
+
clear_dataset
|
23
|
+
set_dataset
|
24
|
+
end
|
25
|
+
|
26
|
+
end; end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
module Rcfiles
|
6
|
+
|
7
|
+
class Rcfiles
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === run (run tag)
|
11
|
+
# ========================================================================= #
|
12
|
+
def run
|
13
|
+
check_whether_rcfiles_directory_exists
|
14
|
+
generate_the_most_important_rcfiles
|
15
|
+
end
|
16
|
+
|
17
|
+
end; end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/colours/colours.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Rcfiles
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'colours'
|
11
|
+
rescue LoadError; end
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === @use_colours
|
15
|
+
#
|
16
|
+
# Note that this will only TRY to use colours; the actual USING of
|
17
|
+
# colours depends on the availability of the gem called "colours".
|
18
|
+
# ========================================================================= #
|
19
|
+
@use_colours = true
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === Rcfiles.rev
|
23
|
+
# ========================================================================= #
|
24
|
+
def self.rev
|
25
|
+
if @use_colours
|
26
|
+
::Colours.rev
|
27
|
+
else
|
28
|
+
''
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# ========================================================================= #
|
33
|
+
# === Rcfiles.use_colours?
|
34
|
+
# ========================================================================= #
|
35
|
+
def self.use_colours?
|
36
|
+
@use_colours
|
37
|
+
end
|
38
|
+
|
39
|
+
# ========================================================================= #
|
40
|
+
# === Rcfiles.enable_colours
|
41
|
+
# ========================================================================= #
|
42
|
+
def self.enable_colours
|
43
|
+
@use_colours = true
|
44
|
+
end
|
45
|
+
|
46
|
+
# ========================================================================= #
|
47
|
+
# === Rcfiles.disable_colours
|
48
|
+
# ========================================================================= #
|
49
|
+
def self.disable_colours
|
50
|
+
@use_colours = false
|
51
|
+
end; self.instance_eval { alias no_colours disable_colours } # === Rcfiles.no_colours
|
52
|
+
|
53
|
+
# ========================================================================= #
|
54
|
+
# === Rcfiles.sdir
|
55
|
+
# ========================================================================= #
|
56
|
+
def self.sdir(i = '')
|
57
|
+
if @use_colours and Object.const_defined?(:Colours)
|
58
|
+
return ::Colours.sdir(i)
|
59
|
+
end
|
60
|
+
i
|
61
|
+
end
|
62
|
+
|
63
|
+
# ========================================================================= #
|
64
|
+
# === Rcfiles.sfancy
|
65
|
+
# ========================================================================= #
|
66
|
+
def self.sfancy(i = '')
|
67
|
+
if @use_colours and Object.const_defined?(:Colours)
|
68
|
+
return ::Colours.sfancy(i)
|
69
|
+
end
|
70
|
+
i
|
71
|
+
end
|
72
|
+
|
73
|
+
# ========================================================================= #
|
74
|
+
# === Rcfiles.simp
|
75
|
+
# ========================================================================= #
|
76
|
+
def self.simp(i = '')
|
77
|
+
if @use_colours and Object.const_defined?(:Colours)
|
78
|
+
return ::Colours.simp(i)
|
79
|
+
end
|
80
|
+
i
|
81
|
+
end
|
82
|
+
|
83
|
+
# ========================================================================= #
|
84
|
+
# === Rcfiles.teal
|
85
|
+
# ========================================================================= #
|
86
|
+
def self.teal(i = '')
|
87
|
+
if @use_colours and Object.const_defined?(:Colours) and
|
88
|
+
Colours.respond_to?(:teal)
|
89
|
+
return ::Colours.teal(i)
|
90
|
+
else
|
91
|
+
i
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# ========================================================================= #
|
96
|
+
# === Rcfiles.sfile
|
97
|
+
# ========================================================================= #
|
98
|
+
def self.sfile(i = '')
|
99
|
+
if @use_colours and Object.const_defined?(:Colours) and
|
100
|
+
Colours.respond_to?(:sfile)
|
101
|
+
return ::Colours.sfile(i)
|
102
|
+
else
|
103
|
+
i
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
@@ -0,0 +1,170 @@
|
|
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 --windows-cd-aliases
|
47
|
+
# ===================================================================== #
|
48
|
+
when /^-?-?windows(-|_)?cd(-|_)?aliases$/
|
49
|
+
create_windows_cd_aliases_bat_file
|
50
|
+
# ===================================================================== #
|
51
|
+
# === rcfiles --help
|
52
|
+
# ===================================================================== #
|
53
|
+
when /help$/
|
54
|
+
show_help
|
55
|
+
# ======================================================================= #
|
56
|
+
# === rcfiles --set foobar
|
57
|
+
#
|
58
|
+
# or
|
59
|
+
#
|
60
|
+
# rcfiles --populate-this-dir=/Depot/Chroot/AUTOGENERATED/
|
61
|
+
#
|
62
|
+
# ======================================================================= #
|
63
|
+
when /^-?-?set (.+)$/,
|
64
|
+
/^-?-?populate-this-dir=(.+)$/
|
65
|
+
set_store_into_this_directory($1.to_s.dup)
|
66
|
+
# ======================================================================= #
|
67
|
+
# === rcfiles --copy-rcfiles
|
68
|
+
# === rcfiles --copy
|
69
|
+
# === rcfiles --cp
|
70
|
+
# ======================================================================= #
|
71
|
+
when /^-?-?copy(-|_)?rcfiles$/i,
|
72
|
+
/^-?-?copy$/i,
|
73
|
+
/^-?-?cp$/i
|
74
|
+
copy_the_rcfiles
|
75
|
+
# ======================================================================= #
|
76
|
+
# === rcfiles --n_aliases?
|
77
|
+
# ======================================================================= #
|
78
|
+
when /^-?-?n(-|_)?aliases\??$/i,
|
79
|
+
/^-?-?n(-|_)?entries\??$/i
|
80
|
+
show_how_many_aliases_are_registered_in_this_project_in_total
|
81
|
+
# ======================================================================= #
|
82
|
+
# === rcfiles --aliases
|
83
|
+
# ======================================================================= #
|
84
|
+
when /^-?-?aliases$/i
|
85
|
+
require 'rcfiles/files/file_aliases.rb'
|
86
|
+
generate_aliases_rcfile
|
87
|
+
# ======================================================================= #
|
88
|
+
# === rcfiles --programs-aliases
|
89
|
+
# ======================================================================= #
|
90
|
+
when /^-?-?programs(_|-)?aliases$/i
|
91
|
+
require 'rcfiles/files/file_programs_aliases.rb'
|
92
|
+
generate_programs_aliases_rcfile
|
93
|
+
# ======================================================================= #
|
94
|
+
# === rcfiles --ps1
|
95
|
+
# ======================================================================= #
|
96
|
+
when /^-?-?ps1$/i
|
97
|
+
require 'rcfiles/files/file_ps1.rb'
|
98
|
+
generate_ps1_rcfile
|
99
|
+
# ======================================================================= #
|
100
|
+
# === rcfiles --report
|
101
|
+
# ======================================================================= #
|
102
|
+
when /^-?-?report$/i
|
103
|
+
::Rcfiles.report
|
104
|
+
# ======================================================================= #
|
105
|
+
# === rcfiles --utf8
|
106
|
+
# ======================================================================= #
|
107
|
+
when /^-?-?utf8$/
|
108
|
+
opn(namespace: 'Rcfiles')
|
109
|
+
e 'Will generate Unicode-conforming (UTF8) yaml files.'
|
110
|
+
set_use_this_encoding(:utf8)
|
111
|
+
generate_yaml_files
|
112
|
+
# ===================================================================== #
|
113
|
+
# === rcfiles --no-quotes
|
114
|
+
# ===================================================================== #
|
115
|
+
when /^-?-?no(-|_)?quotes$/
|
116
|
+
disable_quotes_then_generate_the_files
|
117
|
+
# ===================================================================== #
|
118
|
+
# === rcfiles --directory?
|
119
|
+
# ===================================================================== #
|
120
|
+
when /^-?-?directory\??$/ # yrcfile --directory?
|
121
|
+
e sdir(CREATE_RCFILES_WHERE)
|
122
|
+
# ===================================================================== #
|
123
|
+
# === rcfiles --cmder-target
|
124
|
+
# ===================================================================== #
|
125
|
+
when /^-?-?cmder(-|_)?target$/i,
|
126
|
+
/^-?-?cmder$/,
|
127
|
+
/^-?-?cmd$/
|
128
|
+
opn; e 'Generating cmder-conforming rc-files next.'
|
129
|
+
disable_quotes_then_generate_the_files
|
130
|
+
else # This is the default.
|
131
|
+
# =================================================================== #
|
132
|
+
# First, handle directly passing existing yaml files into the
|
133
|
+
# rcfiles project here.
|
134
|
+
#
|
135
|
+
# Usage example:
|
136
|
+
#
|
137
|
+
# rcfiles cd_aliases.yml
|
138
|
+
#
|
139
|
+
# =================================================================== #
|
140
|
+
if File.exist?(i) and
|
141
|
+
(File.extname(i).delete('.') == 'yml')
|
142
|
+
autogenerate_rc_file_from_this_yaml_file(i)
|
143
|
+
# =================================================================== #
|
144
|
+
# Else, autogenerate all the various rc-files.
|
145
|
+
# =================================================================== #
|
146
|
+
else
|
147
|
+
run_default_action # === rcfiles
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end; self.instance_eval { alias menu parse_commandline } # === Rcfiles.menu
|
152
|
+
self.instance_eval { alias handle_commandline parse_commandline } # === Rcfiles.handle_commandline
|
153
|
+
|
154
|
+
# ========================================================================= #
|
155
|
+
# === Rcfiles.show_how_many_aliases_are_registered_in_this_project_in_total
|
156
|
+
#
|
157
|
+
# To run this method, try:
|
158
|
+
#
|
159
|
+
# rcfiles --n_aliases?
|
160
|
+
#
|
161
|
+
# ========================================================================= #
|
162
|
+
def self.show_how_many_aliases_are_registered_in_this_project_in_total
|
163
|
+
n_aliases = 0
|
164
|
+
n_aliases += YAML.load_file(file_aliases?).keys.size
|
165
|
+
n_aliases += YAML.load_file(file_cd_aliases?).keys.size
|
166
|
+
n_aliases += YAML.load_file(file_programs_aliases?).keys.size
|
167
|
+
e "#{n_aliases} aliases are available in this project."
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# The content of this file is mostly for my home directory, aka when
|
6
|
+
# IS_ROEBE is set to 1 (true).
|
7
|
+
#
|
8
|
+
# One goal of the rcfiles project is to auto-generate my various
|
9
|
+
# shell-rc files, which is why the file here has been added. For other
|
10
|
+
# uses this file is evidently not too terribly useful, so it will not
|
11
|
+
# be used on these other systems.
|
12
|
+
# =========================================================================== #
|
13
|
+
# require 'rcfiles/constants/custom_files.rb'
|
14
|
+
# =========================================================================== #
|
15
|
+
require 'rcfiles/constants/misc.rb'
|
16
|
+
|
17
|
+
module Rcfiles
|
18
|
+
|
19
|
+
# ========================================================================= #
|
20
|
+
# === HASH_CUSTOM_FILES
|
21
|
+
#
|
22
|
+
# The following Hash has two important entries:
|
23
|
+
#
|
24
|
+
# (1) The file path where the file exists locally
|
25
|
+
# (2) How to generate the rc-file at hand, e. g. if it is a file
|
26
|
+
# with aliases (then the key :aliases should be used), or
|
27
|
+
# whether it is a file that makes use of export-statements
|
28
|
+
# (then :export should be used as second value).
|
29
|
+
#
|
30
|
+
# Do note that the first entry, aka file path, does not necessarily
|
31
|
+
# have to be the full path per se. Code has been added to allow
|
32
|
+
# me to just give the name, and let ruby search for the local
|
33
|
+
# file at hand instead.
|
34
|
+
# ========================================================================= #
|
35
|
+
HASH_CUSTOM_FILES = {
|
36
|
+
# ======================================================================= #
|
37
|
+
# Not sure if roeberia should be included. Guess it would have to
|
38
|
+
# be changed before it can be included, so it was removed on 10.04.2019
|
39
|
+
# 'roeberia_settings.yml' => :export,
|
40
|
+
# ======================================================================= #
|
41
|
+
'individual_environment_variables/term.yml' => :export,
|
42
|
+
'special_aliases.yml' => :aliases,
|
43
|
+
'german_umlaute.yml' => :aliases,
|
44
|
+
# 'colours.yml' => :aliases,
|
45
|
+
# ^^^ colours.yml is dysfunct since 2018 or so - I am not sure if
|
46
|
+
# it will make a comeback.
|
47
|
+
'file_information.yml' => :export,
|
48
|
+
'gnome.yml' => :export,
|
49
|
+
'kde.yml' => :export,
|
50
|
+
'kernel.yml' => :export,
|
51
|
+
'system.yml' => :export,
|
52
|
+
'compile.yml' => :export,
|
53
|
+
'network.yml' => :export,
|
54
|
+
'video.yml' => :export,
|
55
|
+
# ======================================================================= #
|
56
|
+
# Next, entries under individual_environment_variables/
|
57
|
+
# ======================================================================= #
|
58
|
+
'individual_environment_variables/ldflags.yml' => :export,
|
59
|
+
'individual_environment_variables/cflags.yml' => :export,
|
60
|
+
'individual_environment_variables/lang.yml' => :export
|
61
|
+
}
|
62
|
+
|
63
|
+
# ========================================================================= #
|
64
|
+
# The following .yml file is special:
|
65
|
+
# directory_layout.yml
|
66
|
+
# ========================================================================= #
|
67
|
+
|
68
|
+
# ========================================================================= #
|
69
|
+
# === FILE_ROEBERIA_SETTINGS
|
70
|
+
#
|
71
|
+
# The next constant is only useful on my home setup:
|
72
|
+
# ========================================================================= #
|
73
|
+
FILE_ROEBERIA_SETTINGS =
|
74
|
+
"#{LINUX_YAML_BASE_DIRECTORY}roeberia_settings.yml"
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
if __FILE__ == $PROGRAM_NAME
|
79
|
+
pp Rcfiles::HASH_CUSTOM_FILES
|
80
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# Specify some constants related to Encodings. That way, if we ever have
|
6
|
+
# to, we can quickly change the main encoding for this project.
|
7
|
+
# =========================================================================== #
|
8
|
+
# require 'rcfiles/constants/encodings.rb'
|
9
|
+
# Rcfiles.ensure_main_encoding
|
10
|
+
# =========================================================================== #
|
11
|
+
module Rcfiles
|
12
|
+
|
13
|
+
# ========================================================================= #
|
14
|
+
# === UTF_ENCODING
|
15
|
+
# ========================================================================= #
|
16
|
+
UTF_ENCODING = 'utf-8'
|
17
|
+
UTF8_ENCODING = UTF_ENCODING # === UTF8_ENCODING
|
18
|
+
|
19
|
+
# ========================================================================= #
|
20
|
+
# === ISO_ENCODING
|
21
|
+
# ========================================================================= #
|
22
|
+
ISO_ENCODING = 'ISO-8859-1'
|
23
|
+
ENCODING_ISO = ISO_ENCODING # === ENCODING_ISO
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === MAIN_ENCODING_TO_USE
|
27
|
+
#
|
28
|
+
# This constant is very important - it denotes which is the main
|
29
|
+
# encoding for the rcfiles-project.
|
30
|
+
# ========================================================================= #
|
31
|
+
MAIN_ENCODING_TO_USE = UTF_ENCODING # === MAIN_ENCODING_TO_USE
|
32
|
+
USE_THIS_ENCODING = UTF_ENCODING # === USE_THIS_ENCODING
|
33
|
+
|
34
|
+
# ========================================================================= #
|
35
|
+
# === Rcfiles.set_use_this_encoding
|
36
|
+
#
|
37
|
+
# This toplevel-method can be used to assign to another encoding
|
38
|
+
# set that is to be used.
|
39
|
+
# ========================================================================= #
|
40
|
+
def self.set_use_this_encoding(
|
41
|
+
i = MAIN_ENCODING_TO_USE
|
42
|
+
)
|
43
|
+
case i
|
44
|
+
when :default
|
45
|
+
i = MAIN_ENCODING_TO_USE
|
46
|
+
when :utf, :utf8
|
47
|
+
i = UTF8_ENCODING
|
48
|
+
end
|
49
|
+
@use_this_encoding = i
|
50
|
+
end
|
51
|
+
|
52
|
+
# ========================================================================= #
|
53
|
+
# Initialize it to the default.
|
54
|
+
# ========================================================================= #
|
55
|
+
set_use_this_encoding(:default)
|
56
|
+
|
57
|
+
# ========================================================================= #
|
58
|
+
# === Rcfiles.use_this_encoding?
|
59
|
+
# ========================================================================= #
|
60
|
+
def self.use_this_encoding?
|
61
|
+
@use_this_encoding
|
62
|
+
end; self.instance_eval { alias use_this_encoding use_this_encoding? } # === Rcfiles.use_this_encoding
|
63
|
+
self.instance_eval { alias main_encoding? use_this_encoding? } # === Rcfiles.main_encoding?
|
64
|
+
|
65
|
+
# ========================================================================= #
|
66
|
+
# === Rcfiles.ensure_main_encoding
|
67
|
+
#
|
68
|
+
# The second argument to this method specifies which encoding we will
|
69
|
+
# use by default.
|
70
|
+
# ========================================================================= #
|
71
|
+
def self.ensure_main_encoding(
|
72
|
+
i,
|
73
|
+
use_this_encoding = @use_this_encoding
|
74
|
+
)
|
75
|
+
i = i.dup if i.frozen?
|
76
|
+
case use_this_encoding
|
77
|
+
when :utf,
|
78
|
+
:utf8
|
79
|
+
use_this_encoding = UTF8_ENCODING
|
80
|
+
end
|
81
|
+
i = i.dup if i.frozen?
|
82
|
+
i.force_encoding(use_this_encoding) # Return this value here.
|
83
|
+
end; self.instance_eval { alias ensure_proper_encoding_for ensure_main_encoding } # === Rcfiles.ensure_proper_encoding_for
|
84
|
+
|
85
|
+
end
|