cliz 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cliz +4 -24
- data/lib/functions.rb +26 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6a19654ddbd2f60b46cf7d6866a5c009277776592a251226a7bfbec25b5bedd
|
4
|
+
data.tar.gz: 7272322ebc966a438df414fb52c7529d43f41be69624c5635a5721acc82423b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec5d7a30cf06b43cfade1a65bdd54e26da8a58ebee9278796b7d860a218b557d2cfc554d72a4a051fec2135a342eb4b8a9ede6c2080bda4cddb5915d38786fa2
|
7
|
+
data.tar.gz: e76c59d0589a33f2e2b49b486d216f46cd266ee35b1b9a8288c2282e7f9faab3bc42462daca633dc3572e514ac8ee03a37f678ac5c9bcab4491da98807b58444
|
data/bin/cliz
CHANGED
@@ -11,36 +11,16 @@ config = YAML.load(File.read('config.yml'))
|
|
11
11
|
OUTPUT_DIR = config['output_dir']
|
12
12
|
BASE_DOMAIN = config['base_domain']
|
13
13
|
DEPLOY_SCRIPT = config['deploy_script']
|
14
|
-
|
15
|
-
<!DOCTYPE html>
|
16
|
-
<html>
|
17
|
-
<head>
|
18
|
-
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
19
|
-
<meta content="utf-8" http-equiv="encoding">
|
20
|
-
<script type="text/javascript">
|
21
|
-
window.location.replace("https://cliz.in");
|
22
|
-
</script>
|
23
|
-
<meta http-equiv="refresh" content="0; url='https://cliz.in'" />
|
24
|
-
</head>
|
25
|
-
<body>
|
26
|
-
<p>Please follow <a href="https://cliz.in">this link</a>.</p>
|
27
|
-
</body>
|
28
|
-
</html>
|
29
|
-
}
|
14
|
+
PRE_SCRIPT = config['pre_script']
|
30
15
|
|
31
16
|
url = ARGV[0]
|
32
17
|
short_suggestion = ARGV[1]
|
33
|
-
|
18
|
+
|
19
|
+
system("sh #{PRE_SCTIPT}") if PRE_SCTIPT
|
34
20
|
|
35
21
|
short_suggestion ||= generate_short_suggestion OUTPUT_DIR
|
36
22
|
folder_path = get_a_folder_path OUTPUT_DIR, short_suggestion
|
37
|
-
|
38
|
-
|
39
|
-
FileUtils.mkdir_p(folder_path)
|
40
|
-
|
41
|
-
File.open "#{folder_path}/index.html", 'w' do |f|
|
42
|
-
f.puts redirect_content
|
43
|
-
end
|
23
|
+
create_index_file(url, folder_path)
|
44
24
|
|
45
25
|
system("sh #{DEPLOY_SCRIPT}") if DEPLOY_SCRIPT
|
46
26
|
|
data/lib/functions.rb
CHANGED
@@ -29,3 +29,29 @@ def generate_short_suggestion output_directory
|
|
29
29
|
|
30
30
|
random_string
|
31
31
|
end
|
32
|
+
|
33
|
+
def create_index_file url, folder_path
|
34
|
+
html = %Q{
|
35
|
+
<!DOCTYPE html>
|
36
|
+
<html>
|
37
|
+
<head>
|
38
|
+
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
|
39
|
+
<meta content="utf-8" http-equiv="encoding">
|
40
|
+
<script type="text/javascript">
|
41
|
+
window.location.replace("https://cliz.in");
|
42
|
+
</script>
|
43
|
+
<meta http-equiv="refresh" content="0; url='https://cliz.in'" />
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
<p>Please follow <a href="https://cliz.in">this link</a>.</p>
|
47
|
+
</body>
|
48
|
+
</html>
|
49
|
+
}
|
50
|
+
|
51
|
+
redirect_content = html.gsub 'https://cliz.in', url
|
52
|
+
FileUtils.mkdir_p(folder_path)
|
53
|
+
|
54
|
+
File.open "#{folder_path}/index.html", 'w' do |f|
|
55
|
+
f.puts redirect_content
|
56
|
+
end
|
57
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cliz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karthikeyan A K
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Cliz - The static URL shortner
|
14
14
|
email: mindaslab@protonmail.com
|
@@ -38,7 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
|
-
rubygems_version: 3.2.
|
41
|
+
rubygems_version: 3.2.15
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
44
|
summary: Cliz - The static URL shortner
|