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 +4 -4
- data/Dockerfile +3 -1
- data/README.md +3 -3
- data/bin/sitemap_check +0 -1
- data/lib/sitemap_check/sitemap.rb +22 -10
- data/lib/sitemap_check/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d49c855487981b357e247bd51099795f9e8c1444
|
4
|
+
data.tar.gz: 8787dcdc878e484471cb5a998a4dce27cf1f9eec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
@@ -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
|
51
|
-
|
52
|
-
|
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 (
|
57
|
-
|
58
|
-
|
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
|
-
|
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
|