markdown_exec 1.2.0 → 1.3.1

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
  SHA256:
3
- metadata.gz: 160eb660362db62302a05b8b46398c6d85357c917ee55eeb89a8ce0f739eec8a
4
- data.tar.gz: 706e575c290ec56d34ad58f06ca9e30127b2c0bdacf431a4c9e3f69bc30e80dc
3
+ metadata.gz: e0c996cc59c02f9cfff6948467f4714bfb7e010ec61f886b9508b4af1a80dbc6
4
+ data.tar.gz: 9cd5bbe3d4b59c5d272ae42bd58ef228132a4af6471ee7d31867a69742c8b9ea
5
5
  SHA512:
6
- metadata.gz: f540464a21a3ca2b654d89b3bc32f2172a3e610066bc64b9eae1bc29d99b8006ed3581998a50ae2327052c944656584375df55e64ffeeb77864ae05e45325e1c
7
- data.tar.gz: a22c5ff757a2b5173725786bdbc399cae29f63eda891a0741149286391cb413abbcccd3799bd15ec769230ed44245b49664d434c77c12610bc2cfc138a9d3ddb
6
+ metadata.gz: d2a005d3d3d4550644d470ea734902fb3ba796de73d115a041dccbcdee85a675956427ee20e8a6fb68df91c8a5b96cc820458f61120e71ab64f568563145689a
7
+ data.tar.gz: 3eadd9f350b5138f808b7ce986f2b6a5b8f747c650788c36b7d46b1ed17eccde6b018862c1334e1277fe29a27f617fe08d44b45e2bed6f182888713df813c04f
data/.reek CHANGED
@@ -11,7 +11,7 @@ detectors:
11
11
  ControlParameter:
12
12
  enabled: true
13
13
  DuplicateMethodCall:
14
- enabled: true
14
+ enabled: false # too strict
15
15
  FeatureEnvy:
16
16
  enabled: false # too strict
17
17
  InstanceVariableAssumption:
@@ -22,3 +22,8 @@ detectors:
22
22
  enabled: true
23
23
  LongYieldList:
24
24
  enabled: true
25
+ TooManyStatements:
26
+ enabled: false # too strict
27
+
28
+ exclude_paths:
29
+ - vendor/
data/.rubocop.yml CHANGED
@@ -6,6 +6,12 @@ AllCops:
6
6
  NewCops: enable
7
7
  TargetRubyVersion: 2.6
8
8
 
9
+ Layout/LeadingCommentSpace:
10
+ Enabled: false
11
+
12
+ Lint/SafeNavigationChain:
13
+ Enabled: false
14
+
9
15
  Metrics/AbcSize:
10
16
  Enabled: false
11
17
 
@@ -30,9 +36,24 @@ Metrics/MethodLength:
30
36
  Metrics/PerceivedComplexity:
31
37
  Enabled: false
32
38
 
39
+ Minitest/MultipleAssertions:
40
+ Enabled: false
41
+
42
+ Security/YAMLLoad:
43
+ Enabled: false
44
+
45
+ Style/CommentedKeyword:
46
+ Enabled: false
47
+
48
+ Style/DoubleNegation:
49
+ Enabled: false
50
+
33
51
  Style/GlobalVars:
34
52
  Enabled: false
35
53
 
54
+ Style/MixinUsage:
55
+ Enabled: false
56
+
36
57
  Style/MultilineBlockChain:
37
58
  Enabled: false
38
59
 
data/CHANGELOG.md CHANGED
@@ -7,8 +7,6 @@
7
7
  - hidden w , w/o () in names
8
8
  - fix regexp in pathnames
9
9
 
10
- - [ ] read file once to allow for tempdoc stream
11
-
12
10
  - tree display
13
11
 
14
12
  - [ ] mde options, user prompt, in md file or included file
@@ -39,6 +37,92 @@
39
37
  - [ ] ren logged_stdout_filename_prefix to saved_stdout_filename_prefix
40
38
  - [ ] ignore '#' in fenced code blocks
41
39
 
