markdown_exec 3.0.1 → 3.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6105f345e0f4e3b856fc2209f92872c3ab08aa1f7dadab2e3dba4fa686a8d20c
4
- data.tar.gz: 3463e2cf4f292621d34007a55953744769047747c62fb20408e9a3c7070dc617
3
+ metadata.gz: 7e95733b82149c0ae79c429132f53373975961457c9fc6dd6b5f4feed5618d63
4
+ data.tar.gz: bfc880428a6cb6e3f58f3248972fffdbe2a51449c3e12ee1b4542aee0148fa29
5
5
  SHA512:
6
- metadata.gz: dd25c39ccfefc8d5db5dd8ec985a4c7537824f631e916b18a17236504ea077eac24bc45eed13bd13756dad18ab045422c583b8479d32e9379219dc7f58682f7b
7
- data.tar.gz: '084bc0518c1b016c738361f2dcc076cf0f51e5cb56b91b54f21880be09198b2d2176a5428ae2f2dfcedd09de34e73f45c278c13c705db04cc83b3bda8a8f5cb5'
6
+ metadata.gz: d24fdac6f00933c9796fe8225c81d35745d2275055b8963b565955a4a9a581e232ddc99e67999e8b00053ecb573ae4e24be8875506d6257b645d4eea74661b40
7
+ data.tar.gz: 10423e9faec308472a9678b7726c78c5b0be55a702c866e6b4cbe722f6aa6f69cae80ed9a30857f08c60dae792fc70062ebb7a16fd3728d0bc289b9487bc3a98
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.0.2] - 2025-05-21
4
+
5
+ ### Added
6
+
7
+ - Options to permit the archiving of ad-hoc shell scripts.
8
+
9
+ ### Changed
10
+
11
+ - Force use of Bash shell for ad-hoc shell scripts.
12
+
3
13
  ## [3.0.1] - 2025-05-21
4
14
 
5
15
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- markdown_exec (3.0.1)
4
+ markdown_exec (3.0.2)
5
5
  clipboard (~> 1.3.6)
6
6
  open3 (~> 0.1.1)
7
7
  optparse (~> 0.1.1)
@@ -3014,7 +3014,7 @@ module MarkdownExec
3014
3014
  )
3015
3015
 
3016
3016
  else
3017
- output_lines = `#{cmd}`.split("\n")
3017
+ output_lines = `bash #{file.path}`.split("\n")
3018
3018
  end
3019
3019
  end
3020
3020
 
@@ -3568,11 +3568,24 @@ module MarkdownExec
3568
3568
 
3569
3569
  def output_from_adhoc_bash_script_file(bash_script_lines)
3570
3570
  Tempfile.create('script_exec') do |temp_file|
3571
- temp_file.write(HashDelegator.join_code_lines(bash_script_lines))
3572
- temp_file.flush
3571
+ temp_file.write(
3572
+ HashDelegator.join_code_lines(
3573
+ bash_script_lines
3574
+ )
3575
+ )
3576
+ temp_file.close # Close the file before chmod and execution
3573
3577
  File.chmod(0o755, temp_file.path)
3574
3578
 
3575
- output = `#{temp_file.path}`
3579
+ if @delegate_object[:archive_ad_hoc_scripts]
3580
+ archive_filename = format(
3581
+ @delegate_object[:archive_path_format],
3582
+ time: Time.now.strftime(@delegate_object[:archive_time_format])
3583
+ )
3584
+ `cp #{temp_file.path} #{archive_filename}`
3585
+ end
3586
+
3587
+ output = `bash #{temp_file.path}`
3588
+ #### use shell per configuration
3576
3589
 
3577
3590
  CommandResult.new(stdout: output, exit_status: $?.exitstatus)
3578
3591
  end
@@ -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.1'
10
+ VERSION = '3.0.2'
11
11
  end
data/lib/menu.src.yml CHANGED
@@ -4,6 +4,25 @@
4
4
  :description: Show current configuration values
5
5
  :procname: show_config
6
6
 
7
+ - :opt_name: archive_ad_hoc_scripts
8
+ :env_var: MDE_ARCHIVE_AD_HOC_SCRIPTS
9
+ :description: Archive ad-hoc bash scripts
10
+ :arg_name: BOOL
11
+ :default: false
12
+ :procname: val_as_bool
13
+
14
+ - :opt_name: archive_time_format
15
+ :env_var: MDE_ARCHIVE_TIME_FORMAT
16
+ :description: Time format for archive filenames
17
+ :default: '%Y-%m-%d-%H-%M-%S-%N'
18
+ :procname: val_as_str
19
+
20
+ - :opt_name: archive_path_format
21
+ :env_var: MDE_ARCHIVE_PATH_FORMAT
22
+ :description: Format for archive file paths
23
+ :default: '/tmp/mde-ad-hoc-%{time}'
24
+ :procname: val_as_str
25
+
7
26
  - :opt_name: bash_only
8
27
  :env_var: MDE_BASH_ONLY
9
28
  :description: Execute only blocks of type "bash"
data/lib/menu.yml CHANGED
@@ -2,6 +2,22 @@
2
2
  - :short_name: '0'
3
3
  :description: Show current configuration values
4
4
  :procname: show_config
5
+ - :opt_name: archive_ad_hoc_scripts
6
+ :env_var: MDE_ARCHIVE_AD_HOC_SCRIPTS
7
+ :description: Archive ad-hoc bash scripts
8
+ :arg_name: BOOL
9
+ :default: false
10
+ :procname: val_as_bool
11
+ - :opt_name: archive_time_format
12
+ :env_var: MDE_ARCHIVE_TIME_FORMAT
13
+ :description: Time format for archive filenames
14
+ :default: "%Y-%m-%d-%H-%M-%S-%N"
15
+ :procname: val_as_str
16
+ - :opt_name: archive_path_format
17
+ :env_var: MDE_ARCHIVE_PATH_FORMAT
18
+ :description: Format for archive file paths
19
+ :default: "/tmp/mde-ad-hoc-%{time}"
20
+ :procname: val_as_str
5
21
  - :opt_name: bash_only
6
22
  :env_var: MDE_BASH_ONLY
7
23
  :description: Execute only blocks of type "bash"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_exec
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fareed Stevenson