rundoc 1.1.2 → 2.0.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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/check_changelog.yml +16 -7
  3. data/.github/workflows/ci.yml +48 -0
  4. data/.standard.yml +6 -0
  5. data/CHANGELOG.md +12 -0
  6. data/Gemfile +1 -1
  7. data/README.md +98 -5
  8. data/Rakefile +9 -10
  9. data/lib/rundoc/cli.rb +15 -17
  10. data/lib/rundoc/code_command/background/log/clear.rb +1 -1
  11. data/lib/rundoc/code_command/background/log/read.rb +1 -1
  12. data/lib/rundoc/code_command/background/process_spawn.rb +8 -9
  13. data/lib/rundoc/code_command/background/start.rb +7 -7
  14. data/lib/rundoc/code_command/background/stop.rb +1 -1
  15. data/lib/rundoc/code_command/background/wait.rb +2 -2
  16. data/lib/rundoc/code_command/background.rb +6 -6
  17. data/lib/rundoc/code_command/bash/cd.rb +6 -7
  18. data/lib/rundoc/code_command/bash.rb +12 -13
  19. data/lib/rundoc/code_command/file_command/append.rb +12 -16
  20. data/lib/rundoc/code_command/file_command/remove.rb +6 -9
  21. data/lib/rundoc/code_command/no_such_command.rb +0 -1
  22. data/lib/rundoc/code_command/pipe.rb +2 -5
  23. data/lib/rundoc/code_command/print/erb.rb +48 -0
  24. data/lib/rundoc/code_command/print/text.rb +33 -0
  25. data/lib/rundoc/code_command/raw.rb +1 -1
  26. data/lib/rundoc/code_command/rundoc/depend_on.rb +0 -1
  27. data/lib/rundoc/code_command/rundoc/require.rb +2 -3
  28. data/lib/rundoc/code_command/rundoc_command.rb +3 -4
  29. data/lib/rundoc/code_command/website/driver.rb +17 -17
  30. data/lib/rundoc/code_command/website/navigate.rb +2 -2
  31. data/lib/rundoc/code_command/website/screenshot.rb +1 -1
  32. data/lib/rundoc/code_command/website/visit.rb +4 -5
  33. data/lib/rundoc/code_command/website.rb +4 -4
  34. data/lib/rundoc/code_command/write.rb +10 -11
  35. data/lib/rundoc/code_command.rb +28 -17
  36. data/lib/rundoc/code_section.rb +42 -25
  37. data/lib/rundoc/parser.rb +17 -19
  38. data/lib/rundoc/peg_parser.rb +57 -59
  39. data/lib/rundoc/version.rb +1 -1
  40. data/lib/rundoc.rb +10 -14
  41. data/rundoc.gemspec +19 -21
  42. data/test/fixtures/rails_4/rundoc.md +100 -33
  43. data/test/fixtures/rails_5/rundoc.md +77 -14
  44. data/test/fixtures/rails_6/rundoc.md +231 -167
  45. data/test/fixtures/rails_7/rundoc.md +477 -0
  46. data/test/integration/print_test.rb +194 -0
  47. data/test/rundoc/code_commands/append_file_test.rb +5 -8
  48. data/test/rundoc/code_commands/background_test.rb +3 -6
  49. data/test/rundoc/code_commands/bash_test.rb +12 -7
  50. data/test/rundoc/code_commands/pipe_test.rb +9 -9
  51. data/test/rundoc/code_commands/print_test.rb +94 -0
  52. data/test/rundoc/code_commands/remove_contents_test.rb +4 -5
  53. data/test/rundoc/code_section_test.rb +50 -56
  54. data/test/rundoc/parser_test.rb +28 -61
  55. data/test/rundoc/peg_parser_test.rb +49 -53
  56. data/test/rundoc/regex_test.rb +120 -127
  57. data/test/rundoc/test_parse_java.rb +1 -3
  58. data/test/test_helper.rb +4 -6
  59. metadata +39 -42
  60. data/.travis.yml +0 -8
  61. data/lib/rundoc/code_command/repl.rb +0 -37
@@ -3,8 +3,8 @@ module Rundoc
3
3
  class CodeSection
