sitemap_check 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd9a4cfc39e08bca7d5dd77de0cd92e7db8a2bbe
4
- data.tar.gz: cbbd9fb1683ef791161a85b7d7deb4e7c4124a01
3
+ metadata.gz: d49c855487981b357e247bd51099795f9e8c1444
4
+ data.tar.gz: 8787dcdc878e484471cb5a998a4dce27cf1f9eec
5
5
  SHA512:
6
- metadata.gz: c29cd2c071c1b1147d9041af1f3dff4a8e4091fba6fa483691eb6457ddee4bebdf262828f253ea2e2c6f9b6c8d028005e073d35241ec7218256ab8564a93ccaa
7
- data.tar.gz: b1a12fa01464e71218a5fe30e0a9a35305c49d9709a74d9abc43c4c27554897a7301076b36b3f5201ff7949a9e09c9ba8cf3294cbe1e0c4fba783824d1c1e642
6
+ metadata.gz: 1c50fa5f6518a2b6329a4a3e481cf4aa167af4fd1c772d4b3aec6fdf7f0493689c4c131f4eb0c424c3eec735689611b4be0e30d7ca252cd606566cdc394542c4
7
+ data.tar.gz: 3325d58fb39689c119f54234e4000489121642046e0f440b1ae8ab2a48ae0200c1bb17e434b3e1252119c0ad61868c3571554121fd359bd3636b747457e6518b
data/Dockerfile CHANGED
@@ -1,11 +1,13 @@
1
1
  FROM quay.io/assemblyline/alpine:3.5
2
2
 
3
+ MAINTAINER ed@reevoo.com
4
+ ARG VERSION
3
5
  RUN apk add --no-cache --virtual .builddeps \
4
6
  build-base \
5
7
  ruby-dev=2.3.3-r100 \
6
8
  ruby=2.3.3-r100 \
7
9
  zlib-dev \
8
- && gem install sitemap_check -v $VERSION --no-document \
10
+ && gem install sitemap_check --no-document -v $VERSION \
9
11
  && runDeps="$( \
10
12
  scanelf --needed --nobanner --recursive /usr/lib/ruby/gems \
11
13
  | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
data/README.md CHANGED
@@ -12,19 +12,19 @@
12
12
  ## Usage
13
13
 
14
14
  ```bash
15
- $ CHECK_URL=http://reevoo.com/sitemap_index.xml sitemap_check
15
+ $ CHECK_URL=http://www.reevoo.com/sitemap_index.xml sitemap_check
16
16
  ```
17
17
 
18
18
  `CHECK_URL` can also be passed as an argument to sitemap_check
19
19
 
20
20
  ```bash
21
- $ sitemap_check http://reevoo.com/sitemap_index.xml
21
+ $ sitemap_check http://www.reevoo.com/sitemap_index.xml
22
22
  ```
23
23
 
24
24
  # Docker
25
25
 
26
26
  ```bash
27
- $ docker run --rm quay.io/reevoo/sitemap_check https://reevoo.com/sitemap_index.xml
27
+ $ docker run --rm quay.io/reevoo/sitemap_check https://www.reevoo.com/sitemap_index.xml
28
28
  ```
29
29
 
30
30
  ## Config
data/bin/sitemap_check CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "sitemap_check"
4
- puts ARGV[0]
5
4
  SitemapCheck.check ARGV[0]
@@ -11,6 +11,7 @@ class SitemapCheck
11
11
  self.url = url
12
12
  self.checked = 0
13
13
  self.http = http
14
+ self.queue = Queue.new
14
15
  setup_doc
15
16
  end
16
17
 
@@ -38,7 +39,7 @@ class SitemapCheck
38
39
 
39
40
  protected
40
41
 
41
- attr_accessor :http, :doc, :logger
42
+ attr_accessor :http, :doc, :logger, :queue
42
43
  attr_writer :url, :checked
43
44
 
44
45
  private
@@ -47,22 +48,33 @@ class SitemapCheck
47
48
  ENV.fetch("CONCURRENCY", "10").to_i
48
49
  end
49
50
 
50
- def find_missing_pages # rubocop:disable Metrics/AbcSize
51
- q = Queue.new
52
- pages.each { |page| q.push page }
51
+ def find_missing_pages
52
+ queue_pages
53
+ check_pages
54
+ pages.reject(&:exists?)
55
+ end
56
+
57
+ def check_pages
53
58
  concurency.times.map do
54
59
  Thread.new do
55
60
  begin
56
- while (page = q.pop(true))
57
- logger.log " missing: #{page.url}".red unless page.exists?
58
- logger.log " warning: error connecting to #{page.url}".magenta if page.error
59
- end
60
- rescue ThreadError # rubocop:disable Lint/HandleExceptions
61
+ nil while check_page(queue.pop(true))
62
+ rescue ThreadError
63
+ nil
61
64
  end
62
65
  end
63
66
  end.each(&:join)
64
67
  self.checked = pages.count
65
- pages.reject(&:exists?)
68
+ end
69
+
70
+ def check_page(page)
71
+ return unless page
72
+ logger.log " missing: #{page.url}".red unless page.exists?
73
+ logger.log " warning: error connecting to #{page.url}".magenta if page.error
74
+ end
75
+
76
+ def queue_pages
77
+ pages.each { |page| queue.push page }
66
78
  end
67
79
 
68
80
  def setup_doc
@@ -1,3 +1,3 @@
1
1
  class SitemapCheck
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitemap_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Robinson