beautiful_url 1.5.90

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +112 -0
  3. data/beautiful_url.gemspec +60 -0
  4. data/bin/beautiful_url +9 -0
  5. data/doc/README.gen +65 -0
  6. data/lib/beautiful_url/class/constants.rb +23 -0
  7. data/lib/beautiful_url/class/generate_tab_completion_for_bash_shell.rb +67 -0
  8. data/lib/beautiful_url/class/initialize.rb +149 -0
  9. data/lib/beautiful_url/class/misc.rb +486 -0
  10. data/lib/beautiful_url/class/reset.rb +50 -0
  11. data/lib/beautiful_url/class/run.rb +20 -0
  12. data/lib/beautiful_url/constants/base_constants.rb +249 -0
  13. data/lib/beautiful_url/constants/constants.rb +9 -0
  14. data/lib/beautiful_url/constants/encoding.rb +48 -0
  15. data/lib/beautiful_url/constants/misc.rb +14 -0
  16. data/lib/beautiful_url/constants/newline.rb +14 -0
  17. data/lib/beautiful_url/constants/tasks.rb +30 -0
  18. data/lib/beautiful_url/constants/time.rb +21 -0
  19. data/lib/beautiful_url/json_generator/json_generator.rb +85 -0
  20. data/lib/beautiful_url/project/project.rb +23 -0
  21. data/lib/beautiful_url/requires/failsafe_require_of_beautiful_url.rb +9 -0
  22. data/lib/beautiful_url/requires/require_the_beautiful_url_project.rb +15 -0
  23. data/lib/beautiful_url/toplevel_methods/current_month.rb +32 -0
  24. data/lib/beautiful_url/toplevel_methods/jobs_menu.rb +118 -0
  25. data/lib/beautiful_url/toplevel_methods/local_menu.rb +2764 -0
  26. data/lib/beautiful_url/toplevel_methods/menu.rb +123 -0
  27. data/lib/beautiful_url/toplevel_methods/misc.rb +73 -0
  28. data/lib/beautiful_url/toplevel_methods/moodle_menu.rb +135 -0
  29. data/lib/beautiful_url/toplevel_methods/new_university_menu.rb +2852 -0
  30. data/lib/beautiful_url/toplevel_methods/pdf_books_menu.rb +32 -0
  31. data/lib/beautiful_url/toplevel_methods/return_location_of_the_menu_file.rb +27 -0
  32. data/lib/beautiful_url/toplevel_methods/roebe.rb +17 -0
  33. data/lib/beautiful_url/toplevel_methods/science_menu.rb +561 -0
  34. data/lib/beautiful_url/toplevel_methods/traditional_menu.rb +6404 -0
  35. data/lib/beautiful_url/toplevel_methods/university_menu.rb +12655 -0
  36. data/lib/beautiful_url/toplevel_methods/video_menu.rb +1570 -0
  37. data/lib/beautiful_url/version/version.rb +26 -0
  38. data/lib/beautiful_url/www/app.rb +168 -0
  39. data/lib/beautiful_url.rb +1 -0
  40. data/test/testing_beautiful_url.rb +56 -0
  41. data/test/testing_the_base_constants.rb +26 -0
  42. metadata +107 -0