4
4
  class ParseError < StandardError
5
5
  def initialize(options = {})
6
- keyword = options[:keyword]
7
- command = options[:command]
6
+ keyword = options[:keyword]
7
+ command = options[:command]
8
8
  line_number = options[:line_number]
9
9
  block = options[:block].lines.map do |line|
10
10
  if line == command
@@ -14,37 +14,40 @@ module Rundoc
14
14
  end
15
15
  end.join("")
16
16
 
17
- msg = "Error parsing (line:#{line_number}):\n"
17
+ msg = "Error parsing (line:#{line_number}):\n"
18
18
  msg << "> '#{command.strip}'\n"
19
19
  msg << "No such registered command: '#{keyword}'\n"
20
20
  msg << "registered commands: #{Rundoc.known_commands.inspect}\n\n"
21
21
  msg << block
22
22
  msg << "\n"
23
- super msg
23
+ super(msg)
24
24
  end
25
25
  end
26
26
 
27
- COMMAND_REGEX = Rundoc::Parser::COMMAND_REGEX # todo: move whole thing
27
+ COMMAND_REGEX = Rundoc::Parser::COMMAND_REGEX # todo: move whole thing
28
+ AUTOGEN_WARNING = "\n<!-- STOP. This document is autogenerated. Do not manually modify. See the top of the doc for more details. -->"
28
29
  attr_accessor :original, :fence, :lang, :code, :commands, :keyword
29
30
 
30
31
  def initialize(match, options = {})
31
32
  @original = match.to_s
32
33
  @commands = []
33
- @stack = []
34
- @keyword = options[:keyword] or raise "keyword is required"
34
+ @stack = []
35
+ @keyword = options[:keyword] or raise "keyword is required"
35
36
  @document_path = options[:document_path]
36
- @fence = match[:fence]
37
- @lang = match[:lang]
38
- @code = match[:contents]
37
+ @fence = match[:fence]
38
+ @lang = match[:lang]
39
+ @code = match[:contents]
39
40
  parse_code_command
40
41
  end
41
42
 
42
43
  def render
43
44
  result = []
44
- env = {}
45
+ env = {}
45
46
  env[:commands] = []
46
- env[:before] = String.new("#{fence}#{lang}")
47
- env[:after] = String.new(fence)
47
+ env[:fence_start] = +"#{fence}#{lang}"
48
+ env[:fence_end] = "#{fence}#{AUTOGEN_WARNING}"
49
+ env[:before] = []
50
+ env[:after] = []
48
51
  env[:document_path] = @document_path
49
52
 
50
53
  @stack.each do |s|
@@ -54,30 +57,44 @@ module Rundoc
54
57
  end
55
58
 
56
59
  code_command = s
57
- code_output = code_command.call(env) || ""
58
- code_line = code_command.to_md(env) || ""
60
+ code_output = code_command.call(env) || ""
61
+ code_line = code_command.to_md(env) || ""
59
62
 
60
- env[:commands] << { object: code_command, output: code_output, command: code_line }
63
+ env[:commands] << {object: code_command, output: code_output, command: code_line}
61
64
 
62
65
  tmp_result = []
63
- tmp_result << code_line if code_command.render_command?
66
+ tmp_result << code_line if code_command.render_command?
64
67
  tmp_result << code_output if code_command.render_result?
65
68
 
66
69
  result << tmp_result unless code_command.hidden?
67
- result
68
70
  end
69
71
 
70
72
  return env[:replace] if env[:replace]
71
73
 
72
74
  return "" if hidden?
73
75
 
74
- array = [env[:before], result, env[:after]]
76
+ array = [env[:before]]
77
+
78
+ result.flatten!
79
+ result.compact!
80
+ result.map! { |s| s.respond_to?(:rstrip) ? s.rstrip : s }
81
+ result.reject!(&:empty?)
82
+ result.map!(&:to_s)
83
+
84
+ if !result.empty?
85
+ array << env[:fence_start]
86
+ array << result
87
+ array << env[:fence_end]
88
+ end
89
+ array << env[:after]
90
+
75
91
  array.flatten!
