awesome_bot 1.13.3 → 1.13.4

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: 66cab9489f67486d0e789ee5610f7e0eb46033f3
4
- data.tar.gz: bcac80b32a5e966ed9b6b38f2073adc9babe2342
3
+ metadata.gz: 06365d94443a05ed03f115ef3d0b490cb512016e
4
+ data.tar.gz: e14ba8d9a8a55496d62c763ac18a32bfc1978ffd
5
5
  SHA512:
6
- metadata.gz: a6857196eeb0c7265fdd3574f90c51f676279905e45f6800ba55572f545230cd51aff59d2fd883fa53224bf932fccf71778fb0fd6e62ac84202d4a1325b96e74
7
- data.tar.gz: 201fe4ded0451bb6621b05b7c5dd98c41d86698331ebfd53adbc434f5c3c654696b4b404a04f95282ea2863d06f41ee11fb535a8878b3ad2b2372678619e01c7
6
+ metadata.gz: 8a0705f7b850a4a0e1e6c90308b6e67b30d8b212ab2bb02c5c2aa530b7dd5b9719728e9e92c94bba2ec4f33815b26b9e53e6af689ecd272c8398edb3510cd0e1
7
+ data.tar.gz: 3a86393003437ac2d4e7c59b3fa3047b7714ca18876d74a4ea8ed43e2c8e4283ec30311eea995af656bba92df127c2a5b3bb03a4aeb16b55e1477fa2b28d1682
@@ -2,6 +2,11 @@
2
2
 
3
3
  Changes by [Daniel Khamsing][] unless otherwise noted.
4
4
 
5
+ # 1.13.4
6
+
7
+ - cleanup `-1` error in markdown table
8
+ - isolate `write`
9
+
5
10
  # 1.13.3
6
11
 