@@ -0,0 +1,249 @@
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_IMAGES_ROEBE
42
+ # ========================================================================= #
43
+ DATA_IMAGES_ROEBE = "#{MY_DATA}images/roebe/"
44
+
45
+ # ========================================================================= #
46
+ # === MY_DATA_DIR
47
+ # ========================================================================= #
48
+ MY_DATA_DIR = DATA_DIR
49
+
50
+ # ========================================================================= #
51
+ # === DATA_RUBY_SRC
52
+ # ========================================================================= #
53
+ DATA_RUBY_SRC = "#{BASE_DIR}programming/ruby/src/"
54
+
55
+ # ========================================================================= #
56
+ # === IMG TAG
57
+ # ========================================================================= #
58
+ IMG = "#{DATA_DIR}images/"
59
+
60
+ # ========================================================================= #
61
+ # === PROGL
62
+ # ========================================================================= #
63
+ PROGL = "#{BASE_DIR}programming/"
64
+ # ======================================================================= #
65
+ # === PROGRAMMING_LANGUAGES
66
+ # ======================================================================= #
67
+ PROGRAMMING_LANGUAGES = PROGL # Alias to the ^^^ above.
68
+ # ======================================================================= #
69
+ # === PROGRAMMING
70
+ # ======================================================================= #
71
+ PROGRAMMING = PROGRAMMING_LANGUAGES
72
+
73
+ # ========================================================================= #
74
+ # === RUBY
75
+ #
76
+ # This constant refers to where I keep my ruby code.
77
+ # ========================================================================= #
78
+ RUBY = "#{PROGRAMMING_LANGUAGES}ruby/"
79
+
80
+ # ========================================================================= #
81
+ # === RUBY_SRC
82
+ # ========================================================================= #
83
+ RUBY_SRC = "#{RUBY}src/"
84
+ RSRC = RUBY_SRC
85
+
86
+ # ========================================================================= #
87
+ # The following constants are all relative to LOCAL_HOST
88
+ # ========================================================================= #
89
+
90
+ # ========================================================================= #
91
+ # === LHOST
92
+ # ========================================================================= #
93
+ LHOST = 'http://localhost/data/' # This is the LOCAL_HOST constant.
94
+ # ======================================================================= #
95
+ # === DATA
96
+ # ======================================================================= #
97
+ DATA = LHOST # An "alias" to the above ^^^.
98
+
99
+ # ========================================================================= #
100
+ # === SRC
101
+ # ========================================================================= #
102
+ SRC = "#{BASE_DIR}src"
103
+
104
+ # ========================================================================= #
105
+ # === PC
106
+ # ========================================================================= #
107
+ PC = "#{LHOST}PC/"
108
+
109
+ # ========================================================================= #
110
+ # === HARDWARE
111
+ # ========================================================================= #
112
+ HARDWARE = "#{PC}hardware/"
113
+
114
+ # ========================================================================= #
115
+ # === PC_YAML
116
+ # ========================================================================= #
117
+ PC_YAML = "#{PC}yaml/"
118
+
119
+ # ========================================================================= #
120
+ # === OS
121
+ # ========================================================================= #
122
+ OS = "#{PC}OS/"
123
+
124
+ # ========================================================================= #
125
+ # === MISC
126
+ # ========================================================================= #
127
+ MISC = "#{LHOST}misc/"
128
+
129
+ # ========================================================================= #
130
+ # === CSS
131
+ # ========================================================================= #
132
+ CSS = "#{LHOST}CSS/"
133
+
134
+ # ========================================================================= #
135
+ # === RPG
136
+ # ========================================================================= #
137
+ RPG = "#{LHOST}rpg/"
138
+
139
+ # ========================================================================= #
140
+ # === MUDS
141
+ # ========================================================================= #
142
+ MUDS = "#{RPG}MUDS/"
143
+ MUD = MUDS # === MUD
144
+
145
+ # ========================================================================= #
146
+ # === STUDIUM
147
+ # ========================================================================= #
148
+ STUDIUM = "#{BASE_DIR}/studium/"
149
+
150
+ # ========================================================================= #
151
+ # === SCI
152
+ # ========================================================================= #
153
+ SCI = "#{LHOST}science/"
154
+ SCIENCE = SCI # Alias to the ^^^ above.
155
+
156
+ # ========================================================================= #
157
+ # === GAMES
158
+ # ========================================================================= #
159
+ GAMES = "#{LHOST}games/"
160
+
161
+ # ========================================================================= #
162
+ # === AUDIO
163
+ # ========================================================================= #
164
+ AUDIO = "#{LHOST}AUDIO/"
165
+
166
+ # ========================================================================= #
167
+ # === AUDIO_YAML
168
+ # ========================================================================= #
169
+ AUDIO_YAML = "#{AUDIO}yaml/"
170
+
171
+ # ========================================================================= #
172
+ # === VIDEO
173
+ # ========================================================================= #
174
+ VIDEO = "#{LHOST}video/"
175
+
176
+ # ========================================================================= #
177
+ # === LINUX
178
+ # ========================================================================= #
179
+ LINUX = "#{PC}OS/LINUX/"
180
+
181
+ # ========================================================================= #
182
+ # === LINUX_YAML
183
+ # ========================================================================= #
184
+ LINUX_YAML = "#{LINUX}yaml/"
185
+
186
+ # ========================================================================= #
187
+ # === BIOINFORMATIC
188
+ # ========================================================================= #
189
+ BIOINFORMATIC = "#{SCI}BIOINFORMATIK/"
190
+
191
+ # ========================================================================= #
192
+ # === BIOLANG_DIR
193
+ # ========================================================================= #
194
+ BIOLANG_DIR = "#{SCI}BIOLOGY/"
195
+
196
+ # ========================================================================= #
197
+ # === RUBY_DOCUMENTATION
198
+ # ========================================================================= #
199
+ RUBY_DOCUMENTATION = RUBY+'documentation/'
200
+ COOKBOOK_DIR = PC+'COOKBOOKS/YAML/' # ALL_COOKBOOKS
201
+ DATABASES = PC+'DATABASES/'
202
+ IRC = PC+'IRC/'
203
+ PHP = PROGL+'php/'
204
+ PERL = PROGL+'perl/'
205
+
206
+ # ========================================================================= #
207
+ # === RUBY_SYS
208
+ # ========================================================================= #
209
+ RUBY_SYS = RUBY_SRC+'sys/'
210
+ RUBY_WWW = RUBY_SRC+'www/'
211
+ RUBY_TOOLS = RUBY_SRC+'tools/'
212
+
213
+ # ========================================================================= #
214
+ # === RUBY_RBT
215
+ # ========================================================================= #
216
+ RUBY_RBT = RUBY_SRC+'rbt/lib/rbt/'
217
+ RUBY_BT = RUBY_RBT
218
+
219
+ # ========================================================================= #
220
+ # === RUBY_DIA
221
+ # ========================================================================= #
222
+ RUBY_DIA = RUBY_SRC+'roebe/lib/roebe/shell/'
223
+
224
+ # ========================================================================= #
225
+ # === BEAUTIFUL_URL
226
+ # ========================================================================= #
227
+ BEAUTIFUL_URL = RUBY_TOOLS+'beautiful_url/lib/beautiful_url/'
228
+ MASTER_PIPE = "#{RUBY_SRC}pipe_handler/lib/pipe_handler/"
229
+
230
+ # ========================================================================= #
231
+ # === RUBY_CYBERWEB
232
+ # ========================================================================= #
233
+ RUBY_CYBERWEB = "#{RUBY_SRC}cyberweb/lib/cyberweb/"
234
+ # ======================================================================= #
235
+ # === CYBERWEB
236
+ # ======================================================================= #
237
+ CYBERWEB = RUBY_CYBERWEB
238
+
239
+ # ========================================================================= #
240
+ # === IMG_RPG
241
+ # ========================================================================= #
242
+ IMG_RPG = "#{IMG}RPG/"
243
+
244
+ # ========================================================================= #
245
+ # === TODO_DIRECTORY
246
+ # ========================================================================= #
247
+ TODO_DIRECTORY = "#{MY_DATA}personal/todo/"
248
+
249
+ 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,48 @@
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.dup if i.frozen?
42
+ i = i.force_encoding(use_this_encoding)
43
+ end
44
+ end
45
+ i # Return it here anyway.
46
+ end
47
+
48
+ 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
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === BeautifulUrl::JsonGenerator
6
+ #
7
+ # The task of this class is to generate all entries in the case/when
8
+ # menu as json.
9
+ # =========================================================================== #
10
+ # require 'beautiful_url/json_generator/json_generator.rb'
11
+ # =========================================================================== #
12
+ module BeautifulUrl
13
+
14
+ class JsonGenerator # === BeautifulUrl::JsonGenerator
15
+
16
+ require 'json'
17
+
18
+ begin
19
+ require 'case_parser' # This gem is required in this file here.
20
+ rescue LoadError; end
21
+
22
+ alias e puts
23
+
24
+ # ========================================================================= #
25
+ # === STORE_WHERE
26
+ # ========================================================================= #
27
+ STORE_WHERE = '/Depot/Temp/dataset.json'
28
+
29
+ # ========================================================================= #
30
+ # === initialize
31
+ # ========================================================================= #
32
+ def initialize(
33
+ run_already = true
34
+ )
35
+ reset
36
+ run if run_already
37
+ end
38
+
39
+ # ========================================================================= #
40
+ # === reset
41
+ # ========================================================================= #
42
+ def reset
43
+ # ======================================================================= #
44
+ # === @array
45
+ # ======================================================================= #
46
+ @array = CaseParser.return_array(:beautiful_menu)
47
+ end
48
+
49
+ # ========================================================================= #
50
+ # === save_result
51
+ # ========================================================================= #
52
+ def save_result
53
+ report_where_we_will_store
54
+ File.open(STORE_WHERE, 'w+') {|file| file.print @serialized }
55
+ end
56
+
57
+ # ========================================================================= #
58
+ # === report_where_we_will_store
59
+ # ========================================================================= #
60
+ def report_where_we_will_store
61
+ e "Next storing at `#{STORE_WHERE}`."
62
+ end
63
+
64
+ # ========================================================================= #
65
+ # === serialized?
66
+ # ========================================================================= #
67
+ def serialized?
68
+ @serialized
69
+ end; alias serialized serialized? # === serialized
70
+
71
+ # ========================================================================= #
72
+ # === run
73
+ # ========================================================================= #
74
+ def run
75
+ @serialized = @array.to_json
76
+ save_result
77
+ end
78
+
79
+ end; end
80
+
81
+ if __FILE__ == $PROGRAM_NAME
82
+ _ = BeautifulUrl::JsonGenerator.new
83
+ pp _.serialized
84
+ _.report_where_we_will_store
85
+ end # json_generator
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'beautiful_url/project/project.rb'
6
+ # =========================================================================== #
7
+ module BeautifulUrl
8
+
9
+ # ========================================================================= #
10
+ # === BeautifulUrl.project_base_directory?
11
+ # ========================================================================= #
12
+ def self.project_base_directory?
13
+ File.absolute_path("#{__dir__}/..")+'/'
14
+ end; self.instance_eval { alias project_base_dir? project_base_directory? } # === BeautifulUrl.project_base_dir?
15
+ self.instance_eval { alias project_dir? project_base_directory? } # === BeautifulUrl.project_dir?
16
+ self.instance_eval { alias base_dir? project_base_directory? } # === BeautifulUrl.base_dir?
17
+ self.instance_eval { alias base_directory? project_base_directory? } # === BeautifulUrl.base_directory?
18
+
19
+ end
20
+
21
+ if __FILE__ == $PROGRAM_NAME
22
+ puts BeautifulUrl.project_base_dir?
23
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'beautiful_url/requires/failsafe_require_of_beautiful_url.rb'
6
+ # =========================================================================== #
7
+ begin
8
+ require 'beautiful_url/requires/require_the_beautiful_url_project.rb'
9
+ rescue LoadError; end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'beautiful_url/requires/require_the_beautiful_url_project.rb'
6
+ # =========================================================================== #
7
+ require 'beautiful_url/constants/constants.rb'
8
+ require 'beautiful_url/version/version.rb'
9
+ require 'beautiful_url/project/project.rb'
10
+ require 'beautiful_url/json_generator/json_generator.rb'
11
+ require 'beautiful_url/toplevel_methods/local_menu.rb'
12
+ require 'beautiful_url/toplevel_methods/moodle_menu.rb'
13
+ require 'beautiful_url/toplevel_methods/return_location_of_the_menu_file.rb'
14
+ require 'beautiful_url/toplevel_methods/university_menu.rb'
15
+ require 'beautiful_url/class/initialize.rb'
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ module BeautifulUrl
6
+
7
+ require 'date'
8
+
9
+ # ========================================================================= #
10
+ # === BeautifulUrl.current_month?
11
+ #
12
+ # This will return e. g. "5".
13
+ # ========================================================================= #
14
+ def self.current_month?(
15
+ pad_with_zeroes = false
16
+ )
17
+ current_month = Date.today.month.to_s
18
+ case pad_with_zeroes
19
+ when :pad_with_zeroes
20
+ pad_with_zeroes = true
21
+ end
22
+ if pad_with_zeroes
23
+ current_month = current_month.rjust(2,'0')
24
+ end
25
+ return current_month
26
+ end
27
+
28
+ end
29
+
30
+ if __FILE__ == $PROGRAM_NAME
31
+ puts BeautifulUrl.current_month?
32
+ end