markdown_exec 0.0.1 → 0.0.3

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: 631d15d315eeb3a40ef3458f9b0577d4b2f5f9eeddbcdd3ad26c9d2cb1e28c3a
4
- data.tar.gz: f1fdebc4461fb7b5f3b37ebd2f8d369cbe804621cc42ca8c672baec5ea0c4f74
3
+ metadata.gz: 0103a836804fd50f493ec31ad7899a7b1235c1b26feb2ce30b8f2738657f820f
4
+ data.tar.gz: 0b2cbd8e447e0dab4c6f63c3d23cd1c952841a713414df49193cef0495d0fca4
5
5
  SHA512:
6
- metadata.gz: f597613ff0bd0c556e0c205168d32653b4a4cd71cd93c24549b0b9f3f18dd8551ca301ac618f191fa005dfdbfaceef6263e4fe18cb229244c20c989b8fb99ac4
7
- data.tar.gz: c890e7187a1394e37f56a81e7f3a2a64dbd3ec0fe8f6d9b904089b9d7b3d10a89c7df476aac2ff3bc437c50137d89f28bea8f4711995f2b1ed8f660785dd76ae
6
+ metadata.gz: df473dc9a66adae26932f11268f2a9d7fd4faae7949a0ab8b97a148916f41a679173d1500696e3d822ff49c9d730a7e9e28ac7601e19fb9c6edd513c042da05f
7
+ data.tar.gz: 8bb208972a34a57a9e2008a081e957e6e11a1e4d2e69aae28575e8af6afb3d8199116799b324e202706c909b3760f0b4c92d7c8f1b6a332ce98e00c01f560464
data/.rubocop.yml CHANGED
@@ -1,6 +1,36 @@
1
1
  AllCops:
2
2
  TargetRubyVersion: 2.6
3
3
 
4
+ Metrics/AbcSize:
5
+ Enabled: false
6
+
7
+ Metrics/BlockLength:
8
+ Enabled: false
9
+
10
+ Metrics/BlockNesting:
11
+ Enabled: false
12
+
13
+ Metrics/ClassLength:
14
+ Enabled: false
15
+
16
+ Metrics/CyclomaticComplexity:
17
+ Enabled: false
18
+
19
+ # Metrics/LayoutLength:
20
+ # Enabled: false
21
+
22
+ Metrics/MethodLength:
23
+ Enabled: false
24
+
25
+ Metrics/PerceivedComplexity:
26
+ Enabled: false
27
+
28
+ Style/GlobalVars:
29
+ Enabled: false
30
+
31
+ Style/MultilineBlockChain:
32
+ Enabled: false
33
+
4
34
  Style/StringLiterals:
5
35
  Enabled: true
6
36
  EnforcedStyle: single_quotes
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in markdown_exec.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
8
+ gem 'rake', '~> 13.0'
9
9
 
10
- gem "minitest", "~> 5.0"
10
+ gem 'minitest', '~> 5.0'
11
11
 
