markdown_exec 3.0.3 → 3.0.4
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/hash_delegator.rb +24 -19
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/mdoc.rb +9 -6
- 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: '05862fe57c684d4f2fd510c9bea4b54b9d035837d5865c32810c2c8ad08b76b2'
|
4
|
+
data.tar.gz: 6e9b150d5938c2a297dd34fb45420f1f6fb339c22ce3af59beb65b4b3558b72e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '020862e33c9713980663eb7840d2a5d3369c0c6cc7a40422fa87313c8206cf1ab287dc26c7f266d8ea25929ea4eabb4e08e5ac37cfcda112b7c8e768a9a73199'
|
7
|
+
data.tar.gz: 3bd45e67c4976d0391bb133650f524db7c6c0bd0550103f4346ffb8ebe9ef7d6aedfd4d78b80cae356772fd699ad55d5d4b6b1ce5b2a2b11762e9a5e0e47d2f1
|
data/Gemfile.lock
CHANGED
data/lib/hash_delegator.rb
CHANGED
@@ -1377,11 +1377,13 @@ module MarkdownExec
|
|
1377
1377
|
end
|
1378
1378
|
|
1379
1379
|
if allow_execution
|
1380
|
-
execute_required_lines(
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1380
|
+
execute_required_lines(
|
1381
|
+
blockname: selected.pub_name,
|
1382
|
+
erls: { play_bin: play_bin,
|
1383
|
+
shell: selected_shell(selected.shell) },
|
1384
|
+
required_lines: required_lines,
|
1385
|
+
shell: selected_shell(selected.shell)
|
1386
|
+
)
|
1385
1387
|
end
|
1386
1388
|
|
1387
1389
|
link_state.block_name = nil
|
@@ -1694,6 +1696,10 @@ module MarkdownExec
|
|
1694
1696
|
@prior_execution_block = nil
|
1695
1697
|
end
|
1696
1698
|
|
1699
|
+
def selected_shell(shell_name)
|
1700
|
+
shell_name.empty? ? shell : shell_name
|
1701
|
+
end
|
1702
|
+
|
1697
1703
|
# Determines the state of a selected block in the menu based
|
1698
1704
|
# on the selected option.
|
1699
1705
|
# It categorizes the selected option into either EXIT, BACK,
|
@@ -2490,7 +2496,7 @@ module MarkdownExec
|
|
2490
2496
|
if @delegate_object[:save_executed_script]
|
2491
2497
|
write_command_file(blockname: blockname,
|
2492
2498
|
required_lines: required_lines,
|
2493
|
-
shell: shell)
|
2499
|
+
shell: selected_shell(shell))
|
2494
2500
|
end
|
2495
2501
|
if @dml_block_state
|
2496
2502
|
calc_logged_stdout_filename(block_name: @dml_block_state.block.oname)
|
@@ -2498,7 +2504,7 @@ module MarkdownExec
|
|
2498
2504
|
format_and_execute_command(
|
2499
2505
|
code_lines: required_lines,
|
2500
2506
|
erls: erls,
|
2501
|
-
shell: shell
|
2507
|
+
shell: selected_shell(shell)
|
2502
2508
|
)
|
2503
2509
|
post_execution_process
|
2504
2510
|
end
|
@@ -2705,7 +2711,7 @@ module MarkdownExec
|
|
2705
2711
|
formatted_command,
|
2706
2712
|
args: @pass_args,
|
2707
2713
|
erls: erls,
|
2708
|
-
shell: shell
|
2714
|
+
shell: selected_shell(shell)
|
2709
2715
|
)
|
2710
2716
|
@fout.fout fetch_color(data_sym: :script_execution_tail,
|
2711
2717
|
color_sym: :script_execution_frame_color)
|
@@ -2968,8 +2974,8 @@ module MarkdownExec
|
|
2968
2974
|
else
|
2969
2975
|
iter_blocks_from_nested_files do |btype, fcb|
|
2970
2976
|
case btype
|
2971
|
-
when :blocks
|
2972
|
-
when :filter
|
2977
|
+
when :blocks then yield fcb
|
2978
|
+
when :filter then %i[blocks]
|
2973
2979
|
end
|
2974
2980
|
end
|
2975
2981
|
end
|
@@ -3138,9 +3144,9 @@ module MarkdownExec
|
|
3138
3144
|
opts_block_name)
|
3139
3145
|
return if selected_blocks.empty?
|
3140
3146
|
|
3141
|
-
dependency_map = selected_blocks.
|
3147
|
+
dependency_map = selected_blocks.to_h do |block|
|
3142
3148
|
[block.id, block.reqs]
|
3143
|
-
end
|
3149
|
+
end
|
3144
3150
|
|
3145
3151
|
selected_blocks.each do |block|
|
3146
3152
|
mdoc.collect_dependencies(memo: dependency_map, block: block)
|
@@ -3576,7 +3582,7 @@ module MarkdownExec
|
|
3576
3582
|
bash_script_lines
|
3577
3583
|
)
|
3578
3584
|
)
|
3579
|
-
temp_file.close
|
3585
|
+
temp_file.close # Close the file before chmod and execution
|
3580
3586
|
File.chmod(0o755, temp_file.path)
|
3581
3587
|
|
3582
3588
|
if @delegate_object[:archive_ad_hoc_scripts]
|
@@ -3587,8 +3593,7 @@ module MarkdownExec
|
|
3587
3593
|
`cp #{temp_file.path} #{archive_filename}`
|
3588
3594
|
end
|
3589
3595
|
|
3590
|
-
output =
|
3591
|
-
#### use shell per configuration
|
3596
|
+
output = `#{shell} #{temp_file.path}`
|
3592
3597
|
|
3593
3598
|
CommandResult.new(stdout: output, exit_status: $?.exitstatus)
|
3594
3599
|
end
|
@@ -3868,7 +3873,7 @@ module MarkdownExec
|
|
3868
3873
|
elsif sel == MenuOptions::SAVE_SCRIPT
|
3869
3874
|
save_to_file(
|
3870
3875
|
required_lines: required_lines, selected: selected,
|
3871
|
-
shell: selected.shell
|
3876
|
+
shell: selected_shell(selected.shell)
|
3872
3877
|
)
|
3873
3878
|
end
|
3874
3879
|
|
@@ -4204,7 +4209,7 @@ module MarkdownExec
|
|
4204
4209
|
required_lines:, selected:, shell:
|
4205
4210
|
)
|
4206
4211
|
write_command_file(
|
4207
|
-
required_lines: required_lines, blockname: selected.pub_name, shell: shell
|
4212
|
+
required_lines: required_lines, blockname: selected.pub_name, shell: selected_shell(shell)
|
4208
4213
|
)
|
4209
4214
|
@fout.fout "File saved: #{@run_state.saved_filespec}"
|
4210
4215
|
end
|
@@ -4215,7 +4220,7 @@ module MarkdownExec
|
|
4215
4220
|
saved_asset_format:
|
4216
4221
|
shell_escape_asset_format(
|
4217
4222
|
code_lines: link_state&.inherited_lines,
|
4218
|
-
shell: shell
|
4223
|
+
shell: selected_shell(shell)
|
4219
4224
|
)
|
4220
4225
|
).generate_name
|
4221
4226
|
end
|
@@ -4607,7 +4612,7 @@ module MarkdownExec
|
|
4607
4612
|
new_lines = []
|
4608
4613
|
command_result = nil
|
4609
4614
|
|
4610
|
-
case
|
4615
|
+
case FCB.act_source(export)
|
4611
4616
|
when false, UxActSource::FALSE
|
4612
4617
|
raise 'Should not be reached.'
|
4613
4618
|
|
data/lib/mdoc.rb
CHANGED
@@ -469,6 +469,9 @@ module MarkdownExec
|
|
469
469
|
else
|
470
470
|
blocks = [block]
|
471
471
|
end
|
472
|
+
blocks.each do |block|
|
473
|
+
memo[block.id] = []
|
474
|
+
end
|
472
475
|
return memo unless blocks.count.positive?
|
473
476
|
|
474
477
|
required_blocks = blocks.map(&:reqs).flatten(1)
|
@@ -542,11 +545,11 @@ if $PROGRAM_NAME == __FILE__
|
|
542
545
|
end if false
|
543
546
|
|
544
547
|
def test_collect_dependencies_with_valid_source
|
545
|
-
@mdoc.stubs(:
|
546
|
-
.with('source1').returns(OpenStruct.new(id: 'source1',
|
547
|
-
|
548
|
-
@mdoc.stubs(:
|
549
|
-
.with('source2').returns(OpenStruct.new(id: 'source2', reqs: []))
|
548
|
+
@mdoc.stubs(:get_blocks_by_anyname)
|
549
|
+
.with('source1').returns([OpenStruct.new(id: 'source1',
|
550
|
+
reqs: ['source2'])])
|
551
|
+
@mdoc.stubs(:get_blocks_by_anyname)
|
552
|
+
.with('source2').returns([OpenStruct.new(id: 'source2', reqs: [])])
|
550
553
|
|
551
554
|
expected = { 'source1' => ['source2'], 'source2' => [] }
|
552
555
|
assert_equal expected, @mdoc.collect_dependencies(pubname: 'source1')
|
@@ -627,7 +630,7 @@ if $PROGRAM_NAME == __FILE__
|
|
627
630
|
result = @doc.recursively_required_hash('block3')
|
628
631
|
assert_equal ({ 'block3' => ['block1'],
|
629
632
|
'block1' => ['block2'],
|
630
|
-
'block2' => nil }),
|
633
|
+
'block2' => [nil] }),
|
631
634
|
result
|
632
635
|
|
633
636
|
result_no_reqs = @doc.recursively_required_hash(nil)
|
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.4
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clipboard
|