markdown_exec 3.0.4 → 3.0.6

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/Gemfile.lock +1 -1
  4. data/bats/block-type-ux-act-init.bats +17 -0
  5. data/bats/block-type-ux-echo-hash-transform.bats +8 -0
  6. data/bats/block-type-ux-echo.bats +1 -1
  7. data/bats/block-type-ux-sources.bats +1 -1
  8. data/bats/block-type-ux-transform.bats +1 -1
  9. data/bats/import-conflict.bats +11 -0
  10. data/bats/import-duplicates.bats +53 -0
  11. data/bats/variable-expansion-multiline.bats +1 -1
  12. data/bin/bmde +4 -3
  13. data/docs/dev/block-type-ux-act-init.md +187 -0
  14. data/docs/dev/block-type-ux-auto.md +0 -1
  15. data/docs/dev/block-type-ux-default.md +2 -2
  16. data/docs/dev/block-type-ux-echo-hash-transform.md +40 -0
  17. data/docs/dev/block-type-ux-echo.md +3 -0
  18. data/docs/dev/block-type-ux-exec.md +0 -1
  19. data/docs/dev/block-type-ux-sources.md +1 -1
  20. data/docs/dev/block-type-ux-transform.md +5 -4
  21. data/docs/dev/command-substitution.md +1 -0
  22. data/docs/dev/import-conflict-0.md +12 -0
  23. data/docs/dev/import-conflict-1.md +7 -0
  24. data/docs/dev/import-duplicates-0.md +17 -0
  25. data/docs/dev/import-duplicates-1.md +13 -0
  26. data/docs/dev/load_code.md +1 -0
  27. data/docs/dev/no-active-elements.md +1 -0
  28. data/docs/dev/variable-expansion-multiline.md +4 -1
  29. data/docs/ux-blocks-examples.md +120 -0
  30. data/docs/ux-blocks-init-act.md +100 -0
  31. data/lib/command_result.rb +51 -0
  32. data/lib/command_result_alternatives.rb +233 -0
  33. data/lib/env_interface.rb +57 -0
  34. data/lib/fcb.rb +1 -1
  35. data/lib/hash_delegator.rb +207 -123
  36. data/lib/markdown_exec/version.rb +1 -1
  37. data/lib/resize_terminal.rb +11 -5
  38. data/lib/ww.rb +4 -1
  39. metadata +16 -2
@@ -7,5 +7,5 @@ module MarkdownExec
7
7
  BIN_NAME = 'mde'
8
8
  GEM_NAME = 'markdown_exec'
9
9
  TAP_DEBUG = 'MDE_DEBUG'
10
- VERSION = '3.0.4'
10
+ VERSION = '3.0.6'
11
11
  end
@@ -4,6 +4,7 @@
4
4
  # encoding=utf-8
5
5
  require 'io/console'
6
6
  require 'timeout'
7
+ require_relative 'env_interface'
7
8
 
8
9
  # This function attempts to resize the terminal to its maximum supported size.
9
10
  # It checks if the script is running in an interactive terminal with no arguments.