76
92
  array.compact!
77
- array.map!(&:rstrip)
93
+ array.map! { |s| s.respond_to?(:rstrip) ? s.rstrip : s }
78
94
  array.reject!(&:empty?)
95
+ array.map!(&:to_s)
79
96
 
80
- return array.join("\n") << "\n"
97
+ array.join("\n") << "\n"
81
98
  end
82
99
 
83
100
  # all of the commands are hidden
@@ -88,7 +105,7 @@ module Rundoc
88
105
  # one or more of the commands are not hidden
89
106
  def not_hidden?
90
107
  return true if commands.empty?
91
- commands.map(&:not_hidden?).detect {|c| c }
108
+ commands.map(&:not_hidden?).detect { |c| c }
92
109
  end
93
110
 
94
111
  def parse_code_command
@@ -97,8 +114,8 @@ module Rundoc
97
114
  actual = Rundoc::PegTransformer.new.apply(tree)
98
115
  actual = [actual] unless actual.is_a?(Array)
99
116
  actual.each do |code_command|
100
- @stack << "\n" if commands.last.is_a?(Rundoc::CodeCommand)
101
- @stack << code_command
117
+ @stack << "\n" if commands.last.is_a?(Rundoc::CodeCommand)
118
+ @stack << code_command
102
119
  commands << code_command
103
120
  end
104
121
  rescue ::Parslet::ParseFailed => e
@@ -117,4 +134,4 @@ module Rundoc
117
134
  # end
118
135
  # end
119
136
  end
120
- end
137
+ end
data/lib/rundoc/parser.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  module Rundoc
2
2
  class Parser
3
- DEFAULT_KEYWORD = ":::"
4
- INDENT_BLOCK = '(?<before_indent>(^\s*$\n|\A)(^(?:[ ]{4}|\t))(?<indent_contents>.*)(?<after_indent>[^\s].*$\n?(?:(?:^\s*$\n?)*^(?:[ ]{4}|\t).*[^\s].*$\n?)*))'
5
- GITHUB_BLOCK = '^(?<fence>(?<fence_char>~|`){3,})\s*?(?<lang>\w+)?\s*?\n(?<contents>.*?)^\g<fence>\g<fence_char>*\s*?\n'
6
- CODEBLOCK_REGEX = /(#{GITHUB_BLOCK})/m
7
- COMMAND_REGEX = ->(keyword) {
8
- /^#{keyword}(?<tag>(\s|=|-|>)?(=|-|>)?)\s*(?<command>(\S)+)\s+(?<statement>.*)$/
9
- }
3
+ DEFAULT_KEYWORD = ":::"
4
+ INDENT_BLOCK = '(?<before_indent>(^\s*$\n|\A)(^(?:[ ]{4}|\t))(?<indent_contents>.*)(?<after_indent>[^\s].*$\n?(?:(?:^\s*$\n?)*^(?:[ ]{4}|\t).*[^\s].*$\n?)*))'
5
+ GITHUB_BLOCK = '^(?<fence>(?<fence_char>~|`){3,})\s*?(?<lang>\w+)?\s*?\n(?<contents>.*?)^\g<fence>\g<fence_char>*\s*?\n'
6
+ CODEBLOCK_REGEX = /(#{GITHUB_BLOCK})/m
7
+ COMMAND_REGEX = ->(keyword) {
8
+ /^#{keyword}(?<tag>(\s|=|-|>)?(=|-|>)?)\s*(?<command>(\S)+)\s+(?<statement>.*)$/
9
+ }
10
10
 
11
11
  attr_reader :contents, :keyword, :stack
12
12
 
@@ -14,25 +14,23 @@ module Rundoc
14
14
  @document_path = document_path
15
15
  @contents = contents
16
16
  @original = contents.dup
17
- @keyword = keyword
18
- @stack = []
17
+ @keyword = keyword
18
+ @stack = []
19
19
  partition
20
20
  end
21
21
 
22
22
  def to_md
23
23
  result = []
24
24
  @stack.each do |s|
25
- if s.respond_to?(:render)
26
- result << s.render
25
+ result << if s.respond_to?(:render)
26
+ s.render
27
27
  else
28
- result << s
28
+ s
29
29
  end
30
30
  end
31
- return result.join("")
32
- rescue Exception => e
33
- File.open("README.md", "w") do |f|
34
- f.write(result.join(""))
35
- end
31
+ result.join("")
32
+ rescue => e
33
+ File.write("README.md", result.join(""))
36
34
  raise e
37
35
  end
38
36
 
@@ -40,7 +38,7 @@ module Rundoc
40
38
  def partition
41
39
  until contents.empty?
42
40
  head, code, tail = contents.partition(CODEBLOCK_REGEX)
43
- @stack << head unless head.empty?
41
+ @stack << head unless head.empty?
44
42
  unless code.empty?
45
43
  match = code.match(CODEBLOCK_REGEX)
46
44
  @stack << CodeSection.new(match, keyword: keyword, document_path: @document_path)
@@ -51,4 +49,4 @@ module Rundoc
51
49
  end
52
50
  end
53
51
 
54
- # convert string of markdown to array of strings and code_command
52
+ # convert string of markdown to array of strings and code_command
@@ -1,53 +1,53 @@
1
- require 'parslet'
1
+ require "parslet"
2
2
 
3
3
  module Rundoc
4
4
  class PegParser < Parslet::Parser
5
- rule(:spaces) { match('\s').repeat(1) }
5
+ rule(:spaces) { match('\s').repeat(1) }
6
6
  rule(:spaces?) { spaces.maybe }
7
- rule(:comma) { spaces? >> str(',') >> spaces? }
8
- rule(:digit) { match('[0-9]') }
9
- rule(:lparen) { str('(') >> spaces? }
10
- rule(:rparen) { str(')') }
11
- rule(:newline) { str("\r").maybe >> str("\n") }
7
+ rule(:comma) { spaces? >> str(",") >> spaces? }
8
+ rule(:digit) { match("[0-9]") }
9
+ rule(:lparen) { str("(") >> spaces? }
10
+ rule(:rparen) { str(")") }
11
+ rule(:newline) { str("\r").maybe >> str("\n") }
12
12
 
13
13
  rule(:singlequote_string) {
14
14
  str("'") >> (
15
- str("'").absnt? >> any
15
+ str("'").absent? >> any
16
16
  ).repeat.as(:string) >>
17
- str("'") >> spaces?
17
+ str("'") >> spaces?
18
18
  }
19
19
  rule(:doublequote_string) {
20
20
  str('"') >> (
21
- str('"').absnt? >> any
21
+ str('"').absent? >> any
22
22
  ).repeat.as(:string) >>
23
- str('"') >> spaces?
23
+ str('"') >> spaces?
24
24
  }
25
25
  rule(:string) { doublequote_string | singlequote_string }
26
26
 
27
27
  rule(:number) {
28
28
  (
29
- str('-').maybe >> (
30
- str('0') | (match('[1-9]') >> digit.repeat)
29
+ str("-").maybe >> (
30
+ str("0") | (match("[1-9]") >> digit.repeat)
31
31
  ) >> (
32
- str('.') >> digit.repeat(1)
32
+ str(".") >> digit.repeat(1)
33
33
  ).maybe >> (
34
- match('[eE]') >> (str('+') | str('-')).maybe >> digit.repeat(1)
34
+ match("[eE]") >> (str("+") | str("-")).maybe >> digit.repeat(1)
35
35
  ).maybe
36
36
  ).as(:number)
37
37
  }
38
38
 
39
39
  rule(:value) {
40
40
  string |
41
- number |
42
- str('true').as(:true) |
43
- str('false').as(:false) |
44
- str('nil').as(:nil)
41
+ number |
42
+ str("true").as(true) |
43
+ str("false").as(false) |
44
+ str("nil").as(:nil)
45
45
  }
46
46
 
47
47
  rule(:key) {
48
48
  spaces? >> (
49
- str(':').absent? >> match('\s').absent? >> any
50
- ).repeat.as(:key) >> str(':') >> spaces?
49
+ str(":").absent? >> match('\s').absent? >> any
50
+ ).repeat.as(:key) >> str(":") >> spaces?
51
51
  }
52
52
 
53
53
  rule(:key_value) {
@@ -60,16 +60,16 @@ module Rundoc
60
60
  spaces? >> (
61
61
  key_value >> (comma >> key_value).repeat
62
62
  ).as(:named_args) >>
63
- spaces?
63
+ spaces?
64
64
  }
65
65
 
66
66
  rule(:unquoted_string) {
67
- (newline.absent? >> any).repeat.as(:string) #>> newline
67
+ (newline.absent? >> any).repeat.as(:string) # >> newline
68
68
  }
69
69
 
70
70
  rule(:positional_args) {
71
71
  spaces? >> value.as(:val) >> (comma >> value.as(:val)).repeat >>
72
- comma.maybe >> named_args.maybe
72
+ comma.maybe >> named_args.maybe
73
73
  }
74
74
 
75
75
  rule(:args) {
@@ -82,17 +82,17 @@ module Rundoc
82
82
 
83
83
  rule(:parens_method) {
84
84
  funcall >> lparen >>
85
- args.as(:args) >>
86
- rparen
85
+ args.as(:args) >>
86
+ rparen
87
87
  }
88
88
 
89
89
  rule(:seattle_method) {
90
90
  funcall >> spaces >>
91
- (args).as(:args)
91
+ args.as(:args)
92
92
  }
93
93
 
94
94
  rule(:no_args_method) {
95
- spaces? >> ( lparen.absent? >> rparen.absent? >> spaces.absent? >> any).repeat(1)
95
+ spaces? >> (lparen.absent? >> rparen.absent? >> spaces.absent? >> any).repeat(1)
96
96
  }
97
97
 
98
98
  rule(:method_call) {
@@ -105,13 +105,13 @@ module Rundoc
105
105
  # --
106
106
  rule(:visability) {
107
107
  (
108
- match('>|-').maybe.as(:vis_command) >> match('>|-').maybe.as(:vis_result)
108
+ match(">|-").maybe.as(:vis_command) >> match(">|-").maybe.as(:vis_result)
109
109
  ).as(:visability)
110
110
  }
111
111
 
112
112
  # :::
113
113
  rule(:start_command) {
114
- match(/\A:/) >> str('::')
114
+ match(/\A:/) >> str("::")
115
115
  }
116
116
 
117
117
  # :::>> $ cat foo.rb
@@ -119,7 +119,7 @@ module Rundoc
119
119
  (
120
120
  start_command >>
121
121
  visability.as(:cmd_visability) >> spaces? >>
122
- method_call.as(:cmd_method_call) >> newline.maybe #>> match(/\z/)
122
+ method_call.as(:cmd_method_call) >> newline.maybe # >> match(/\z/)
123
123
  ).as(:command)
124
124
  }
125
125
 
@@ -135,7 +135,6 @@ module Rundoc
135
135
  command
136
136
  }
137
137
 
138
-
139
138
  # :::>> file.write hello.txt
140
139
  # world
141
140
  # :::>> file.write foo.txt
@@ -152,13 +151,13 @@ module Rundoc
152
151
  code_fence >>
153
152
  match('\S').repeat >>
154
153
  newline >>
155
- multiple_commands >>
156
- code_fence >> newline
154
+ multiple_commands >>
155
+ code_fence >> newline
157
156
  }
158
157
 
159
158
  rule(:raw_code) {
160
159
  (start_command.absent? >> command.absent? >> any).repeat(1).as(:raw_code) >>
161
- multiple_commands.maybe
160
+ multiple_commands.maybe
162
161
  }
163
162
 
164
163
  rule(:code_block) {
@@ -167,27 +166,26 @@ module Rundoc
167
166
  end
168
167
  end
169
168
 
170
-
171
169
  module Rundoc
172
170
  class PegTransformer < Parslet::Transform
173
- rule(nill: simple(:nu)) { nil }
174
- rule(true: simple(:tr)) { true }
175
- rule(false: simple(:fa)) { false }
171
+ rule(nill: simple(:nu)) { nil }
172
+ rule(true => simple(:tr)) { true }
173
+ rule(false => simple(:fa)) { false }
176
174
  rule(string: simple(:st)) { st.to_s }
177
175
 
178
- rule(:number => simple(:nb)) {
179
- nb.match(/[eE\.]/) ? Float(nb) : Integer(nb)
176
+ rule(number: simple(:nb)) {
177
+ /[eE.]/.match?(nb) ? Float(nb) : Integer(nb)
180
178
  }
181
179
 
182
180
  def self.convert_named_args(na)
183
- (na.is_a?(Array) ? na : [ na ]).each_with_object({}) { |element, hash|
181
+ (na.is_a?(Array) ? na : [na]).each_with_object({}) { |element, hash|
184
182
  key = element[:key_value][:key].to_sym
185
183
  val = element[:key_value][:val]
186
184
  hash[key] = val
187
185
  }
188
186
  end
189
187
 
190
- rule(:named_args => subtree(:na)) {
188
+ rule(named_args: subtree(:na)) {
191
189
  PegTransformer.convert_named_args(na)
192
190
  }
193
191
 
@@ -206,7 +204,7 @@ module Rundoc
206
204
  args = nil
207
205
  else
208
206
  keyword = mc[:funcall].to_sym
209
- args = mc[:args]
207
+ args = mc[:args]
210
208
  end
211
209
 
212
210
  Rundoc.code_command_from_keyword(keyword, args)
@@ -214,47 +212,47 @@ module Rundoc
214
212
 
215
213
  class Visability
216
214
  attr_reader :command, :result
217
- alias :command? :command
218
- alias :result? :result
215
+ alias_method :command?, :command
216
+ alias_method :result?, :result
219
217
  def initialize(command:, result:)
220
218
  @command = command
221
- @result = result
219
+ @result = result
222
220
  end
223
221
  end
224
222
 
225
223
  class TransformError < ::StandardError
226
224
  attr_reader :line_and_column
227
- def initialize(message: , line_and_column:)
225
+ def initialize(message:, line_and_column:)
228
226
  @line_and_column = line_and_column || [1, 1]
229
- super message
227
+ super(message)
230
228
  end
231
229
  end
232
230
 
233
- rule(:visability => {
234
- vis_command: simple(:command),
235
- vis_result: simple(:result)
236
- }) {
231
+ rule(visability: {
232
+ vis_command: simple(:command),
233
+ vis_result: simple(:result)
234
+ }) {
237
235
  if result.nil? || command.nil?
238
236
  line_and_column = command&.line_and_column
239
237
  line_and_column ||= result&.line_and_column
240
238
 
241
239
  message = +""
242
240
  message << "You attempted to use a command that does not begin with two visibility indicators. Please replace: "
243
- message << "`:::#{command}#{result}` with `:::#{command || '-'}#{result || '-'}`"
241
+ message << "`:::#{command}#{result}` with `:::#{command || "-"}#{result || "-"}`"
244
242
  raise TransformError.new(message: message, line_and_column: line_and_column)
245
243
  end
246
244
  Visability.new(
247
- command: command.to_s == '>'.freeze,
248
- result: result.to_s == '>'.freeze
245
+ command: command.to_s == ">".freeze,
246
+ result: result.to_s == ">".freeze
249
247
  )
250
248
  }
251
249
 
252
250
  rule(
253
- cmd_visability: simple(:cmd_vis), # Visibility#new
251
+ cmd_visability: simple(:cmd_vis), # Visibility#new
254
252
  cmd_method_call: simple(:code_command) # Rundoc::CodeCommand#new
255
- ) {
253
+ ) {
256
254
  code_command.render_command = cmd_vis.command?
257
- code_command.render_result = cmd_vis.result?
255
+ code_command.render_result = cmd_vis.result?
258
256
  code_command
259
257
  }
260
258
 
@@ -1,3 +1,3 @@
1
1
  module Rundoc
2
- VERSION = "1.1.2"
2
+ VERSION = "2.0.0"
3
3
  end
data/lib/rundoc.rb CHANGED
@@ -1,12 +1,12 @@
1
- require 'fileutils'
2
- require 'pathname'
3
- require 'rundoc/version'
1
+ require "fileutils"
2
+ require "pathname"
3
+ require "rundoc/version"
4
4
 
5
5
  module Rundoc
6
6
  extend self
7
7
 
8
8
  def code_command_from_keyword(keyword, args)
9
- klass = code_command(keyword.to_sym) || Rundoc::CodeCommand::NoSuchCommand
9
+ klass = code_command(keyword.to_sym) || Rundoc::CodeCommand::NoSuchCommand
10
10
  original_args = args.dup
11
11
  if args.is_a?(Array) && args.last.is_a?(Hash)
12
12
  kwargs = args.pop
@@ -62,10 +62,6 @@ module Rundoc
62
62
  yield self
63
63
  end
64
64
 
65
- def register_repl(*args, &block)
66
- ReplRunner.register_commands(*args, &block)
67
- end
68
-
69
65
  def filter_sensitive(sensitive)
70
66
  raise "Expecting #{sensitive} to be a hash" unless sensitive.is_a?(Hash)
71
67
  @sensitive ||= {}
@@ -77,14 +73,14 @@ module Rundoc
77
73
  @sensitive.each do |sensitive, replace|
78
74
  doc.gsub!(sensitive.to_s, replace)
79
75
  end
80
- return doc
76
+ doc
81
77
  end
82
78
 
83
79
  attr_accessor :project_root
84
80
  end
85
81
 
86
- require 'rundoc/parser'
87
- require 'rundoc/code_section'
88
- require 'rundoc/code_command'
89
- require 'rundoc/peg_parser'
90
- require 'rundoc/cli'
82
+ require "rundoc/parser"
83
+ require "rundoc/code_section"
84
+ require "rundoc/code_command"
85
+ require "rundoc/peg_parser"
86
+ require "rundoc/cli"
data/rundoc.gemspec CHANGED
@@ -1,34 +1,32 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'rundoc/version'
3
+ require "rundoc/version"
5
4
 
6
5
  Gem::Specification.new do |gem|
7
- gem.name = "rundoc"
8
- gem.version = Rundoc::VERSION
9
- gem.authors = ["Richard Schneeman"]
10
- gem.email = ["richard.schneeman+rubygems@gmail.com"]
11
- gem.description = %q{RunDOC turns docs to runable code}
12
- gem.summary = %q{RunDOC generates runable code from docs}
13
- gem.homepage = "https://github.com/schneems/rundoc"
14
- gem.license = "MIT"
6
+ gem.name = "rundoc"
7
+ gem.version = Rundoc::VERSION
8
+ gem.authors = ["Richard Schneeman"]
9
+ gem.email = ["richard.schneeman+rubygems@gmail.com"]
10
+ gem.description = "RunDOC turns docs to runable code"
11
+ gem.summary = "RunDOC generates runable code from docs"
12
+ gem.homepage = "https://github.com/schneems/rundoc"
13
+ gem.license = "MIT"
15
14
 
16
- gem.files = `git ls-files`.split($/)
17
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
19
17
  gem.require_paths = ["lib"]
20
18
 
21
19
  gem.add_dependency "thor"
22
- gem.add_dependency "repl_runner"
23
- gem.add_dependency 'parslet', '~> 1'
24
- gem.add_dependency 'capybara', '~> 3'
25
- gem.add_dependency 'selenium-webdriver', '~> 3'
20
+ gem.add_dependency "parslet", "~> 2"
21
+ gem.add_dependency "capybara", "~> 3"
22
+ gem.add_dependency "selenium-webdriver", "~> 4"
23
+ gem.add_dependency "base64", "~> 0"
26
24
 
27
- gem.add_dependency 'aws-sdk-s3', '~> 1'
28
- gem.add_dependency 'dotenv'
25
+ gem.add_dependency "aws-sdk-s3", "~> 1"
26
+ gem.add_dependency "dotenv"
29
27
 
30
28
  gem.add_development_dependency "rake"
31
29
  gem.add_development_dependency "mocha"
32
30
  gem.add_development_dependency "minitest"
31
+ gem.add_development_dependency "standard"
33
32
  end
34
-