markdown_exec 3.0.6 → 3.0.8
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/Gemfile.lock +1 -1
- data/lib/command_result.rb +11 -50
- data/lib/evaluate_shell_expressions.rb +5 -0
- data/lib/fcb.rb +1 -1
- data/lib/hash_delegator.rb +34 -9
- 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: fd2355b28f935804fb135a650cc4260276be2bed20a8ed33cf9d188e01734466
|
4
|
+
data.tar.gz: 9e001b6252ebc4f012408e8a43373ab49b474d72982fc9bbc653c93e6d39c497
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a17c1e662569ae1b0f34ecbb63571120c3d56bc2efdde29651240ec6d6d07e0f24e361ae9c95d34725f5c9f6a1c2d6f18fc9aad9971bdba3e2b2f850f14418d5
|
7
|
+
data.tar.gz: 95184776dfde2e6579aa18e0893a9f54180c2b641d65263f0d47f5533512611f3b92c9012959bb18c0c263ca3f50dccc42e4f69651f46a4af878d02784ce40ba
|
data/Gemfile.lock
CHANGED
data/lib/command_result.rb
CHANGED
@@ -14,45 +14,6 @@
|
|
14
14
|
# result.new_field = 42
|
15
15
|
# result.new_field # => 42
|
16
16
|
# result.success? # => true
|
17
|
-
|
18
|
-
# require 'ostruct'
|
19
|
-
|
20
|
-
# class CommandResult < OpenStruct
|
21
|
-
# def initialize(**attributes)
|
22
|
-
# # Set defaults
|
23
|
-
# defaults = { exit_status: 0, stdout: '' }
|
24
|
-
# super(defaults.merge(attributes))
|
25
|
-
# end
|
26
|
-
|
27
|
-
# def failure?
|
28
|
-
# !success?
|
29
|
-
# end
|
30
|
-
|
31
|
-
# def success?
|
32
|
-
# exit_status.zero?
|
33
|
-
# end
|
34
|
-
|
35
|
-
# # intercept specific getters and setters
|
36
|
-
# def new_lines
|
37
|
-
# # read current value
|
38
|
-
# # binding.irb
|
39
|
-
# v = self[:new_lines]
|
40
|
-
# ww caller.deref[0..4], v
|
41
|
-
# v
|
42
|
-
# end
|
43
|
-
|
44
|
-
# # Intercept specific setter
|
45
|
-
# def new_lines=(value)
|
46
|
-
# ww caller.deref[0..4], value
|
47
|
-
# # binding.irb
|
48
|
-
# super(value)
|
49
|
-
# end
|
50
|
-
# end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
17
|
class CommandResult
|
57
18
|
# @param attributes [Hash{Symbol=>Object}] initial named attributes
|
58
19
|
def initialize(**attributes)
|
@@ -71,17 +32,17 @@ class CommandResult
|
|
71
32
|
exit_status.zero?
|
72
33
|
end
|
73
34
|
|
74
|
-
def new_lines
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
# trap assignment to new_lines
|
81
|
-
def new_lines=(value)
|
82
|
-
|
83
|
-
|
84
|
-
end
|
35
|
+
# def new_lines
|
36
|
+
# value = @attributes[:new_lines]
|
37
|
+
# ww caller.deref[0..4], value
|
38
|
+
# value
|
39
|
+
# end
|
40
|
+
|
41
|
+
# # trap assignment to new_lines
|
42
|
+
# def new_lines=(value)
|
43
|
+
# ww caller.deref[0..4], value
|
44
|
+
# @attributes[:new_lines] = value
|
45
|
+
# end
|
85
46
|
|
86
47
|
def method_missing(name, *args)
|
87
48
|
key = name.to_s.chomp('=').to_sym
|
@@ -45,6 +45,11 @@ def evaluate_shell_expressions(initial_code, expressions, shell: '/bin/bash',
|
|
45
45
|
end
|
46
46
|
|
47
47
|
result_hash
|
48
|
+
|
49
|
+
rescue StandardError
|
50
|
+
ww $@, $!, caller.deref
|
51
|
+
ww initial_code, expressions
|
52
|
+
raise StandardError, $!
|
48
53
|
end
|
49
54
|
|
50
55
|
return if $PROGRAM_NAME != __FILE__
|
data/lib/fcb.rb
CHANGED
data/lib/hash_delegator.rb
CHANGED
@@ -994,6 +994,9 @@ module MarkdownExec
|
|
994
994
|
initial_code_required: false,
|
995
995
|
occurrence_expressions: nil
|
996
996
|
)
|
997
|
+
ww commands
|
998
|
+
ww link_state
|
999
|
+
# binding.irb####
|
997
1000
|
evaluate_shell_expressions(
|
998
1001
|
(link_state&.inherited_lines_block || ''),
|
999
1002
|
commands,
|
@@ -1110,9 +1113,11 @@ module MarkdownExec
|
|
1110
1113
|
selected, mdoc, inherited_code: nil, force: true, only_default: false,
|
1111
1114
|
silent:
|
1112
1115
|
)
|
1116
|
+
ww selected
|
1113
1117
|
ret_command_result = nil
|
1114
1118
|
exit_prompt = @delegate_object[:prompt_filespec_back]
|
1115
1119
|
|
1120
|
+
ww \
|
1116
1121
|
required = mdoc.collect_recursively_required_code(
|
1117
1122
|
anyname: selected.pub_name,
|
1118
1123
|
label_format_above: @delegate_object[:shell_code_label_format_above],
|
@@ -1187,6 +1192,9 @@ module MarkdownExec
|
|
1187
1192
|
end
|
1188
1193
|
|
1189
1194
|
ret_command_result || CommandResult.new(stdout: required_lines)
|
1195
|
+
rescue StandardError
|
1196
|
+
ww $@, $!
|
1197
|
+
HashDelegator.error_handler('code_from_ux_block_to_set_environment_variables')
|
1190
1198
|
end
|
1191
1199
|
|
1192
1200
|
def env_set(name, value)
|
@@ -2532,6 +2540,7 @@ module MarkdownExec
|
|
2532
2540
|
end
|
2533
2541
|
|
2534
2542
|
def expand_references!(fcb, link_state)
|
2543
|
+
ww fcb, link_state, caller.deref
|
2535
2544
|
expand_variable_references!(
|
2536
2545
|
blocks: [fcb],
|
2537
2546
|
echo_formatter: method(:format_echo_command),
|
@@ -2574,15 +2583,22 @@ module MarkdownExec
|
|
2574
2583
|
link_state:,
|
2575
2584
|
pattern:
|
2576
2585
|
)
|
2586
|
+
ww blocks####
|
2587
|
+
ww link_state
|
2588
|
+
# binding.irb
|
2577
2589
|
variable_counts, occurrence_expressions = count_named_group_occurrences(
|
2578
2590
|
blocks, pattern, group_name: group_name
|
2579
2591
|
)
|
2580
2592
|
return if variable_counts.nil? || variable_counts == {}
|
2593
|
+
ww [variable_counts, occurrence_expressions]
|
2581
2594
|
|
2595
|
+
ww \
|
2582
2596
|
echo_commands = generate_echo_commands(
|
2583
2597
|
variable_counts, formatter: echo_formatter
|
2584
2598
|
)
|
2585
2599
|
|
2600
|
+
ww link_state
|
2601
|
+
ww \
|
2586
2602
|
replacements = build_replacement_dictionary(
|
2587
2603
|
echo_commands, link_state,
|
2588
2604
|
initial_code_required: initial_code_required,
|
@@ -2590,8 +2606,13 @@ module MarkdownExec
|
|
2590
2606
|
)
|
2591
2607
|
|
2592
2608
|
return if replacements.nil?
|
2593
|
-
|
2609
|
+
if replacements == EvaluateShellExpression::StatusFail
|
2610
|
+
# happens on first processing of blocks before requirements are met
|
2611
|
+
ww "EvaluateShellExpression::StatusFail", echo_commands, link_state
|
2612
|
+
return
|
2613
|
+
end
|
2594
2614
|
|
2615
|
+
ww \
|
2595
2616
|
expand_blocks_with_replacements(blocks, replacements)
|
2596
2617
|
# no return
|
2597
2618
|
end
|
@@ -2602,10 +2623,10 @@ module MarkdownExec
|
|
2602
2623
|
exportable = true
|
2603
2624
|
command_result = nil
|
2604
2625
|
new_lines = []
|
2605
|
-
export_string = string
|
2626
|
+
export_string = string.nil? ? export.echo : string
|
2606
2627
|
case export_string
|
2607
2628
|
when String, Integer, Float, TrueClass, FalseClass
|
2608
|
-
command_result, = output_from_adhoc_bash_script_file(
|
2629
|
+
command_result, exportable, new_lines = output_from_adhoc_bash_script_file(
|
2609
2630
|
join_array_of_arrays(
|
2610
2631
|
bash_script_lines,
|
2611
2632
|
%(printf '%s' "#{export_string}")
|
@@ -2994,7 +3015,7 @@ module MarkdownExec
|
|
2994
3015
|
# convert single items to arrays
|
2995
3016
|
def join_array_of_arrays(*args)
|
2996
3017
|
args.map do |item|
|
2997
|
-
item.is_a?(Array) ? item : [item]
|
3018
|
+
item.nil? ? nil : (item.is_a?(Array) ? item : [item])
|
2998
3019
|
end.compact.flatten(1)
|
2999
3020
|
end
|
3000
3021
|
|
@@ -4746,8 +4767,9 @@ module MarkdownExec
|
|
4746
4767
|
command_result = CommandResult.new(stdout: output)
|
4747
4768
|
|
4748
4769
|
when :exec, UxActSource::EXEC
|
4749
|
-
command_result, = output_from_adhoc_bash_script_file(
|
4750
|
-
join_array_of_arrays(bash_script_lines, export.exec)
|
4770
|
+
command_result, exportable, new_lines = output_from_adhoc_bash_script_file(
|
4771
|
+
join_array_of_arrays(bash_script_lines, export.exec),
|
4772
|
+
export
|
4751
4773
|
)
|
4752
4774
|
|
4753
4775
|
else
|
@@ -4792,7 +4814,8 @@ module MarkdownExec
|
|
4792
4814
|
join_array_of_arrays(
|
4793
4815
|
bash_script_lines,
|
4794
4816
|
%(printf '%s' "#{export.echo}")
|
4795
|
-
)
|
4817
|
+
),
|
4818
|
+
export
|
4796
4819
|
)
|
4797
4820
|
export_init = cr_echo.stdout.split("\n").first
|
4798
4821
|
command_result, exportable, new_lines = export_echo_with_code(
|
@@ -4805,8 +4828,9 @@ module MarkdownExec
|
|
4805
4828
|
|
4806
4829
|
when :exec, ExportValueSource::EXEC
|
4807
4830
|
# extract first line from 'exec' output
|
4808
|
-
command_result, = output_from_adhoc_bash_script_file(
|
4809
|
-
join_array_of_arrays(bash_script_lines, export.exec)
|
4831
|
+
command_result, exportable, new_lines = output_from_adhoc_bash_script_file(
|
4832
|
+
join_array_of_arrays(bash_script_lines, export.exec),
|
4833
|
+
export
|
4810
4834
|
)
|
4811
4835
|
unless command_result.failure?
|
4812
4836
|
export_init = command_result.stdout.split("\n").first
|
@@ -5313,6 +5337,7 @@ module MarkdownExec
|
|
5313
5337
|
mdoc_menu_and_blocks_from_nested_files(
|
5314
5338
|
@dml_link_state, source_id: source_id
|
5315
5339
|
)
|
5340
|
+
ww @dml_link_state####
|
5316
5341
|
dump_delobj(@dml_blocks_in_file, @dml_menu_blocks, @dml_link_state)
|
5317
5342
|
end
|
5318
5343
|
|
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.8
|
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-06-
|
11
|
+
date: 2025-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|