awesome_bot 1.13.2 → 1.13.3
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/CHANGELOG.md +4 -0
- data/README.md +21 -0
- data/lib/awesome_bot/cli.rb +48 -1
- data/lib/awesome_bot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66cab9489f67486d0e789ee5610f7e0eb46033f3
|
4
|
+
data.tar.gz: bcac80b32a5e966ed9b6b38f2073adc9babe2342
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6857196eeb0c7265fdd3574f90c51f676279905e45f6800ba55572f545230cd51aff59d2fd883fa53224bf932fccf71778fb0fd6e62ac84202d4a1325b96e74
|
7
|
+
data.tar.gz: 201fe4ded0451bb6621b05b7c5dd98c41d86698331ebfd53adbc434f5c3c654696b4b404a04f95282ea2863d06f41ee11fb535a8878b3ad2b2372678619e01c7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -212,6 +212,27 @@ As it happens, the default code snippet provided contain a redirect so adding a
|
|
212
212
|
|
213
213
|
You can also add a badge for other CI tools, check out [shields.io](http://shields.io/).
|
214
214
|
|
215
|
+
### Danger
|
216
|
+
|
217
|
+
You can integrate `awesome_bot` with [`danger`](https://github.com/danger/danger)
|
218
|
+
|
219
|
+

|
220
|
+
|
221
|
+
The above is from an actual [pull request](https://github.com/vsouza/awesome-ios/pull/1001).
|
222
|
+
|
223
|
+
Here's the step in your **Dangerfile**:
|
224
|
+
|
225
|
+
```ruby
|
226
|
+
# Check links
|
227
|
+
require 'json'
|
228
|
+
results = File.read 'ab-results-README.md-markdown-table.json'
|
229
|
+
j = JSON.parse results
|
230
|
+
if j['error']==true
|
231
|
+
fail j['title']
|
232
|
+
markdown j['message']
|
233
|
+
end
|
234
|
+
```
|
235
|
+
|
215
236
|
## Contact
|
216
237
|
|
217
238
|
- [github.com/dkhamsing](https://github.com/dkhamsing)
|
data/lib/awesome_bot/cli.rb
CHANGED
@@ -133,6 +133,7 @@ module AwesomeBot
|
|
133
133
|
if r.success(options) == true
|
134
134
|
puts 'No issues :-)'
|
135
135
|
cli_write_results(filename, r)
|
136
|
+
cli_write_markdown_results(filename, nil)
|
136
137
|
return STATUS_OK
|
137
138
|
else
|
138
139
|
filtered_issues = []
|
@@ -183,7 +184,8 @@ module AwesomeBot
|
|
183
184
|
end
|
184
185
|
|
185
186
|
cli_write_results(filename, r)
|
186
|
-
cli_write_results_filtered(filename, filtered_issues)
|
187
|
+
filtered = cli_write_results_filtered(filename, filtered_issues)
|
188
|
+
cli_write_markdown_results(filename, filtered)
|
187
189
|
return 'Issues'
|
188
190
|
end
|
189
191
|
end
|
@@ -201,6 +203,51 @@ module AwesomeBot
|
|
201
203
|
results_file = "#{RESULTS_PREFIX}-#{results_file_filter}-filtered.json"
|
202
204
|
File.open(results_file, 'w') { |f| f.write JSON.pretty_generate(filtered) }
|
203
205
|
puts "Wrote filtered results to #{results_file}"
|
206
|
+
|
207
|
+
return results_file
|
208
|
+
end
|
209
|
+
|
210
|
+
def cli_write_markdown_results(filename, filtered)
|
211
|
+
payload =
|
212
|
+
if filtered.nil?
|
213
|
+
{'error'=>false}
|
214
|
+
else
|
215
|
+
title = 'Found links issues'
|
216
|
+
message = "#### Link issues by [`awesome_bot`](https://github.com/dkhamsing/awesome_bot)\n\n"
|
217
|
+
message << " Line | Status | Link\n"
|
218
|
+
message << "| ---: | :----: | --- |\n"
|
219
|
+
|
220
|
+
results = File.read filtered
|
221
|
+
require 'json'
|
222
|
+
j = JSON.parse results
|
223
|
+
j.sort_by { |h| h['loc'] }.each do |i|
|
224
|
+
error = i['error']
|
225
|
+
loc = i['loc']
|
226
|
+
link = i['link']
|
227
|
+
s = i['status']
|
228
|
+
r = i['redirect']
|
229
|
+
|
230
|
+
if error=='Dupe'
|
231
|
+
message << "#{loc} | Dupe | #{link} "
|
232
|
+
else
|
233
|
+
message << "#{loc} | [#{s}](https://httpstatuses.com/#{s}) | #{link} "
|
234
|
+
message << "<br> #{error}" unless error ==''
|
235
|
+
message << "redirects to<br>#{r}" unless r==''
|
236
|
+
end
|
237
|
+
message << "\n"
|
238
|
+
end
|
239
|
+
|
240
|
+
{
|
241
|
+
'error' => true,
|
242
|
+
'title' => title,
|
243
|
+
'message'=> message
|
244
|
+
}
|
245
|
+
end
|
246
|
+
|
247
|
+
results_file_filter = filename.gsub('/','-')
|
248
|
+
results_file = "#{RESULTS_PREFIX}-#{results_file_filter}-markdown-table.json"
|
249
|
+
File.open(results_file, 'w') { |f| f.write JSON.pretty_generate(payload) }
|
250
|
+
puts "Wrote markdown table results to #{results_file}"
|
204
251
|
end
|
205
252
|
end # class
|
206
253
|
end
|
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.13.
|
4
|
+
version: 1.13.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Khamsing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parallel
|