7
12
  - add markdown results table artifacts to use with [`danger`](https://github.com/danger/danger)
data/README.md CHANGED
@@ -132,7 +132,10 @@ Does your GitHub README contain a lot of links? `awesome_bot` can help you valid
132
132
 
133
133
  and [more](status/status.md).
134
134
 
135
- Tip: Use the keyword `[ci skip]` in your commit title/message to skip verification.
135
+ Tips
136
+
137
+ - Use the keyword `[ci skip]` in your commit title/message to skip verification.
138
+ - Use [Danger](#danger).
136
139
 
137
140
  ### Travis CI
138
141
 
@@ -214,12 +217,10 @@ You can also add a badge for other CI tools, check out [shields.io](http://shiel
214
217
 
215
218
  ### Danger
216
219
 
217
- You can integrate `awesome_bot` with [`danger`](https://github.com/danger/danger)
220
+ Integrate `awesome_bot` with [Danger](https://github.com/danger/danger) and have results reported back to the [pull request](https://github.com/vsouza/awesome-ios/pull/1001)).
218
221
 
219
222
  ![danger](https://cloud.githubusercontent.com/assets/4723115/17375716/0cdd37cc-5967-11e6-8ae3-829060a786dc.png)
220
223
 
221
- The above is from an actual [pull request](https://github.com/vsouza/awesome-ios/pull/1001).
222
-
223
224
  Here's the step in your **Dangerfile**:
224
225
 
225
226
  ```ruby
@@ -1,5 +1,5 @@
1
- https://twitter.com
2
- https://twitter.com
1
+ http://www.nytimes.com/
2
+ http://www.nytimes.com/
3
3
  https://github.com/dkhamsing
4
4
  https://github.com
5
5
  https://github.com
@@ -2,11 +2,10 @@ require 'awesome_bot/check'
2
2
  require 'awesome_bot/output'
3
3
  require 'awesome_bot/result'
4
4
  require 'awesome_bot/version'
5
+ require 'awesome_bot/write'
5
6
 
6
7
  # Command line interface
7
8
  module AwesomeBot
8
- RESULTS_PREFIX = 'ab-results'
9
-
10
9
  class << self
11
10
  def cli()
12
11
  require 'optparse'
@@ -132,8 +131,8 @@ module AwesomeBot
132
131
 
133
132
  if r.success(options) == true
134
133
  puts 'No issues :-)'
135
- cli_write_results(filename, r)
136
- cli_write_markdown_results(filename, nil)
134
+ write_results(filename, r)
135
+ write_markdown_results(filename, nil)
137
136
  return STATUS_OK
138
137
  else
139
138
  filtered_issues = []
@@ -174,7 +173,7 @@ module AwesomeBot
174
173
  'link'=> url,
175
174
  'error'=> error
176
175
  }
177
- filtered_issues.push hash
176
+ filtered_issues.push hash
178
177
 
179
178
  print " #{pad_text index + 1, pad_list(r.dupes.uniq)}. "
180
179
  print loc_formatted loc, largest
@@ -183,71 +182,11 @@ module AwesomeBot
183
182
  end
184
183
  end
185
184
 
186
- cli_write_results(filename, r)
187
- filtered = cli_write_results_filtered(filename, filtered_issues)
188
- cli_write_markdown_results(filename, filtered)
185
+ write_results(filename, r)
186
+ filtered = write_results_filtered(filename, filtered_issues)
187
+ write_markdown_results(filename, filtered)
189
188
  return 'Issues'
190
189
  end
191
190
  end
192
-
193
- def cli_write_results(f, r)
194
- results_file_filter = f.gsub('/','-')
195
- results_file = "#{RESULTS_PREFIX}-#{results_file_filter}.json"
196
- r.write results_file
197
- puts "\nWrote results to #{results_file}"
198
- end
199
-
200
- def cli_write_results_filtered(file, filtered)
201
- require 'json'
202
- results_file_filter = file.gsub('/','-')
203
- results_file = "#{RESULTS_PREFIX}-#{results_file_filter}-filtered.json"
204
- File.open(results_file, 'w') { |f| f.write JSON.pretty_generate(filtered) }
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}"
251
- end
252
191
  end # class
253
192
  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.3'
8
+ VERSION = '1.13.4'
9
9
  end
@@ -0,0 +1,74 @@
1
+ require 'json'
2
+
3
+ # Command line interface
4
+ module AwesomeBot
5
+ RESULTS_PREFIX = 'ab-results'
6
+
7
+ class << self
8
+ def filter_filename(f)
9
+ f.gsub('/','-')
10
+ end
11
+
12
+ def write_markdown_results(filename, filtered)
13
+ payload =
14
+ if filtered.nil?
15
+ {'error'=>false}
16
+ else
17
+ results = File.read filtered
18
+ j = JSON.parse results
19
+
20
+ num = j.count
21
+ plural = num==1?'':'s'
22
+ title = "Found #{num} link issue#{plural}"
23
+ message = "#### Link issue#{plural} by [`awesome_bot`](https://github.com/dkhamsing/awesome_bot)\n\n"
24
+ message << " Line | Status | Link\n"
25
+ message << "| ---: | :----: | --- |\n"
26
+
27
+ j.sort_by { |h| h['loc'] }.each do |i|
28
+ error = i['error']
29
+ loc = i['loc']
30
+ link = i['link']
31
+ s = i['status']
32
+ r = i['redirect']
33
+
34
+ if error=='Dupe'
35
+ message << "#{loc} | Dupe | #{link} "
36
+ else
37
+ status = s==-1? 'Error' : "[#{s}](https://httpstatuses.com/#{s})"
38
+ message << "#{loc} | #{status} | #{link} "
39
+ message << "<br> #{error}" unless error ==''
40
+ message << "redirects to<br>#{r}" unless r==''
41
+ end
42
+ message << "\n"
43
+ end
44
+
45
+ {
46
+ 'error' => true,
47
+ 'title' => title,
48
+ 'message'=> message
49
+ }
50
+ end
51
+
52
+ results_file_filter = filter_filename filename
53
+ results_file = "#{RESULTS_PREFIX}-#{results_file_filter}-markdown-table.json"
54
+ File.open(results_file, 'w') { |f| f.write JSON.pretty_generate(payload) }
55
+ puts "Wrote markdown table results to #{results_file}"
56
+ end
57
+
58
+ def write_results(f, r)
59
+ results_file_filter = filter_filename f
60
+ results_file = "#{RESULTS_PREFIX}-#{results_file_filter}.json"
61
+ r.write results_file
62
+ puts "\nWrote results to #{results_file}"
63
+ end
64
+
65
+ def write_results_filtered(file, filtered)
66
+ results_file_filter = filter_filename file
67
+ results_file = "#{RESULTS_PREFIX}-#{results_file_filter}-filtered.json"
68
+ File.open(results_file, 'w') { |f| f.write JSON.pretty_generate(filtered) }
69
+ puts "Wrote filtered results to #{results_file}"
70
+
71
+ return results_file
72
+ end
73
+ end # class
74
+ 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.3
4
+ version: 1.13.4
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-03 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -67,6 +67,7 @@ files:
67
67
  - lib/awesome_bot/result.rb
68
68
  - lib/awesome_bot/version.rb
69
69
  - lib/awesome_bot/white_list.rb
70
+ - lib/awesome_bot/write.rb
70
71
  - status/README.md
71
72
  - status/list-circle-ci
72
73
  - status/list-travis-ci