asciibuild 0.3.0 → 0.4.0

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: 1a6bfa059dad0c3bff1d25fc23bccaa19921072c
4
- data.tar.gz: e2da6451f981f2c3efdfcc095aa0a085c0f712ec
3
+ metadata.gz: d7d504183cebbc48f58474ddb695625d22c66c71
4
+ data.tar.gz: ca3f3e66597e1d029b59df92337b4a65fae5a124
5
5
  SHA512:
6
- metadata.gz: f19b35ba2a027507e2fe0025fcbc15f07965d53e7975a1918f65704c95c949d40f5913daf0babaa670f9d30853d562850e4f006e8747d0424b8a97d938fe719d
7
- data.tar.gz: 425b4331f57f3eb908995531d1970fa66ab01d0db7b5655004dab74a10dc5db6b4fa5cb9dca45c23ad9e6c3a0673ab12bdc3a3d200480f2ccb8e8ef99f35746c
6
+ metadata.gz: 8882a0552645928345632016ad9e8911ab01c2767f2a24742b03cfea52308426894f4973ac94f1eeb679904f9fbfae04405d415c0873448dddea3e94e89c382b
7
+ data.tar.gz: b0bf78dc4d5cebd2dada1de1419f0073585dc7c92da364e6679de62584f6016ed20024b48153a2813903c2111d786067306ce700acda796790beb28ab5cde4a9
data/bin/asciibuild CHANGED
@@ -41,6 +41,13 @@ OptionParser.new do |opts|
41
41
  attrs[k] = v
42
42
  end
43
43
  end
44
+ opts.on('-r', '--redact PATT', 'Regex pattern of text to redact from output and replace with [****]') do |r|
45
+ if not attrs['redact']
46
+ attrs['redact'] = [r]
47
+ else
48
+ attrs['redact'] << r
49
+ end
50
+ end
44
51
  end.parse!
45
52
 
46
53
  ARGV.each do |f|
@@ -4,6 +4,12 @@ require 'open3'
4
4
  require 'mustache'
5
5
 
6
6
  def include_section? parent, attrs
7
+ if parent.document.attributes["error"]
8
+ return false
9
+ elsif parent.title == "Before All" or parent.title == "After All"
10
+ return true
11
+ end
12
+
7
13
  sections = if parent.document.attributes["sections"]
8
14
  parent.document.attributes["sections"].split(/,[ ]*/)
9
15
  else
@@ -22,7 +28,7 @@ def include_section? parent, attrs
22
28
  end
23
29
  end
24
30
 
25
- incl_sect or deps.include?(parent.title) or (not parent.document.attributes["error"])
31
+ incl_sect or deps.include?(parent.title)
26
32
  end
27
33
 
28
34
  def get_lang lang
@@ -44,6 +50,27 @@ def write_file attrs, default_name, body
44
50
  end
45
51
  end
46
52
 
53
+ def redact parent, attrs, lines
54
+ patts = if parent.document.attributes['redact']
55
+ if parent.document.attributes['redact'].class == Array
56
+ parent.document.attributes['redact']
57
+ else
58
+ [parent.document.attributes['redact']]
59
+ end
60
+ else
61
+ []
62
+ end
63
+
64
+ new_lines = []
65
+ lines.each do |l|
66
+ patts.each do |p|
67
+ l = l.gsub(Regexp.new(p), "[****]")
68
+ end
69
+ new_lines << l
70
+ end
71
+ new_lines
72
+ end
73
+
47
74
  module Asciibuild
48
75
  module Extensions
49
76
  class ConcatBlock < Asciidoctor::Extensions::BlockProcessor
@@ -270,7 +297,7 @@ module Asciibuild
270
297
  attrs['title'] = 'icon:check-circle[role=green] ' + attrs['title']
271
298
  end
272
299
 
273
- after_end cmd, parent, lines, attrs
300
+ after_end cmd, parent, redact(parent, attrs, lines), attrs
274
301
  end
275
302
 
276
303
  end
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciibuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Brisbin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-08 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -63,6 +63,7 @@ files:
63
63
  - bin/asciibuild
64
64
  - lib/asciibuild.rb
65
65
  - lib/asciibuild/extensions.rb
66
+ - lib/asciibuild/slackbot.rb
66
67
  - stylesheets/colony.css
67
68
  homepage: http://github.com/jbrisbin/asciibuild
68
69
  licenses: