rundoc 1.0.0 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/check_changelog.yml +13 -0
- data/.gitignore +7 -0
- data/CHANGELOG.md +27 -0
- data/Dockerfile +24 -0
- data/README.md +221 -100
- data/bin/rundoc +4 -68
- data/lib/rundoc.rb +1 -0
- data/lib/rundoc/cli.rb +84 -0
- data/lib/rundoc/code_command.rb +3 -2
- data/lib/rundoc/code_command/background/process_spawn.rb +30 -4
- data/lib/rundoc/code_command/background/start.rb +2 -0
- data/lib/rundoc/code_command/bash.rb +3 -2
- data/lib/rundoc/code_command/bash/cd.rb +20 -2
- data/lib/rundoc/code_command/no_such_command.rb +4 -0
- data/lib/rundoc/code_command/pipe.rb +17 -4
- data/lib/rundoc/code_command/rundoc/depend_on.rb +37 -0
- data/lib/rundoc/code_command/rundoc/require.rb +41 -0
- data/lib/rundoc/code_command/rundoc_command.rb +4 -1
- data/lib/rundoc/code_command/website.rb +7 -0
- data/lib/rundoc/code_command/website/driver.rb +111 -0
- data/lib/rundoc/code_command/website/navigate.rb +29 -0
- data/lib/rundoc/code_command/website/screenshot.rb +28 -0
- data/lib/rundoc/code_command/website/visit.rb +47 -0
- data/lib/rundoc/code_section.rb +13 -4
- data/lib/rundoc/parser.rb +4 -3
- data/lib/rundoc/peg_parser.rb +1 -1
- data/lib/rundoc/version.rb +1 -1
- data/rundoc.gemspec +7 -2
- data/test/fixtures/build_logs/rundoc.md +56 -0
- data/test/fixtures/depend_on/dependency/rundoc.md +5 -0
- data/test/fixtures/depend_on/main/rundoc.md +10 -0
- data/test/fixtures/java/rundoc.md +9 -0
- data/test/fixtures/rails_4/rundoc.md +8 -5
- data/test/fixtures/rails_5/rundoc.md +17 -7
- data/test/fixtures/{rails_5_beta → rails_6}/rundoc.md +97 -88
- data/test/fixtures/require/dependency/rundoc.md +5 -0
- data/test/fixtures/require/main/rundoc.md +10 -0
- data/test/fixtures/screenshot/rundoc.md +10 -0
- data/test/rundoc/code_commands/background_test.rb +26 -0
- data/test/rundoc/code_commands/bash_test.rb +7 -0
- data/test/rundoc/code_commands/pipe_test.rb +11 -1
- data/test/rundoc/parser_test.rb +0 -1
- data/test/rundoc/peg_parser_test.rb +43 -0
- metadata +90 -11
@@ -1,6 +1,32 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class BackgroundTest < Minitest::Test
|
4
|
+
def test_process_spawn_gc
|
5
|
+
Dir.mktmpdir do |dir|
|
6
|
+
Dir.chdir(dir) do
|
7
|
+
file = "foo.txt"
|
8
|
+
`echo 'foo' >> #{file}`
|
9
|
+
|
10
|
+
background_start = Rundoc::CodeCommand::Background::Start.new("tail -f #{file}",
|
11
|
+
name: "tail2",
|
12
|
+
wait: "f"
|
13
|
+
)
|
14
|
+
|
15
|
+
GC.start
|
16
|
+
|
17
|
+
output = background_start.call
|
18
|
+
|
19
|
+
assert_match("foo", output)
|
20
|
+
assert_equal(true, background_start.alive?)
|
21
|
+
|
22
|
+
background_stop = Rundoc::CodeCommand::Background::Stop.new(name: "tail2")
|
23
|
+
background_stop.call
|
24
|
+
|
25
|
+
assert_equal(false, background_start.alive?)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
4
30
|
def test_background_start
|
5
31
|
Dir.mktmpdir do |dir|
|
6
32
|
Dir.chdir(dir) do
|
@@ -11,6 +11,13 @@ class BashTest < Minitest::Test
|
|
11
11
|
Dir.chdir(original_dir.strip)
|
12
12
|
end
|
13
13
|
|
14
|
+
def test_bash_stderr_with_or_is_capture
|
15
|
+
|
16
|
+
command = "1>&2 echo 'msg to STDERR 1' || 1>&2 echo 'msg to STDERR 2'"
|
17
|
+
bash = Rundoc::CodeCommand::Bash.new(command)
|
18
|
+
assert_equal "$ #{command}", bash.to_md
|
19
|
+
assert_equal "msg to STDERR 1\n", bash.call
|
20
|
+
end
|
14
21
|
|
15
22
|
def test_bash_shells_and_shows_correctly
|
16
23
|
["pwd", "ls"].each do |command|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class PipeTest < Minitest::Test
|
4
|
-
|
5
4
|
def test_pipe
|
6
5
|
pipe_cmd = "tail -n 2"
|
7
6
|
cmd = "ls"
|
@@ -12,4 +11,15 @@ class PipeTest < Minitest::Test
|
|
12
11
|
expected = `#{cmd} | #{pipe_cmd}`
|
13
12
|
assert_equal expected, actual
|
14
13
|
end
|
14
|
+
|
15
|
+
def test_moar_pipe_with_dollar
|
16
|
+
pipe_cmd = "tail -n 2"
|
17
|
+
cmd = "ls"
|
18
|
+
out = `#{cmd}`
|
19
|
+
pipe = Rundoc::CodeCommand::Pipe.new("$ #{pipe_cmd}")
|
20
|
+
actual = pipe.call(commands: [{command: cmd, output: out}])
|
21
|
+
|
22
|
+
expected = `#{cmd} | #{pipe_cmd}`
|
23
|
+
assert_equal expected, actual
|
24
|
+
end
|
15
25
|
end
|
data/test/rundoc/parser_test.rb
CHANGED
@@ -116,6 +116,16 @@ class PegParserTest < Minitest::Test
|
|
116
116
|
assert_equal false, actual.result?
|
117
117
|
end
|
118
118
|
|
119
|
+
def test_blerg_method_call
|
120
|
+
input = %Q{$ cat foo.rb}
|
121
|
+
parser = Rundoc::PegParser.new.method_call
|
122
|
+
tree = parser.parse_with_debug(input)
|
123
|
+
|
124
|
+
actual = @transformer.apply(tree)
|
125
|
+
assert_equal :"$", actual.keyword
|
126
|
+
assert_equal("cat foo.rb", actual.original_args)
|
127
|
+
end
|
128
|
+
|
119
129
|
def test_command
|
120
130
|
input = %Q{:::>> $ cat foo.rb\n}
|
121
131
|
parser = Rundoc::PegParser.new.command
|
@@ -261,6 +271,39 @@ class PegParserTest < Minitest::Test
|
|
261
271
|
assert_equal("email = ENV['HEROKU_EMAIL'] || `heroku auth:whoami`", actual.original_args)
|
262
272
|
end
|
263
273
|
|
274
|
+
def test_rundoc_sub_commands_no_quotes
|
275
|
+
input = String.new
|
276
|
+
input << %Q{:::-- rundoc.depend_on ../foo/bar.md\n}
|
277
|
+
|
278
|
+
parser = Rundoc::PegParser.new.command_with_stdin
|
279
|
+
tree = parser.parse_with_debug(input)
|
280
|
+
|
281
|
+
actual = @transformer.apply(tree)
|
282
|
+
assert_equal :"rundoc.depend_on", actual.keyword
|
283
|
+
end
|
284
|
+
|
285
|
+
def test_seattle_style_method_call
|
286
|
+
input = String.new
|
287
|
+
input << %Q{rundoc.depend_on '../foo/bar.md'}
|
288
|
+
parser = Rundoc::PegParser.new.method_call
|
289
|
+
tree = parser.parse_with_debug(input)
|
290
|
+
|
291
|
+
actual = @transformer.apply(tree)
|
292
|
+
|
293
|
+
assert_equal :"rundoc.depend_on", actual.keyword
|
294
|
+
end
|
295
|
+
|
296
|
+
def test_rundoc_seattle_sub_command
|
297
|
+
input = String.new
|
298
|
+
input << %Q{:::>> rundoc.depend_on '../foo/bar.md'\n}
|
299
|
+
|
300
|
+
parser = Rundoc::PegParser.new.command
|
301
|
+
tree = parser.parse_with_debug(input)
|
302
|
+
|
303
|
+
actual = @transformer.apply(tree)
|
304
|
+
|
305
|
+
assert_equal :"rundoc.depend_on", actual.keyword
|
306
|
+
end
|
264
307
|
|
265
308
|
def test_positional_args
|
266
309
|
input = +""
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rundoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -52,6 +52,62 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: capybara
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: selenium-webdriver
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aws-sdk-s3
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: dotenv
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
55
111
|
- !ruby/object:Gem::Dependency
|
56
112
|
name: rake
|
57
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +150,7 @@ dependencies:
|
|
94
150
|
- - ">="
|
95
151
|
- !ruby/object:Gem::Version
|
96
152
|
version: '0'
|
97
|
-
description:
|
153
|
+
description: RunDOC turns docs to runable code
|
98
154
|
email:
|
99
155
|
- richard.schneeman+rubygems@gmail.com
|
100
156
|
executables:
|
@@ -102,14 +158,17 @@ executables:
|
|
102
158
|
extensions: []
|
103
159
|
extra_rdoc_files: []
|
104
160
|
files:
|
161
|
+
- ".github/workflows/check_changelog.yml"
|
105
162
|
- ".gitignore"
|
106
163
|
- ".travis.yml"
|
107
164
|
- CHANGELOG.md
|
165
|
+
- Dockerfile
|
108
166
|
- Gemfile
|
109
167
|
- README.md
|
110
168
|
- Rakefile
|
111
169
|
- bin/rundoc
|
112
170
|
- lib/rundoc.rb
|
171
|
+
- lib/rundoc/cli.rb
|
113
172
|
- lib/rundoc/code_command.rb
|
114
173
|
- lib/rundoc/code_command/background.rb
|
115
174
|
- lib/rundoc/code_command/background/log/clear.rb
|
@@ -126,17 +185,31 @@ files:
|
|
126
185
|
- lib/rundoc/code_command/pipe.rb
|
127
186
|
- lib/rundoc/code_command/raw.rb
|
128
187
|
- lib/rundoc/code_command/repl.rb
|
188
|
+
- lib/rundoc/code_command/rundoc/depend_on.rb
|
189
|
+
- lib/rundoc/code_command/rundoc/require.rb
|
129
190
|
- lib/rundoc/code_command/rundoc_command.rb
|
191
|
+
- lib/rundoc/code_command/website.rb
|
192
|
+
- lib/rundoc/code_command/website/driver.rb
|
193
|
+
- lib/rundoc/code_command/website/navigate.rb
|
194
|
+
- lib/rundoc/code_command/website/screenshot.rb
|
195
|
+
- lib/rundoc/code_command/website/visit.rb
|
130
196
|
- lib/rundoc/code_command/write.rb
|
131
197
|
- lib/rundoc/code_section.rb
|
132
198
|
- lib/rundoc/parser.rb
|
133
199
|
- lib/rundoc/peg_parser.rb
|
134
200
|
- lib/rundoc/version.rb
|
135
201
|
- rundoc.gemspec
|
202
|
+
- test/fixtures/build_logs/rundoc.md
|
203
|
+
- test/fixtures/depend_on/dependency/rundoc.md
|
204
|
+
- test/fixtures/depend_on/main/rundoc.md
|
205
|
+
- test/fixtures/java/rundoc.md
|
136
206
|
- test/fixtures/play/source.md
|
137
207
|
- test/fixtures/rails_4/rundoc.md
|
138
208
|
- test/fixtures/rails_5/rundoc.md
|
139
|
-
- test/fixtures/
|
209
|
+
- test/fixtures/rails_6/rundoc.md
|
210
|
+
- test/fixtures/require/dependency/rundoc.md
|
211
|
+
- test/fixtures/require/main/rundoc.md
|
212
|
+
- test/fixtures/screenshot/rundoc.md
|
140
213
|
- test/rundoc/code_commands/append_file_test.rb
|
141
214
|
- test/rundoc/code_commands/background_test.rb
|
142
215
|
- test/rundoc/code_commands/bash_test.rb
|
@@ -152,7 +225,7 @@ homepage: https://github.com/schneems/rundoc
|
|
152
225
|
licenses:
|
153
226
|
- MIT
|
154
227
|
metadata: {}
|
155
|
-
post_install_message:
|
228
|
+
post_install_message:
|
156
229
|
rdoc_options: []
|
157
230
|
require_paths:
|
158
231
|
- lib
|
@@ -167,16 +240,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
240
|
- !ruby/object:Gem::Version
|
168
241
|
version: '0'
|
169
242
|
requirements: []
|
170
|
-
|
171
|
-
|
172
|
-
signing_key:
|
243
|
+
rubygems_version: 3.0.3
|
244
|
+
signing_key:
|
173
245
|
specification_version: 4
|
174
|
-
summary:
|
246
|
+
summary: RunDOC generates runable code from docs
|
175
247
|
test_files:
|
248
|
+
- test/fixtures/build_logs/rundoc.md
|
249
|
+
- test/fixtures/depend_on/dependency/rundoc.md
|
250
|
+
- test/fixtures/depend_on/main/rundoc.md
|
251
|
+
- test/fixtures/java/rundoc.md
|
176
252
|
- test/fixtures/play/source.md
|
177
253
|
- test/fixtures/rails_4/rundoc.md
|
178
254
|
- test/fixtures/rails_5/rundoc.md
|
179
|
-
- test/fixtures/
|
255
|
+
- test/fixtures/rails_6/rundoc.md
|
256
|
+
- test/fixtures/require/dependency/rundoc.md
|
257
|
+
- test/fixtures/require/main/rundoc.md
|
258
|
+
- test/fixtures/screenshot/rundoc.md
|
180
259
|
- test/rundoc/code_commands/append_file_test.rb
|
181
260
|
- test/rundoc/code_commands/background_test.rb
|
182
261
|
- test/rundoc/code_commands/bash_test.rb
|