beautiful_url 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of beautiful_url might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +52 -0
- data/beautiful_url.gemspec +60 -0
- data/bin/beautiful_url +9 -0
- data/doc/README.gen +50 -0
- data/lib/beautiful_url.rb +1 -0
- data/lib/beautiful_url/class/constants.rb +23 -0
- data/lib/beautiful_url/class/generate_tab_completion_for_bash_shell.rb +67 -0
- data/lib/beautiful_url/class/initialize.rb +149 -0
- data/lib/beautiful_url/class/misc.rb +475 -0
- data/lib/beautiful_url/class/reset.rb +50 -0
- data/lib/beautiful_url/class/run.rb +20 -0
- data/lib/beautiful_url/constants/base_constants.rb +230 -0
- data/lib/beautiful_url/constants/constants.rb +9 -0
- data/lib/beautiful_url/constants/encoding.rb +47 -0
- data/lib/beautiful_url/constants/misc.rb +14 -0
- data/lib/beautiful_url/constants/newline.rb +14 -0
- data/lib/beautiful_url/constants/tasks.rb +30 -0
- data/lib/beautiful_url/constants/time.rb +21 -0
- data/lib/beautiful_url/json_generator/json_generator.rb +85 -0
- data/lib/beautiful_url/requires/failsafe_require_of_beautiful_url.rb +9 -0
- data/lib/beautiful_url/requires/require_the_beautiful_url_project.rb +14 -0
- data/lib/beautiful_url/toplevel_methods/current_month.rb +32 -0
- data/lib/beautiful_url/toplevel_methods/jobs_menu.rb +106 -0
- data/lib/beautiful_url/toplevel_methods/local_menu.rb +2033 -0
- data/lib/beautiful_url/toplevel_methods/menu.rb +5293 -0
- data/lib/beautiful_url/toplevel_methods/misc.rb +18 -0
- data/lib/beautiful_url/toplevel_methods/moodle_menu.rb +135 -0
- data/lib/beautiful_url/toplevel_methods/return_location_of_the_menu_file.rb +27 -0
- data/lib/beautiful_url/toplevel_methods/roebe.rb +17 -0
- data/lib/beautiful_url/toplevel_methods/university_menu.rb +14135 -0
- data/lib/beautiful_url/version/version.rb +26 -0
- data/lib/beautiful_url/www/app.rb +168 -0
- data/test/testing_beautiful_url.rb +46 -0
- data/test/testing_the_base_constants.rb +26 -0
- metadata +101 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'beautiful_url/class/reset.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BeautifulUrl
|
8
|
+
|
9
|
+
class BeautifulUrl # === BeautifulUrl::BeautifulUrl
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === reset (reset tag)
|
13
|
+
# ========================================================================= #
|
14
|
+
def reset
|
15
|
+
set_intralink
|
16
|
+
set_data_dir(:default)
|
17
|
+
# ======================================================================= #
|
18
|
+
# === @commandline_arguments
|
19
|
+
# ======================================================================= #
|
20
|
+
@commandline_arguments = []
|
21
|
+
# ======================================================================= #
|
22
|
+
# === @is_registered
|
23
|
+
#
|
24
|
+
# By default the given input is NOT registered. A method can change
|
25
|
+
# this value at a later time. (In the past this variable was called
|
26
|
+
# @url_was_found, but during the rewrite in early 2020 it was
|
27
|
+
# renamed).
|
28
|
+
# ======================================================================= #
|
29
|
+
@is_registered = false # Will become true if the URL was found.
|
30
|
+
# ======================================================================= #
|
31
|
+
# === @replace_localhost_with_data
|
32
|
+
#
|
33
|
+
# This variable must be false by default. If true then we will replace
|
34
|
+
# the localhost string with the DATA/ string.
|
35
|
+
# ======================================================================= #
|
36
|
+
@replace_localhost_with_data = false
|
37
|
+
# ======================================================================= #
|
38
|
+
# === @replace_data_with_localhost
|
39
|
+
# ======================================================================= #
|
40
|
+
@replace_data_with_localhost = false
|
41
|
+
# ======================================================================= #
|
42
|
+
# === @ignore_help
|
43
|
+
#
|
44
|
+
# This variable can be used to specifically NOT make use of --help,
|
45
|
+
# that is to ignore this case even if the user specified it.
|
46
|
+
# ======================================================================= #
|
47
|
+
@ignore_help = false
|
48
|
+
end
|
49
|
+
|
50
|
+
end; end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'beautiful_url/class/run.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BeautifulUrl
|
8
|
+
|
9
|
+
class BeautifulUrl # === BeautifulUrl::BeautifulUrl
|
10
|
+
|
11
|
+
# ========================================================================= #
|
12
|
+
# === run
|
13
|
+
# ========================================================================= #
|
14
|
+
def run
|
15
|
+
menu
|
16
|
+
map_the_input_arguments_to_their_corresponding_values
|
17
|
+
handle_additional_actions_after_the_input_arguments_were_already_mapped
|
18
|
+
end
|
19
|
+
|
20
|
+
end; end
|
@@ -0,0 +1,230 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'beautiful_url/constants/base_constants.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BeautifulUrl
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === Constants tag.
|
11
|
+
#
|
12
|
+
# Use these constants to define the base layout of the host system.
|
13
|
+
#
|
14
|
+
# This evidently defaults to my use case, but I will try to adapt the
|
15
|
+
# project to be more flexible for other users as well, in the long
|
16
|
+
# run.
|
17
|
+
# ========================================================================= #
|
18
|
+
|
19
|
+
# ========================================================================= #
|
20
|
+
# === BASE_DIR
|
21
|
+
# ========================================================================= #
|
22
|
+
BASE_DIR = '/home/x/'
|
23
|
+
HOME_X = BASE_DIR # === HOME_X
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === DATA_DIR
|
27
|
+
#
|
28
|
+
# Note that the very useful convention for the constants here is to
|
29
|
+
# KEEP a trailing /.
|
30
|
+
#
|
31
|
+
# On my home system this will default to '/home/x/DATA/'.
|
32
|
+
# ========================================================================= #
|
33
|
+
DATA_DIR = "#{BASE_DIR}data/" # Can't use ENV here as ENV is not
|
34
|
+
# always available.
|
35
|
+
# ========================================================================= #
|
36
|
+
# === MY_DATA
|
37
|
+
# ========================================================================= #
|
38
|
+
MY_DATA = DATA_DIR
|
39
|
+
|
40
|
+
# ========================================================================= #
|
41
|
+
# === DATA_RUBY_SRC
|
42
|
+
# ========================================================================= #
|
43
|
+
DATA_RUBY_SRC = "#{BASE_DIR}programming/ruby/src/"
|
44
|
+
|
45
|
+
# ========================================================================= #
|
46
|
+
# === IMG TAG
|
47
|
+
# ========================================================================= #
|
48
|
+
IMG = "#{DATA_DIR}images/"
|
49
|
+
|
50
|
+
# ========================================================================= #
|
51
|
+
# === PROGL
|
52
|
+
# ========================================================================= #
|
53
|
+
PROGL = "#{BASE_DIR}programming/"
|
54
|
+
# ======================================================================= #
|
55
|
+
# === PROGRAMMING_LANGUAGES
|
56
|
+
# ======================================================================= #
|
57
|
+
PROGRAMMING_LANGUAGES = PROGL # Alias to the ^^^ above.
|
58
|
+
|
59
|
+
# ========================================================================= #
|
60
|
+
# === RUBY
|
61
|
+
# ========================================================================= #
|
62
|
+
RUBY = "#{PROGL}RUBY/"
|
63
|
+
|
64
|
+
# ========================================================================= #
|
65
|
+
# === RUBY_SRC
|
66
|
+
# ========================================================================= #
|
67
|
+
RUBY_SRC = "#{RUBY}src/"
|
68
|
+
RSRC = RUBY_SRC
|
69
|
+
|
70
|
+
# ========================================================================= #
|
71
|
+
# The following constants are all relative to LOCAL_HOST
|
72
|
+
# ========================================================================= #
|
73
|
+
|
74
|
+
# ========================================================================= #
|
75
|
+
# === LHOST
|
76
|
+
# ========================================================================= #
|
77
|
+
LHOST = 'http://localhost/DATA/' # This is the LOCAL_HOST constant.
|
78
|
+
# ======================================================================= #
|
79
|
+
# === DATA
|
80
|
+
# ======================================================================= #
|
81
|
+
DATA = LHOST # An "alias" to the above ^^^.
|
82
|
+
|
83
|
+
# ========================================================================= #
|
84
|
+
# === SRC
|
85
|
+
# ========================================================================= #
|
86
|
+
SRC = "#{BASE_DIR}src"
|
87
|
+
|
88
|
+
# ========================================================================= #
|
89
|
+
# === PC
|
90
|
+
# ========================================================================= #
|
91
|
+
PC = "#{LHOST}PC/"
|
92
|
+
|
93
|
+
# ========================================================================= #
|
94
|
+
# === HARDWARE
|
95
|
+
# ========================================================================= #
|
96
|
+
HARDWARE = "#{PC}hardware/"
|
97
|
+
|
98
|
+
# ========================================================================= #
|
99
|
+
# === PC_YAML
|
100
|
+
# ========================================================================= #
|
101
|
+
PC_YAML = "#{PC}yaml/"
|
102
|
+
|
103
|
+
# ========================================================================= #
|
104
|
+
# === OS
|
105
|
+
# ========================================================================= #
|
106
|
+
OS = "#{PC}OS/"
|
107
|
+
|
108
|
+
# ========================================================================= #
|
109
|
+
# === MISC
|
110
|
+
# ========================================================================= #
|
111
|
+
MISC = "#{LHOST}misc/"
|
112
|
+
|
113
|
+
# ========================================================================= #
|
114
|
+
# === CSS
|
115
|
+
# ========================================================================= #
|
116
|
+
CSS = "#{LHOST}CSS/"
|
117
|
+
|
118
|
+
# ========================================================================= #
|
119
|
+
# === RPG
|
120
|
+
# ========================================================================= #
|
121
|
+
RPG = "#{LHOST}rpg/"
|
122
|
+
|
123
|
+
# ========================================================================= #
|
124
|
+
# === MUDS
|
125
|
+
# ========================================================================= #
|
126
|
+
MUDS = "#{RPG}MUDS/"
|
127
|
+
MUD = MUDS # === MUD
|
128
|
+
|
129
|
+
# ========================================================================= #
|
130
|
+
# === STUDIUM
|
131
|
+
# ========================================================================= #
|
132
|
+
STUDIUM = "#{BASE_DIR}/studium/"
|
133
|
+
|
134
|
+
# ========================================================================= #
|
135
|
+
# === SCI
|
136
|
+
# ========================================================================= #
|
137
|
+
SCI = "#{LHOST}science/"
|
138
|
+
SCIENCE = SCI # Alias to the ^^^ above.
|
139
|
+
|
140
|
+
# ========================================================================= #
|
141
|
+
# === GAMES
|
142
|
+
# ========================================================================= #
|
143
|
+
GAMES = "#{LHOST}games/"
|
144
|
+
|
145
|
+
# ========================================================================= #
|
146
|
+
# === AUDIO
|
147
|
+
# ========================================================================= #
|
148
|
+
AUDIO = "#{LHOST}AUDIO/"
|
149
|
+
|
150
|
+
# ========================================================================= #
|
151
|
+
# === AUDIO_YAML
|
152
|
+
# ========================================================================= #
|
153
|
+
AUDIO_YAML = "#{AUDIO}yaml/"
|
154
|
+
|
155
|
+
# ========================================================================= #
|
156
|
+
# === VIDEO
|
157
|
+
# ========================================================================= #
|
158
|
+
VIDEO = "#{LHOST}video/"
|
159
|
+
|
160
|
+
# ========================================================================= #
|
161
|
+
# === LINUX
|
162
|
+
# ========================================================================= #
|
163
|
+
LINUX = "#{PC}OS/LINUX/"
|
164
|
+
|
165
|
+
# ========================================================================= #
|
166
|
+
# === LINUX_YAML
|
167
|
+
# ========================================================================= #
|
168
|
+
LINUX_YAML = "#{LINUX}yaml/"
|
169
|
+
|
170
|
+
# ========================================================================= #
|
171
|
+
# === BIOINFORMATIC
|
172
|
+
# ========================================================================= #
|
173
|
+
BIOINFORMATIC = "#{SCI}BIOINFORMATIK/"
|
174
|
+
|
175
|
+
# ========================================================================= #
|
176
|
+
# === BIOLANG_DIR
|
177
|
+
# ========================================================================= #
|
178
|
+
BIOLANG_DIR = "#{SCI}BIOLOGY/"
|
179
|
+
|
180
|
+
# ========================================================================= #
|
181
|
+
# === RUBY_DOCUMENTATION
|
182
|
+
# ========================================================================= #
|
183
|
+
RUBY_DOCUMENTATION = RUBY+'documentation/'
|
184
|
+
COOKBOOK_DIR = PC+'COOKBOOKS/YAML/' # ALL_COOKBOOKS
|
185
|
+
DATABASES = PC+'DATABASES/'
|
186
|
+
IRC = PC+'IRC/'
|
187
|
+
PHP = PROGL+'php/'
|
188
|
+
PERL = PROGL+'perl/'
|
189
|
+
|
190
|
+
RUBY_SYS = RUBY_SRC+'SYS/'
|
191
|
+
RUBY_WWW = RUBY_SRC+'WWW/'
|
192
|
+
RUBY_TOOLS = RUBY_SRC+'tools/'
|
193
|
+
|
194
|
+
# ========================================================================= #
|
195
|
+
# === RUBY_RBT
|
196
|
+
# ========================================================================= #
|
197
|
+
RUBY_RBT = RUBY_SRC+'rbt/lib/rbt/'
|
198
|
+
RUBY_BT = RUBY_RBT
|
199
|
+
|
200
|
+
# ========================================================================= #
|
201
|
+
# === RUBY_DIA
|
202
|
+
# ========================================================================= #
|
203
|
+
RUBY_DIA = RUBY_SRC+'roebe/lib/roebe/shell/'
|
204
|
+
|
205
|
+
# ========================================================================= #
|
206
|
+
# === BEAUTIFUL_URL
|
207
|
+
# ========================================================================= #
|
208
|
+
BEAUTIFUL_URL = RUBY_TOOLS+'beautiful_url/lib/beautiful_url/'
|
209
|
+
MASTER_PIPE = "#{RUBY_SRC}pipe_handler/lib/pipe_handler/"
|
210
|
+
|
211
|
+
# ========================================================================= #
|
212
|
+
# === RUBY_CYBERWEB
|
213
|
+
# ========================================================================= #
|
214
|
+
RUBY_CYBERWEB = "#{RUBY_SRC}cyberweb/lib/cyberweb/"
|
215
|
+
# ======================================================================= #
|
216
|
+
# === CYBERWEB
|
217
|
+
# ======================================================================= #
|
218
|
+
CYBERWEB = RUBY_CYBERWEB
|
219
|
+
|
220
|
+
# ========================================================================= #
|
221
|
+
# === IMG_RPG
|
222
|
+
# ========================================================================= #
|
223
|
+
IMG_RPG = "#{IMG}RPG/"
|
224
|
+
|
225
|
+
# ========================================================================= #
|
226
|
+
# === TODO_DIRECTORY
|
227
|
+
# ========================================================================= #
|
228
|
+
TODO_DIRECTORY = "#{MY_DATA}personal/todo/"
|
229
|
+
|
230
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# require 'beautiful_url/constants/constants.rb'
|
3
|
+
# =========================================================================== #
|
4
|
+
require 'beautiful_url/constants/base_constants.rb'
|
5
|
+
require 'beautiful_url/constants/encoding.rb'
|
6
|
+
require 'beautiful_url/constants/misc.rb'
|
7
|
+
require 'beautiful_url/constants/newline.rb'
|
8
|
+
require 'beautiful_url/constants/tasks.rb'
|
9
|
+
require 'beautiful_url/constants/time.rb'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This file here ensures a consistent, uniform encoding to be used
|
6
|
+
# for the whole BeautifulUrl namespace.
|
7
|
+
# =========================================================================== #
|
8
|
+
# require 'beautiful_url/constants/encoding.rb'
|
9
|
+
# =========================================================================== #
|
10
|
+
module BeautifulUrl
|
11
|
+
|
12
|
+
# ========================================================================= #
|
13
|
+
# === ENCODING_UNICODE
|
14
|
+
# ========================================================================= #
|
15
|
+
ENCODING_UNICODE = 'UTF-8'
|
16
|
+
|
17
|
+
# ========================================================================= #
|
18
|
+
# === ENCODING_ISO
|
19
|
+
# ========================================================================= #
|
20
|
+
ENCODING_ISO = 'ISO-8859-1'
|
21
|
+
|
22
|
+
# ========================================================================= #
|
23
|
+
# === USE_THIS_ENCODING
|
24
|
+
#
|
25
|
+
# This constant specifies the main encoding to be used in the
|
26
|
+
# BeautifulUrl namespace.
|
27
|
+
# ========================================================================= #
|
28
|
+
USE_THIS_ENCODING = ENCODING_UNICODE
|
29
|
+
|
30
|
+
# ========================================================================= #
|
31
|
+
# === BeautifulUrl.ensure_main_encoding
|
32
|
+
#
|
33
|
+
# his method can be used to ensure that the same base-encoding is
|
34
|
+
# used, for a given String.
|
35
|
+
# ========================================================================= #
|
36
|
+
def self.ensure_main_encoding(
|
37
|
+
i, use_this_encoding = USE_THIS_ENCODING
|
38
|
+
)
|
39
|
+
if i.is_a? String
|
40
|
+
unless i.encoding.to_s.include? use_this_encoding
|
41
|
+
i = i.force_encoding(use_this_encoding)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
i # Return it here anyway.
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'beautiful_url/constants/misc.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BeautifulUrl
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === HTTP_LOCALHOST_STRING
|
11
|
+
# ========================================================================= #
|
12
|
+
HTTP_LOCALHOST_STRING = 'http://localhost/'
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'beautiful_url/constants/newline.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BeautifulUrl
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === N
|
11
|
+
# ========================================================================= #
|
12
|
+
N = "\n"
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'beautiful_url/constants/tasks.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BeautifulUrl
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === BeautifulUrl::YAML_FILE_TASKS
|
11
|
+
#
|
12
|
+
# We will try to load the file called "tasks.yml" but this file may
|
13
|
+
# be missing for various reasons - hence a File.exist? check must
|
14
|
+
# be done.
|
15
|
+
# ========================================================================= #
|
16
|
+
tasks = '/home/x/DATA/todo/yaml/tasks.yml' # cat $MY_DATA/todo/yaml/tasks.yml
|
17
|
+
if File.exist? tasks
|
18
|
+
require 'yaml'
|
19
|
+
begin
|
20
|
+
YAML_FILE_TASKS = YAML.load_file(tasks)
|
21
|
+
YFT = YAML_FILE_TASKS # alias to the above ^^^
|
22
|
+
rescue LoadError # Silent Rescue.
|
23
|
+
# puts 'The file does not exist.'
|
24
|
+
rescue Psych::SyntaxError => error
|
25
|
+
puts 'An error happened (via psych). Showing this error next:'
|
26
|
+
pp error
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'beautiful_url/constants/time.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BeautifulUrl
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === CURRENT_YEAR
|
11
|
+
# ========================================================================= #
|
12
|
+
CURRENT_YEAR = Time.now.year.to_s
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# === BeautifulUrl.current_year?
|
16
|
+
# ========================================================================= #
|
17
|
+
def self.current_year?
|
18
|
+
CURRENT_YEAR
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|