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 +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/lib/hash_delegator.rb +17 -4
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/menu.src.yml +19 -0
- data/lib/menu.yml +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e95733b82149c0ae79c429132f53373975961457c9fc6dd6b5f4feed5618d63
|
4
|
+
data.tar.gz: bfc880428a6cb6e3f58f3248972fffdbe2a51449c3e12ee1b4542aee0148fa29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d24fdac6f00933c9796fe8225c81d35745d2275055b8963b565955a4a9a581e232ddc99e67999e8b00053ecb573ae4e24be8875506d6257b645d4eea74661b40
|
7
|
+
data.tar.gz: 10423e9faec308472a9678b7726c78c5b0be55a702c866e6b4cbe722f6aa6f69cae80ed9a30857f08c60dae792fc70062ebb7a16fd3728d0bc289b9487bc3a98
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/hash_delegator.rb
CHANGED
@@ -3014,7 +3014,7 @@ module MarkdownExec
|
|
3014
3014
|
)
|
3015
3015
|
|
3016
3016
|
else
|
3017
|
-
output_lines =
|
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(
|
3572
|
-
|
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
|
-
|
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
|
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"
|