rundoc 1.1.1 → 1.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +9 -11
- data/lib/rundoc/code_command/pipe.rb +6 -6
- data/lib/rundoc/version.rb +1 -1
- data/test/fixtures/rails_6/rundoc.md +5 -5
- data/test/rundoc/code_commands/pipe_test.rb +11 -1
- data/test/rundoc/peg_parser_test.rb +10 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64447cf981514498089c30f81d5a9885059db08ac2120b8bb700eed4089d0105
|
4
|
+
data.tar.gz: b46c802f280388c043adddcdfbe0a385fcf2bee8aa4c1fd76563452c7d24698c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf89810f545312fd23e6759015473f5d64e9991f7348344649a4b672a3e97e774702ec04d5d3b91f64b8ebb14caecf78ac0f2d583d423b1c3f25c1915eaa1e5a
|
7
|
+
data.tar.gz: 9b7f288a0b23806729f07690faf8ec1b295c45652e7db07253aba38019c50d0e30a1cfb4b9973cc97ef36ac78bb8a1139228ed9b9fc5cbf15658770817a13e5e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -39,7 +39,7 @@ $ gem install rundoc
|
|
39
39
|
or add it to your Gemfile:
|
40
40
|
|
41
41
|
```
|
42
|
-
gem 'rundoc
|
42
|
+
gem 'rundoc'
|
43
43
|
```
|
44
44
|
|
45
45
|
## Use It
|
@@ -128,8 +128,6 @@ This code block might generate an output something like this to your markdown do
|
|
128
128
|
Gemfile.lock Rakefile config db lib public test vendor
|
129
129
|
```
|
130
130
|
|
131
|
-
### Stdin
|
132
|
-
|
133
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:
|
134
132
|
|
135
133
|
```
|
@@ -203,13 +201,13 @@ It looks like the command was run without any flags, but in reality `rails new m
|
|
203
201
|
|
204
202
|
## Rendering Cheat Sheet
|
205
203
|
|
206
|
-
An arrow `>` is shorthand for "render this" and a dash `-` is shorthand for skip this section. The
|
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.
|
207
205
|
|
208
206
|
|
209
|
-
- `:::>-` (
|
210
|
-
- `:::>>` (
|
211
|
-
- `:::--` (not command, not result)
|
212
|
-
- `:::->` (not command,
|
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)
|
213
211
|
|
214
212
|
## Shell Commands
|
215
213
|
|
@@ -463,7 +461,7 @@ You can configure your docs in your docs use the `RunDOC` command
|
|
463
461
|
|
464
462
|
Note: Make sure you run this as a hidden command (with `-`).
|
465
463
|
|
466
|
-
**
|
464
|
+
**After Build**
|
467
465
|
|
468
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:
|
469
467
|
|
@@ -500,7 +498,7 @@ Sometimes sensitive info like usernames, email addresses, or passwords may be in
|
|
500
498
|
```
|
501
499
|
:::-- rundoc.configure
|
502
500
|
Rundoc.configure do |config|
|
503
|
-
config.filter_sensitive("schneems@
|
501
|
+
config.filter_sensitive("schneems@example.com" => "developer@example.com")
|
504
502
|
end
|
505
503
|
```
|
506
504
|
|
@@ -508,4 +506,4 @@ This command `filter_sensitive` can be called multiple times with different valu
|
|
508
506
|
|
509
507
|
## Copyright
|
510
508
|
|
511
|
-
All content Copyright Richard Schneeman ©
|
509
|
+
All content Copyright Richard Schneeman © 2020
|
@@ -8,6 +8,7 @@ module Rundoc
|
|
8
8
|
def initialize(line)
|
9
9
|
@delegate = parse(line)
|
10
10
|
end
|
11
|
+
|
11
12
|
# before: "",
|
12
13
|
# after: "",
|
13
14
|
# commands:
|
@@ -25,15 +26,14 @@ module Rundoc
|
|
25
26
|
end
|
26
27
|
|
27
28
|
private def parse(code)
|
28
|
-
parser = Rundoc::PegParser.new.
|
29
|
+
parser = Rundoc::PegParser.new.method_call
|
29
30
|
tree = parser.parse(code)
|
30
31
|
actual = Rundoc::PegTransformer.new.apply(tree)
|
31
32
|
|
32
|
-
if actual.is_a?(Array)
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
33
|
+
actual = actual.first if actual.is_a?(Array)
|
34
|
+
|
35
|
+
actual = Rundoc::CodeCommand::Bash.new(code) if actual.is_a?(Rundoc::CodeCommand::NoSuchCommand)
|
36
|
+
return actual
|
37
37
|
|
38
38
|
# Since `| tail -n 2` does not start with a `$` assume any "naked" commands
|
39
39
|
# are bash
|
data/lib/rundoc/version.rb
CHANGED
@@ -19,7 +19,7 @@ end
|
|
19
19
|
Ruby on Rails is a popular web framework written in [Ruby](http://www.ruby-lang.org/). This guide covers using Rails 6 on Heroku. For information on running previous versions of Rails on Heroku, see the tutorial for [Rails 5.x](getting-started-with-rails5) or [Rails 4.x](getting-started-with-rails4).
|
20
20
|
|
21
21
|
```
|
22
|
-
:::-- $ ruby -e "exit 1 unless RUBY_VERSION == '2.6.
|
22
|
+
:::-- $ ruby -e "exit 1 unless RUBY_VERSION == '2.6.6'"
|
23
23
|
```
|
24
24
|
|
25
25
|
For this guide you will need:
|
@@ -157,13 +157,13 @@ end
|
|
157
157
|
|
158
158
|
## Specify your Ruby version
|
159
159
|
|
160
|
-
Rails 6 requires Ruby 2.
|
160
|
+
Rails 6 requires Ruby 2.5.0 or above. Heroku has a recent version of Ruby installed by default, however you can specify an exact version by using the `ruby` DSL in your `Gemfile`. Depending on your version of Ruby that you are currently running it might look like this:
|
161
161
|
|
162
162
|
|
163
163
|
```ruby
|
164
164
|
:::-- $ sed -i'' -e '/^ruby/d' ./Gemfile
|
165
165
|
:::-> file.append Gemfile#4
|
166
|
-
ruby "2.6.
|
166
|
+
ruby "2.6.6"
|
167
167
|
```
|
168
168
|
|
169
169
|
You should also be running the same version of Ruby locally. You can check this by running `$ ruby -v`. You can get more information on [specifying your Ruby version on Heroku here](https://devcenter.heroku.com/articles/ruby-versions).
|
@@ -222,7 +222,7 @@ If you see `fatal: not in a git directory` then you are likely not in the correc
|
|
222
222
|
Deploy your code:
|
223
223
|
|
224
224
|
```term
|
225
|
-
:::>> $ git push heroku master
|
225
|
+
:::>> $ git push heroku main || git push heroku master
|
226
226
|
```
|
227
227
|
|
228
228
|
It is always a good idea to check to see if there are any warnings or errors in the output. If everything went well you can migrate your database.
|
@@ -376,7 +376,7 @@ Looks good, so press `Ctrl+C` to exit and you can deploy your changes to Heroku:
|
|
376
376
|
```term
|
377
377
|
:::>- $ git add .
|
378
378
|
:::>- $ git commit -m "use puma via procfile"
|
379
|
-
:::>- $ git push heroku master
|
379
|
+
:::>- $ git push heroku main || git push heroku master
|
380
380
|
```
|
381
381
|
|
382
382
|
Check `ps`. You'll see that the web process uses your new command specifying Puma as the web server.
|
@@ -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
|
@@ -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
|
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.1.
|
4
|
+
version: 1.1.2
|
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: 2020-
|
11
|
+
date: 2020-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -225,7 +225,7 @@ homepage: https://github.com/schneems/rundoc
|
|
225
225
|
licenses:
|
226
226
|
- MIT
|
227
227
|
metadata: {}
|
228
|
-
post_install_message:
|
228
|
+
post_install_message:
|
229
229
|
rdoc_options: []
|
230
230
|
require_paths:
|
231
231
|
- lib
|
@@ -240,8 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
240
240
|
- !ruby/object:Gem::Version
|
241
241
|
version: '0'
|
242
242
|
requirements: []
|
243
|
-
rubygems_version: 3.
|
244
|
-
signing_key:
|
243
|
+
rubygems_version: 3.0.3
|
244
|
+
signing_key:
|
245
245
|
specification_version: 4
|
246
246
|
summary: RunDOC generates runable code from docs
|
247
247
|
test_files:
|