12
- gem "rubocop", "~> 1.21"
12
+ gem 'rubocop', '~> 1.21'
data/Gemfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ markdown_exec (0.0.3)
5
+ tty-prompt (~> 0.23.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ minitest (5.15.0)
12
+ parallel (1.21.0)
13
+ parser (3.1.1.0)
14
+ ast (~> 2.4.1)
15
+ pastel (0.8.0)
16
+ tty-color (~> 0.5)
17
+ rainbow (3.1.1)
18
+ rake (13.0.6)
19
+ regexp_parser (2.2.1)
20
+ rexml (3.2.5)
21
+ rubocop (1.26.0)
22
+ parallel (~> 1.10)
23
+ parser (>= 3.1.0.0)
24
+ rainbow (>= 2.2.2, < 4.0)
25
+ regexp_parser (>= 1.8, < 3.0)
26
+ rexml
27
+ rubocop-ast (>= 1.16.0, < 2.0)
28
+ ruby-progressbar (~> 1.7)
29
+ unicode-display_width (>= 1.4.0, < 3.0)
30
+ rubocop-ast (1.16.0)
31
+ parser (>= 3.1.1.0)
32
+ ruby-progressbar (1.11.0)
33
+ tty-color (0.6.0)
34
+ tty-cursor (0.7.1)
35
+ tty-prompt (0.23.1)
36
+ pastel (~> 0.8)
37
+ tty-reader (~> 0.8)
38
+ tty-reader (0.9.0)
39
+ tty-cursor (~> 0.7)
40
+ tty-screen (~> 0.8)
41
+ wisper (~> 2.0)
42
+ tty-screen (0.8.1)
43
+ unicode-display_width (2.1.0)
44
+ wisper (2.0.1)
45
+
46
+ PLATFORMS
47
+ arm64-darwin-21
48
+
49
+ DEPENDENCIES
50
+ markdown_exec!
51
+ minitest (~> 5.0)
52
+ rake (~> 13.0)
53
+ rubocop (~> 1.21)
54
+
55
+ BUNDLED WITH
56
+ 2.2.32
data/Rakefile CHANGED
@@ -1,37 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rake/testtask"
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
5
 
6
6
  Rake::TestTask.new(:test) do |t|
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/*_test.rb"]
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
10
  end
11
11
 
12
- require "rubocop/rake_task"
12
+ require 'rubocop/rake_task'
13
13
 
14
14
  RuboCop::RakeTask.new
15
15
 
16
16
  task default: %i[test rubocop]
17
17
 
18
- GEM_NAME = "pagekey"
19
- GEM_VERSION = "0.0.0"
18
+ GEM_NAME = 'markdown_exec'
19
+ GEM_VERSION = '0.0.3'
20
20
 
21
21
  # task :default => :build
22
22
 
23
23
  task :build do
24
- system "gem build " + GEM_NAME + ".gemspec"
24
+ system "gem build #{GEM_NAME}.gemspec"
25
25
  end
26
26
 
27
- task :install => :build do
28
- system "gem install " + GEM_NAME + "-" + GEM_VERSION + ".gem"
27
+ task install: :build do
28
+ system "gem install #{GEM_NAME}-#{GEM_VERSION}.gem"
29
29
  end
30
30
 
31
- task :publish => :build do
32
- system 'gem push ' + GEM_NAME + "-" + GEM_VERSION + ".gem"
31
+ task publish: :build do
32
+ system "gem push #{GEM_NAME}-#{GEM_VERSION}.gem"
33
33
  end
34
34
 
35
35
  task :clean do
36
- system "rm *.gem"
36
+ system 'rm *.gem'
37
37
  end
data/bin/console CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "bundler/setup"
5
- require "markdown_exec"
4
+ require 'bundler/setup'
5
+ require 'markdown_exec'
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -11,5 +11,5 @@ require "markdown_exec"
11
11
  # require "pry"
12
12
  # Pry.start
13
13
 
14
- require "irb"
14
+ require 'irb'
15
15
  IRB.start(__FILE__)
data/bin/mde CHANGED
@@ -2,21 +2,22 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  # encoding=utf-8
5
+ # rubocop:disable Style/GlobalVars
5
6
 
6
- env_debug = ENV["MARKDOWN_EXEC_DEBUG"]
7
- $pdebug = !(env_debug || "").empty?
7
+ env_debug = ENV['MARKDOWN_EXEC_DEBUG']
8
+ $pdebug = !(env_debug || '').empty?
8
9
 
9
- APP_NAME = "MDExec"
10
- APP_DESC = "Markdown block executor"
11
- VERSION = "0.0.2"
10
+ APP_NAME = 'MDExec'
11
+ APP_DESC = 'Markdown block executor'
12
+ VERSION = '0.0.3'
12
13
 
13
- require "markdown_exec"
14
+ require 'markdown_exec'
14
15
  # puts MarkdownExec::MDExec.echo(ARGV[0])
15
16
 
16
- require "optparse"
17
- require "pathname"
18
- require "tty-prompt"
19
- require "yaml"
17
+ require 'optparse'
18
+ require 'pathname'
19
+ require 'tty-prompt'
20
+ require 'yaml'
20
21
 
21
22
  # require_relative 'mdlib'
22
23
  # #!/usr/bin/env ruby
@@ -26,12 +27,8 @@ require "yaml"
26
27
  # env_debug = ENV['MARKDOWN_EXEC_DEBUG']
27
28
  # $pdebug = !(env_debug || '').empty?
28
29
 
29
- require "open3"
30
- require "tty-prompt"
31
- # require 'yaml'
32
- # require_relative 'deep_merge'
33
- # require_relative 'object_odig'
34
- # require_relative 'present'
30
+ require 'open3'
31
+ # require 'tty-prompt'
35
32
 
36
33
  BLOCK_SIZE = 1024
37
34
  SELECT_PAGE_HEIGHT = 12
@@ -56,7 +53,7 @@ class MarkParse
56
53
  def find_files
57
54
  puts "pwd: #{`pwd`}" if $pdebug
58
55
  # `ls -1 *.md`.split("\n").tap { |ret| puts "find_files() ret: #{ret.inspect}" if $pdebug }
59
- `ls -1 #{File.join options[:mdfolder], "*.md"}`.split("\n").tap do |ret|
56
+ `ls -1 #{File.join options[:mdfolder], '*.md'}`.split("\n").tap do |ret|
60
57
  puts "find_files() ret: #{ret.inspect}" if $pdebug
61
58
  end
62
59
  end
@@ -109,7 +106,7 @@ class MarkParse
109
106
  blocks = []
110
107
  current = nil
111
108
  in_block = false
112
- block_title = ""
109
+ block_title = ''
113
110
 
114
111
  headings = []
115
112
  File.readlines(opts[:mdfilename]).each do |line|
@@ -117,11 +114,11 @@ class MarkParse
117
114
  continue unless line
118
115
 
119
116
  if opts[:mdheadings]
120
- if lm = line.match(/^### *(.+?) *$/)
117
+ if (lm = line.match(/^### *(.+?) *$/))
121
118
  headings = [headings[0], headings[1], lm[1]]
122
- elsif lm = line.match(/^## *([^#]*?) *$/)
119
+ elsif (lm = line.match(/^## *([^#]*?) *$/))
123
120
  headings = [headings[0], lm[1]]
124
- elsif lm = line.match(/^# *([^#]*?) *$/)
121
+ elsif (lm = line.match(/^# *([^#]*?) *$/))
125
122
  headings = [lm[1]]
126
123
  end
127
124
  puts "get_blocks() headings: #{headings.inspect}" if $pdebug
@@ -129,17 +126,17 @@ class MarkParse
129
126
 
130
127
  if line.match(/^`{3,}/)
131
128
  if in_block
132
- puts "get_blocks() in_block" if $pdebug
129
+ puts 'get_blocks() in_block' if $pdebug
133
130
  if current
134
131
 
135
132
  # block_title ||= current.join(' ').gsub(/ +/, ' ')[0..64]
136
- block_title = current.join(" ").gsub(/ +/, " ")[0..64] if block_title.nil? || block_title.empty?
133
+ block_title = current.join(' ').gsub(/ +/, ' ')[0..64] if block_title.nil? || block_title.empty?
137
134
 
138
135
  blocks += block_summary opts, headings, block_title, current
139
136
  current = nil
140
137
  end
141
138
  in_block = false
142
- block_title = ""
139
+ block_title = ''
143
140
  else
144
141
  ## new block
145
142
  #
@@ -149,9 +146,9 @@ class MarkParse
149
146
 
150
147
  do1 = false
151
148
  if opts[:bash_only]
152
- do1 = true if lm && (lm[1] == "bash")
149
+ do1 = true if lm && (lm[1] == 'bash')
153
150
  elsif opts[:exclude_expect_blocks]
154
- do1 = true unless lm && (lm[1] == "expect")
151
+ do1 = true unless lm && (lm[1] == 'expect')
155
152
  else
156
153
  do1 = true
157
154
  end
@@ -180,7 +177,7 @@ class MarkParse
180
177
  puts "make_block_label() opts: #{opts.inspect}" if $pdebug
181
178
  puts "make_block_label() block: #{block.inspect}" if $pdebug
182
179
  if opts[:mdheadings]
183
- heads = block.fetch(:headings, []).compact.join(" # ")
180
+ heads = block.fetch(:headings, []).compact.join(' # ')
184
181
  "#{block[:title]} [#{heads}] (#{opts[:mdfilename]})"
185
182
  else
186
183
  "#{block[:title]} (#{opts[:mdfilename]})"
@@ -201,7 +198,7 @@ class MarkParse
201
198
  puts "select_block() blocks: #{blocks.to_yaml}" if $pdebug
202
199
 
203
200
  prompt = TTY::Prompt.new(interrupt: :exit)
204
- pt = "#{opts.fetch(:prompt, nil) || "Pick one"}:"
201
+ pt = "#{opts.fetch(:prompt, nil) || 'Pick one'}:"
205
202
  puts "select_block() pt: #{pt.inspect}" if $pdebug
206
203
 
207
204
  blocks.each { |block| block.merge! label: make_block_label(block, opts) }
@@ -226,9 +223,9 @@ class MarkParse
226
223
  # puts "InputInterrupt"
227
224
  # end
228
225
 
229
- block = blocks.select { |block| block[:label] == sel }.fetch(0, nil)
230
- puts "select_block() block: #{block.inspect}" if $pdebug
231
- sel = block[:name]
226
+ label_block = blocks.select { |block| block[:label] == sel }.fetch(0, nil)
227
+ puts "select_block() label_block: #{label_block.inspect}" if $pdebug
228
+ sel = label_block[:name]
232
229
  puts "select_block() sel: #{sel.inspect}" if $pdebug
233
230
 
234
231
  cbs = code_blocks(blocks, sel)
@@ -239,9 +236,9 @@ class MarkParse
239
236
  cbs.each { |cb| fout cb } if opts[:display] || opts[:approve]
240
237
 
241
238
  allow = true
242
- allow = prompt.yes? "Process?" if opts[:approve]
239
+ allow = prompt.yes? 'Process?' if opts[:approve]
243
240
 
244
- selected = table_block blocks, sel
241
+ selected = block_by_name blocks, sel
245
242
  puts "select_block() selected: #{selected.inspect}" if $pdebug
246
243
  if allow && opts[:execute]
247
244
 
@@ -249,7 +246,6 @@ class MarkParse
249
246
  #
250
247
  cmd2 = cbs.flatten.join("\n")
251
248
  fout "$ #{cmd2.to_yaml}"
252
- cnt = 0
253
249
 
254
250
  # Open3.popen3(cmd2) do |stdin, stdout, stderr, wait_thr|
255
251
  # cnt += 1
@@ -257,7 +253,7 @@ class MarkParse
257
253
  # # stdin.close # we're done
258
254
  # stdout_str = stdout.read # read stdout to string. note that this will block until the command is done!
259
255
  # stderr_str = stderr.read # read stderr to string
260
- # status = wait_thr.value # will block until the command finishes; returns status that responds to .success? etc
256
+ # status = wait_thr.value # will block until the command finishes; returns status that responds to .success?
261
257
  # fout "#{stdout_str}"
262
258
  # fout "#{cnt}: err: #{stderr_str}" if stderr_str != ''
263
259
  # # fout "#{cnt}: stt: #{status}"
@@ -278,15 +274,13 @@ class MarkParse
278
274
  # exceptions = ready[2]
279
275
 
280
276
  readable.each do |f|
281
- fileno = f.fileno
282
-
283
- begin
284
- data = f.read_nonblock(BLOCK_SIZE)
285
- # fout "- fileno: #{fileno}\n#{data}"
286
- fout data
287
- rescue EOFError => e
288
- # fout "fileno: #{fileno} EOF"
289
- end
277
+ # fileno = f.fileno
278
+
279
+ data = f.read_nonblock(BLOCK_SIZE)
280
+ # fout "- fileno: #{fileno}\n#{data}"
281
+ fout data
282
+ rescue EOFError #=> e
283
+ # fout "fileno: #{fileno} EOF"
290
284
  end
291
285
  end
292
286
  rescue IOError => e
@@ -315,7 +309,7 @@ class MarkParse
315
309
  end
316
310
 
317
311
  prompt = TTY::Prompt.new
318
- sel = prompt.select("#{opts.fetch(:prompt, "Pick one")}:", files, per_page: select_per_page)
312
+ sel = prompt.select("#{opts.fetch(:prompt, 'Pick one')}:", files, per_page: select_per_page)
319
313
  end
320
314
 
321
315
  sel
@@ -334,25 +328,29 @@ class MarkParse
334
328
  puts "code() all: #{all.inspect}" if $pdebug
335
329
  all.reverse.map do |req|
336
330
  puts "code() req: #{req.inspect}" if $pdebug
337
- table_block(table, req).fetch(:body, "")
338
- end.flatten(1).tap { |ret| puts "code() ret: #{ret.inspect}" if $pdebug }
331
+ block_by_name(table, req).fetch(:body, '')
332
+ end
333
+ .flatten(1)
334
+ .tap { |ret| puts "code() ret: #{ret.inspect}" if $pdebug }
339
335
  end
340
336
 
341
- def table_block(table, name, default = {})
337
+ def block_by_name(table, name, default = {})
342
338
  table.select { |block| block[:name] == name }.fetch(0, default)
343
339
  end
344
340
 
345
341
  def code_blocks(table, name)
346
342
  puts "code_blocks() table: #{table.inspect}" if $pdebug
347
343
  puts "code_blocks() name: #{name.inspect}" if $pdebug
348
- block = table_block(table, name)
349
- puts "code_blocks() block: #{block.inspect}" if $pdebug
350
- all = [block[:name]] + unroll(table, block[:reqs])
344
+ name_block = block_by_name(table, name)
345
+ puts "code_blocks() name_block: #{name_block.inspect}" if $pdebug
346
+ all = [name_block[:name]] + unroll(table, name_block[:reqs])
351
347
  puts "code_blocks() all: #{all.inspect}" if $pdebug
352
- all.reverse.map do |req|
353
- puts "code_blocks() req: #{req.inspect}" if $pdebug
354
- table_block(table, req).fetch(:body, "")
355
- end.flatten(1).tap { |ret| puts "code_blocks() ret: #{ret.inspect}" if $pdebug }
348
+
349
+ # in order of appearance in document
350
+ table.select { |block| all.include? block[:name] }
351
+ .map { |block| block.fetch(:body, '') }
352
+ .flatten(1)
353
+ .tap { |ret| puts "code_blocks() ret: #{ret.inspect}" if $pdebug }
356
354
  end
357
355
 
358
356
  def unroll(table, reqs)
@@ -368,12 +366,13 @@ class MarkParse
368
366
 
369
367
  all += [req]
370
368
  puts "unrol() all: #{all.inspect}" if $pdebug
371
- table_block(table, req).fetch(:reqs, [])
372
- end.compact.flatten(1).tap { |_ret| puts "unroll() rem: #{rem.inspect}" if $pdebug }
369
+ block_by_name(table, req).fetch(:reqs, [])
373
370
  end
374
- all.tap { |ret| puts "unroll() ret: #{ret.inspect}" if $pdebug }
371
+ .compact
372
+ .flatten(1)
373
+ .tap { |_ret| puts "unroll() rem: #{rem.inspect}" if $pdebug }
375
374
  end
376
- end
375
+ all.tap { |ret| puts "unroll() ret: #{ret.inspect}" if $pdebug }
377
376
 
378
377
  $stderr.sync = true
379
378
  $stdout.sync = true
@@ -386,10 +385,10 @@ end
386
385
  #
387
386
  def read_configuration!(options, configuration_path)
388
387
  if Pathname.new(configuration_path).exist?
389
- # rubocop:disable Security/YAMLLoad
390
- options.merge!((YAML::load(open(configuration_path)) || {})
388
+ # rubocop:disable Security/YAMLLoad
389
+ options.merge!((YAML.load(File.open(configuration_path)) || {})
391
390
  .transform_keys(&:to_sym))
392
- # rubocop:enable Security/YAMLLoad
391
+ # rubocop:enable Security/YAMLLoad
393
392
  end
394
393
  options
395
394
  end
@@ -400,8 +399,8 @@ options = {
400
399
  mdheadings: true,
401
400
  list_blocks: false,
402
401
  list_docs: false,
403
- mdfilename: "README.md",
404
- mdfolder: "."
402
+ mdfilename: 'README.md',
403
+ mdfolder: '.'
405
404
  }
406
405
 
407
406
  def options_finalize!(options); end
@@ -415,58 +414,60 @@ read_configuration! options, ".#{APP_NAME.downcase}.yml"
415
414
  # load_resources! options
416
415
  # puts "q31 options: #{options.to_yaml}" if $pdebug
417
416
 
417
+ # rubocop:disable Metrics/BlockLength
418
418
  option_parser = OptionParser.new do |opts|
419
419
  executable_name = File.basename($PROGRAM_NAME)
420
420
  opts.banner = [
421
- APP_VDESC = "#{APP_NAME} - #{APP_DESC} (#{VERSION})",
421
+ "#{APP_NAME} - #{APP_DESC} (#{VERSION})".freeze,
422
422
  "Usage: #{executable_name} [options]"
423
423
  ].join("\n")
424
424
 
425
425
  ## menu top: on_head appear in reverse order added
426
426
  #
427
- opts.on("--config PATH", "Read configuration file") do |value|
427
+ opts.on('--config PATH', 'Read configuration file') do |value|
428
428
  read_configuration! options, value
429
429
  end
430
430
 
431
431
  ## menu body: items appear in order added
432
432
  #
433
- opts.on("-f RELATIVE", "--mdfilename", "Name of document") do |value|
433
+ opts.on('-f RELATIVE', '--mdfilename', 'Name of document') do |value|
434
434
  options[:mdfilename] = value
435
435
  end
436
436
 
437
- opts.on("-p PATH", "--mdfolder", "Path to documents") do |value|
437
+ opts.on('-p PATH', '--mdfolder', 'Path to documents') do |value|
438
438
  options[:mdfolder] = value
439
439
  end
440
440
 
441
- opts.on("--list-blocks", "List blocks") do |_value|
441
+ opts.on('--list-blocks', 'List blocks') do |_value|
442
442
  options[:list_blocks] = true
443
443
  end
444
444
 
445
- opts.on("--list-docs", "List docs in current folder") do |_value|
445
+ opts.on('--list-docs', 'List docs in current folder') do |_value|
446
446
  options[:list_docs] = true
447
447
  end
448
448
 
449
449
  ## menu bottom: items appear in order added
450
450
  #
451
- opts.on_tail("-h", "--help", "App help") do |_value|
451
+ opts.on_tail('-h', '--help', 'App help') do |_value|
452
452
  puts option_parser.help
453
453
  exit
454
454
  end
455
455
 
456
- opts.on_tail("-v", "--version", "App version") do |_value|
456
+ opts.on_tail('-v', '--version', 'App version') do |_value|
457
457
  puts VERSION
458
458
  exit
459
459
  end
460
460
 
461
- opts.on_tail("-x", "--exit", "Exit app") do |_value|
461
+ opts.on_tail('-x', '--exit', 'Exit app') do |_value|
462
462
  exit
463
463
  end
464
464
 
465
- opts.on_tail("-0", "Show configuration") do |_v|
465
+ opts.on_tail('-0', 'Show configuration') do |_v|
466
466
  options_finalize! options
467
467
  puts options.to_yaml
468
468
  end
469
469
  end
470
+ # rubocop:enable Metrics/BlockLength
470
471
 
471
472
  option_parser.load # filename defaults to basename of the program without suffix in a directory ~/.options
472
473
  option_parser.environment # env defaults to the basename of the program.
@@ -475,6 +476,7 @@ options_finalize! options
475
476
 
476
477
  ## process
477
478
  #
479
+ # rubocop:disable Metrics/BlockLength
478
480
  loop do # once
479
481
  mp = MarkParse.new options
480
482
  options.merge!(
@@ -482,8 +484,9 @@ loop do # once
482
484
  approve: true,
483
485
  bash: true,
484
486
  display: true,
487
+ exclude_expect_blocks: true,
485
488
  execute: true,
486
- prompt: "Execute",
489
+ prompt: 'Execute',
487
490
  struct: true
488
491
  }
489
492
  )
@@ -506,6 +509,7 @@ loop do # once
506
509
  #
507
510
  mp.select_block(bash: true, struct: true) if options[:mdfilename]
508
511
 
512
+ # rubocop:disable Style/BlockComments
509
513
  =begin
510
514
  # rescue ArgumentError => e
511
515
  # puts "User abort: #{e}"
@@ -517,5 +521,9 @@ loop do # once
517
521
  # ensure
518
522
  # exit
519
523
  =end
520
- break unless false
524
+ # rubocop:enable Style/BlockComments
525
+
526
+ break unless false # rubocop:disable Lint/LiteralAsCondition
521
527
  end
528
+ # rubocop:enable Metrics/BlockLength
529
+ # rubocop:enable Style/GlobalVars
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MarkdownExec
4
- VERSION = "0.0.1"
4
+ VERSION = '0.0.3'
5
5
  end
data/lib/markdown_exec.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "markdown_exec/version"
3
+ require_relative 'markdown_exec/version'
4
4
 
5
5
  module MarkdownExec
6
6
  class Error < StandardError; end
7
- # Your code goes here...
8
7
 
8
+ # Markdown Exec
9
9
  class MDExec
10
- def self.echo(str = "")
10
+ def self.echo(str = '')
11
11
  "#{str}#{str}"
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_exec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fareed Stevenson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-07 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-03-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tty-prompt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.23.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.23.1
13
27
  description: Execute shell blocks in markdown files. Name blocks and require named
14
28
  blocks.
15
29
  email:
@@ -22,6 +36,7 @@ files:
22
36
  - CHANGELOG.md
23
37
  - CODE_OF_CONDUCT.md
24
38
  - Gemfile
39
+ - Gemfile.lock
25
40
  - LICENSE.txt
26
41
  - README.md
27
42
  - Rakefile
@@ -30,11 +45,11 @@ files:
30
45
  - bin/setup
31
46
  - lib/markdown_exec.rb
32
47
  - lib/markdown_exec/version.rb
33
- homepage: https://rubygems.org/gems/markdown_executor
48
+ homepage: https://rubygems.org/gems/markdown_exec
34
49
  licenses:
35
50
  - MIT
36
51
  metadata:
37
- homepage_uri: https://rubygems.org/gems/markdown_executor
52
+ homepage_uri: https://rubygems.org/gems/markdown_exec
38
53
  post_install_message:
39
54
  rdoc_options: []
40
55
  require_paths: