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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6c32eddffc69778c7661f3c38ce6bc4c5f9a06dc18f46a737de2dfca2382fe8
|
4
|
+
data.tar.gz: cb1d8d74338a9dc4b8b39a9d6d21a51d6d89728ae14147ab2b9e9aa71a335e4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 327b5690d7ac1ab8985e0d8d338d38e79af97bae4c683204594bdb8f7ed3c2461fb4cbbb90c058c77120de00b1af95ed3e6bd0573d92e39d248a32315938125d
|
7
|
+
data.tar.gz: 1571964f78dd43e9b742729106e294813b970229d0424ee9af44f97be22d1c9293324605a3e85b92b7396cdc427955cd73f7958c9ac60ccb6cc9fa0aa14b583e
|
@@ -0,0 +1,13 @@
|
|
1
|
+
name: Check Changelog
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types: [opened, reopened, edited, synchronize]
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v1
|
11
|
+
- name: Check that CHANGELOG is touched
|
12
|
+
run: |
|
13
|
+
cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
## HEAD
|
2
|
+
|
3
|
+
## 1.1.3
|
4
|
+
|
5
|
+
- Bugfix: Bash commands that output to stderr and use `||` are now captured (https://github.com/schneems/rundoc/pull/29)
|
6
|
+
|
7
|
+
## 1.1.2
|
8
|
+
|
9
|
+
- Fix pipe support (https://github.com/schneems/rundoc/pull/28)
|
10
|
+
|
11
|
+
## 1.1.1
|
12
|
+
|
13
|
+
- Fix log read race condition (https://github.com/schneems/rundoc/pull/25)
|
14
|
+
|
15
|
+
## 1.1.0
|
16
|
+
|
17
|
+
- Pipe logic is now implemented through a parser (https://github.com/schneems/rundoc/pull/22)
|
18
|
+
- Bugfix, background processes error when the log file is not touched before read, not sure why this is possible but here's a fix for it anyway (https://github.com/schneems/rundoc/commit/620ae55d8a5d3d443cf5e8cb77950a841f92900c)
|
19
|
+
|
20
|
+
## 1.0.1
|
21
|
+
|
22
|
+
- Allow non-headless browser sessions and navigation [#23](https://github.com/schneems/rundoc/pull/23)
|
23
|
+
- Fix issue where a background task's log file was not present before it was attempted to be opened.
|
24
|
+
- Allow composability of documents `rundoc.depend_on` and `rundoc.require` [#19](https://github.com/schneems/rundoc/pull/19)
|
25
|
+
- The `rundoc` command is now `rundoc.configure`.
|
26
|
+
- Ignore chdir warning since that affect is intentional [#20](https://github.com/schneems/rundoc/pull/20)
|
27
|
+
|
1
28
|
## 1.0.0
|
2
29
|
|
3
30
|
- Now using a propper PEG parser (parslet)
|
data/Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
FROM ruby:2.6.3-stretch
|
2
|
+
|
3
|
+
RUN useradd rundoc
|
4
|
+
RUN curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
|
5
|
+
|
6
|
+
RUN apt-get clean && apt-get update && apt-get install -y locales nodejs
|
7
|
+
|
8
|
+
RUN locale-gen en_US.UTF-8
|
9
|
+
ENV LC_ALL=C.UTF-8
|
10
|
+
ENV LANG=en_US.UTF-8
|
11
|
+
ENV LANGUAGE=en_US.UTF-8
|
12
|
+
ENV DISABLE_SPRING=1
|
13
|
+
|
14
|
+
WORKDIR /home/rundoc
|
15
|
+
RUN mkdir -p /home/rundoc/ && chown -R rundoc:rundoc /home/rundoc
|
16
|
+
USER rundoc
|
17
|
+
RUN mkdir -p /home/rundoc/workdir
|
18
|
+
|
19
|
+
RUN git config --global user.email "developer@example.com"
|
20
|
+
RUN git config --global user.name "Dev Eloper"
|
21
|
+
|
22
|
+
ADD Gemfile Gemfile.lock
|
23
|
+
|
24
|
+
RUN bundle install
|
data/README.md
CHANGED
@@ -4,34 +4,29 @@
|
|
4
4
|
|
5
5
|
## What
|
6
6
|
|
7
|
-
This library allows you to "run" your docs and embed the code as well as results back into the documentation.
|
7
|
+
This library allows you to "run" your docs and embed the code as well as results back into the documentation. Here's a quick example:
|
8
8
|
|
9
|
-
Write
|
9
|
+
Write documentation:
|
10
10
|
|
11
|
-
|
11
|
+
Install by running:
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
## Why
|
18
|
-
|
19
|
-
I wrote a [Rails course for the University of Texas](http://schneems.com), that required I build an app and write
|
20
|
-
documentation at the same time. I enjoyed the experience but having to do both essentially doubled my work load, worse than the time wasted copying snippets between the two was my docs were prone to paste errors, keyboard slips, or me just forgetting to add sections that I had implemented in the app. The only way for me to find these errors was to give the docs to someone to actually follow them and build the project. This method of manually checking is extremely time consuming, prone to errors (the developer may work around problems instead of reporting them to you), and makes making minor edits a major pain. Instead of writing your docs once and iterating, I found adding sections required me to start from scratch.
|
21
|
-
|
22
|
-
|
23
|
-
While I was writing the course I dreamed of a system where the docs and the
|
24
|
-
code could automatically stay in sync. One where if I had a typo in my tutorials, an automatic tech-editor would know and tell me. One where I couldn't accidentally skip over critical sections leaving true novices confused.
|
13
|
+
```
|
14
|
+
:::>> $ gem install rails --no-document
|
15
|
+
```
|
25
16
|
|
26
|
-
|
17
|
+
Now if you "run" this document you'll get this output:
|
27
18
|
|
28
|
-
|
19
|
+
Install by running:
|
29
20
|
|
30
|
-
|
21
|
+
```
|
22
|
+
$ gem install rails --no-document
|
23
|
+
Successfully installed rails-5.2.2
|
24
|
+
1 gem installed
|
25
|
+
```
|
31
26
|
|
32
|
-
|
27
|
+
The idea is that as your documentation "runs" it builds a working tutorial. It also acts as tests since if your docs become incorrect due to a typo or bit-rot then when you try to generate them, the process will fail.
|
33
28
|
|
34
|
-
|
29
|
+
Think of RunDOC as your ever-vigilant tech editor and writing partner.
|
35
30
|
|
36
31
|
## Install
|
37
32
|
|
@@ -44,7 +39,7 @@ $ gem install rundoc
|
|
44
39
|
or add it to your Gemfile:
|
45
40
|
|
46
41
|
```
|
47
|
-
gem 'rundoc
|
42
|
+
gem 'rundoc'
|
48
43
|
```
|
49
44
|
|
50
45
|
## Use It
|
@@ -52,32 +47,53 @@ gem 'rundoc`
|
|
52
47
|
Run the `rundoc build` command on any markdown file
|
53
48
|
|
54
49
|
```sh
|
55
|
-
$ rundoc build --path
|
50
|
+
$ rundoc build --path my/path/to/run_doc.md
|
56
51
|
```
|
57
52
|
|
58
|
-
Note: This command will create and manipulate directories in the working directory of your source markdown file. Best practice is to have your source markdown file in its own empty directory.
|
53
|
+
> Note: This command will create and manipulate directories in the working directory of your source markdown file. Best practice is to have your source markdown file in its own empty directory.
|
59
54
|
|
60
55
|
This will generate a project folder with your project in it, and a markdown README.md with the parsed output of the markdown docs, and a copy of the source.
|
61
56
|
|
62
57
|
## Quick docs
|
63
58
|
|
64
|
-
- [
|
65
|
-
- [
|
66
|
-
- [
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
-
|
71
|
-
- [
|
72
|
-
- [
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
59
|
+
- [Understanding the Syntax](#rundoc-syntax)
|
60
|
+
- [Dotenv support](#dotenv-support)
|
61
|
+
- [Rendering cheat sheet](#rendering-cheat-sheet)
|
62
|
+
|
63
|
+
### Commands
|
64
|
+
|
65
|
+
- Execute Bash Commands
|
66
|
+
- [$](#shell-commands)
|
67
|
+
- [fail.$](#shell-commands)
|
68
|
+
- Chain commands
|
69
|
+
- [pipe](#pipe)
|
70
|
+
- [|](#pipe)
|
71
|
+
- Manipulate Files
|
72
|
+
- [file.write](#file-commands)
|
73
|
+
- [file.append](#file-commands)
|
74
|
+
- [file.remove](#file-commands)
|
75
|
+
- Boot background processes such as a local server
|
76
|
+
- [background.start](#background)
|
77
|
+
- [background.stop](#background)
|
78
|
+
- [background.log.read](#background)
|
79
|
+
- [background.log.clear](#background)
|
80
|
+
- Take screenshots
|
81
|
+
- [website.visit](#screenshots)
|
82
|
+
- [website.nav](#screenshots)
|
83
|
+
- [website.screenshot](#screenshots)
|
84
|
+
- Configure RunDOC
|
85
|
+
- [rundoc.configure](#configure)
|
86
|
+
- Import and compose documents
|
87
|
+
- [rundoc.depend_on](#compose-multiple-rundoc-documents)
|
88
|
+
- [rundoc.require](#compose-multiple-rundoc-documents)
|
89
|
+
|
90
|
+
## RunDOC Syntax
|
91
|
+
|
92
|
+
RunDOC uses GitHub flavored markdown. This means you write like normal but in your code sections
|
93
|
+
you can add special annotations that when run through RunDOC can
|
78
94
|
generate a project.
|
79
95
|
|
80
|
-
All
|
96
|
+
All RunDOC commands are prefixed with three colons `:::` and are inclosed in a code block a
|
81
97
|
command such as `$` which is an alias for `bash` commands like this:
|
82
98
|
|
83
99
|
```
|
@@ -112,26 +128,7 @@ This code block might generate an output something like this to your markdown do
|
|
112
128
|
Gemfile.lock Rakefile config db lib public test vendor
|
113
129
|
```
|
114
130
|
|
115
|
-
|
116
|
-
|
117
|
-
## Rendering Cheat Sheet
|
118
|
-
|
119
|
-
An arrow `>` is shorthand for "render this" and a dash `-` is shorthand for skip this section. The posions two positions are command first and result second. You can skip a trailing `-`.
|
120
|
-
|
121
|
-
|
122
|
-
- `:::>-` (yes command, not result)
|
123
|
-
- `:::>>` (yes command, yes result)
|
124
|
-
- `:::--` (not command, not result)
|
125
|
-
- `:::->` (not command, yes result)
|
126
|
-
|
127
|
-
## Shell Commands
|
128
|
-
|
129
|
-
Current Commands:
|
130
|
-
|
131
|
-
- `$`
|
132
|
-
- `fail.$`
|
133
|
-
|
134
|
-
Anything you pass to `$` will be run in a shell. Any items below the command will be passed into the stdin of the bash command so:
|
131
|
+
Any items below the command will be passed into the stdin of the command. For example using a `$` command you can effectively pipe contents to stdin:
|
135
132
|
|
136
133
|
```
|
137
134
|
:::>> $ tail -n 2
|
@@ -151,7 +148,76 @@ Would output:
|
|
151
148
|
|
152
149
|
This STDIN feature could be useful if you are running an interactive command such as `play new` which requires user input. For more fine grained input you'll need to use a custom repl object (will be covered later).
|
153
150
|
|
154
|
-
|
151
|
+
Different commands will do different things with this input. For example the `rundoc` command executes Ruby configuration code:
|
152
|
+
|
153
|
+
```
|
154
|
+
:::-- rundoc
|
155
|
+
Rundoc.configure do |config|
|
156
|
+
config.after_build do
|
157
|
+
puts "you could push to GitHub here"
|
158
|
+
puts "You could do anything here"
|
159
|
+
puts "This code will run after the docs are done building"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
```
|
163
|
+
|
164
|
+
|
165
|
+
And the `website.visit` command allows you to navigate and manipulate a webpage via a Capybara API:
|
166
|
+
|
167
|
+
```
|
168
|
+
:::>> website.visit(name: "localhost", url: "http://localhost:3000", scroll: 100)
|
169
|
+
session.execute_script "window.scrollBy(0,100)"
|
170
|
+
session.click("sign up")
|
171
|
+
```
|
172
|
+
|
173
|
+
### Exact output
|
174
|
+
|
175
|
+
RunDOC only cares about things that come after a `:::` section. If you have a "regular" code section, it will be rendered as as normal:
|
176
|
+
|
177
|
+
```
|
178
|
+
$ echo "I won't run since i'm missing the :::>> at the front"
|
179
|
+
```
|
180
|
+
|
181
|
+
You can mix non-command code and commands, as long as the things that aren't rendering come first. This can be used to "fake" a command, for example:
|
182
|
+
|
183
|
+
```
|
184
|
+
$ rails new myapp # Not a command since it's missing the ":::>>""
|
185
|
+
:::-> $ rails new myapp --skip-test --skip-yarn --skip-sprockets
|
186
|
+
:::>> | $ head -n 5
|
187
|
+
```
|
188
|
+
|
189
|
+
This will render as:
|
190
|
+
|
191
|
+
```
|
192
|
+
$ rails new myapp # Not a command since it's missing the ":::>>""
|
193
|
+
create
|
194
|
+
create README.md
|
195
|
+
create Rakefile
|
196
|
+
create .ruby-version
|
197
|
+
create config.ru
|
198
|
+
```
|
199
|
+
|
200
|
+
It looks like the command was run without any flags, but in reality `rails new myapp --skip-test --skip-yarn --skip-sprockets | head -n 5` was executed.
|
201
|
+
|
202
|
+
## Rendering Cheat Sheet
|
203
|
+
|
204
|
+
An arrow `>` is shorthand for "render this" and a dash `-` is shorthand for skip this section. The two positions are **command** first and **result** second.
|
205
|
+
|
206
|
+
|
207
|
+
- `:::>-` (YES command output, not result output)
|
208
|
+
- `:::>>` (YES command output, YES result output)
|
209
|
+
- `:::--` (not command output, not result output)
|
210
|
+
- `:::->` (not command output, YES result output)
|
211
|
+
|
212
|
+
## Shell Commands
|
213
|
+
|
214
|
+
Current Commands:
|
215
|
+
|
216
|
+
- `$`
|
217
|
+
- `fail.$`
|
218
|
+
|
219
|
+
Anything you pass to `$` will be run in a shell. If a shell command returns a non-zero exit status an error will be raised. If you expect a non-zero exit status use `fail.$` instead:
|
220
|
+
|
155
221
|
|
156
222
|
```
|
157
223
|
:::>> fail.$ cat /dev/null/foo
|
@@ -176,7 +242,8 @@ Some commands may be custom, for example when running `cd` you likely want to ch
|
|
176
242
|
However this command would fall on its face:
|
177
243
|
|
178
244
|
```
|
179
|
-
:::>> $ cd myapp
|
245
|
+
:::>> $ cd myapp && cat config/database.yml
|
246
|
+
:::>> $ rails g scaffold users # <=== This command would be in the wrong directory, not `myapp`
|
180
247
|
```
|
181
248
|
|
182
249
|
These custom commands are kept to a minimum, and for the most part behave as you would expect them to. Write your docs as you normally would and check the output frequently.
|
@@ -191,9 +258,7 @@ Current Commands:
|
|
191
258
|
- `file.append`
|
192
259
|
- `file.remove`
|
193
260
|
|
194
|
-
|
195
|
-
|
196
|
-
Use the `file.write` keyword followed by a filename, on the next line(s) put the contents of the file
|
261
|
+
Use the `file.write` keyword followed by a filename, on the next line(s) put the contents of the file:
|
197
262
|
|
198
263
|
```
|
199
264
|
:::>- file.write config/routes.rb
|
@@ -207,6 +272,8 @@ Use the `file.write` keyword followed by a filename, on the next line(s) put the
|
|
207
272
|
end
|
208
273
|
```
|
209
274
|
|
275
|
+
> If the exact filename is not known you can use a [file glob (\*)](https://GitHub.com/schneems/rundoc/pull/6).
|
276
|
+
|
210
277
|
If you wanted to change `users` to `products` you could write to the same file again.
|
211
278
|
|
212
279
|
```
|
@@ -294,7 +361,6 @@ You can stop the process by referencing the name:
|
|
294
361
|
|
295
362
|
You can also get the log contents:
|
296
363
|
|
297
|
-
|
298
364
|
```
|
299
365
|
:::>> background.log.read(name: "server")
|
300
366
|
```
|
@@ -305,26 +371,106 @@ You can also truncate the logs:
|
|
305
371
|
:::>> background.log.clear(name: "server")
|
306
372
|
```
|
307
373
|
|
374
|
+
## Screenshots
|
375
|
+
|
376
|
+
You'll need selenium and `chromedriver` installed on your system to make screenshots work. On a mac you can run:
|
377
|
+
|
378
|
+
```
|
379
|
+
$ brew cask install chromedriver
|
380
|
+
```
|
381
|
+
|
382
|
+
To take a screenshot first "visit" a website. The values you pass in to stdin can be used to further navigate. For more information see the [Capybara DSL](https://www.rubydoc.info/GitHub/teamcapybara/capybara/master#the-dsl). Use the keyword `session`
|
383
|
+
|
384
|
+
Once you're on the page you want to capture you can execute `website.screenshot`:
|
385
|
+
|
386
|
+
```
|
387
|
+
:::>> website.visit(name: "localhost", url: "http://localhost:3000", scroll: 100)
|
388
|
+
session.execute_script "window.scrollBy(0,100)"
|
389
|
+
session.first(:link, "sign up").click
|
390
|
+
|
391
|
+
:::>> website.screenshot(name: "localhost")
|
392
|
+
```
|
393
|
+
|
394
|
+
The result of the screenshot command will be to replace the code section with a markdown link to a relative path of the screenshot.
|
395
|
+
|
396
|
+
Once you've visited a website you can further navigate using `website.nav` or `website.navigate`:
|
397
|
+
|
398
|
+
|
399
|
+
```
|
400
|
+
:::>> website.visit(name: "localhost", url: "http://localhost:3000")
|
401
|
+
:::>> website.navigate(name: "localhost")
|
402
|
+
session.execute_script "window.scrollBy(0,100)"
|
403
|
+
session.first(:link, "sign up").click
|
404
|
+
|
405
|
+
:::>> website.screenshot(name: "localhost")
|
406
|
+
```
|
407
|
+
|
408
|
+
## Upload Screenshots
|
409
|
+
|
410
|
+
You can specify that you want to upload files to S3 instead of hosting them locally by passing in `upload: "s3"` to the screenshot command:
|
411
|
+
|
412
|
+
```
|
413
|
+
:::>> website.visit(name: "localhost", url: "http://localhost:3000", scroll: 100)
|
414
|
+
:::>> website.screenshot(name: "localhost", upload: "s3")
|
415
|
+
```
|
416
|
+
|
417
|
+
To authorize, you'll need to set these environment variables:
|
418
|
+
|
419
|
+
```
|
420
|
+
AWS_ACCESS_KEY_ID
|
421
|
+
AWS_REGION
|
422
|
+
AWS_SECRET_ACCESS_KEY
|
423
|
+
AWS_BUCKET_NAME
|
424
|
+
```
|
425
|
+
|
426
|
+
The bucketeer addon on Heroku is supported out of the box. To specify project specific environment variables see the "dotenv" section below.
|
427
|
+
|
428
|
+
## Compose multiple RunDOC documents
|
429
|
+
|
430
|
+
If you're writing multiple tutorials that all are used together to build one larger project then you can declare dependencies inside of your RunDOC document.
|
431
|
+
|
432
|
+
For example on day two (`day_two/rundoc.md`) of the tutorials you could:
|
433
|
+
|
434
|
+
```
|
435
|
+
:::-- rundoc.depend_on "../day_one/rundoc.md"
|
436
|
+
```
|
437
|
+
|
438
|
+
Now when you build `day_two/rundoc.md` it will also run the steps in `day_one/rundoc.md` first. This way you don't have to copy and paste previous commands.
|
439
|
+
|
440
|
+
You can also break up your document into smaller components:
|
441
|
+
|
442
|
+
|
443
|
+
```
|
444
|
+
:::>> rundoc.require "../shared/rails_new.md"
|
445
|
+
```
|
446
|
+
|
447
|
+
This will replace the code section with the generated contents of `rundoc.require`.
|
448
|
+
|
449
|
+
|
450
|
+
## Dotenv support
|
451
|
+
|
452
|
+
If you need to specify project specific environment variables create a file called `.env` at the same directory as your `rundoc.md` and it will be imported. Add this file to your `.gitignore` so you don't accidentally share with the world
|
453
|
+
|
308
454
|
## Configure
|
309
455
|
|
310
|
-
You can configure your docs in your docs use the `
|
456
|
+
You can configure your docs in your docs use the `RunDOC` command
|
311
457
|
|
312
458
|
```
|
313
|
-
:::-- rundoc
|
459
|
+
:::-- rundoc.configure
|
314
460
|
```
|
315
461
|
|
316
462
|
Note: Make sure you run this as a hidden command (with `-`).
|
317
463
|
|
318
|
-
**
|
464
|
+
**After Build**
|
319
465
|
|
320
466
|
This will eval any code you put under that line (in Ruby). If you want to run some code after you're done building your docs you could use `Rundoc.configure` block and call the `after_build` method like this:
|
321
467
|
|
322
468
|
|
323
469
|
```
|
324
|
-
:::-- rundoc
|
470
|
+
:::-- rundoc.configure
|
325
471
|
Rundoc.configure do |config|
|
326
472
|
config.after_build do
|
327
|
-
puts "you could push to
|
473
|
+
puts "you could push to GitHub here"
|
328
474
|
puts "You could do anything here"
|
329
475
|
puts "This code will run after the docs are done building"
|
330
476
|
end
|
@@ -334,10 +480,10 @@ This will eval any code you put under that line (in Ruby). If you want to run so
|
|
334
480
|
|
335
481
|
**Project Root**
|
336
482
|
|
337
|
-
By default your app builds in a `tmp` directory. If any failures occur the results will remain in `tmp`. On a successful build the contents are copied over to `project`. If you are generating a new rails project in your code `$ rails new myapp`. Then the finished directory would be in `project/myapp`. If you don't like the `./project` prefix you could tell
|
483
|
+
By default your app builds in a `tmp` directory. If any failures occur the results will remain in `tmp`. On a successful build the contents are copied over to `project`. If you are generating a new rails project in your code `$ rails new myapp`. Then the finished directory would be in `project/myapp`. If you don't like the `./project` prefix you could tell RunDOC to output contents in `./myapp` instead.
|
338
484
|
|
339
485
|
```
|
340
|
-
:::-- rundoc
|
486
|
+
:::-- rundoc.configure
|
341
487
|
Rundoc.configure do |config|
|
342
488
|
config.project_root = "myapp"
|
343
489
|
end
|
@@ -350,39 +496,14 @@ This will also be the root directory that the `after_build` is executed in.
|
|
350
496
|
Sometimes sensitive info like usernames, email addresses, or passwords may be introduced to the output readme. Let's say that your email address was `schneems@example.com` you could filter this out of your final document and replace it with `developer@example.com` instead like this:
|
351
497
|
|
352
498
|
```
|
353
|
-
:::-- rundoc
|
499
|
+
:::-- rundoc.configure
|
354
500
|
Rundoc.configure do |config|
|
355
|
-
config.filter_sensitive("schneems@
|
501
|
+
config.filter_sensitive("schneems@example.com" => "developer@example.com")
|
356
502
|
end
|
357
503
|
```
|
358
504
|
|
359
505
|
This command `filter_sensitive` can be called multiple times with different values. Since the config is in Ruby you could iterate over an array of sensitive data
|
360
506
|
|
361
|
-
##
|
362
|
-
|
363
|
-
This is a section for brainstorming. If it's here it's not guaranteed to get worked on, but it will be considered.
|
364
|
-
|
365
|
-
- Seperate parsing from running. This will help for easier linting of syntax etc.
|
366
|
-
- Cache SHAs and output of each code block. If one sha changes, re-generate all code blocks, otherwise allow a re-render without code execution. Configure a check sum for busting the cache for instance a new version of Rails is released.
|
367
|
-
|
368
|
-
|
369
|
-
- A way to run background processes indefinitely such as `rails server`
|
370
|
-
- Maybe a way to truncate them after only a period of time such as grab a few lines of `heroku local`.
|
371
|
-
|
372
|
-
|
373
|
-
```
|
374
|
-
:::>- background.start(command: "rails server")
|
375
|
-
```
|
376
|
-
|
377
|
-
```
|
378
|
-
:::>> background.read("rails server")
|
379
|
-
:::>- | $ head -n 23
|
380
|
-
:::>- background.clear
|
381
|
-
```
|
382
|
-
|
507
|
+
## Copyright
|
383
508
|
|
384
|
-
|
385
|
-
- Better line matching for backtrace
|
386
|
-
- `-=` command (runs command, only shows output, does not show command) ?
|
387
|
-
- An easy test syntax?
|
388
|
-
- Screenshot tool(s) ?!?!?!?!?!?! :)
|
509
|
+
All content Copyright Richard Schneeman © 2020
|