40
+ - [ ] write named block, can be included
41
+ - [ ] file type per block type
42
+ - [ ] file name per block name or specified in quotes ("")
43
+ - [ ] overwrite-rules for writing blocks
44
+ - [ ] erase-rules for written blocks
45
+ - [ ] files to create named at top of script to execute; written prior to start of script
46
+
47
+ - [ ] tab completion example ascii demo
48
+
49
+ - [ ] parameters or (env vars) in menu
50
+ - [ ] config menu or read env vars
51
+ - [ ] enable/disable script, output saving per file
52
+ - [ ] keep values between runs so same env vars are not prompted
53
+
54
+ - [ ] option to list full menu
55
+
56
+ - [ ] task confirmation block option or bash template, env names
57
+
58
+ - [ ] configuration block `mde_config` anywhere in file
59
+ - [ ] configuration block `mde_config` anywhere in folder config file
60
+ ```yaml :(mde_config)```
61
+ - [x] fix execution stdin, stdout to allow for ask function
62
+ - [ ] fix execution stdin, stdout to allow for tty-prompt
63
+ - [ ] accept stdin as filename `-`
64
+ - [ ] fix
65
+ $ bin/mde
66
+ Choose a file: * Exit
67
+ No blocks found.
68
+ Choose a block: * Exit
69
+
70
+ - [ ] accept `!` shell execute command at prompt
71
+ - [ ] menu response: re-exec last saved script (like mde --select-recent-script)
72
+
73
+ - [ ] process shebang in markdown
74
+ - [ ] ignore shebang in markdown in rest of processing
75
+ - [! ] search for document in path
76
+ - [! ] search for document in custom path
77
+ - [ ] doc use of `#!/usr/bin/env mde`
78
+ - [ ] command to export each command to file, menu for list
79
+ - [ ] list of fenced code blocks to ignore, eg ```expect or ```mermaid
80
+
81
+ ## [1.3.1] - 2022-10-29
82
+
83
+ ### Added
84
+
85
+ - Delay to allow all command output to be received
86
+ - Display an error message when the specified document file is missing
87
+ - Options to display, format and colorize menu dividers and demarcations
88
+ - Tab completion for short option names
89
+
90
+ ### Changed
91
+
92
+ - Fix handling of document supplied by process substitution
93
+
94
+ ## [1.3.0] - 2022-07-16
95
+
96
+ ### Added
97
+
98
+ - Short name `-p` for `--user-must-approve` option
99
+ Enable/disable pause for user to review and approve script
100
+ - Automatic wrapping for data in blocks of yaml data eg ` ```yaml `
101
+ Data is written to the file named in the fenced block heading
102
+ - Data transformations are embedded in the script at every invocation
103
+ with arguments to the transformation as stdin and stdout for the `yq` process
104
+ eg `export fruit_summary=$(yq e '[.fruit.name,.fruit.price]' fruit.yml)`
105
+ for invocation `%(summarize_fruits <fruit.yml >fruit_summary)`
106
+ and transformation `[.fruit.name,.fruit.price]`
107
+ - Option to extract document text and display it as disabled items in-line with the blocks in the selection menu.
108
+ Add options for constants used in parsing.
109
+ - [x] yaml processing
110
+ - ```yaml :(make_fruit_file) >fruit.yml```
111
+ write to: fruit.yml
112
+ - ```yq [summarize_fruits] +(make_fruit_file) <fruit.yml =color_price```
113
+ not included in linear script
114
+ read from: fruit.yml
115
+ result into var: color_price instead of stdout
116
+ - ```bash :show_fruit_yml +(summarize_fruits)```
117
+ include summarize_fruits
118
+ output value of var color_price
119
+
120
+ ### Changed
121
+
122
+ - Refactoring
123
+ - Run-time menu in YAML file.
124
+ - Tap module initialization
125
+
42
126
  ## [1.2.0] - 2022-06-11
43
127
 
44
128
  ### Added
@@ -180,7 +264,7 @@ e.g. `MDE_OUTPUT_VIEWER_OPTIONS="-a '/Applications/Sublime Text.app'" mde --sele
180
264
 
181
265
  | YAML Name | Environment Variable | Default |
182
266
  | :--- | :--- | :--- |
183
- | block_name_excluded_match | MDE_BLOCK_NAME_EXCLUDED_MATCH | `^\(.+\)$` |
267
+ | block_name_hidden_match | MDE_BLOCK_NAME_HIDDEN_MATCH | `^\(.+\)$` |
184
268
  | block_name_match | MDE_BLOCK_NAME_MATCH | `:(?<title>\S+)( \|$)` |
185
269
  | block_required_scan | MDE_BLOCK_REQUIRED_SCAN | `\+\S+` |
186
270
  | fenced_start_and_end_match | MDE_FENCED_START_AND_END_MATCH | ``^`{3,}`` |
data/Gemfile CHANGED
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # echo "gem: --no-document" >> ~/.gemrc
4
+ # bundle install --path vendor/bundle
5
+
3
6
  source 'https://rubygems.org'
4
7
 
5
8
  gemspec
@@ -8,9 +11,11 @@ gem 'erb'
8
11
  gem 'minitest', '~> 5.0'
9
12
  gem 'rake', '~> 13.0'
10
13
  gem 'reek'
14
+ # gem 'rspec'
11
15
  gem 'rubocop', '~> 1.21'
12
16
  gem 'rubocop-minitest', require: false
13
17
  gem 'rubocop-rake', require: false
18
+ # gem 'rubocop-rspec', require: false
14
19
  gem 'shellwords'
15
20
  gem 'uri'
16
21
  gem 'yaml'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (1.2.0)
4
+ markdown_exec (1.3.1)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -12,16 +12,17 @@ GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
14
  ast (2.4.2)
15
- cgi (0.3.2)
15
+ cgi (0.3.3)
16
16
  clipboard (1.3.6)
17
17
  erb (2.2.3)
18
18
  cgi
19
+ json (2.6.2)
19
20
  kwalify (0.7.2)
20
- minitest (5.15.0)
21
+ minitest (5.16.3)
21
22
  open3 (0.1.1)
22
23
  optparse (0.1.1)
23
- parallel (1.21.0)
24
- parser (3.1.1.0)
24
+ parallel (1.22.1)
25
+ parser (3.1.2.1)
25
26
  ast (~> 2.4.1)
26
27
  pastel (0.8.0)
27
28
  tty-color (~> 0.5)
@@ -31,20 +32,21 @@ GEM
31
32
  kwalify (~> 0.7.0)
32
33
  parser (~> 3.1.0)
33
34
  rainbow (>= 2.0, < 4.0)
34
- regexp_parser (2.2.1)
35
+ regexp_parser (2.6.0)
35
36
  rexml (3.2.5)
36
- rubocop (1.26.0)
37
+ rubocop (1.37.1)
38
+ json (~> 2.3)
37
39
  parallel (~> 1.10)
38
- parser (>= 3.1.0.0)
40
+ parser (>= 3.1.2.1)
39
41
  rainbow (>= 2.2.2, < 4.0)
40
42
  regexp_parser (>= 1.8, < 3.0)
41
- rexml
42
- rubocop-ast (>= 1.16.0, < 2.0)
43
+ rexml (>= 3.2.5, < 4.0)
44
+ rubocop-ast (>= 1.23.0, < 2.0)
43
45
  ruby-progressbar (~> 1.7)
44
46
  unicode-display_width (>= 1.4.0, < 3.0)
45
- rubocop-ast (1.16.0)
47
+ rubocop-ast (1.23.0)
46
48
  parser (>= 3.1.1.0)
47
- rubocop-minitest (0.18.0)
49
+ rubocop-minitest (0.22.2)
48
50
  rubocop (>= 0.90, < 2.0)
49
51
  rubocop-rake (0.6.0)
50
52
  rubocop (~> 1.0)
@@ -60,7 +62,7 @@ GEM
60
62
  tty-screen (~> 0.8)
61
63
  wisper (~> 2.0)
62
64
  tty-screen (0.8.1)
63
- unicode-display_width (2.1.0)
65
+ unicode-display_width (2.3.0)
64
66
  uri (0.11.0)
65
67
  wisper (2.0.1)
66
68
  yaml (0.2.0)
data/README.md CHANGED
@@ -49,7 +49,7 @@ Displays help information.
49
49
 
50
50
  #### `mde`
51
51
 
52
- Process `README.md` file in the current folder. Displays all the blocks in the file and allows you to select using [up], [down], and [return]. Press [ctrl]-c to abort selection.
52
+ Process `README.md` file in the current folder. Displays all the blocks in the file and allows you to select using [up], [down], and [return].
53
53
 
54
54
  #### `mde my.md` or `mde -f my.md`
55
55
 
@@ -159,7 +159,7 @@ echo "source $(mde --pwd)/bin/tab_completion.sh" >> ~/.bash_profile
159
159
  ### Behavior
160
160
 
161
161
  Press tab for completions appropriate to the current input.
162
- `mde <...> <prior word> <current word>`
162
+ `mde <...> <prior word> <current word><TAB>`
163
163
 
164
164
  Completions are calculated based on the current word and the prior word.
165
165
  1. If the current word starts with `-`, present matching options, eg `--version` for the current word `--v`.
@@ -171,7 +171,7 @@ Completions are calculated based on the current word and the prior word.
171
171
 
172
172
  In the table below, tab is indicated by `!`
173
173
  | Input | Completions |
174
- | :---: | :---: |
174
+ | :--- | :--- |
175
175
  | `mde !` | local files and folders |
176
176
  | `mde -!` | all options |
177
177
  | `mde --!` | all options |
@@ -213,4 +213,81 @@ The gem is available as open source under the terms of the [MIT License](https:/
213
213
 
214
214
  # Code of Conduct
215
215
 
216
- Everyone interacting in the MarkdownExec project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/markdown_exec/blob/master/CODE_OF_CONDUCT.md).
216
+ Everyone interacting in the MarkdownExec project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/fareedst/markdown_exec/blob/master/CODE_OF_CONDUCT.md).
217
+
218
+
219
+ ``` :test_vars +(echo_vars)
220
+ vars1=$(
221
+ echo '1'
222
+ whoami
223
+ echo '2'
224
+ pwd
225
+ echo '3'
226
+ stat README.md
227
+ echo '4'
228
+ /bin/ls
229
+ echo '5'
230
+ whoami
231
+ echo '6'
232
+ )
233
+ ```
234
+
235
+ ``` :(echo_vars)
236
+ echo "vars1: ${vars1:-missing}"
237
+ ```
238
+
239
+ ```bash :test_quick
240
+ cat README.md
241
+ ```
242
+
243
+ - `echo "gem: --no-document" >> ~/.gemrc`
244
+
245
+ - `bundle install --path vendor/bundle`
246
+
247
+ ```
248
+ bundle exec rake test
249
+ bundle exec rake rubocopminitest
250
+ # bundle exec rake reek
251
+ reek --config .reek .
252
+ ```
253
+
254
+ ```
255
+ bundle exec rake build
256
+ ```
257
+ includes Rake::Task['update_menu_yml'].execute
258
+ Rake::Task['update_tab_completion'].execute
259
+
260
+ ```
261
+ bundle exec rake uninstall
262
+ ```
263
+
264
+ ```
265
+ bundle exec rake install
266
+ ```
267
+
268
+ ```
269
+ bundle exec rake publish
270
+ ```
271
+
272
+ ```
273
+ bundle exec rake --tasks
274
+ ```
275
+ ```expect
276
+ rake build # Build markdown_exec-1.3.0.9.gem into the pkg directory / gem build
277
+ rake clean # Remove any temporary products / gem build clean
278
+ rake clobber # Remove any generated files
279
+ rake install # Build and install markdown_exec-1.3.0.9.gem into system gems / gem install
280
+ rake install:local # Build and install markdown_exec-1.3.0.9.gem into system gems without network access
281
+ rake publish # gem publish
282
+ rake reek # reek
283
+ rake release[remote] # Create tag v1.3.0.9 and build and push markdown_exec-1.3.0.9.gem to rubygems.org
284
+ rake rubocop # Run RuboCop
285
+ rake rubocop:autocorrect # Autocorrect RuboCop offenses (only when it's safe)
286
+ rake rubocop:autocorrect_all # Autocorrect RuboCop offenses (safe and unsafe)
287
+ rake rubocopminitest # named task because minitest not included in rubocop tests
288
+ rake test # Run tests
289
+ rake uninstall # gem uninstall
290
+ rake update_installed_tab_completion # update installed tab_completion.sh
291
+ rake update_menu_yml # update menu.yml
292
+ rake update_tab_completion # update tab_completion.sh
293
+ ```