cliz 0.1.0 → 0.1.1
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 +6 -2
- data/lib/functions.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de4a5cd7ac9ce9598f60e1674053920a3362d5cf93a9fc19c1b879845fb06567
|
4
|
+
data.tar.gz: 23e5e440771e05f9e15a8b8a508de4747fccf613dc1af6e459cce7c9bad85c5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8d8bde06fc90d008c29ccfa234157a9d26d160557ecc6cef78cd201db533c5ec13cedfd1f4a3d05b2b5b33bef7b4dbe43cb4e9611b3025070f3594a0232892
|
7
|
+
data.tar.gz: 504e21a63bd2359ce50ef4e567fbb3b894c2d92aed4a1c37e2d40f105b4661ba11e698706891a96e564b6ef2cb799c6f0d5ac8cefb527083dab1eeeeab011f1d
|
data/bin/cliz
CHANGED
@@ -8,15 +8,19 @@ require_relative '../lib/functions.rb'
|
|
8
8
|
|
9
9
|
include Cliz
|
10
10
|
|
11
|
-
|
11
|
+
|
12
12
|
|
13
13
|
config = YAML.load(File.read('config.yml'))
|
14
|
+
output_dir = config['output_dir']
|
15
|
+
|
16
|
+
FileUtils.mkdir_p File.join output_dir, 'reverse-index'
|
17
|
+
|
14
18
|
url = ARGV[0]
|
15
19
|
short_suggestion = ARGV[1]
|
16
20
|
|
17
21
|
unless short_suggestion
|
18
22
|
# check for reverse index
|
19
|
-
reverse_index_file = File.join 'reverse-index', "#{Digest::SHA2.hexdigest url}"
|
23
|
+
reverse_index_file = File.join output_dir, 'reverse-index', "#{Digest::SHA2.hexdigest url}"
|
20
24
|
|
21
25
|
if File.exist? reverse_index_file
|
22
26
|
base_domain = config['base_domain']
|
data/lib/functions.rb
CHANGED
@@ -93,9 +93,11 @@ module Cliz
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def reverse_index config, short_url
|
96
|
+
output_dir = config['output_dir']
|
97
|
+
|
96
98
|
long_url = long_url config, short_url
|
97
99
|
|
98
|
-
reverse_index_file = File.join 'reverse-index', "#{Digest::SHA2.hexdigest long_url}"
|
100
|
+
reverse_index_file = File.join output_dir, 'reverse-index', "#{Digest::SHA2.hexdigest long_url}"
|
99
101
|
|
100
102
|
|
101
103
|
File.open reverse_index_file, "a" do |f|
|