rcfiles 1.2.46
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 +559 -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 +177 -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 +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 +20431 -0
- data/lib/rcfiles/rcfiles/cd_aliases_rc +14980 -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 +17571 -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 +23069 -0
- data/lib/rcfiles/yaml/cd_aliases.yml +15699 -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 +13 -0
- data/lib/rcfiles/yaml/pkgconfig.yml +46 -0
- data/lib/rcfiles/yaml/programs_aliases.yml +19203 -0
- data/lib/rcfiles/yaml/programs_aliases.yml~ +19086 -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 +205 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/class/initialize.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Rcfiles
|
8
|
+
|
9
|
+
class Rcfiles # === Rcfiles::Rcfiles
|
10
|
+
|
11
|
+
# ========================================================================== #
|
12
|
+
# === initialize
|
13
|
+
# ========================================================================== #
|
14
|
+
def initialize(
|
15
|
+
i = ARGV,
|
16
|
+
run_already = true
|
17
|
+
)
|
18
|
+
register_sigint
|
19
|
+
reset
|
20
|
+
set_commandline_arguments(i)
|
21
|
+
if i
|
22
|
+
set_generate_this(i)
|
23
|
+
end
|
24
|
+
# ======================================================================= #
|
25
|
+
# === Handle blocks next
|
26
|
+
# ======================================================================= #
|
27
|
+
if block_given?
|
28
|
+
yielded = yield
|
29
|
+
if yielded.is_a? Hash
|
30
|
+
if yielded.has_key? :be_verbose
|
31
|
+
@be_verbose = yielded.delete(:be_verbose)
|
32
|
+
end
|
33
|
+
if yielded.has_key? :use_colours
|
34
|
+
use_colours = yielded.delete(:use_colours)
|
35
|
+
if use_colours == false
|
36
|
+
disable_colours
|
37
|
+
end
|
38
|
+
end
|
39
|
+
else # else it is not a Hash
|
40
|
+
case yielded
|
41
|
+
# =================================================================== #
|
42
|
+
# === :initialize_main_hash
|
43
|
+
# =================================================================== #
|
44
|
+
when :initialize_main_hash
|
45
|
+
initialize_main_hash
|
46
|
+
# =================================================================== #
|
47
|
+
# === :disable_colours
|
48
|
+
#
|
49
|
+
# The block-argument :disable_colours will disable
|
50
|
+
# colours for the current run.
|
51
|
+
# =================================================================== #
|
52
|
+
when :disable_colours,
|
53
|
+
:no_colours,
|
54
|
+
:toggle,
|
55
|
+
:c
|
56
|
+
disable_colours
|
57
|
+
# === :be_quiet
|
58
|
+
when :be_quiet
|
59
|
+
@be_verbose = false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
run if run_already
|
64
|
+
end
|
65
|
+
|
66
|
+
end; end
|
@@ -0,0 +1,300 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/class/misc.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'rcfiles/constants/constants.rb'
|
8
|
+
require 'rcfiles/class/initialize.rb'
|
9
|
+
require 'rcfiles/class/colours.rb'
|
10
|
+
require 'rcfiles/class/reset.rb'
|
11
|
+
require 'rcfiles/class/run.rb'
|
12
|
+
require 'rcfiles/version/version.rb'
|
13
|
+
|
14
|
+
module Rcfiles
|
15
|
+
|
16
|
+
class Rcfiles # === Rcfiles::Rcfiles
|
17
|
+
|
18
|
+
require 'rcfiles/toplevel_methods/e.rb'
|
19
|
+
require 'rcfiles/toplevel_methods/misc.rb'
|
20
|
+
require 'rcfiles/toplevel_methods/save_file.rb'
|
21
|
+
require 'rcfiles/toplevel_methods/return_standard_header.rb'
|
22
|
+
require 'rcfiles/toplevel_methods/remove_newlines.rb'
|
23
|
+
require 'rcfiles/toplevel_methods/use_quotes.rb'
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === do_not_use_quotes
|
27
|
+
# ========================================================================= #
|
28
|
+
def do_not_use_quotes
|
29
|
+
::Rcfiles.use_quotes = false
|
30
|
+
end; alias disable_quotes do_not_use_quotes # === disable_quotes
|
31
|
+
|
32
|
+
# ========================================================================= #
|
33
|
+
# === use_quotes?
|
34
|
+
# ========================================================================= #
|
35
|
+
def use_quotes?
|
36
|
+
::Rcfiles.use_quotes?
|
37
|
+
end
|
38
|
+
|
39
|
+
# ========================================================================== #
|
40
|
+
# === set_commandline_arguments
|
41
|
+
# ========================================================================== #
|
42
|
+
def set_commandline_arguments(i)
|
43
|
+
@commandline_arguments = [i].flatten.compact
|
44
|
+
end
|
45
|
+
|
46
|
+
# ========================================================================== #
|
47
|
+
# === register_sigint
|
48
|
+
# ========================================================================== #
|
49
|
+
def register_sigint
|
50
|
+
Signal.trap('SIGINT') { exit }
|
51
|
+
end
|
52
|
+
|
53
|
+
# ========================================================================= #
|
54
|
+
# === mkdir
|
55
|
+
# ========================================================================= #
|
56
|
+
def mkdir(i)
|
57
|
+
FileUtils.mkdir(i)
|
58
|
+
end; alias create_directory mkdir # === create_directory
|
59
|
+
|
60
|
+
# ========================================================================= #
|
61
|
+
# === remove_newlines
|
62
|
+
# ========================================================================= #
|
63
|
+
def remove_newlines(i)
|
64
|
+
::Rcfiles.remove_newlines(i)
|
65
|
+
end
|
66
|
+
|
67
|
+
# ========================================================================= #
|
68
|
+
# === remove_file
|
69
|
+
# ========================================================================= #
|
70
|
+
def remove_file(i) # rm tag, remove tag.
|
71
|
+
FileUtils.rm(i) if File.exist?(i)
|
72
|
+
end
|
73
|
+
|
74
|
+
# ========================================================================= #
|
75
|
+
# === create_file
|
76
|
+
# ========================================================================= #
|
77
|
+
def create_file(i) # This will create a file.
|
78
|
+
opnn; e "Now creating the file `#{sfile(i)}`."
|
79
|
+
FileUtils.touch(i)
|
80
|
+
end
|
81
|
+
|
82
|
+
# ========================================================================== #
|
83
|
+
# === set_current_date
|
84
|
+
# ========================================================================== #
|
85
|
+
def set_current_date
|
86
|
+
@current_date = Time.now.strftime '%d.%m.%Y'
|
87
|
+
end
|
88
|
+
|
89
|
+
# ========================================================================= #
|
90
|
+
# === get_files_from
|
91
|
+
# ========================================================================= #
|
92
|
+
def get_files_from(i = Dir.pwd)
|
93
|
+
return Dir["#{i}*.yml"]
|
94
|
+
end; alias get_files get_files_from # === get_files
|
95
|
+
|
96
|
+
# ========================================================================== #
|
97
|
+
# === return_standard_header
|
98
|
+
#
|
99
|
+
# This adds a standard header to our RC-File in question.
|
100
|
+
#
|
101
|
+
# The input argument should be the name of the rc-file at hand.
|
102
|
+
# ========================================================================== #
|
103
|
+
def return_standard_header(which_file = '')
|
104
|
+
::Rcfiles.return_standard_header(which_file)
|
105
|
+
end; alias add_header return_standard_header # === add_header
|
106
|
+
|
107
|
+
# ========================================================================= #
|
108
|
+
# === rds
|
109
|
+
# ========================================================================= #
|
110
|
+
def rds(i)
|
111
|
+
i.squeeze('/')
|
112
|
+
end
|
113
|
+
|
114
|
+
# ========================================================================= #
|
115
|
+
# === do_be_silent
|
116
|
+
# ========================================================================= #
|
117
|
+
def do_be_silent
|
118
|
+
@be_verbose = false
|
119
|
+
end
|
120
|
+
|
121
|
+
# ========================================================================= #
|
122
|
+
# === check_whether_rcfiles_directory_exists
|
123
|
+
#
|
124
|
+
# This method will check whether the rcfiles-directory exists. If it
|
125
|
+
# does not, then we will create these directories.
|
126
|
+
# ========================================================================= #
|
127
|
+
def check_whether_rcfiles_directory_exists(
|
128
|
+
i = @create_rcfiles_where
|
129
|
+
)
|
130
|
+
unless File.directory? i
|
131
|
+
mkdir(i)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# ========================================================================= #
|
136
|
+
# === e (e tag)
|
137
|
+
# ========================================================================= #
|
138
|
+
def e(i = '')
|
139
|
+
::Rcfiles.e(i)
|
140
|
+
end
|
141
|
+
|
142
|
+
# ========================================================================= #
|
143
|
+
# === set_generate_this
|
144
|
+
#
|
145
|
+
# The default setting is to generate all the various rc-files.
|
146
|
+
# ========================================================================= #
|
147
|
+
def set_generate_this(i = :default)
|
148
|
+
if i.is_a? Array
|
149
|
+
i = i.first
|
150
|
+
elsif i.is_a? Hash
|
151
|
+
if i.has_key? :store_at
|
152
|
+
set_create_rcfiles_where(i.delete(:store_at))
|
153
|
+
i = :default
|
154
|
+
end
|
155
|
+
end
|
156
|
+
case i
|
157
|
+
# ======================================================================= #
|
158
|
+
# === cd_aliases
|
159
|
+
# ======================================================================= #
|
160
|
+
when 'cd_aliases',
|
161
|
+
:cd_aliases
|
162
|
+
set_dataset(
|
163
|
+
::Rcfiles.cd_aliases?
|
164
|
+
)
|
165
|
+
when :default # :default is an alias towards :all
|
166
|
+
i = :all # This is the default.
|
167
|
+
else
|
168
|
+
# if File.exist? i.to_s
|
169
|
+
# pass through for now
|
170
|
+
# end
|
171
|
+
end
|
172
|
+
@generate_this = i
|
173
|
+
end
|
174
|
+
|
175
|
+
# ========================================================================= #
|
176
|
+
# === determine_rc_file
|
177
|
+
# ========================================================================= #
|
178
|
+
def determine_rc_file(i)
|
179
|
+
"#{@create_rcfiles_where}#{File.basename(i).sub(/\.yml$/,'')}_rc".dup
|
180
|
+
end
|
181
|
+
|
182
|
+
# ========================================================================= #
|
183
|
+
# === set_dataset
|
184
|
+
#
|
185
|
+
# Determine the dataset, that is, the yaml files to be used, here.
|
186
|
+
# ========================================================================= #
|
187
|
+
def set_dataset(
|
188
|
+
i = nil
|
189
|
+
)
|
190
|
+
if i
|
191
|
+
if i.is_a? Array
|
192
|
+
i.flatten!
|
193
|
+
i.uniq!
|
194
|
+
end
|
195
|
+
end
|
196
|
+
@dataset = i
|
197
|
+
end
|
198
|
+
|
199
|
+
# ========================================================================= #
|
200
|
+
# === replace_newlines
|
201
|
+
# ========================================================================= #
|
202
|
+
def replace_newlines(
|
203
|
+
i, replace_with_this_character = ':'
|
204
|
+
)
|
205
|
+
if replace_with_this_character.is_a? Hash
|
206
|
+
if replace_with_this_character.has_key? :with
|
207
|
+
replace_with_this_character = replace_with_this_character[:with]
|
208
|
+
end
|
209
|
+
end
|
210
|
+
return i.gsub(/ /, replace_with_this_character).
|
211
|
+
gsub(/\n/, replace_with_this_character).
|
212
|
+
gsub(/#{replace_with_this_character}#{replace_with_this_character}/,
|
213
|
+
replace_with_this_character
|
214
|
+
)
|
215
|
+
end
|
216
|
+
|
217
|
+
# ========================================================================= #
|
218
|
+
# === generate_ps1_rcfile
|
219
|
+
# ========================================================================= #
|
220
|
+
def generate_ps1_rcfile
|
221
|
+
::Rcfiles.generate_ps1_rcfile
|
222
|
+
end
|
223
|
+
|
224
|
+
# ========================================================================= #
|
225
|
+
# === generate_ls_colours_rcfile
|
226
|
+
# ========================================================================= #
|
227
|
+
def generate_ls_colours_rcfile
|
228
|
+
::Rcfiles.generate_ls_colours_rcfile
|
229
|
+
end
|
230
|
+
|
231
|
+
# ========================================================================= #
|
232
|
+
# === generate_custom_roebe_rcfiles
|
233
|
+
# ========================================================================= #
|
234
|
+
def generate_custom_roebe_rcfiles
|
235
|
+
::Rcfiles.generate_custom_roebe_rcfiles
|
236
|
+
end
|
237
|
+
|
238
|
+
# ========================================================================= #
|
239
|
+
# === clear_dataset
|
240
|
+
# ========================================================================= #
|
241
|
+
def clear_dataset # Use this method to clear our main dataset.
|
242
|
+
@dataset = [] # Our main Array - it will contain entries such as "lang.yml".
|
243
|
+
end
|
244
|
+
|
245
|
+
# ========================================================================= #
|
246
|
+
# === opnn
|
247
|
+
# ========================================================================= #
|
248
|
+
def opnn(
|
249
|
+
i = NAMESPACE
|
250
|
+
)
|
251
|
+
if i.is_a? String
|
252
|
+
i = { namespace: i }
|
253
|
+
end
|
254
|
+
Opn.opn(i) {{ use_colours: use_colours? }}
|
255
|
+
end
|
256
|
+
|
257
|
+
# ========================================================================= #
|
258
|
+
# === generate_the_most_important_rcfiles
|
259
|
+
# ========================================================================= #
|
260
|
+
def generate_the_most_important_rcfiles
|
261
|
+
::Rcfiles.generate_the_most_important_rcfiles
|
262
|
+
end
|
263
|
+
|
264
|
+
# ========================================================================= #
|
265
|
+
# === set_create_rcfiles_where
|
266
|
+
#
|
267
|
+
# Where to store the rc-files. Usually this will be at /AUTOGENERATED
|
268
|
+
# but we need a way to also specify other target-directories, so this
|
269
|
+
# method has to exist.
|
270
|
+
#
|
271
|
+
# Invoke this like so:
|
272
|
+
#
|
273
|
+
# _.create_here :my_home_directory
|
274
|
+
#
|
275
|
+
# ========================================================================= #
|
276
|
+
def set_create_rcfiles_where(
|
277
|
+
i = CREATE_RCFILES_WHERE
|
278
|
+
)
|
279
|
+
case i
|
280
|
+
when :my_home_directory,
|
281
|
+
:home
|
282
|
+
i = AUTOGENERATED_RC_FILES
|
283
|
+
end
|
284
|
+
i << '/' unless i.end_with? '/' # Ensure trailing '/' token.
|
285
|
+
@create_rcfiles_where = i
|
286
|
+
end; alias create_here set_create_rcfiles_where # === create_here
|
287
|
+
|
288
|
+
# ========================================================================= #
|
289
|
+
# === store_what_into
|
290
|
+
# ========================================================================= #
|
291
|
+
def store_what_into(
|
292
|
+
store_this_data, where
|
293
|
+
)
|
294
|
+
if @be_verbose
|
295
|
+
opnn; e "Storing into -> #{sfile(where)}."
|
296
|
+
end
|
297
|
+
write_what_into_file(store_this_data.chomp, where)
|
298
|
+
end
|
299
|
+
|
300
|
+
end; end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === Rcfiles::Rcfiles
|
6
|
+
#
|
7
|
+
# This class is able to generate the various rc-files that can also be
|
8
|
+
# generated via the toplevel-module code as-is.
|
9
|
+
#
|
10
|
+
# rc-files in this context refers to files that can be used by shells,
|
11
|
+
# such as bash or zsh.
|
12
|
+
#
|
13
|
+
# The format of these rc-files can differ from one another:
|
14
|
+
#
|
15
|
+
# - some variables can be exported, such as in:
|
16
|
+
#
|
17
|
+
# export CLFAGS="-Werror"
|
18
|
+
#
|
19
|
+
# - some other variables are held in a "foo:bla:ble" schemata,
|
20
|
+
# for instance the $PATH variable.
|
21
|
+
#
|
22
|
+
# Usage examples:
|
23
|
+
# Rcfiles::Rcfiles.new
|
24
|
+
# =========================================================================== #
|
25
|
+
# require 'rcfiles/class/rcfiles.rb'
|
26
|
+
# =========================================================================== #
|
27
|
+
require 'rcfiles/class/misc.rb'
|
28
|
+
|
29
|
+
if __FILE__ == $PROGRAM_NAME
|
30
|
+
Rcfiles::Rcfiles.new(ARGV)
|
31
|
+
end
|
@@ -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,111 @@
|
|
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
|
+
return ::Colours.rev
|
27
|
+
else
|
28
|
+
return ''
|
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(
|
57
|
+
i = '', use_colours = @use_colours
|
58
|
+
)
|
59
|
+
if use_colours and Object.const_defined?(:Colours)
|
60
|
+
return ::Colours.sdir(i)
|
61
|
+
end
|
62
|
+
i
|
63
|
+
end
|
64
|
+
|
65
|
+
# ========================================================================= #
|
66
|
+
# === Rcfiles.sfancy
|
67
|
+
# ========================================================================= #
|
68
|
+
def self.sfancy(i = '')
|
69
|
+
if @use_colours and Object.const_defined?(:Colours)
|
70
|
+
return ::Colours.sfancy(i)
|
71
|
+
end
|
72
|
+
i
|
73
|
+
end
|
74
|
+
|
75
|
+
# ========================================================================= #
|
76
|
+
# === Rcfiles.simp
|
77
|
+
# ========================================================================= #
|
78
|
+
def self.simp(
|
79
|
+
i = '', use_colours = @use_colours
|
80
|
+
)
|
81
|
+
if use_colours and Object.const_defined?(:Colours)
|
82
|
+
return ::Colours.simp(i)
|
83
|
+
end
|
84
|
+
i
|
85
|
+
end
|
86
|
+
|
87
|
+
# ========================================================================= #
|
88
|
+
# === Rcfiles.teal
|
89
|
+
# ========================================================================= #
|
90
|
+
def self.teal(i = '')
|
91
|
+
if @use_colours and Object.const_defined?(:Colours) and
|
92
|
+
Colours.respond_to?(:teal)
|
93
|
+
return ::Colours.teal(i)
|
94
|
+
else
|
95
|
+
i
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
# ========================================================================= #
|
100
|
+
# === Rcfiles.sfile
|
101
|
+
# ========================================================================= #
|
102
|
+
def self.sfile(i = '')
|
103
|
+
if @use_colours and Object.const_defined?(:Colours) and
|
104
|
+
Colours.respond_to?(:sfile)
|
105
|
+
return ::Colours.sfile(i)
|
106
|
+
else
|
107
|
+
i
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|