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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2a75e4fc3c003f07fd35639cd6fcacc695bc1ad4
4
- data.tar.gz: 5bff4a91690e13a7dbf6d5414f8e3af67b51ed72
3
+ metadata.gz: 66cab9489f67486d0e789ee5610f7e0eb46033f3
4
+ data.tar.gz: bcac80b32a5e966ed9b6b38f2073adc9babe2342
5
5
  SHA512:
6
- metadata.gz: 50edd3464a0b34839cb598a050aa5a3a086cfd4ecf9c005ef658b76b237fa71ea723421c3fedac0687c77f496f00e7b417efb4a3e210980d04c25f1c4d62a1a6
7
- data.tar.gz: 2ee3d230c20cd435314adf126f31a72e288a5c23fd71b69c1ad005f104eb45f0cc65bf820a7e8c35711a3cc8d2d67300b39889c34ba5fbb437243c97af219d58
6
+ metadata.gz: a6857196eeb0c7265fdd3574f90c51f676279905e45f6800ba55572f545230cd51aff59d2fd883fa53224bf932fccf71778fb0fd6e62ac84202d4a1325b96e74
7
+ data.tar.gz: 201fe4ded0451bb6621b05b7c5dd98c41d86698331ebfd53adbc434f5c3c654696b4b404a04f95282ea2863d06f41ee11fb535a8878b3ad2b2372678619e01c7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Changes by [Daniel Khamsing][] unless otherwise noted.
4
4
 
5
+ # 1.13.3
6
+
7
+ - add markdown results table artifacts to use with [`danger`](https://github.com/danger/danger)
8
+
5
9
  # 1.13.2
6
10
 
7
11
  - correct `redirect` in filtered issues
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
+ ![danger](https://cloud.githubusercontent.com/assets/4723115/17375716/0cdd37cc-5967-11e6-8ae3-829060a786dc.png)
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)
@@ -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
@@ -5,5 +5,5 @@ module AwesomeBot
5
5
  'Great for "awesome" projects.'
6
6
  PROJECT_URL = 'https://github.com/dkhamsing/awesome_bot'
7
7
 
8
- VERSION = '1.13.2'
8
+ VERSION = '1.13.3'
9
9
  end
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.2
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-01 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel