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,177 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/directory_aliases/toplevel_stored_dataset.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Rcfiles
|
8
|
+
|
9
|
+
class DirectoryAliases # === Rcfiles::DirectoryAliases
|
10
|
+
|
11
|
+
require 'yaml'
|
12
|
+
require 'rcfiles/directory_aliases/yaml_file_used_by_class_directory_aliases.rb'
|
13
|
+
require 'rcfiles/toplevel_methods/e.rb'
|
14
|
+
require 'rcfiles/toplevel_methods/no_file_exists_at.rb'
|
15
|
+
require 'rcfiles/toplevel_methods/save_file.rb'
|
16
|
+
|
17
|
+
# ========================================================================= #
|
18
|
+
# === @toplevel_stored_dataset
|
19
|
+
#
|
20
|
+
# This variable will hold the whole cd-aliases dataset. It should be
|
21
|
+
# kept as a Hash at all times. It also should be empty, initially.
|
22
|
+
#
|
23
|
+
# In the event that it is filled with content it will be copied
|
24
|
+
# onto any new instance of DirectoryAliases. That way we can
|
25
|
+
# use a substitute hash, or allow the user to fill it up on
|
26
|
+
# his or her own.
|
27
|
+
#
|
28
|
+
# Note that before May 2022 this was called @cd_aliases, but
|
29
|
+
# I think the new name is more logical.
|
30
|
+
# ========================================================================= #
|
31
|
+
@toplevel_stored_dataset = {}
|
32
|
+
|
33
|
+
# ========================================================================= #
|
34
|
+
# === Rcfiles::DirectoryAliases.toplevel_stored_dataset?
|
35
|
+
#
|
36
|
+
# Main getter over the cd-aliases. This will be our main datastructure.
|
37
|
+
# ========================================================================= #
|
38
|
+
def self.toplevel_stored_dataset?
|
39
|
+
@toplevel_stored_dataset
|
40
|
+
end; self.instance_eval { alias cd_aliases? toplevel_stored_dataset? } # === Rcfiles::DirectoryAliases.cd_aliases?
|
41
|
+
self.instance_eval { alias toplevel_dataset? toplevel_stored_dataset? } # === Rcfiles::DirectoryAliases.toplevel_dataset?
|
42
|
+
|
43
|
+
# ========================================================================= #
|
44
|
+
# === Rcfiles::DirectoryAliases.n_entries?
|
45
|
+
#
|
46
|
+
# How many entries can be found in class DirectoryAliases is answered
|
47
|
+
# by this toplevel method.
|
48
|
+
# ========================================================================= #
|
49
|
+
def self.n_entries?
|
50
|
+
toplevel_stored_dataset?.keys.size
|
51
|
+
end
|
52
|
+
|
53
|
+
# ========================================================================= #
|
54
|
+
# === Rcfiles::DirectoryAliases.set_toplevel_stored_dataset (set_cd_aliases tag)
|
55
|
+
#
|
56
|
+
# The @toplevel_stored_dataset should always be a Hash. This is an
|
57
|
+
# explicit setter here, though, so the user could always assign a
|
58
|
+
# non-Hash. No error will be raised in this case.
|
59
|
+
# ========================================================================= #
|
60
|
+
def self.set_toplevel_stored_dataset(i = {})
|
61
|
+
@toplevel_stored_dataset = i
|
62
|
+
end; self.instance_eval { alias set_cd_aliases set_toplevel_stored_dataset } # === Rcfiles::DirectoryAliases.set_cd_aliases=
|
63
|
+
self.instance_eval { alias set_cd_aliases= set_toplevel_stored_dataset } # === Rcfiles::DirectoryAliases.set_cd_aliases=
|
64
|
+
|
65
|
+
# ========================================================================= #
|
66
|
+
# === Rcfiles::DirectoryAliases.clear
|
67
|
+
#
|
68
|
+
# Reset the main Hash again.
|
69
|
+
# ========================================================================= #
|
70
|
+
def self.clear
|
71
|
+
@toplevel_stored_dataset.clear
|
72
|
+
end
|
73
|
+
|
74
|
+
# ========================================================================= #
|
75
|
+
# === Rcfiles::DirectoryAliases.load_dataset_from_main_file
|
76
|
+
#
|
77
|
+
# Load up the dataset next
|
78
|
+
#
|
79
|
+
# This determines the main cd-aliases file.
|
80
|
+
# ========================================================================= #
|
81
|
+
def self.load_dataset_from_main_file(
|
82
|
+
i = yaml_file?
|
83
|
+
)
|
84
|
+
if File.exist? i
|
85
|
+
dataset = YAML.load_file(i) # This may be UTF-8 encoding.
|
86
|
+
# ===================================================================== #
|
87
|
+
# Assign the cd-aliases via a toplevel method next:
|
88
|
+
# ===================================================================== #
|
89
|
+
set_toplevel_stored_dataset(dataset)
|
90
|
+
else # Else use an empty dataset instead.
|
91
|
+
if is_on_roebe?
|
92
|
+
::Rcfiles.no_file_exists_at(i)
|
93
|
+
end
|
94
|
+
set_toplevel_stored_dataset({})
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# ========================================================================= #
|
99
|
+
# === Rcfiles::DirectoryAliases.initialize_main_hash
|
100
|
+
# ========================================================================= #
|
101
|
+
def self.initialize_main_hash
|
102
|
+
clear # First empty the old dataset, should it be non-empty.
|
103
|
+
if toplevel_dataset?.empty?
|
104
|
+
load_dataset_from_main_file
|
105
|
+
end
|
106
|
+
end; self.instance_eval { alias initialize_main_dataset initialize_main_hash } # === Rcfiles::DirectoryAliases.initialize_main_dataset
|
107
|
+
self.instance_eval { alias run initialize_main_hash } # === Rcfiles::DirectoryAliases.run
|
108
|
+
# ======================================================================= #
|
109
|
+
# Initialize the main dataset if it has not been loaded up yet.
|
110
|
+
# ======================================================================= #
|
111
|
+
if ::Rcfiles::DirectoryAliases.cd_aliases?.empty?
|
112
|
+
::Rcfiles::DirectoryAliases.load_dataset_from_main_file
|
113
|
+
end
|
114
|
+
# ========================================================================= #
|
115
|
+
# === Rcfiles::DirectoryAliases.register_sigint
|
116
|
+
# ========================================================================= #
|
117
|
+
def self.register_sigint
|
118
|
+
Signal.trap('SIGINT') { exit }
|
119
|
+
end
|
120
|
+
|
121
|
+
register_sigint # ← And call it at once.
|
122
|
+
|
123
|
+
# ========================================================================= #
|
124
|
+
# === Rcfiles::DirectoryAliases.save_into_ruby_file
|
125
|
+
#
|
126
|
+
# This method will store the hash in a CONSTANT, into a file (normally
|
127
|
+
# a .rb file).
|
128
|
+
#
|
129
|
+
# The first argument to this method denotes where to store this file,
|
130
|
+
# so you have the possibility to save into some special location
|
131
|
+
# instead.
|
132
|
+
#
|
133
|
+
# The name of the hash is provided via the the second argument to
|
134
|
+
# this method.
|
135
|
+
# ========================================================================= #
|
136
|
+
def self.save_into_ruby_file(
|
137
|
+
store_into_this_file = '/Depot/j/expand_cd_aliases_hash.rb',
|
138
|
+
name_of_the_main_hash = 'EXPAND_CD_ALIASES_HASH'
|
139
|
+
)
|
140
|
+
_ = ::Rcfiles::DirectoryAliases.new
|
141
|
+
dataset = _.cd_aliases?
|
142
|
+
# ======================================================================= #
|
143
|
+
# First add the header:
|
144
|
+
# ======================================================================= #
|
145
|
+
what = '#!/usr/bin/ruby -w
|
146
|
+
# Encoding: UTF-8
|
147
|
+
# frozen_string_literal: true
|
148
|
+
# =========================================================================== #
|
149
|
+
'.dup
|
150
|
+
what << "#{name_of_the_main_hash} = {\n"
|
151
|
+
what = ::Rcfiles.ensure_main_encoding(what)
|
152
|
+
dataset.each_pair {|key, value|
|
153
|
+
key = key.to_s unless key.is_a? String
|
154
|
+
value = ConvertGlobalEnv.convert(value)
|
155
|
+
key = ::Rcfiles.ensure_main_encoding(key)
|
156
|
+
value = ::Rcfiles.ensure_main_encoding(value)
|
157
|
+
what << " \"#{key}\": \"#{value}\",\n"
|
158
|
+
}
|
159
|
+
what << "}\n"
|
160
|
+
into = store_into_this_file
|
161
|
+
if block_given?
|
162
|
+
yielded = yield
|
163
|
+
case yielded
|
164
|
+
when :be_verbose
|
165
|
+
puts 'Storing into the file `'+into+'`.'
|
166
|
+
end
|
167
|
+
end
|
168
|
+
::Rcfiles.write_what_into(what, into)
|
169
|
+
end; self.instance_eval { alias generate_cd_aliases save_into_ruby_file } # === Rcfiles::DirectoryAliases.generate_cd_aliases
|
170
|
+
|
171
|
+
end; end
|
172
|
+
|
173
|
+
if __FILE__ == $PROGRAM_NAME
|
174
|
+
Rcfiles::DirectoryAliases.initialize_main_hash
|
175
|
+
pp Rcfiles::DirectoryAliases.n_entries?
|
176
|
+
# Rcfiles::DirectoryAliases.save_into_ruby_file
|
177
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === Rcfiles::DirectoryAliases
|
6
|
+
# =========================================================================== #
|
7
|
+
# require 'rcfiles/directory_aliases/yaml_file_used_by_class_directory_aliases.rb'
|
8
|
+
# =========================================================================== #
|
9
|
+
module Rcfiles
|
10
|
+
|
11
|
+
class DirectoryAliases # === Rcfiles::DirectoryAliases
|
12
|
+
|
13
|
+
require 'rcfiles/files/file_cd_aliases.rb'
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === @yaml_file_used_by_class_directory_aliases
|
17
|
+
#
|
18
|
+
# This variable will keep track of the main yaml file, that is, the
|
19
|
+
# file that holds the dataset for "cd-aliases".
|
20
|
+
#
|
21
|
+
# It is nil initially here, but will be changed lateron through a method
|
22
|
+
# call.
|
23
|
+
# ========================================================================= #
|
24
|
+
@yaml_file_used_by_class_directory_aliases = nil
|
25
|
+
|
26
|
+
# ========================================================================= #
|
27
|
+
# === Rcfiles::DirectoryAliases.set_yaml_file_used_by_class_directory_aliases
|
28
|
+
#
|
29
|
+
# The user can modify which yaml file is to be used, via this method call.
|
30
|
+
# ========================================================================= #
|
31
|
+
def self.set_yaml_file_used_by_class_directory_aliases(
|
32
|
+
i = :default
|
33
|
+
)
|
34
|
+
case i
|
35
|
+
# ======================================================================= #
|
36
|
+
# === :default
|
37
|
+
# ======================================================================= #
|
38
|
+
when :default,
|
39
|
+
:default_yaml_file
|
40
|
+
i = ::Rcfiles.file_cd_aliases
|
41
|
+
end
|
42
|
+
@yaml_file_used_by_class_directory_aliases = i
|
43
|
+
end
|
44
|
+
|
45
|
+
# ========================================================================= #
|
46
|
+
# Define the main cd-aliases file next. The constant FILE_CD_ALIASES
|
47
|
+
# must be defined for this to work.
|
48
|
+
# ========================================================================= #
|
49
|
+
DirectoryAliases.set_yaml_file_used_by_class_directory_aliases(:default_yaml_file)
|
50
|
+
|
51
|
+
# ========================================================================= #
|
52
|
+
# === Rcfiles::DirectoryAliases.yaml_file?
|
53
|
+
#
|
54
|
+
# On my home system this defaults to:
|
55
|
+
#
|
56
|
+
# /usr/lib/ruby/site_ruby/3.1.0/rcfiles/yaml/cd_aliases.yml
|
57
|
+
#
|
58
|
+
# ========================================================================= #
|
59
|
+
def self.yaml_file?
|
60
|
+
@yaml_file_used_by_class_directory_aliases
|
61
|
+
end
|
62
|
+
|
63
|
+
end; end
|
64
|
+
|
65
|
+
if __FILE__ == $PROGRAM_NAME
|
66
|
+
puts Rcfiles::DirectoryAliases.yaml_file?
|
67
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/files/file_aliases.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Rcfiles
|
8
|
+
|
9
|
+
require 'rcfiles/project/project.rb'
|
10
|
+
require 'rcfiles/toplevel_methods/is_on_roebe.rb'
|
11
|
+
require 'rcfiles/toplevel_methods/convert.rb'
|
12
|
+
require 'rcfiles/toplevel_methods/notifications.rb'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === Rcfiles.set_file_aliases
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.set_file_aliases(
|
18
|
+
i = :default
|
19
|
+
)
|
20
|
+
case i
|
21
|
+
when :default, nil
|
22
|
+
if is_on_roebe? and File.exist?('/Depot/aliases.yml')
|
23
|
+
i = '/Depot/aliases.yml'
|
24
|
+
else
|
25
|
+
i = "#{project_yaml_dir?}aliases.yml"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
@file_aliases = i
|
29
|
+
end
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === @file_aliases
|
33
|
+
#
|
34
|
+
# On my home system, the value of the toplevel @file_aliases instance
|
35
|
+
# variable points to a file path such as:
|
36
|
+
#
|
37
|
+
# /Programs/Ruby/2.5.0/lib/ruby/site_ruby/2.5.0/rcfile_generator/yaml/aliases.yml
|
38
|
+
#
|
39
|
+
# It may also point to another target location, though.
|
40
|
+
# ========================================================================= #
|
41
|
+
@file_aliases = nil
|
42
|
+
|
43
|
+
# ========================================================================= #
|
44
|
+
# And set it at once.
|
45
|
+
# ========================================================================= #
|
46
|
+
set_file_aliases
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === Rcfiles.file_aliases?
|
50
|
+
# ========================================================================= #
|
51
|
+
def self.file_aliases?
|
52
|
+
@file_aliases
|
53
|
+
end; self.instance_eval { alias file_aliases file_aliases? } # === Rcfiles.file_aliases
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === Rcfiles.generate_aliases_rcfile
|
57
|
+
# ========================================================================= #
|
58
|
+
def self.generate_aliases_rcfile
|
59
|
+
_ = @file_aliases
|
60
|
+
if File.exist? _
|
61
|
+
into = "#{main_directory?}aliases_rc"
|
62
|
+
notify_the_user_that_this_file_will_be_generated_from_that_existing_file(into, _)
|
63
|
+
what = return_standard_header(into).dup
|
64
|
+
hash_dataset = YAML.load_file(_)
|
65
|
+
hash_dataset.each_pair {|key, value|
|
66
|
+
if @use_quotes
|
67
|
+
what << "alias '#{key}'=\"#{value}\"\n"
|
68
|
+
else
|
69
|
+
what << "alias #{key}=#{value}\n"
|
70
|
+
end
|
71
|
+
}
|
72
|
+
write_what_into(what, into)
|
73
|
+
else
|
74
|
+
no_file_exists_at(_)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/files/file_cd_aliases.rb'
|
6
|
+
# Rcfiles.file_cd_aliases?
|
7
|
+
# =========================================================================== #
|
8
|
+
module Rcfiles
|
9
|
+
|
10
|
+
require 'rcfiles/project/project.rb'
|
11
|
+
require 'rcfiles/toplevel_methods/is_on_roebe.rb'
|
12
|
+
require 'rcfiles/toplevel_methods/convert.rb'
|
13
|
+
require 'rcfiles/toplevel_methods/notifications.rb'
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === Rcfiles.set_cd_aliases
|
17
|
+
# ========================================================================= #
|
18
|
+
def self.set_cd_aliases(
|
19
|
+
i = :default
|
20
|
+
)
|
21
|
+
case i
|
22
|
+
when :default, nil
|
23
|
+
if is_on_roebe? and File.exist?('/Depot/cd_aliases.yml')
|
24
|
+
i = '/Depot/cd_aliases.yml'
|
25
|
+
else
|
26
|
+
i = "#{project_yaml_dir?}cd_aliases.yml"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
@file_cd_aliases = i
|
30
|
+
end
|
31
|
+
|
32
|
+
# ========================================================================= #
|
33
|
+
# === Rcfiles::@file_cd_aliases
|
34
|
+
# ========================================================================= #
|
35
|
+
@file_cd_aliases = nil
|
36
|
+
|
37
|
+
set_cd_aliases
|
38
|
+
|
39
|
+
# ========================================================================= #
|
40
|
+
# === Rcfiles.file_cd_aliases?
|
41
|
+
#
|
42
|
+
# This method will keep the location to the cd_aliases.yml file (or
|
43
|
+
# the substitute for it, if the user specified another cd_aliases.yml
|
44
|
+
# file).
|
45
|
+
# ========================================================================= #
|
46
|
+
def self.file_cd_aliases?
|
47
|
+
@file_cd_aliases
|
48
|
+
end; self.instance_eval { alias file_cd_aliases file_cd_aliases? } # === Rcfiles.file_cd_aliases
|
49
|
+
self.instance_eval { alias cd_aliases file_cd_aliases? } # === Rcfiles.cd_aliases
|
50
|
+
self.instance_eval { alias cd_aliases? file_cd_aliases? } # === Rcfiles.cd_aliases?
|
51
|
+
|
52
|
+
# ========================================================================= #
|
53
|
+
# === Rcfiles.generate_cd_aliases_rcfile
|
54
|
+
# ========================================================================= #
|
55
|
+
def self.generate_cd_aliases_rcfile(
|
56
|
+
be_verbose = ::Rcfiles.be_verbose?
|
57
|
+
)
|
58
|
+
_ = @file_cd_aliases
|
59
|
+
if File.exist? _
|
60
|
+
if block_given?
|
61
|
+
yielded = yield
|
62
|
+
if yielded.has_key? :be_verbose
|
63
|
+
be_verbose = yielded.delete(:be_verbose)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
into = "#{main_directory?}cd_aliases_rc"
|
67
|
+
if be_verbose
|
68
|
+
notify_the_user_that_this_file_will_be_generated_from_that_existing_file(into, _)
|
69
|
+
end
|
70
|
+
what = return_standard_header(into).dup
|
71
|
+
hash_dataset = YAML.load_file(_)
|
72
|
+
hash_dataset.each_pair {|key, value|
|
73
|
+
if @use_quotes
|
74
|
+
what << "alias '#{key}'=\"#{value}\"\n"
|
75
|
+
else
|
76
|
+
what << "alias #{key}=#{value}\n"
|
77
|
+
end
|
78
|
+
}
|
79
|
+
write_what_into(what, into)
|
80
|
+
else
|
81
|
+
no_file_exists_at(_) if be_verbose
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/files/file_ls_colours.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Rcfiles
|
8
|
+
|
9
|
+
require 'rcfiles/project/project.rb'
|
10
|
+
require 'rcfiles/toplevel_methods/is_on_roebe.rb'
|
11
|
+
require 'rcfiles/toplevel_methods/convert.rb'
|
12
|
+
require 'rcfiles/toplevel_methods/notifications.rb'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === Rcfiles.set_file_ls_colours
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.set_file_ls_colours(
|
18
|
+
i = :default
|
19
|
+
)
|
20
|
+
case i
|
21
|
+
when :default, nil
|
22
|
+
if is_on_roebe? and File.exist?('/Depot/ls_colours.yml')
|
23
|
+
i = '/Depot/ls_colours.yml'
|
24
|
+
else
|
25
|
+
i = "#{project_yaml_dir?}ls_colours.yml"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
@file_ls_colours = i
|
29
|
+
end
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === @file_ls_colours
|
33
|
+
#
|
34
|
+
# On my home system, the value of the toplevel @file_ls_colours instance
|
35
|
+
# variable points to a file path such as:
|
36
|
+
#
|
37
|
+
# /Programs/Ruby/2.5.0/lib/ruby/site_ruby/2.5.0/rcfile_generator/yaml/ls_colours.yml
|
38
|
+
#
|
39
|
+
# It may also point to another target location, though.
|
40
|
+
# ========================================================================= #
|
41
|
+
@file_ls_colours = nil
|
42
|
+
|
43
|
+
# ========================================================================= #
|
44
|
+
# And set it at once.
|
45
|
+
# ========================================================================= #
|
46
|
+
set_file_ls_colours
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === Rcfiles.file_ls_colours?
|
50
|
+
# ========================================================================= #
|
51
|
+
def self.file_ls_colours?
|
52
|
+
@file_ls_colours
|
53
|
+
end; self.instance_eval { alias file_ls_colours file_ls_colours? } # === Rcfiles.file_ls_colours
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === Rcfiles.generate_ls_colours_rcfile
|
57
|
+
# ========================================================================= #
|
58
|
+
def self.generate_ls_colours_rcfile
|
59
|
+
_ = @file_ls_colours
|
60
|
+
if File.exist? _
|
61
|
+
into = "#{main_directory?}ls_colours_rc"
|
62
|
+
notify_the_user_that_this_file_will_be_generated_from_that_existing_file(into, _)
|
63
|
+
hash = YAML.load_file(_)
|
64
|
+
dataset = hash.map {|key, value| "#{key}=#{value}"}.join(':')
|
65
|
+
# ^^^ dataset is now a String past this point.
|
66
|
+
what = return_standard_header(into).dup
|
67
|
+
what << convert_this_input_to_export_file(
|
68
|
+
dataset, 'LS_COLORS'
|
69
|
+
)
|
70
|
+
write_what_into(what, into)
|
71
|
+
else
|
72
|
+
no_file_exists_at(_)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/files/file_path_variable.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Rcfiles
|
8
|
+
|
9
|
+
require 'rcfiles/project/project.rb'
|
10
|
+
require 'rcfiles/toplevel_methods/is_on_roebe.rb'
|
11
|
+
require 'rcfiles/toplevel_methods/convert.rb'
|
12
|
+
require 'rcfiles/toplevel_methods/notifications.rb'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === Rcfiles.set_file_path_variable
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.set_file_path_variable(
|
18
|
+
i = :default
|
19
|
+
)
|
20
|
+
case i
|
21
|
+
when :default, nil
|
22
|
+
if is_on_roebe? and File.exist?('/Depot/path_variable.yml')
|
23
|
+
i = '/Depot/path_variable.yml'
|
24
|
+
else
|
25
|
+
i = "#{project_yaml_dir?}path_variable.yml"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
@file_path_variable = i
|
29
|
+
end
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === @file_path_variable
|
33
|
+
#
|
34
|
+
# On my home system, the value of the toplevel @file_path_variable instance
|
35
|
+
# variable points to a file path such as:
|
36
|
+
#
|
37
|
+
# /Programs/Ruby/2.5.0/lib/ruby/site_ruby/2.5.0/rcfile_generator/yaml/path_variable.yml
|
38
|
+
#
|
39
|
+
# It may also point to another target location, though.
|
40
|
+
# ========================================================================= #
|
41
|
+
@file_path_variable = nil
|
42
|
+
|
43
|
+
# ========================================================================= #
|
44
|
+
# And set it at once.
|
45
|
+
# ========================================================================= #
|
46
|
+
set_file_path_variable
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === Rcfiles.file_path_variable?
|
50
|
+
# ========================================================================= #
|
51
|
+
def self.file_path_variable?
|
52
|
+
@file_path_variable
|
53
|
+
end; self.instance_eval { alias file_path_variable file_path_variable? } # === Rcfiles.file_path_variable
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === Rcfiles.generate_path_variable_rcfile
|
57
|
+
# ========================================================================= #
|
58
|
+
def self.generate_path_variable_rcfile
|
59
|
+
_ = @file_path_variable
|
60
|
+
if File.exist? _
|
61
|
+
into = "#{main_directory?}path_variable_rc"
|
62
|
+
notify_the_user_that_this_file_will_be_generated_from_that_existing_file(into, _)
|
63
|
+
dataset = YAML.load_file(_)
|
64
|
+
what = return_standard_header(into).dup
|
65
|
+
what << convert_this_input_to_export_file(
|
66
|
+
dataset, 'PATH'
|
67
|
+
)
|
68
|
+
write_what_into(what, into)
|
69
|
+
else
|
70
|
+
no_file_exists_at(_)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'rcfiles/files/file_pkgconfig.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module Rcfiles
|
8
|
+
|
9
|
+
require 'rcfiles/project/project.rb'
|
10
|
+
require 'rcfiles/toplevel_methods/is_on_roebe.rb'
|
11
|
+
require 'rcfiles/toplevel_methods/convert.rb'
|
12
|
+
require 'rcfiles/toplevel_methods/notifications.rb'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === Rcfiles.set_file_pkgconfig
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.set_file_pkgconfig(
|
18
|
+
i = :default
|
19
|
+
)
|
20
|
+
case i
|
21
|
+
when :default, nil
|
22
|
+
if is_on_roebe? and File.exist?('/Depot/pkgconfig.yml')
|
23
|
+
i = '/Depot/pkgconfig.yml'
|
24
|
+
else
|
25
|
+
i = "#{project_yaml_dir?}pkgconfig.yml"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
@file_pkgconfig = i
|
29
|
+
end
|
30
|
+
|
31
|
+
# ========================================================================= #
|
32
|
+
# === @file_pkgconfig
|
33
|
+
#
|
34
|
+
# On my home system, the value of the toplevel @file_pkgconfig instance
|
35
|
+
# variable points to a file path such as:
|
36
|
+
#
|
37
|
+
# /Programs/Ruby/2.5.0/lib/ruby/site_ruby/2.5.0/rcfile_generator/yaml/pkgconfig.yml
|
38
|
+
#
|
39
|
+
# It may also point to another target location, though.
|
40
|
+
# ========================================================================= #
|
41
|
+
@file_pkgconfig = nil
|
42
|
+
|
43
|
+
# ========================================================================= #
|
44
|
+
# === Rcfiles.file_pkgconfig?
|
45
|
+
# ========================================================================= #
|
46
|
+
def self.file_pkgconfig?
|
47
|
+
@file_pkgconfig
|
48
|
+
end; self.instance_eval { alias file_pkgconfig file_pkgconfig? } # === Rcfiles.file_pkgconfig
|
49
|
+
|
50
|
+
# ========================================================================= #
|
51
|
+
# And set it at once.
|
52
|
+
# ========================================================================= #
|
53
|
+
set_file_pkgconfig
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === Rcfiles.generate_pkgconfig_rcfile
|
57
|
+
# ========================================================================= #
|
58
|
+
def self.generate_pkgconfig_rcfile
|
59
|
+
_ = @file_pkgconfig
|
60
|
+
if File.exist? _
|
61
|
+
into = "#{main_directory?}pkgconfig_rc"
|
62
|
+
notify_the_user_that_this_file_will_be_generated_from_that_existing_file(into, _)
|
63
|
+
dataset = YAML.load_file(_)['pkg_config_path']
|
64
|
+
what = return_standard_header(into).dup
|
65
|
+
what << convert_this_input_to_export_file(
|
66
|
+
dataset, 'PKG_CONFIG_PATH'
|
67
|
+
)
|
68
|
+
write_what_into(what, into)
|
69
|
+
else
|
70
|
+
no_file_exists_at(_)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|