cliz 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/cliz +2 -16
- data/lib/functions.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3244d06cf94a457489f61c5f74aa87e38809ddf73ae1d4afff4cd1223e3bf20a
|
4
|
+
data.tar.gz: 555842ee24707775b95c7cdedac5e1f0a385454951987b6e10317baec436e8c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04da2ae52ffb1b8756e349f8e177751d5040bb4309f8ff00c19deb2d8229fce35f704a0be5335da0ae382c208b15eb314ab3d08b8ca625b64cc41a58889d9a50
|
7
|
+
data.tar.gz: 8baec4b0aa47d518723a56be58113c1f5436e0ae75638592c10d045babeccfac395117d0becdd5630b2e6fc5c4fdfd100b229ef63f6c976b70930b72ed7bd703
|
data/bin/cliz
CHANGED
@@ -7,21 +7,7 @@ require_relative '../lib/functions.rb'
|
|
7
7
|
|
8
8
|
|
9
9
|
config = YAML.load(File.read('config.yml'))
|
10
|
-
|
11
|
-
OUTPUT_DIR = config['output_dir']
|
12
|
-
BASE_DOMAIN = config['base_domain']
|
13
|
-
DEPLOY_SCRIPT = config['deploy_script']
|
14
|
-
PRE_SCRIPT = config['pre_script']
|
15
|
-
|
16
10
|
url = ARGV[0]
|
17
11
|
short_suggestion = ARGV[1]
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
short_suggestion ||= generate_short_suggestion OUTPUT_DIR
|
22
|
-
folder_path = get_a_folder_path OUTPUT_DIR, short_suggestion
|
23
|
-
create_index_file(url, folder_path)
|
24
|
-
|
25
|
-
system("sh #{DEPLOY_SCRIPT}") if DEPLOY_SCRIPT
|
26
|
-
|
27
|
-
puts File.join BASE_DOMAIN, short_suggestion
|
12
|
+
short_url = short config, url, short_suggestion
|
13
|
+
puts short_url
|
data/lib/functions.rb
CHANGED
@@ -54,4 +54,21 @@ def create_index_file url, folder_path
|
|
54
54
|
File.open "#{folder_path}/index.html", 'w' do |f|
|
55
55
|
f.puts redirect_content
|
56
56
|
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def short config, url, short_suggestion = nil
|
60
|
+
output_dir = config['output_dir']
|
61
|
+
base_domain = config['base_domain']
|
62
|
+
deploy_script = config['deploy_script']
|
63
|
+
pre_script = config['pre_script']
|
64
|
+
|
65
|
+
system("sh #{pre_script}") if pre_script
|
66
|
+
|
67
|
+
short_suggestion ||= generate_short_suggestion output_dir
|
68
|
+
folder_path = get_a_folder_path output_dir, short_suggestion
|
69
|
+
create_index_file(url, folder_path)
|
70
|
+
|
71
|
+
system("sh #{deploy_script}") if deploy_script
|
72
|
+
|
73
|
+
File.join base_domain, short_suggestion
|
57
74
|
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.7
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Cliz - The static URL shortner
|
14
14
|
email: mindaslab@protonmail.com
|