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,26 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# require 'beautiful_url/version/version.rb'
|
6
|
+
# =========================================================================== #
|
7
|
+
module BeautifulUrl
|
8
|
+
|
9
|
+
# ========================================================================= #
|
10
|
+
# === VERSION
|
11
|
+
# ========================================================================= #
|
12
|
+
VERSION = '1.5.5'
|
13
|
+
|
14
|
+
# ========================================================================= #
|
15
|
+
# ===LAST_UPDATE
|
16
|
+
# ========================================================================= #
|
17
|
+
LAST_UPDATE = '18.07.2021'
|
18
|
+
|
19
|
+
# ========================================================================= #
|
20
|
+
# === BeautifulUrl.version?
|
21
|
+
# ========================================================================= #
|
22
|
+
def self.version?
|
23
|
+
VERSION
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === BeautifulUrl::App
|
6
|
+
#
|
7
|
+
# This class can show, on a webpage, whether a remote URL is registered
|
8
|
+
# or not. Additionally it can redirect or load up a new website.
|
9
|
+
#
|
10
|
+
# Usage example:
|
11
|
+
#
|
12
|
+
# BeautifulUrl::App.new
|
13
|
+
#
|
14
|
+
# =========================================================================== #
|
15
|
+
# require 'beautiful_url/www/app.rb'
|
16
|
+
# BeautifulUrl::App.start_sinatra_interface
|
17
|
+
# =========================================================================== #
|
18
|
+
require 'web_object/requires/require_sinatra.rb'
|
19
|
+
|
20
|
+
module BeautifulUrl
|
21
|
+
|
22
|
+
class App < ::WebObject::Sinatra # === BeautifulUrl::App
|
23
|
+
|
24
|
+
require 'beautiful_url'
|
25
|
+
|
26
|
+
# ========================================================================= #
|
27
|
+
# === before (before tag)
|
28
|
+
# ========================================================================= #
|
29
|
+
before {
|
30
|
+
content_type(:html, 'charset' => 'UTF-8')
|
31
|
+
}
|
32
|
+
|
33
|
+
# ========================================================================= #
|
34
|
+
# === initialize
|
35
|
+
# ========================================================================= #
|
36
|
+
def initialize(
|
37
|
+
commandline_arguments = nil,
|
38
|
+
run_already = true
|
39
|
+
)
|
40
|
+
super()
|
41
|
+
reset
|
42
|
+
set_commandline_arguments(
|
43
|
+
commandline_arguments
|
44
|
+
)
|
45
|
+
run if run_already
|
46
|
+
end
|
47
|
+
|
48
|
+
# ========================================================================= #
|
49
|
+
# === reset (reset tag)
|
50
|
+
# ========================================================================= #
|
51
|
+
def reset
|
52
|
+
super()
|
53
|
+
# ======================================================================= #
|
54
|
+
# === @automatically_redirect_when_the_input_has_been_found
|
55
|
+
#
|
56
|
+
# If the next variable is set to true then we will automatically
|
57
|
+
# redirect the visitor.
|
58
|
+
# ======================================================================= #
|
59
|
+
@automatically_redirect_when_the_input_has_been_found = false
|
60
|
+
end
|
61
|
+
|
62
|
+
# ========================================================================= #
|
63
|
+
# === set_input
|
64
|
+
# ========================================================================= #
|
65
|
+
def set_commandline_arguments(i = '')
|
66
|
+
i = [i].flatten.compact
|
67
|
+
@commandline_arguments = i
|
68
|
+
end
|
69
|
+
|
70
|
+
# ========================================================================= #
|
71
|
+
# === commandline_arguments?
|
72
|
+
# ========================================================================= #
|
73
|
+
def commandline_arguments?
|
74
|
+
@commandline_arguments
|
75
|
+
end
|
76
|
+
|
77
|
+
# ========================================================================= #
|
78
|
+
# === /
|
79
|
+
# ========================================================================= #
|
80
|
+
get('/*') {
|
81
|
+
_ = params[:splat]
|
82
|
+
route_to_this_action = '/'
|
83
|
+
if params.has_key?('user_input')
|
84
|
+
_ = params.fetch('user_input')
|
85
|
+
end
|
86
|
+
original_input = _.dup
|
87
|
+
original_input = original_input.join(' ').strip if _.is_a? Array
|
88
|
+
_ = ::BeautifulUrl.return_as_string(original_input)
|
89
|
+
header = html_title('Translate URLs')+'<body>'
|
90
|
+
footer = '</body></html>'
|
91
|
+
form_div = div(css_style: 'padding: 0.2em') {
|
92
|
+
form(action: route_to_this_action, id: 'beautiful_url', css_style: 'margin-left:2em; margin-top:2px') {
|
93
|
+
'<input type="text" name="user_input" autofocus '\
|
94
|
+
'style="padding:2px; border:3px solid slateblue; padding: 4px"><br>'+
|
95
|
+
input_type_submit
|
96
|
+
}
|
97
|
+
}
|
98
|
+
if original_input.empty?
|
99
|
+
header+
|
100
|
+
p(
|
101
|
+
'Please provide an URL (shortcut).'
|
102
|
+
)+
|
103
|
+
form_div+
|
104
|
+
footer
|
105
|
+
elsif _ == original_input
|
106
|
+
header+
|
107
|
+
p(
|
108
|
+
'Not found the input: <br><b>'+original_input+'</b>'
|
109
|
+
)+
|
110
|
+
form_div+
|
111
|
+
footer
|
112
|
+
else
|
113
|
+
# In this case the input was found.
|
114
|
+
if @automatically_redirect_when_the_input_has_been_found
|
115
|
+
redirect _
|
116
|
+
end
|
117
|
+
header+
|
118
|
+
p(
|
119
|
+
'The original input was: <br><b style="margin-left:1em">'+original_input+'</b>'
|
120
|
+
)+
|
121
|
+
return_proper_link_for(_)+
|
122
|
+
br+
|
123
|
+
form_div+
|
124
|
+
footer
|
125
|
+
end
|
126
|
+
}
|
127
|
+
|
128
|
+
# ========================================================================= #
|
129
|
+
# === return_proper_link_for
|
130
|
+
# ========================================================================= #
|
131
|
+
def return_proper_link_for(i)
|
132
|
+
a(
|
133
|
+
i, content: i, css_style: 'margin-left: 2em; font-weight: bold;'
|
134
|
+
)
|
135
|
+
end
|
136
|
+
|
137
|
+
# ========================================================================= #
|
138
|
+
# === html_title
|
139
|
+
# ========================================================================= #
|
140
|
+
def html_title(this_title = 'Translate URLs')
|
141
|
+
"<html><title>#{this_title}</title></html>"
|
142
|
+
end
|
143
|
+
|
144
|
+
# ========================================================================= #
|
145
|
+
# === run (run tag)
|
146
|
+
# ========================================================================= #
|
147
|
+
def run
|
148
|
+
end
|
149
|
+
|
150
|
+
# ========================================================================= #
|
151
|
+
# === BeautifulUrl::App.start_sinatra_interface
|
152
|
+
# ========================================================================= #
|
153
|
+
def self.start_sinatra_interface
|
154
|
+
::BeautifulUrl::App.run!
|
155
|
+
end
|
156
|
+
|
157
|
+
# ========================================================================= #
|
158
|
+
# === BeautifulUrl::App[]
|
159
|
+
# ========================================================================= #
|
160
|
+
def self.[](i = '')
|
161
|
+
new(i)
|
162
|
+
end
|
163
|
+
|
164
|
+
end; end
|
165
|
+
|
166
|
+
if __FILE__ == $PROGRAM_NAME
|
167
|
+
BeautifulUrl::App.start_sinatra_interface
|
168
|
+
end # beautiful_url_app
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
if __FILE__ == $PROGRAM_NAME
|
6
|
+
N = "\n"
|
7
|
+
require 'opn'
|
8
|
+
require 'beautiful_url'
|
9
|
+
require 'cliner'
|
10
|
+
require 'colours/colours_e_autoinclude.rb'
|
11
|
+
# ========================================================================= #
|
12
|
+
# Testing the class next.
|
13
|
+
# ========================================================================= #
|
14
|
+
e 'We will now test that the class BeautifulUrl works well.'
|
15
|
+
e "The version is: `#{simp(BeautifulUrl.version?)}`."
|
16
|
+
# ========================================================================= #
|
17
|
+
# === test_this_input
|
18
|
+
# ========================================================================= #
|
19
|
+
def test_this_input(i)
|
20
|
+
e; cliner {
|
21
|
+
e 'The input that we will test next is: '+sfancy(i)
|
22
|
+
# _ = BeautifulUrl[i]
|
23
|
+
_ = BeautifulUrl::BeautifulUrl.new(i)
|
24
|
+
e 'Is it included? '+sfancy(BeautifulUrl.is_included?(i).to_s)
|
25
|
+
e 'Replaced url is: '+sfancy(_.url?)
|
26
|
+
}; e
|
27
|
+
end
|
28
|
+
input = 'smiley3'; test_this_input(input)
|
29
|
+
input = 'gather_pc_news'; test_this_input(input)
|
30
|
+
# Next, we must test intralink abilities.
|
31
|
+
input = 'local_php#test'; test_this_input(input)
|
32
|
+
# Next, generate tab completion:
|
33
|
+
opn; e 'Next, we will generate the tab completion:'
|
34
|
+
BeautifulUrl::BeautifulUrl.new.generate_tab_completion
|
35
|
+
_ = BeautifulUrl::BeautifulUrl.new(
|
36
|
+
'http://localhost/MISC/projects.cgi', :replace)
|
37
|
+
opn; e _.result?
|
38
|
+
e
|
39
|
+
opn; e 'Now we will test the functionality of .search_for_this_url'
|
40
|
+
opn; e ' '+_.search_for_this_url('videos').to_s
|
41
|
+
e
|
42
|
+
opn; e "Next, we will test the functionality of BeautifulUrl['project']:"
|
43
|
+
opn; e ' '+BeautifulUrl['project']
|
44
|
+
pp BeautifulUrl['cybertest'] { :do_replace_localhost }
|
45
|
+
pp BeautifulUrl.new('bioroebe_tutorial?pdf')
|
46
|
+
end # $RSRC/beautiful_url/test/testing_beautiful_url.rb
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'beautiful_url/constants/base_constants.rb'
|
6
|
+
include BeautifulUrl
|
7
|
+
|
8
|
+
require 'colours/autoinclude'
|
9
|
+
|
10
|
+
e
|
11
|
+
e BeautifulUrl::BASE_DIR
|
12
|
+
e
|
13
|
+
e '^^^ this should equal /home/x/'
|
14
|
+
e
|
15
|
+
|
16
|
+
data_dir = BeautifulUrl::DATA_DIR
|
17
|
+
|
18
|
+
if File.directory? data_dir
|
19
|
+
e 'Yes, the directory '+data_dir+' exists.'
|
20
|
+
else
|
21
|
+
e 'No, the directory '+data_dir+' does NOT exist.'
|
22
|
+
end
|
23
|
+
|
24
|
+
e
|
25
|
+
e 'RUBY_SRC is: '+RUBY_SRC
|
26
|
+
e
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: beautiful_url
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.5.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert A. Heiler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: "\nThis is a medium-sized gem which attempts to handle \"matching\" a
|
14
|
+
String\nor a Symbol against (remote) URLs. The project was created in order to\nuse
|
15
|
+
short identifiers that can pinpoint to remote URLs, a bit similar\nto how shorturl
|
16
|
+
is working.\n\nThe gem is, however had, tailored to my use cases, so it will most\nlikely
|
17
|
+
be utterly useless to other people by default. Most downloads\nof this gem happen
|
18
|
+
by scripts and bots, so do not think that the \ndownload numbers imply anything
|
19
|
+
about \"real\" usage - the gem is \nway too much tailored to my own use case.\n\nIn
|
20
|
+
the long run, though, the project may be extended to allow the\ncustom loading of
|
21
|
+
yaml files, for a later release - but for now,\nI do not think that this project
|
22
|
+
will be useful to anyone else. \n\nMore documentation can be found at:\n\n https://www.rubydoc.info/gems/beautiful_url/\n
|
23
|
+
\ \n"
|
24
|
+
email: shevy@inbox.lt
|
25
|
+
executables: []
|
26
|
+
extensions: []
|
27
|
+
extra_rdoc_files: []
|
28
|
+
files:
|
29
|
+
- README.md
|
30
|
+
- beautiful_url.gemspec
|
31
|
+
- bin/beautiful_url
|
32
|
+
- doc/README.gen
|
33
|
+
- lib/beautiful_url.rb
|
34
|
+
- lib/beautiful_url/class/constants.rb
|
35
|
+
- lib/beautiful_url/class/generate_tab_completion_for_bash_shell.rb
|
36
|
+
- lib/beautiful_url/class/initialize.rb
|
37
|
+
- lib/beautiful_url/class/misc.rb
|
38
|
+
- lib/beautiful_url/class/reset.rb
|
39
|
+
- lib/beautiful_url/class/run.rb
|
40
|
+
- lib/beautiful_url/constants/base_constants.rb
|
41
|
+
- lib/beautiful_url/constants/constants.rb
|
42
|
+
- lib/beautiful_url/constants/encoding.rb
|
43
|
+
- lib/beautiful_url/constants/misc.rb
|
44
|
+
- lib/beautiful_url/constants/newline.rb
|
45
|
+
- lib/beautiful_url/constants/tasks.rb
|
46
|
+
- lib/beautiful_url/constants/time.rb
|
47
|
+
- lib/beautiful_url/json_generator/json_generator.rb
|
48
|
+
- lib/beautiful_url/requires/failsafe_require_of_beautiful_url.rb
|
49
|
+
- lib/beautiful_url/requires/require_the_beautiful_url_project.rb
|
50
|
+
- lib/beautiful_url/toplevel_methods/current_month.rb
|
51
|
+
- lib/beautiful_url/toplevel_methods/jobs_menu.rb
|
52
|
+
- lib/beautiful_url/toplevel_methods/local_menu.rb
|
53
|
+
- lib/beautiful_url/toplevel_methods/menu.rb
|
54
|
+
- lib/beautiful_url/toplevel_methods/misc.rb
|
55
|
+
- lib/beautiful_url/toplevel_methods/moodle_menu.rb
|
56
|
+
- lib/beautiful_url/toplevel_methods/return_location_of_the_menu_file.rb
|
57
|
+
- lib/beautiful_url/toplevel_methods/roebe.rb
|
58
|
+
- lib/beautiful_url/toplevel_methods/university_menu.rb
|
59
|
+
- lib/beautiful_url/version/version.rb
|
60
|
+
- lib/beautiful_url/www/app.rb
|
61
|
+
- test/testing_beautiful_url.rb
|
62
|
+
- test/testing_the_base_constants.rb
|
63
|
+
homepage: https://rubygems.org/gems/beautiful_url
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message: |2+
|
68
|
+
|
69
|
+
You should be able to invoke bin/beautiful_url via:
|
70
|
+
|
71
|
+
beautiful_url
|
72
|
+
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 3.0.2
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 3.2.24
|
86
|
+
requirements: []
|
87
|
+
rubygems_version: 3.2.24
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: 'This is a medium-sized gem which attempts to handle "matching" a String
|
91
|
+
or a Symbol against (remote) URLs. The project was created in order to use short
|
92
|
+
identifiers that can pinpoint to remote URLs, a bit similar to how shorturl is working. The
|
93
|
+
gem is, however had, tailored to my use cases, so it will most likely be utterly
|
94
|
+
useless to other people by default. Most downloads of this gem happen by scripts
|
95
|
+
and bots, so do not think that the download numbers imply anything about "real"
|
96
|
+
usage - the gem is way too much tailored to my own use case. In the long run,
|
97
|
+
though, the project may be extended to allow the custom loading of yaml files, for
|
98
|
+
a later release - but for now, I do not think that this project will be useful to
|
99
|
+
anyone else. More documentation can be found at: https://www.rubydoc.info/gems/beautiful_url/'
|
100
|
+
test_files: []
|
101
|
+
...
|