awesome_bot 1.4.0 → 1.5.0
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/.travis.yml +2 -1
- data/CHANGELOG.md +12 -3
- data/README.md +47 -60
- data/bin/assets/test-redirect +1 -0
- data/lib/awesome_bot/check.rb +6 -7
- data/lib/awesome_bot/cli.rb +6 -5
- data/lib/awesome_bot/result.rb +3 -2
- data/lib/awesome_bot/statuses.rb +7 -4
- data/lib/awesome_bot/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19d8dfe764c84b4cf654c29ba4d6bd9e953a1b9c
|
4
|
+
data.tar.gz: 2811c9cdbae2178e934979da5f2885ffd5ba6968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c566f671dae5922252856621d86052914e8c9f154c0ac31b30e70df1455ad9d0475ca1210ea84f9983e2edcf00b9dc9ef66448bdcdcdf9bd45c23afaee53f50f
|
7
|
+
data.tar.gz: 3bcd9be66cf3a23fc0373f61fbe8ee7cde059bd0e5261df82fdb5b86ac5b571a6da5cd019010a9b240116ab066f957b2f055a22c8d960ed8a75372a9f667141a
|
data/.travis.yml
CHANGED
@@ -11,4 +11,5 @@ script:
|
|
11
11
|
- awesome_bot bin/assets/test-dupe --allow-dupe
|
12
12
|
- awesome_bot bin/assets/test-timeout --allow-timeout --set-timeout 1
|
13
13
|
- awesome_bot bin/assets/test-timeout-and-redirect --allow-timeout --set-timeout 1 --allow-redirect
|
14
|
-
- awesome_bot
|
14
|
+
- awesome_bot bin/assets/test-redirect --allow-redirect
|
15
|
+
- awesome_bot README.md --allow-dupe --white-list gph.is,giphy,bot.svg,codeload,badge,rubydoc,rubygems
|
data/CHANGELOG.md
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
|
34
34
|
# 1.3.0
|
35
35
|
|
36
|
-
- add `--allow-redirect` option
|
36
|
+
- add `--allow-redirect` option, suggested by [R.I. Pienaar][]
|
37
37
|
- output `→` as redirect status indicator
|
38
38
|
- update error logic in statuses
|
39
39
|
|
@@ -44,7 +44,7 @@
|
|
44
44
|
|
45
45
|
# 1.3.2
|
46
46
|
|
47
|
-
- [fix] another error with
|
47
|
+
- [fix] another error with `)` in link parsing, reported by [Julien Bisconti](https://github.com/veggiemonk)
|
48
48
|
|
49
49
|
# 1.3.3
|
50
50
|
|
@@ -52,9 +52,18 @@
|
|
52
52
|
|
53
53
|
# 1.4.0
|
54
54
|
|
55
|
-
- add `--allow-timeout` and `--set-timeout` options
|
55
|
+
- add `--allow-timeout` and `--set-timeout` options, suggested by [R.I. Pienaar][]
|
56
|
+
|
57
|
+
# 1.5.0
|
58
|
+
|
59
|
+
- [output] display url redirect location, by [Colby M. White](https://github.com/colbywhite)
|
60
|
+
- [output] update logic for number of unique links
|
61
|
+
- [output] standardize indent
|
62
|
+
- rename `Result` `rejected` to `links_white_listed`
|
56
63
|
|
57
64
|
## Contact
|
58
65
|
|
59
66
|
- [github.com/dkhamsing](https://github.com/dkhamsing)
|
60
67
|
- [twitter.com/dkhamsing](https://twitter.com/dkhamsing)
|
68
|
+
|
69
|
+
[R.I. Pienaar]:https://github.com/ripienaar
|
data/README.md
CHANGED
@@ -43,80 +43,57 @@ More information at [rubydoc](http://www.rubydoc.info/gems/awesome_bot).
|
|
43
43
|
|
44
44
|
### Command Line
|
45
45
|
|
46
|
-
awesome_bot <file> [--allow-dupe] [--allow-redirect] [--allow-timeout] [--set-timeout d] [--white-list item1,item2,..]
|
47
|
-
file
|
48
|
-
--allow-dupe
|
49
|
-
--allow-redirect
|
50
|
-
--allow-timeout
|
51
|
-
--set-timeout
|
52
|
-
--white-list
|
46
|
+
awesome_bot <file> [--allow-dupe] [--allow-redirect] [--allow-timeout] [--set-timeout d] [--white-list item1,item2,..]
|
47
|
+
file Path to file
|
48
|
+
--allow-dupe Duplicates URLs are allowed URLs
|
49
|
+
--allow-redirect Redirected URLs are allowed
|
50
|
+
--allow-timeout URLs that time out are allowed
|
51
|
+
--set-timeout Set connection timeout (seconds)
|
52
|
+
--white-list Comma separated URLs to white list
|
53
53
|
|
54
54
|
```shell
|
55
55
|
$ awesome_bot README.md
|
56
56
|
> Checking links in README.md
|
57
|
-
Links found:
|
57
|
+
Links found: 56, 53 unique
|
58
58
|
1. https://github.com/sindresorhus/awesome
|
59
|
-
2. http://i.giphy.com/
|
59
|
+
2. http://i.giphy.com/urvsFBDfR6N32.gif
|
60
60
|
3. https://travis-ci.org/dkhamsing/awesome_bot.svg
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
7. http://www.rubydoc.info/gems/awesome_bot
|
65
|
-
8. https://travis-ci.org/
|
66
|
-
9. http://gph.is/1gU5itl
|
67
|
-
10. https://github.com/dkhamsing
|
68
|
-
11. https://twitter.com/dkhamsing
|
69
|
-
12. https://github.com/dkhamsing/open-source-ios-apps/pull/159
|
70
|
-
13. https://github.com/dkhamsing/open-source-ios-apps/blob/master/.travis.yml
|
71
|
-
14. https://codeload.github.com/dkhamsing/awesome_bot/tar.gz/wip
|
72
|
-
Checking URLs: ✓→→x→→✓✓✓✓x✓✓✓
|
61
|
+
...
|
62
|
+
53. https://twitter.com/dkhamsing
|
63
|
+
Checking URLs: ✓x→✓✓✓✓→→✓→✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓→✓✓✓✓✓✓✓✓
|
73
64
|
|
74
65
|
Issues :-(
|
75
|
-
> Links
|
76
|
-
1.
|
77
|
-
2.
|
78
|
-
3.
|
79
|
-
4.
|
80
|
-
5. 301 https://travis-ci.org/dkhamsing/awesome_bot.svg
|
81
|
-
6.
|
82
|
-
> Dupes
|
66
|
+
> Links
|
67
|
+
1. 202 http://www.rubydoc.info/gems/awesome_bot
|
68
|
+
2. 301 http://rubygems.org/gems/awesome_bot → https://rubygems.org/gems/awesome_bot
|
69
|
+
3. 302 https://badge.fury.io/rb/awesome_bot.svg → https://d25lcipzij17d.cloudfront.net/badge.svg?id=rb&type=6&v=1.4.0&x2=0
|
70
|
+
4. 302 https://badge.fury.io/rb/awesome_bot → http://rubygems.org/gems/awesome_bot
|
71
|
+
5. 301 https://travis-ci.org/dkhamsing/awesome_bot.svg → https://api.travis-ci.org/dkhamsing/awesome_bot.svg
|
72
|
+
6. 301 http://gph.is/XM6gMT → http://giphy.com/gifs/urvsFBDfR6N32
|
73
|
+
> Dupes
|
83
74
|
1. https://github.com/sindresorhus/awesome
|
84
|
-
2.
|
85
|
-
3. https://
|
86
|
-
4. https://travis-ci.org/dkhamsing/awesome_bot
|
87
|
-
5. https://travis-ci.org/
|
88
|
-
6. http://gph.is/1gU5itl
|
89
|
-
7. https://github.com/dkhamsing
|
90
|
-
8. https://twitter.com/dkhamsing
|
91
|
-
9. https://github.com/dkhamsing/open-source-ios-apps/pull/159
|
92
|
-
10. https://github.com/dkhamsing/open-source-ios-apps/blob/master/.travis.yml
|
93
|
-
11. https://codeload.github.com/dkhamsing/awesome_bot/tar.gz/wip
|
75
|
+
2. https://github.com/veggiemonk/awesome-docker
|
76
|
+
3. https://github.com/dotfiles/dotfiles.github.com
|
94
77
|
```
|
95
78
|
|
96
79
|
```shell
|
97
|
-
$ awesome_bot README.md --allow-dupe --white-list fury,
|
80
|
+
$ awesome_bot README.md --allow-dupe --white-list fury,rubydoc,travis,codeload,gems,giphy,gph
|
98
81
|
> Checking links in README.md
|
99
82
|
> Will allow duplicate links
|
100
|
-
> White list: fury,
|
101
|
-
Links found:
|
83
|
+
> White list: fury, rubydoc, travis, codeload, gems, giphy, gph
|
84
|
+
Links found: 51, 23 white listed, 42 unique
|
102
85
|
1. https://github.com/sindresorhus/awesome
|
103
|
-
2.
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
Checking URLs: ✓✓✓✓✓
|
108
|
-
Checking white listed URLs: →x→→✓→✓x✓
|
86
|
+
2. https://twitter.com/dkhamsing
|
87
|
+
...
|
88
|
+
Checking URLs: ✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓
|
89
|
+
Checking white listed URLs: →→✓x✓✓✓→✓✓→→→
|
109
90
|
|
110
91
|
> White listed:
|
111
|
-
1. 301
|
112
|
-
2.
|
113
|
-
3.
|
114
|
-
|
115
|
-
|
116
|
-
6. 301: https://travis-ci.org/dkhamsing/awesome_bot.svg
|
117
|
-
7. 200: https://travis-ci.org/
|
118
|
-
8. 404: https://codeload.github.com/dkhamsing/awesome_bot/tar.gz/wip
|
119
|
-
9. 200: https://github.com/dkhamsing/open-source-ios-apps/blob/master/.travis.yml
|
92
|
+
1. 301 http://rubygems.org/gems/awesome_bot → https://rubygems.org/gems/awesome_bot
|
93
|
+
2. 301 http://gph.is/XM6gMT → http://giphy.com/gifs/urvsFBDfR6N32
|
94
|
+
3. 200 http://i.giphy.com/urvsFBDfR6N32.gif
|
95
|
+
...
|
96
|
+
|
120
97
|
No issues :-)
|
121
98
|
```
|
122
99
|
|
@@ -138,16 +115,23 @@ script:
|
|
138
115
|
|
139
116
|
`awesome_bot` is used by the following projects:
|
140
117
|
|
141
|
-
|
118
|
+
1. https://github.com/vinta/awesome-python
|
142
119
|
- https://github.com/prakhar1989/awesome-courses
|
120
|
+
- https://github.com/ripienaar/free-for-dev
|
143
121
|
- https://github.com/vsouza/awesome-ios
|
122
|
+
- https://github.com/caesar0301/awesome-public-datasets
|
144
123
|
- https://github.com/matteocrippa/awesome-swift
|
145
124
|
- https://github.com/iCHAIT/awesome-osx
|
125
|
+
- https://github.com/rosarior/awesome-django
|
146
126
|
- https://github.com/ellisonleao/magictools
|
147
127
|
- https://github.com/JStumpp/awesome-android
|
128
|
+
- https://github.com/dariubs/GoBooks
|
129
|
+
- https://github.com/arslanbilal/git-cheat-sheet
|
148
130
|
- https://github.com/chentsulin/awesome-graphql
|
149
131
|
- https://github.com/fasouto/awesome-dataviz
|
150
132
|
- https://github.com/RichardLitt/awesome-conferences
|
133
|
+
- https://github.com/caesar0301/awesome-pcaptools
|
134
|
+
- https://github.com/matiassingers/awesome-readme
|
151
135
|
- https://github.com/stefanbuck/awesome-browser-extensions-for-github
|
152
136
|
- https://github.com/afonsopacifer/awesome-flexbox
|
153
137
|
- https://github.com/HQarroum/awesome-iot
|
@@ -156,8 +140,8 @@ script:
|
|
156
140
|
- https://github.com/ipfs/awesome-ipfs
|
157
141
|
- https://github.com/brunopulis/awesome-a11y
|
158
142
|
- https://github.com/ramitsurana/awesome-kubernetes
|
159
|
-
- https://github.com/benoitjadinon/awesome-xamarin
|
160
143
|
- https://github.com/christian-bromann/awesome-selenium
|
144
|
+
- https://github.com/benoitjadinon/awesome-xamarin
|
161
145
|
- https://github.com/vinkla/awesome-fuse
|
162
146
|
- https://github.com/wfhio/awesome-job-boards
|
163
147
|
- https://github.com/sotayamashita/awesome-css
|
@@ -165,10 +149,13 @@ script:
|
|
165
149
|
- https://github.com/unixorn/awesome-zsh-plugins
|
166
150
|
- https://github.com/vredniy/awesome-newsletters
|
167
151
|
- https://github.com/unixorn/git-extra-commands
|
152
|
+
- https://github.com/deanhume/typography
|
153
|
+
- https://github.com/dotfiles/dotfiles.github.com
|
154
|
+
- https://github.com/veggiemonk/awesome-docker
|
168
155
|
|
169
156
|
## Credits
|
170
157
|
|
171
|
-
- `faraday
|
158
|
+
- [`faraday` and `parallel`](awesome_bot.gemspec)
|
172
159
|
- [giphy](http://gph.is/XM6gMT)
|
173
160
|
|
174
161
|
## Contact
|
@@ -0,0 +1 @@
|
|
1
|
+
https://github.com/supermarin/Alcatraz
|
data/lib/awesome_bot/check.rb
CHANGED
@@ -22,13 +22,12 @@ module AwesomeBot
|
|
22
22
|
|
23
23
|
log.add "> White list: #{white_listed.join ', '}" if r.white_listing
|
24
24
|
|
25
|
-
r.dupes = r.links.select { |e| r.links.count(e) > 1 }
|
25
|
+
r.dupes = r.links.select { |e| r.links.count(e) > 1 }
|
26
26
|
|
27
27
|
log.addp "Links found: #{r.links.count}"
|
28
|
-
log.addp ", #{r.
|
29
|
-
|
30
|
-
|
31
|
-
end
|
28
|
+
log.addp ", #{r.links_white_listed.count} white listed" if r.white_listing
|
29
|
+
uniq = r.links.uniq.count
|
30
|
+
log.addp ", #{uniq} unique" if uniq != r.links.count
|
32
31
|
log.add ''
|
33
32
|
r.links.uniq.each_with_index { |u, j| log.add " #{j + 1}. #{u}" }
|
34
33
|
|
@@ -43,11 +42,11 @@ module AwesomeBot
|
|
43
42
|
end
|
44
43
|
log.add ''
|
45
44
|
|
46
|
-
return r if !r.white_listing || (r.
|
45
|
+
return r if !r.white_listing || (r.links_white_listed.count == 0)
|
47
46
|
|
48
47
|
log.addp 'Checking white listed URLs: '
|
49
48
|
r.white_listed =
|
50
|
-
statuses(r.
|
49
|
+
statuses(r.links_white_listed.uniq, NUMBER_OF_THREADS, true) do |s|
|
51
50
|
if (s > 299) && (s < 400)
|
52
51
|
log.addp STATUS_REDIRECT
|
53
52
|
else
|
data/lib/awesome_bot/cli.rb
CHANGED
@@ -20,10 +20,11 @@ module AwesomeBot
|
|
20
20
|
|
21
21
|
def output(x, k)
|
22
22
|
s = x['status']
|
23
|
-
print "#{k + 1}. "
|
23
|
+
print " #{k + 1}. "
|
24
24
|
print "#{s} " unless s == STATUS_ERROR
|
25
25
|
print "#{x['url']}"
|
26
26
|
print " #{x['error']}" if s == STATUS_ERROR
|
27
|
+
print " #{STATUS_REDIRECT} #{x['headers']['location']}" if s > 299 && s <400
|
27
28
|
puts ''
|
28
29
|
end
|
29
30
|
|
@@ -38,12 +39,12 @@ module AwesomeBot
|
|
38
39
|
puts "Usage: #{PROJECT} <file> [#{option_d}] [#{option_r}] "\
|
39
40
|
"[#{option_t_a}] [#{option_t} d] "\
|
40
41
|
"[#{option_w} item1,item2,..]\n"\
|
41
|
-
"#{USAGE} file
|
42
|
-
"#{USAGE} #{option_d}
|
42
|
+
"#{USAGE} file Path to file \n"\
|
43
|
+
"#{USAGE} #{option_d} Duplicates URLs are allowed URLs \n"\
|
43
44
|
"#{USAGE} #{option_r} Redirected URLs are allowed \n"\
|
44
45
|
"#{USAGE} #{option_t_a} URLs that time out are allowed \n"\
|
45
|
-
"#{USAGE} #{option_t}
|
46
|
-
"#{USAGE} #{option_w}
|
46
|
+
"#{USAGE} #{option_t} Set connection timeout (seconds) \n"\
|
47
|
+
"#{USAGE} #{option_w} Comma separated URLs to white list \n"\
|
47
48
|
"\nVersion #{VERSION}, see #{PROJECT_URL} for more information"
|
48
49
|
exit
|
49
50
|
end
|
data/lib/awesome_bot/result.rb
CHANGED
@@ -9,7 +9,7 @@ module AwesomeBot
|
|
9
9
|
attr_accessor :status
|
10
10
|
attr_accessor :white_listed
|
11
11
|
|
12
|
-
attr_reader :
|
12
|
+
attr_reader :links_white_listed
|
13
13
|
attr_reader :links
|
14
14
|
|
15
15
|
def initialize(links, white_list_from_cli)
|
@@ -17,7 +17,8 @@ module AwesomeBot
|
|
17
17
|
@w = white_list_from_cli
|
18
18
|
|
19
19
|
return if @w.nil?
|
20
|
-
@
|
20
|
+
@links_white_listed,
|
21
|
+
@links = links.partition { |u| AwesomeBot.white_list @w, u }
|
21
22
|
end
|
22
23
|
|
23
24
|
def statuses_issues(allow_redirects = false, allow_timeouts = false)
|
data/lib/awesome_bot/statuses.rb
CHANGED
@@ -7,11 +7,11 @@ module AwesomeBot
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def net_head_status(url)
|
10
|
-
Faraday.head(url)
|
10
|
+
Faraday.head(url)
|
11
11
|
end
|
12
12
|
|
13
13
|
def net_get_status(url)
|
14
|
-
Faraday.get(url)
|
14
|
+
Faraday.get(url)
|
15
15
|
end
|
16
16
|
|
17
17
|
def net_status(url, head)
|
@@ -22,14 +22,17 @@ module AwesomeBot
|
|
22
22
|
statuses = []
|
23
23
|
Parallel.each(links, in_threads: threads) do |u|
|
24
24
|
begin
|
25
|
-
|
25
|
+
response = net_status u, head
|
26
|
+
status = response.status
|
27
|
+
headers = response.headers
|
26
28
|
rescue => e
|
27
29
|
status = STATUS_ERROR
|
30
|
+
headers = {}
|
28
31
|
error = e
|
29
32
|
end
|
30
33
|
|
31
34
|
yield status, u
|
32
|
-
statuses.push('url' => u, 'status' => status, 'error' => error)
|
35
|
+
statuses.push('url' => u, 'status' => status, 'error' => error, 'headers' => headers)
|
33
36
|
end # Parallel
|
34
37
|
|
35
38
|
statuses
|
data/lib/awesome_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Khamsing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- bin/assets/test-no-issues
|
76
76
|
- bin/assets/test-no-links
|
77
77
|
- bin/assets/test-parse
|
78
|
+
- bin/assets/test-redirect
|
78
79
|
- bin/assets/test-timeout
|
79
80
|
- bin/assets/test-timeout-and-redirect
|
80
81
|
- bin/awesome_bot
|