uhaul 1.0.3 → 1.0.5
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 +7 -1
- data/lib/uhaul/cli.rb +9 -3
- data/lib/uhaul/crawl.rb +11 -8
- data/lib/uhaul/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b388432681a65491cb00ec0e857de4c53d52694cac0c1aadbc0525c5b867f84b
|
4
|
+
data.tar.gz: 728069489c8363a38ca497177e2ea79a460ec508e20bd925fa56b7cecd8290dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dab025e1b62ef31777c9b953b819e3024c9e58740fa0178b8de517c6cbec40981b360da876d773fcc9808a460c9be3f87a615521dc749691be784ce157978b7
|
7
|
+
data.tar.gz: 4566c08f42643043adee459e644199f3e7003390713c64cbf3e99470ba171bc6618494a872dd4110fbf4a7b9e3d871679ce22bd568acf0f459687ce6a318490a
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# U-Haul
|
2
2
|
|
3
3
|
[](https://github.com/ksylvest/uhaul/blob/main/LICENSE)
|
4
4
|
[](https://rubygems.org/gems/uhaul)
|
@@ -6,6 +6,8 @@
|
|
6
6
|
[](https://uhaul.ksylvest.com)
|
7
7
|
[](https://circleci.com/gh/ksylvest/uhaul)
|
8
8
|
|
9
|
+
A Ruby library offering both a CLI and API for scraping [U-Haul](https://www.publicstorage.com/) self-storage facilities and prices.
|
10
|
+
|
9
11
|
## Installation
|
10
12
|
|
11
13
|
```bash
|
@@ -49,3 +51,7 @@ end
|
|
49
51
|
```bash
|
50
52
|
uhaul crawl
|
51
53
|
```
|
54
|
+
|
55
|
+
```bash
|
56
|
+
uhaul crawl "https://www.uhaul.com/Locations/Self-Storage-near-Manchester-Township-NJ-08759/925037/"
|
57
|
+
```
|
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
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uhaul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Sylvestre
|
@@ -115,8 +115,9 @@ licenses:
|
|
115
115
|
metadata:
|
116
116
|
rubygems_mfa_required: 'true'
|
117
117
|
homepage_uri: https://github.com/ksylvest/uhaul
|
118
|
-
source_code_uri: https://github.com/ksylvest/uhaul
|
119
|
-
changelog_uri: https://github.com/ksylvest/uhaul
|
118
|
+
source_code_uri: https://github.com/ksylvest/uhaul/tree/v1.0.5
|
119
|
+
changelog_uri: https://github.com/ksylvest/uhaul/releases/tag/v1.0.5
|
120
|
+
documentation_uri: https://uhaul.ksylvest.com/
|
120
121
|
post_install_message:
|
121
122
|
rdoc_options: []
|
122
123
|
require_paths:
|