@@ -49,7 +50,9 @@ def resize_terminal(show_dims: false, show_rectangle: false,
49
50
 
50
51
  calculated_rows, calculated_columns = match_data.captures.map(&:to_i)
51
52
 
52
- if ENV['COLUMNS'].to_i == calculated_columns && ENV['LINES'].to_i == calculated_rows
53
+ if EnvInterface.get('COLUMNS',
54
+ transform: lambda(&:to_i)) == calculated_columns &&
55
+ EnvInterface.get('LINES', transform: lambda(&:to_i)) == calculated_rows
53
56
  puts "#{ENV.fetch('TERM', nil)} #{calculated_columns}x#{calculated_rows}"
54
57
  elsif calculated_columns.positive? && calculated_rows.positive?
55
58
  warn "#{ENV.fetch('COLUMNS',
@@ -70,6 +73,9 @@ rescue Timeout::Error
70
73
  rescue StandardError => err
71
74
  warn "Error: #{err.message}. Unsupported terminal emulator."
72
75
  1
76
+ ensure
77
+ EnvInterface.set('COLUMNS', @original_columns)
78
+ EnvInterface.set('LINES', @original_lines)
73
79
  end
74
80
 
75
81
  # This function draws a rectangle of the given width and height
@@ -96,8 +102,8 @@ class ResizeTerminalTest < Minitest::Test
96
102
  def teardown
97
103
  # Restore original ARGV and environment variables
98
104
  ARGV.replace(@original_argv)
99
- ENV['COLUMNS'] = @original_columns
100
- ENV['LINES'] = @original_lines
105
+ EnvInterface.set('COLUMNS', @original_columns)
106
+ EnvInterface.set('LINES', @original_lines)
101
107
  end
102
108
 
103
109
  # def test_resize_terminal_successful
@@ -119,8 +125,8 @@ class ResizeTerminalTest < Minitest::Test
119
125
  $stdin.stub(:tty?, true) do
120
126
  ARGV.replace([])
121
127
  columns = 40 + (2 * rand(10))
122
- ENV['COLUMNS'] = columns.to_s
123
- ENV['LINES'] = '24'
128
+ EnvInterface.set('COLUMNS', columns.to_s)
129
+ EnvInterface.set('LINES', '24')
124
130
  response = "\e[999;999H\e[6n\e[24;#{columns}R".dup
125
131
  $stdin.stub(:getch, -> { response.slice!(0) || '' }) do
126
132
  assert_output(/xterm-256color #{columns}x24$/) do
data/lib/ww.rb CHANGED
@@ -87,9 +87,12 @@ end
87
87
 
88
88
  class Array
89
89
  unless defined?(deref)
90
- def deref
90
+ def deref(count = 4)
91
+ dir_pwd = Dir.pwd
91
92
  map(&:deref).reject do |line|
92
93
  %r{^/(vendor|\.bundle)/}.match(line)
94
+ end.first(count).map do |line|
95
+ line.sub(dir_pwd, '.')
93
96
  end
94
97
  end
95
98
  end
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
4
+ version: 3.0.6
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-29 00:00:00.000000000 Z
11
+ date: 2025-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -112,10 +112,12 @@ files:
112
112
  - bats/block-type-link.bats
113
113
  - bats/block-type-opts.bats
114
114
  - bats/block-type-port.bats
115
+ - bats/block-type-ux-act-init.bats
115
116
  - bats/block-type-ux-allowed.bats
116
117
  - bats/block-type-ux-auto.bats
117
118
  - bats/block-type-ux-chained.bats
118
119
  - bats/block-type-ux-default.bats
120
+ - bats/block-type-ux-echo-hash-transform.bats
119
121
  - bats/block-type-ux-echo-hash.bats
120
122
  - bats/block-type-ux-echo.bats
121
123
  - bats/block-type-ux-exec.bats
@@ -135,6 +137,8 @@ files:
135
137
  - bats/document-shell.bats
136
138
  - bats/fail.bats
137
139
  - bats/history.bats
140
+ - bats/import-conflict.bats
141
+ - bats/import-duplicates.bats
138
142
  - bats/import.bats
139
143
  - bats/indented-block-type-vars.bats
140
144
  - bats/indented-multi-line-output.bats
@@ -164,10 +168,12 @@ files:
164
168
  - docs/dev/block-type-bash.md
165
169
  - docs/dev/block-type-opts.md
166
170
  - docs/dev/block-type-port.md
171
+ - docs/dev/block-type-ux-act-init.md
167
172
  - docs/dev/block-type-ux-allowed.md
168
173
  - docs/dev/block-type-ux-auto.md
169
174
  - docs/dev/block-type-ux-chained.md
170
175
  - docs/dev/block-type-ux-default.md
176
+ - docs/dev/block-type-ux-echo-hash-transform.md
171
177
  - docs/dev/block-type-ux-echo-hash.md
172
178
  - docs/dev/block-type-ux-echo.md
173
179
  - docs/dev/block-type-ux-exec.md
@@ -186,6 +192,10 @@ files:
186
192
  - docs/dev/data-blocks.md
187
193
  - docs/dev/disable.md
188
194
  - docs/dev/document-shell.md
195
+ - docs/dev/import-conflict-0.md
196
+ - docs/dev/import-conflict-1.md
197
+ - docs/dev/import-duplicates-0.md
198
+ - docs/dev/import-duplicates-1.md
189
199
  - docs/dev/import-missing.md
190
200
  - docs/dev/import.md
191
201
  - docs/dev/indented-block-type-vars.md
@@ -213,6 +223,8 @@ files:
213
223
  - docs/dev/text-decoration.md
214
224
  - docs/dev/variable-expansion-multiline.md
215
225
  - docs/dev/variable-expansion.md
226
+ - docs/ux-blocks-examples.md
227
+ - docs/ux-blocks-init-act.md
216
228
  - examples/bash-blocks.md
217
229
  - examples/block-names.md
218
230
  - examples/block-types.md
@@ -270,9 +282,11 @@ files:
270
282
  - lib/color_scheme.rb
271
283
  - lib/colorize.rb
272
284
  - lib/command_result.rb
285
+ - lib/command_result_alternatives.rb
273
286
  - lib/constants.rb
274
287
  - lib/directory_searcher.rb
275
288
  - lib/env.rb
289
+ - lib/env_interface.rb
276
290
  - lib/error_reporting.rb
277
291
  - lib/evaluate_shell_expressions.rb
278
292
  - lib/exceptions.rb