uhaul 1.0.3 → 1.0.4
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/README.md +4 -0
- data/lib/uhaul/cli.rb +9 -3
- data/lib/uhaul/crawl.rb +11 -8
- data/lib/uhaul/version.rb +1 -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: 29c3331c29dc2cd48a7e33f30e31e3c280f7256f6abea575baa11ead15711ebf
|
4
|
+
data.tar.gz: 746ec6b6ae647cbcd52d04faeaddbea6bfb89c40df97ca40dc24d6f89e5e7182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2865e42eafe083ef89b66a2f85bc72629a819c732708fed264d85c17285f24e20b4ece8db391b6337ef998e54e71b65594a71b64fd67697c3738e5849d876278
|
7
|
+
data.tar.gz: 873042db4ee1d66f3c7086f80c8bac4e6789afe5e556c8c1a85c30377e9bdd948faea3c2a6101fad7314f9a95719a09abbac3d0ba3dabe301a62b4d4a3048b96
|
data/README.md
CHANGED
data/lib/uhaul/cli.rb
CHANGED
@@ -21,7 +21,7 @@ module UHaul
|
|
21
21
|
command = argv.shift
|
22
22
|
|
23
23
|
case command
|
24
|
-
when 'crawl' then crawl
|
24
|
+
when 'crawl' then crawl(*argv)
|
25
25
|
else
|
26
26
|
warn("unsupported command=#{command.inspect}")
|
27
27
|
exit(Code::ERROR)
|
@@ -30,8 +30,9 @@ module UHaul
|
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
# @param url [String] optional
|
34
|
+
def crawl(url = nil)
|
35
|
+
Crawl.run(url: url)
|
35
36
|
exit(Code::OK)
|
36
37
|
end
|
37
38
|
|
@@ -52,6 +53,11 @@ module UHaul
|
|
52
53
|
|
53
54
|
options.on('-h', '--help', 'help') { help(options) }
|
54
55
|
options.on('-v', '--version', 'version') { version }
|
56
|
+
|
57
|
+
options.separator <<~COMMANDS
|
58
|
+
commands:
|
59
|
+
crawl [url]
|
60
|
+
COMMANDS
|
55
61
|
end
|
56
62
|
end
|
57
63
|
end
|
data/lib/uhaul/crawl.rb
CHANGED
@@ -9,19 +9,22 @@ module UHaul
|
|
9
9
|
|
10
10
|
# @param stdout [IO] optional
|
11
11
|
# @param stderr [IO] optional
|
12
|
-
# @param
|
13
|
-
def initialize(stdout: $stdout, stderr: $stderr,
|
12
|
+
# @param url [String] optional
|
13
|
+
def initialize(stdout: $stdout, stderr: $stderr, url: nil)
|
14
14
|
@stdout = stdout
|
15
15
|
@stderr = stderr
|
16
|
-
@
|
16
|
+
@url = url
|
17
17
|
end
|
18
18
|
|
19
19
|
def run
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
if @url
|
21
|
+
process(url: @url)
|
22
|
+
else
|
23
|
+
sitemap = Facility.sitemap
|
24
|
+
@stdout.puts("count=#{sitemap.links.count}")
|
25
|
+
@stdout.puts
|
26
|
+
sitemap.links.each { |link| process(url: link.loc) }
|
27
|
+
end
|
25
28
|
end
|
26
29
|
|
27
30
|
def process(url:)
|
data/lib/uhaul/version.rb
CHANGED