beautiful_url 1.4.106

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.

Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +52 -0
  3. data/beautiful_url.gemspec +59 -0
  4. data/bin/beautiful_url +9 -0
  5. data/doc/README.gen +50 -0
  6. data/lib/beautiful_url.rb +1 -0
  7. data/lib/beautiful_url/class/constants.rb +23 -0
  8. data/lib/beautiful_url/class/generate_tab_completion_for_bash_shell.rb +67 -0
  9. data/lib/beautiful_url/class/initialize.rb +149 -0
  10. data/lib/beautiful_url/class/misc.rb +473 -0
  11. data/lib/beautiful_url/class/reset.rb +50 -0
  12. data/lib/beautiful_url/class/run.rb +20 -0
  13. data/lib/beautiful_url/constants/base_constants.rb +221 -0
  14. data/lib/beautiful_url/constants/constants.rb +9 -0
  15. data/lib/beautiful_url/constants/encoding.rb +47 -0
  16. data/lib/beautiful_url/constants/misc.rb +14 -0
  17. data/lib/beautiful_url/constants/newline.rb +14 -0
  18. data/lib/beautiful_url/constants/tasks.rb +30 -0
  19. data/lib/beautiful_url/constants/time.rb +21 -0
  20. data/lib/beautiful_url/json_generator/json_generator.rb +85 -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 +14 -0
  23. data/lib/beautiful_url/toplevel_methods/current_month.rb +32 -0
  24. data/lib/beautiful_url/toplevel_methods/local_menu.rb +1701 -0
  25. data/lib/beautiful_url/toplevel_methods/menu.rb +4846 -0
  26. data/lib/beautiful_url/toplevel_methods/misc.rb +18 -0
  27. data/lib/beautiful_url/toplevel_methods/moodle_menu.rb +135 -0
  28. data/lib/beautiful_url/toplevel_methods/return_location_of_the_menu_file.rb +27 -0
  29. data/lib/beautiful_url/toplevel_methods/roebe.rb +17 -0
  30. data/lib/beautiful_url/toplevel_methods/university_menu.rb +13976 -0
  31. data/lib/beautiful_url/version/version.rb +26 -0
  32. data/lib/beautiful_url/www/app.rb +168 -0
  33. data/test/testing_beautiful_url.rb +46 -0
  34. data/test/testing_the_base_constants.rb +26 -0
  35. metadata +99 -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,221 @@
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
+ # === BeautifulUrl::BASE_DIR
21
+ # ========================================================================= #
22
+ BASE_DIR = '/home/x/'
23
+
24
+ # ========================================================================= #
25
+ # === DATA_DIR
26
+ #
27
+ # Note that the very useful convention for the constants here is to
28
+ # KEEP a trailing /.
29
+ #
30
+ # On my home system this will default to '/home/x/DATA/'.
31
+ # ========================================================================= #
32
+ DATA_DIR = "#{BASE_DIR}DATA/" # Can't use ENV here as ENV is not
33
+ # always available.
34
+ MY_DATA = DATA_DIR # === MY_DATA
35
+
36
+ # ========================================================================= #
37
+ # === DATA_RUBY_SRC
38
+ # ========================================================================= #
39
+ DATA_RUBY_SRC = "#{DATA_DIR}PROGRAMMING_LANGUAGES/RUBY/src/"
40
+
41
+ # ========================================================================= #
42
+ # === IMG TAG
43
+ # ========================================================================= #
44
+ IMG = "#{DATA_DIR}images/"
45
+
46
+ # ========================================================================= #
47
+ # === PROGL
48
+ # ========================================================================= #
49
+ PROGL = "#{DATA_DIR}PROGRAMMING_LANGUAGES/"
50
+ # ======================================================================= #
51
+ # === PROGRAMMING_LANGUAGES
52
+ # ======================================================================= #
53
+ PROGRAMMING_LANGUAGES = PROGL # Alias to the ^^^ above.
54
+
55
+ # ========================================================================= #
56
+ # === RUBY
57
+ # ========================================================================= #
58
+ RUBY = "#{PROGL}RUBY/"
59
+
60
+ # ========================================================================= #
61
+ # === RUBY_SRC
62
+ # ========================================================================= #
63
+ RUBY_SRC = "#{RUBY}src/"
64
+ RSRC = RUBY_SRC
65
+
66
+ # ========================================================================= #
67
+ # The following constants are all relative to LOCAL_HOST
68
+ # ========================================================================= #
69
+
70
+ # ========================================================================= #
71
+ # === LHOST
72
+ # ========================================================================= #
73
+ LHOST = 'http://localhost/DATA/' # This is the LOCAL_HOST constant.
74
+ # ======================================================================= #
75
+ # === DATA
76
+ # ======================================================================= #
77
+ DATA = LHOST # An "alias" to the above ^^^.
78
+
79
+ # ========================================================================= #
80
+ # === SRC
81
+ # ========================================================================= #
82
+ SRC = "#{BASE_DIR}src"
83
+
84
+ # ========================================================================= #
85
+ # === PC
86
+ # ========================================================================= #
87
+ PC = "#{LHOST}PC/"
88
+
89
+ # ========================================================================= #
90
+ # === HARDWARE
91
+ # ========================================================================= #
92
+ HARDWARE = "#{PC}hardware/"
93
+
94
+ # ========================================================================= #
95
+ # === PC_YAML
96
+ # ========================================================================= #
97
+ PC_YAML = "#{PC}yaml/"
98
+
99
+ # ========================================================================= #
100
+ # === OS
101
+ # ========================================================================= #
102
+ OS = "#{PC}OS/"
103
+
104
+ # ========================================================================= #
105
+ # === MISC
106
+ # ========================================================================= #
107
+ MISC = "#{LHOST}misc/"
108
+
109
+ # ========================================================================= #
110
+ # === CSS
111
+ # ========================================================================= #
112
+ CSS = "#{LHOST}CSS/"
113
+
114
+ # ========================================================================= #
115
+ # === RPG
116
+ # ========================================================================= #
117
+ RPG = "#{LHOST}rpg/"
118
+
119
+ # ========================================================================= #
120
+ # === MUDS
121
+ # ========================================================================= #
122
+ MUDS = "#{RPG}MUDS/"
123
+ MUD = MUDS # === MUD
124
+
125
+ # ========================================================================= #
126
+ # === STUDIUM
127
+ # ========================================================================= #
128
+ STUDIUM = "#{BASE_DIR}/studium/"
129
+
130
+ # ========================================================================= #
131
+ # === SCI
132
+ # ========================================================================= #
133
+ SCI = "#{LHOST}science/"
134
+ SCIENCE = SCI # Alias to the ^^^ above.
135
+
136
+ # ========================================================================= #
137
+ # === GAMES
138
+ # ========================================================================= #
139
+ GAMES = "#{LHOST}games/"
140
+
141
+ # ========================================================================= #
142
+ # === AUDIO
143
+ # ========================================================================= #
144
+ AUDIO = "#{LHOST}AUDIO/"
145
+
146
+ # ========================================================================= #
147
+ # === AUDIO_YAML
148
+ # ========================================================================= #
149
+ AUDIO_YAML = "#{AUDIO}yaml/"
150
+
151
+ # ========================================================================= #
152
+ # === VIDEO
153
+ # ========================================================================= #
154
+ VIDEO = "#{LHOST}video/"
155
+
156
+ # ========================================================================= #
157
+ # === LINUX
158
+ # ========================================================================= #
159
+ LINUX = "#{PC}OS/LINUX/"
160
+
161
+ # ========================================================================= #
162
+ # === LINUX_YAML
163
+ # ========================================================================= #
164
+ LINUX_YAML = "#{LINUX}yaml/"
165
+
166
+ # ========================================================================= #
167
+ # === BIOINFORMATIC
168
+ # ========================================================================= #
169
+ BIOINFORMATIC = "#{SCI}BIOINFORMATIK/"
170
+
171
+ # ========================================================================= #
172
+ # === BIOLANG_DIR
173
+ # ========================================================================= #
174
+ BIOLANG_DIR = "#{SCI}BIOLOGY/"
175
+
176
+ # ========================================================================= #
177
+ # === RUBY_DOCUMENTATION
178
+ # ========================================================================= #
179
+ RUBY_DOCUMENTATION = RUBY+'documentation/'
180
+ COOKBOOK_DIR = PC+'COOKBOOKS/YAML/' # ALL_COOKBOOKS
181
+ DATABASES = PC+'DATABASES/'
182
+ IRC = PC+'IRC/'
183
+ PHP = PROGL+'php/'
184
+ PERL = PROGL+'perl/'
185
+
186
+ RUBY_SYS = RUBY_SRC+'SYS/'
187
+ RUBY_WWW = RUBY_SRC+'WWW/'
188
+ RUBY_TOOLS = RUBY_SRC+'tools/'
189
+
190
+ # ========================================================================= #
191
+ # === RUBY_RBT
192
+ # ========================================================================= #
193
+ RUBY_RBT = RUBY_SRC+'rbt/lib/rbt/'
194
+ RUBY_BT = RUBY_RBT
195
+
196
+ # ========================================================================= #
197
+ # === RUBY_DIA
198
+ # ========================================================================= #
199
+ RUBY_DIA = RUBY_SRC+'roebe/lib/roebe/shell/'
200
+
201
+ # ========================================================================= #
202
+ # === BEAUTIFUL_URL
203
+ # ========================================================================= #
204
+ BEAUTIFUL_URL = RUBY_TOOLS+'beautiful_url/lib/beautiful_url/'
205
+ MASTER_PIPE = "#{RUBY_SRC}pipe_handler/lib/pipe_handler/"
206
+
207
+ # ========================================================================= #
208
+ # === RUBY_CYBERWEB
209
+ # ========================================================================= #
210
+ RUBY_CYBERWEB = "#{RUBY_SRC}cyberweb/lib/cyberweb/"
211
+ # ======================================================================= #
212
+ # === CYBERWEB
213
+ # ======================================================================= #
214
+ CYBERWEB = RUBY_CYBERWEB
215
+
216
+ # ========================================================================= #
217
+ # === IMG_RPG
218
+ # ========================================================================= #
219
+ IMG_RPG = "#{IMG}RPG/"
220
+
221
+ 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
@@ -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