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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4acc4dc138e904232902f124d9ee0c78923dc74c609c42515b97e83cdeea3fb2
4
- data.tar.gz: 9e98885feb0367400d6a444f191b859d2e54abf646c9dda26938545f0d2bf8c6
3
+ metadata.gz: 29c3331c29dc2cd48a7e33f30e31e3c280f7256f6abea575baa11ead15711ebf
4
+ data.tar.gz: 746ec6b6ae647cbcd52d04faeaddbea6bfb89c40df97ca40dc24d6f89e5e7182
5
5
  SHA512:
6
- metadata.gz: 3ecf98d2ab243fe983f6ef926c6fd425d988676173892a92990845b489561de61525ea30653d66c1b9d5956842006901064847c46aba4c5b9894c8f1a2846940
7
- data.tar.gz: dde69a5ed918065d156872112b37b6d67b6f04a462f18f492da53ca7ecd56224ad38d1659f9e0b2bfa86f7e2f79684a0f7cdf391e1dbbece994e80dfec480e40
6
+ metadata.gz: 2865e42eafe083ef89b66a2f85bc72629a819c732708fed264d85c17285f24e20b4ece8db391b6337ef998e54e71b65594a71b64fd67697c3738e5849d876278
7
+ data.tar.gz: 873042db4ee1d66f3c7086f80c8bac4e6789afe5e556c8c1a85c30377e9bdd948faea3c2a6101fad7314f9a95719a09abbac3d0ba3dabe301a62b4d4a3048b96
data/README.md CHANGED
@@ -49,3 +49,7 @@ end
49
49
  ```bash
50
50
  uhaul crawl
51
51
  ```
52
+
53
+ ```bash
54
+ uhaul crawl "https://www.uhaul.com/Locations/Self-Storage-near-Manchester-Township-NJ-08759/925037/"
55
+ ```
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
- def crawl
34
- Crawl.run
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 options [Hash] optional
13
- def initialize(stdout: $stdout, stderr: $stderr, options: {})
12
+ # @param url [String] optional
13
+ def initialize(stdout: $stdout, stderr: $stderr, url: nil)
14
14
  @stdout = stdout
15
15
  @stderr = stderr
16
- @options = options
16
+ @url = url
17
17
  end
18
18
 
19
19
  def run
20
- sitemap = Facility.sitemap
21
- @stdout.puts("count=#{sitemap.links.count}")
22
- @stdout.puts
23
-
24
- sitemap.links.each { |link| process(url: link.loc) }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UHaul
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
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.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre