markdown_exec 3.0.0 → 3.0.1
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 +7 -0
- data/Gemfile.lock +1 -1
- data/bats/block-type-ux-invalid.bats +1 -1
- data/bats/block-type-ux-required-variables.bats +14 -2
- data/bats/import.bats +8 -0
- data/docs/dev/block-type-ux-required-variables.md +1 -1
- data/lib/cached_nested_file_reader.rb +3 -1
- data/lib/constants.rb +1 -1
- data/lib/hash_delegator.rb +30 -20
- data/lib/markdown_exec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6105f345e0f4e3b856fc2209f92872c3ab08aa1f7dadab2e3dba4fa686a8d20c
|
4
|
+
data.tar.gz: 3463e2cf4f292621d34007a55953744769047747c62fb20408e9a3c7070dc617
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz: '
|
6
|
+
metadata.gz: dd25c39ccfefc8d5db5dd8ec985a4c7537824f631e916b18a17236504ea077eac24bc45eed13bd13756dad18ab045422c583b8479d32e9379219dc7f58682f7b
|
7
|
+
data.tar.gz: '084bc0518c1b016c738361f2dcc076cf0f51e5cb56b91b54f21880be09198b2d2176a5428ae2f2dfcedd09de34e73f45c278c13c705db04cc83b3bda8a8f5cb5'
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -4,5 +4,5 @@ load 'test_helper'
|
|
4
4
|
|
5
5
|
@test 'automatic block is invalid YAML' {
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-invalid.md \
|
7
|
-
'_Error: HashDelegator
|
7
|
+
'_Error: HashDelegator.ItrBlkFrmNstFls:1¤./docs/dev/block-type-ux-invalid.md:1 - --- !ruby/object:NullResult_message: Invalid YAML_data: invalid_ -- -- '
|
8
8
|
}
|
@@ -2,7 +2,19 @@
|
|
2
2
|
|
3
3
|
load 'test_helper'
|
4
4
|
|
5
|
-
@test 'An undefined variable is a precondition' {
|
5
|
+
@test 'An undefined variable is a precondition - initial' {
|
6
6
|
spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-required-variables.md \
|
7
|
-
'
|
7
|
+
'SPECIES='
|
8
8
|
}
|
9
|
+
|
10
|
+
# hangs
|
11
|
+
# Enter a value: []: #<Errno::EISDIR: Is a directory @ io_fillbuf - fd:12 test>
|
12
|
+
# ["/Users/fareed/Documents/dev/ruby/markdown_exec/lib/hash_delegator.rb:4650:in `gets'",
|
13
|
+
# "/Users/fareed/Documents/dev/ruby/markdown_exec/lib/hash_delegator.rb:4650:in `gets'",
|
14
|
+
# "/Users/fareed/Documents/dev/ruby/markdown_exec/lib/hash_delegator.rb:4650:in `block in ux_block_export_activated'",
|
15
|
+
#
|
16
|
+
#@test 'An undefined variable is a precondition - active' {
|
17
|
+
# spec_mde_xansi_dname_doc_blocks_expect docs/dev/block-type-ux-required-variables.md \
|
18
|
+
# test \
|
19
|
+
# 'A value must exist for: MISSING_VARIABLE_SPECIES='
|
20
|
+
#}
|
data/bats/import.bats
CHANGED
@@ -14,3 +14,11 @@ load 'test_helper'
|
|
14
14
|
spec_mde_args_expect docs/dev/import-missing.md \
|
15
15
|
' Error: CachedNestedFileReader.readlines -- No such file or directory - this-is-missing.md @@ '
|
16
16
|
}
|
17
|
+
|
18
|
+
@test 'Directives - import; list block ids' {
|
19
|
+
BATS_OUTPUT_FILTER=A
|
20
|
+
BATS_SAFE=_
|
21
|
+
spec_mde_args_expect docs/dev/import.md \
|
22
|
+
--list-block-message id --list-blocks \
|
23
|
+
'ItrBlkFrmNstFls:1¤./docs/dev/specs-import.md:0_ItrBlkFrmNstFls:4¤./docs/dev/specs-import.md:3_ItrBlkFrmNstFls:7¤./docs/dev/specs-import.md:6'
|
24
|
+
}
|
@@ -39,6 +39,8 @@ class CachedNestedFileReader
|
|
39
39
|
)
|
40
40
|
end
|
41
41
|
|
42
|
+
# yield each line to the block
|
43
|
+
# return the processed lines
|
42
44
|
def readlines(filename, depth = 0, context: '', import_paths: nil,
|
43
45
|
indention: '', &block)
|
44
46
|
if @file_cache.key?(filename)
|
@@ -70,7 +72,7 @@ class CachedNestedFileReader
|
|
70
72
|
indention: import_indention,
|
71
73
|
&block)
|
72
74
|
else
|
73
|
-
nested_line = NestedLine.new(line, depth, indention)
|
75
|
+
nested_line = NestedLine.new(line, depth, indention, filename, ind)
|
74
76
|
processed_lines.push(nested_line)
|
75
77
|
block&.call(nested_line)
|
76
78
|
end
|
data/lib/constants.rb
CHANGED
data/lib/hash_delegator.rb
CHANGED
@@ -1098,7 +1098,8 @@ module MarkdownExec
|
|
1098
1098
|
block,
|
1099
1099
|
mdoc,
|
1100
1100
|
force: @delegate_object[:ux_auto_load_force_default],
|
1101
|
-
only_default: true
|
1101
|
+
only_default: true,
|
1102
|
+
silent: true
|
1102
1103
|
)
|
1103
1104
|
if command_result_w_e_t_nl.failure?
|
1104
1105
|
merged_options
|
@@ -1111,7 +1112,8 @@ module MarkdownExec
|
|
1111
1112
|
# parse YAML body defining the UX for a single variable
|
1112
1113
|
# set ENV value for the variable and return code lines for the same
|
1113
1114
|
def code_from_ux_block_to_set_environment_variables(
|
1114
|
-
selected, mdoc, inherited_code: nil, force: true, only_default: false
|
1115
|
+
selected, mdoc, inherited_code: nil, force: true, only_default: false,
|
1116
|
+
silent:
|
1115
1117
|
)
|
1116
1118
|
exit_prompt = @delegate_object[:prompt_filespec_back]
|
1117
1119
|
|
@@ -1161,7 +1163,7 @@ module MarkdownExec
|
|
1161
1163
|
command_result_w_e_t_nl =
|
1162
1164
|
ux_block_export_activated(eval_code, export, exit_prompt)
|
1163
1165
|
if command_result_w_e_t_nl.failure?
|
1164
|
-
warn command_result_w_e_t_nl.warning if command_result_w_e_t_nl.warning&.present?
|
1166
|
+
warn command_result_w_e_t_nl.warning if command_result_w_e_t_nl.warning&.present? && !silent
|
1165
1167
|
return command_result_w_e_t_nl
|
1166
1168
|
end
|
1167
1169
|
end
|
@@ -2019,7 +2021,8 @@ module MarkdownExec
|
|
2019
2021
|
command_result_w_e_t_nl = code_from_ux_block_to_set_environment_variables(
|
2020
2022
|
selected,
|
2021
2023
|
@dml_mdoc,
|
2022
|
-
inherited_code: @dml_link_state.inherited_lines
|
2024
|
+
inherited_code: @dml_link_state.inherited_lines,
|
2025
|
+
silent: true
|
2023
2026
|
)
|
2024
2027
|
### TBD if command_result_w_e_t_nl.failure?
|
2025
2028
|
next_state_append_code(
|
@@ -2581,7 +2584,7 @@ module MarkdownExec
|
|
2581
2584
|
end
|
2582
2585
|
|
2583
2586
|
def export_echo_with_code(
|
2584
|
-
bash_script_lines, export, force:
|
2587
|
+
bash_script_lines, export, force:, silent:
|
2585
2588
|
)
|
2586
2589
|
exportable = true
|
2587
2590
|
command_result = nil
|
@@ -2596,7 +2599,7 @@ module MarkdownExec
|
|
2596
2599
|
)
|
2597
2600
|
if command_result.exit_status == EXIT_STATUS_REQUIRED_EMPTY
|
2598
2601
|
exportable = false
|
2599
|
-
command_result.warning = warning_required_empty(export)
|
2602
|
+
command_result.warning = warning_required_empty(export) unless silent
|
2600
2603
|
end
|
2601
2604
|
|
2602
2605
|
when Hash
|
@@ -2609,7 +2612,7 @@ module MarkdownExec
|
|
2609
2612
|
)
|
2610
2613
|
)
|
2611
2614
|
if command_result.exit_status == EXIT_STATUS_REQUIRED_EMPTY
|
2612
|
-
command_result.warning = warning_required_empty(export)
|
2615
|
+
command_result.warning = warning_required_empty(export) unless silent
|
2613
2616
|
else
|
2614
2617
|
ENV[name] = command_result.stdout.to_s
|
2615
2618
|
new_lines << code_line_safe_assign(name, command_result.stdout,
|
@@ -2937,17 +2940,20 @@ module MarkdownExec
|
|
2937
2940
|
|
2938
2941
|
state = initial_state
|
2939
2942
|
selected_types = yield :filter
|
2943
|
+
index = 0
|
2940
2944
|
cfile.readlines(
|
2941
2945
|
@delegate_object[:filename],
|
2942
2946
|
import_paths: options_import_paths
|
2943
|
-
)
|
2944
|
-
next
|
2947
|
+
) do |nested_line|
|
2948
|
+
next if nested_line.nil?
|
2945
2949
|
|
2946
2950
|
update_line_and_block_state(
|
2947
2951
|
nested_line, state, selected_types,
|
2948
|
-
source_id: "
|
2952
|
+
source_id: "ItrBlkFrmNstFls:#{index}¤#{nested_line.filename}:#{nested_line.index}",
|
2949
2953
|
&block
|
2950
2954
|
)
|
2955
|
+
|
2956
|
+
index += 1
|
2951
2957
|
end
|
2952
2958
|
end
|
2953
2959
|
|
@@ -2962,10 +2968,8 @@ module MarkdownExec
|
|
2962
2968
|
else
|
2963
2969
|
iter_blocks_from_nested_files do |btype, fcb|
|
2964
2970
|
case btype
|
2965
|
-
when :blocks
|
2966
|
-
|
2967
|
-
when :filter
|
2968
|
-
%i[blocks]
|
2971
|
+
when :blocks; yield fcb
|
2972
|
+
when :filter; %i[blocks]
|
2969
2973
|
end
|
2970
2974
|
end
|
2971
2975
|
end
|
@@ -4587,7 +4591,7 @@ module MarkdownExec
|
|
4587
4591
|
new_lines = []
|
4588
4592
|
command_result = nil
|
4589
4593
|
|
4590
|
-
case as = FCB.act_source(export)
|
4594
|
+
case as = FCB.act_source(export)
|
4591
4595
|
when false, UxActSource::FALSE
|
4592
4596
|
raise 'Should not be reached.'
|
4593
4597
|
|
@@ -4599,7 +4603,8 @@ module MarkdownExec
|
|
4599
4603
|
command_result, exportable, new_lines = export_echo_with_code(
|
4600
4604
|
bash_script_lines,
|
4601
4605
|
export,
|
4602
|
-
force: true
|
4606
|
+
force: true,
|
4607
|
+
silent: false
|
4603
4608
|
)
|
4604
4609
|
if command_result.failure?
|
4605
4610
|
command_result
|
@@ -4634,7 +4639,8 @@ module MarkdownExec
|
|
4634
4639
|
command_result, exportable, new_lines = export_echo_with_code(
|
4635
4640
|
bash_script_lines,
|
4636
4641
|
export,
|
4637
|
-
force: true
|
4642
|
+
force: true,
|
4643
|
+
silent: false
|
4638
4644
|
)
|
4639
4645
|
|
4640
4646
|
command_result
|
@@ -4688,6 +4694,7 @@ module MarkdownExec
|
|
4688
4694
|
exportable = true
|
4689
4695
|
new_lines = []
|
4690
4696
|
command_result = nil
|
4697
|
+
silent = true
|
4691
4698
|
|
4692
4699
|
case FCB.init_source(export)
|
4693
4700
|
when false, UxActSource::FALSE
|
@@ -4703,7 +4710,8 @@ module MarkdownExec
|
|
4703
4710
|
command_result, exportable, new_lines = export_echo_with_code(
|
4704
4711
|
bash_script_lines,
|
4705
4712
|
export,
|
4706
|
-
force: false
|
4713
|
+
force: false,
|
4714
|
+
silent: silent
|
4707
4715
|
)
|
4708
4716
|
unless command_result.failure?
|
4709
4717
|
command_result.stdout = (exportable && command_result.stdout.split("\n").first) || ''
|
@@ -4732,7 +4740,8 @@ module MarkdownExec
|
|
4732
4740
|
command_result, exportable, new_lines = export_echo_with_code(
|
4733
4741
|
bash_script_lines,
|
4734
4742
|
export,
|
4735
|
-
force: false
|
4743
|
+
force: false,
|
4744
|
+
silent: silent
|
4736
4745
|
)
|
4737
4746
|
|
4738
4747
|
when ':exec', UxActSource::EXEC
|
@@ -4750,7 +4759,7 @@ module MarkdownExec
|
|
4750
4759
|
# add message for required variables
|
4751
4760
|
if command_result.exit_status == EXIT_STATUS_REQUIRED_EMPTY
|
4752
4761
|
command_result.warning = warning_required_empty(export)
|
4753
|
-
warn command_result.warning
|
4762
|
+
warn command_result.warning unless silent
|
4754
4763
|
end
|
4755
4764
|
|
4756
4765
|
command_result.exportable = exportable
|
@@ -5198,6 +5207,7 @@ module MarkdownExec
|
|
5198
5207
|
mdoc_menu_and_blocks_from_nested_files(
|
5199
5208
|
@dml_link_state, source_id: source_id
|
5200
5209
|
)
|
5210
|
+
|
5201
5211
|
dump_delobj(@dml_blocks_in_file, @dml_menu_blocks, @dml_link_state)
|
5202
5212
|
end
|
5203
5213
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_exec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fareed Stevenson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|