markdown_exec 1.8.5 → 1.8.7

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.
data/lib/saved_assets.rb CHANGED
@@ -12,18 +12,20 @@ module MarkdownExec
12
12
  # method derives a name for stdout redirection.
13
13
  #
14
14
  class SavedAsset
15
- FNR11 = /pattern1/.freeze # TODO: Replace with actual pattern
16
- FNR12 = 'replacement_string' # TODO: Replace with actual replacement string
15
+ FNR11 = %r{/|:}.freeze
16
+ FNR12 = '_'
17
+ DEFAULT_FTIME = '%F-%H-%M-%S'
17
18
 
18
19
  # Generates a formatted script name based on the provided parameters.
19
- def self.script_name(filename:, prefix:, time:, blockname:)
20
- fne = filename.gsub(FNR11, FNR12)
21
- "#{[prefix, time.strftime('%F-%H-%M-%S'), fne, ',', blockname].join('_')}.sh"
20
+ def self.script_name(filename:, prefix:, time:, blockname:, ftime: DEFAULT_FTIME, join_str: '_', pattern: FNR11, replace: FNR12, exts: '.sh')
21
+ fne = filename.gsub(pattern, replace)
22
+ "#{[prefix, time.strftime(ftime), fne, ',', blockname].join(join_str)}#{exts}"
22
23
  end
23
24
 
24
25
  # Generates a formatted stdout name based on the provided parameters.
25
- def self.stdout_name(filename:, prefix:, time:, blockname:)
26
- "#{[prefix, time.strftime('%F-%H-%M-%S'), filename, blockname].join('_')}.out.txt"
26
+ def self.stdout_name(filename:, prefix:, time:, blockname:, ftime: DEFAULT_FTIME, join_str: '_', pattern: FNR11, replace: FNR12, exts: '.out.txt')
27
+ fne = filename.gsub(pattern, replace)
28
+ "#{[prefix, time.strftime(ftime), fne, ',', blockname].join(join_str)}#{exts}"
27
29
  end
28
30
  end
29
31
  end
@@ -50,7 +52,7 @@ if $PROGRAM_NAME == __FILE__
50
52
  time = Time.new(2023, 1, 1, 12, 0, 0)
51
53
  blockname = 'block1'
52
54
 
53
- expected_name = 'test_2023-01-01-12-00-00_sample.txt_block1.out.txt'
55
+ expected_name = 'test_2023-01-01-12-00-00_sample.txt_,_block1.out.txt'
54
56
  assert_equal expected_name,
55
57
  MarkdownExec::SavedAsset.stdout_name(filename: filename, prefix: prefix, time: time,
56
58
  blockname: blockname)
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: 1.8.5
4
+ version: 1.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fareed Stevenson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-22 00:00:00.000000000 Z
11
+ date: 2023-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clipboard
@@ -81,8 +81,8 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.2.0
83
83
  description: Interactively select and execute fenced code blocks in markdown files.
84
- Build complex scripts by linking documents and naming and requiring blocks. Log
85
- resulting scripts and output. Re-run scripts.
84
+ Build complex scripts by naming and requiring blocks. Log resulting scripts and
85
+ output. Re-run scripts.
86
86
  email:
87
87
  - fareed@phomento.com
88
88
  executables:
@@ -157,6 +157,7 @@ files:
157
157
  - lib/option_value.rb
158
158
  - lib/pty1.rb
159
159
  - lib/regexp.rb
160
+ - lib/regexp_replacer.rb
160
161
  - lib/rspec_helpers.rb
161
162
  - lib/saved_assets.rb
162
163
  - lib/saved_files_matcher.rb