marked-conductor 1.0.9 → 1.0.11
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/.irbrc +2 -0
- data/CHANGELOG.md +23 -0
- data/README.rdoc +1 -1
- data/bin/conductor +98 -67
- data/html/Array.html +160 -0
- data/html/Conductor/Command.html +271 -0
- data/html/Conductor/Condition.html +791 -0
- data/html/Conductor/Config.html +170 -0
- data/html/Conductor/Env.html +220 -0
- data/html/Conductor/Script.html +288 -0
- data/html/Conductor.html +355 -0
- data/html/FalseClass.html +138 -0
- data/html/Hash.html +160 -0
- data/html/Object.html +138 -0
- data/html/README_rdoc.html +86 -0
- data/html/String.html +440 -0
- data/html/TrueClass.html +138 -0
- data/html/created.rid +14 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +687 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +105 -0
- data/html/js/darkfish.js +97 -0
- data/html/js/navigation.js +105 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +110 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +345 -0
- data/lib/conductor/condition.rb +25 -10
- data/lib/conductor/env.rb +18 -7
- data/lib/conductor/script.rb +40 -18
- data/lib/conductor/string.rb +58 -6
- data/lib/conductor/version.rb +1 -1
- data/lib/conductor.rb +1 -0
- data/marked-conductor.gemspec +3 -3
- metadata +89 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0804a21e0ec1796869b539e638b140293ad0557da8f2821c8b2707ea52ca2f4c'
|
4
|
+
data.tar.gz: 1da80616e987b04f403fd17ac9b5016b5d18990af9b8ba1754ff16cce5f10961
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c50d075a5eb9abef4071b72405e41c60299b4df36eb49da590366dda00f82f1b7317806727b47a9d11c76c24244a916bbdcd57855dfb66a5d277398f12db15b9
|
7
|
+
data.tar.gz: 47170b144559d23b5c5a988467efcfd14402961885951e805b0e5a8af66a76ed90a44454faea0572cb0d535867f232d37e20ae05ea9c5f3e601793a35f2f0d7a
|
data/.irbrc
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
### 1.0.11
|
2
|
+
|
3
|
+
2024-04-29 09:46
|
4
|
+
|
5
|
+
#### FIXED
|
6
|
+
|
7
|
+
- Reversed symbols when outputting condition matches to STDERR
|
8
|
+
- Only assume date if it's not part of a filename
|
9
|
+
|
10
|
+
### 1.0.10
|
11
|
+
|
12
|
+
2024-04-28 14:05
|
13
|
+
|
14
|
+
#### IMPROVED
|
15
|
+
|
16
|
+
- Return NOCUSTOM if changes are not made by scripts/commands, even though condition was matched
|
17
|
+
- Use YAML.load instead of .safe_load to allow more flexibility
|
18
|
+
- Trap errors reading YAML and fail gracefully
|
19
|
+
|
20
|
+
#### FIXED
|
21
|
+
|
22
|
+
- Encoding errors on string methods
|
23
|
+
|
1
24
|
### 1.0.9
|
2
25
|
|
3
26
|
2024-04-27 16:00
|
data/README.rdoc
CHANGED
data/bin/conductor
CHANGED
@@ -1,88 +1,101 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
1
|
+
#!/usr/bin/env ruby -W1
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require_relative
|
5
|
-
require
|
6
|
-
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
track
|
18
|
-
if
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
4
|
+
require_relative "../lib/conductor"
|
5
|
+
require "optparse"
|
6
|
+
|
7
|
+
# Main Conductor class
|
8
|
+
module Conductor
|
9
|
+
class << self
|
10
|
+
##
|
11
|
+
## Execute commands/scripts in the track
|
12
|
+
##
|
13
|
+
## @param track The track
|
14
|
+
##
|
15
|
+
## @return Resulting STDOUT output
|
16
|
+
##
|
17
|
+
def execute_track(track)
|
18
|
+
if track[:sequence]
|
19
|
+
track[:sequence].each do |cmd|
|
20
|
+
if cmd[:script]
|
21
|
+
script = Script.new(cmd[:script])
|
22
|
+
|
23
|
+
res = script.run
|
24
|
+
elsif cmd[:command]
|
25
|
+
command = Command.new(cmd[:command])
|
26
|
+
|
27
|
+
res = command.run
|
28
|
+
end
|
29
|
+
|
30
|
+
Conductor.stdin = res unless res.nil?
|
31
|
+
end
|
32
|
+
elsif track[:script]
|
33
|
+
script = Script.new(track[:script])
|
34
|
+
|
35
|
+
Conductor.stdin = script.run
|
36
|
+
elsif track[:command]
|
37
|
+
command = Command.new(track[:command])
|
38
|
+
|
39
|
+
Conductor.stdin = command.run
|
26
40
|
end
|
27
41
|
|
28
|
-
Conductor.stdin
|
42
|
+
Conductor.stdin
|
29
43
|
end
|
30
|
-
elsif track[:script]
|
31
|
-
script = Script.new(track[:script])
|
32
44
|
|
33
|
-
|
34
|
-
|
35
|
-
|
45
|
+
##
|
46
|
+
## Main function to parse conditions and
|
47
|
+
## execute actions. Executes recursively for
|
48
|
+
## sub-tracks.
|
49
|
+
##
|
50
|
+
## @param tracks The tracks to process
|
51
|
+
## @param res The current result
|
52
|
+
## @param condition The current condition
|
53
|
+
##
|
54
|
+
## @return [Array] result, matched condition(s)
|
55
|
+
##
|
56
|
+
def conduct(tracks, res = nil, condition = nil)
|
57
|
+
tracks.each do |track|
|
58
|
+
cond = Condition.new(track[:condition])
|
36
59
|
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
Conductor.stdin
|
41
|
-
end
|
60
|
+
next unless cond.true?
|
42
61
|
|
43
|
-
|
44
|
-
|
45
|
-
|
62
|
+
# Build "matched condition" message
|
63
|
+
title = track[:title] || track[:condition]
|
64
|
+
condition ||= [""]
|
65
|
+
condition << title
|
66
|
+
condition.push(track.key?(:continue) ? " -> " : ", ")
|
46
67
|
|
47
|
-
|
68
|
+
res = execute_track(track)
|
48
69
|
|
70
|
+
if track[:tracks]
|
71
|
+
ts = track[:tracks]
|
49
72
|
|
50
|
-
|
51
|
-
title = track[:title] || track[:condition]
|
52
|
-
condition ||= ['']
|
53
|
-
condition << title
|
54
|
-
condition.push(track.key?(:continue) ? ', ' : ' -> ')
|
73
|
+
res, condition = conduct(ts, res, condition)
|
55
74
|
|
56
|
-
|
75
|
+
next if res.nil?
|
76
|
+
end
|
57
77
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
res, condition = conduct(ts, res, condition)
|
78
|
+
break unless track[:continue]
|
79
|
+
end
|
62
80
|
|
63
|
-
|
81
|
+
if res == Conductor.original_input
|
82
|
+
[nil, "No change in output"]
|
83
|
+
else
|
84
|
+
[res, condition]
|
85
|
+
end
|
64
86
|
end
|
65
|
-
|
66
|
-
break unless track[:continue]
|
67
87
|
end
|
68
|
-
|
69
|
-
[res, condition]
|
70
|
-
end
|
71
|
-
|
72
|
-
def clean_condition(condition)
|
73
|
-
condition.join('').sub(/ *(->|,) *$/, '')
|
74
88
|
end
|
75
89
|
|
76
|
-
|
77
|
-
optparse = OptionParser.new do|opts|
|
90
|
+
optparse = OptionParser.new do |opts|
|
78
91
|
opts.banner = "Called from Marked 2 as a Custom Pre/Processor"
|
79
92
|
|
80
|
-
opts.on(
|
93
|
+
opts.on("-v", "--version", "Show version number") do
|
81
94
|
puts "conductor v#{Conductor::VERSION}"
|
82
95
|
Process.exit 0
|
83
96
|
end
|
84
97
|
|
85
|
-
opts.on(
|
98
|
+
opts.on("-h", "--help", "Display this screen") do
|
86
99
|
puts opts
|
87
100
|
exit
|
88
101
|
end
|
@@ -90,14 +103,32 @@ end
|
|
90
103
|
|
91
104
|
optparse.parse!
|
92
105
|
|
106
|
+
config = Conductor::Config.new
|
107
|
+
|
108
|
+
Conductor.stdin
|
109
|
+
Conductor.original_input = Conductor.stdin
|
110
|
+
|
93
111
|
tracks = config.tracks
|
94
|
-
res, condition = conduct(tracks)
|
112
|
+
res, condition = Conductor.conduct(tracks)
|
113
|
+
|
114
|
+
##
|
115
|
+
## Clean up conditions for output
|
116
|
+
##
|
117
|
+
## @param condition The condition
|
118
|
+
##
|
119
|
+
def clean_condition(condition)
|
120
|
+
condition.join("").sub(/ *(->|,) *$/, "")
|
121
|
+
end
|
95
122
|
|
96
123
|
if res.nil?
|
97
|
-
|
98
|
-
puts
|
124
|
+
warn "No conditions satisfied"
|
125
|
+
puts "NOCUSTOM"
|
99
126
|
else
|
100
|
-
|
101
|
-
|
127
|
+
if res == Conductor.original_input
|
128
|
+
warn "No change in output"
|
129
|
+
puts "NOCUSTOM"
|
130
|
+
else
|
131
|
+
warn "Met condition: #{clean_condition(condition)}"
|
132
|
+
puts res
|
133
|
+
end
|
102
134
|
end
|
103
|
-
|
data/html/Array.html
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Array - Marked Conductor</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="./js/navigation.js" defer></script>
|
15
|
+
<script src="./js/search.js" defer></script>
|
16
|
+
<script src="./js/search_index.js" defer></script>
|
17
|
+
<script src="./js/searcher.js" defer></script>
|
18
|
+
<script src="./js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
<div id="parent-class-section" class="nav-section">
|
62
|
+
<h3>Parent</h3>
|
63
|
+
|
64
|
+
<p class="link"><a href="Object.html">Object</a>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<div id="method-list-section" class="nav-section">
|
72
|
+
<h3>Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list" role="directory">
|
75
|
+
<li ><a href="#method-i-symbolize_keys">#symbolize_keys</a>
|
76
|
+
<li ><a href="#method-i-symbolize_keys-21">#symbolize_keys!</a>
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<main role="main" aria-labelledby="class-Array">
|
84
|
+
<h1 id="class-Array" class="class">
|
85
|
+
class Array
|
86
|
+
</h1>
|
87
|
+
|
88
|
+
<section class="description">
|
89
|
+
|
90
|
+
</section>
|
91
|
+
|
92
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
99
|
+
<header>
|
100
|
+
<h3>Public Instance Methods</h3>
|
101
|
+
</header>
|
102
|
+
|
103
|
+
<div id="method-i-symbolize_keys" class="method-detail ">
|
104
|
+
<div class="method-header">
|
105
|
+
<div class="method-heading">
|
106
|
+
<span class="method-name">symbolize_keys</span><span
|
107
|
+
class="method-args">()</span>
|
108
|
+
<span class="method-click-advice">click to toggle source</span>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<div class="method-description">
|
113
|
+
|
114
|
+
|
115
|
+
<div class="method-source-code" id="symbolize_keys-source">
|
116
|
+
<pre><span class="ruby-comment"># File lib/conductor/array.rb, line 8</span>
|
117
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">symbolize_keys</span>
|
118
|
+
<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">symbolize_keys</span> }
|
119
|
+
<span class="ruby-keyword">end</span></pre>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
</div>
|
125
|
+
|
126
|
+
<div id="method-i-symbolize_keys-21" class="method-detail ">
|
127
|
+
<div class="method-header">
|
128
|
+
<div class="method-heading">
|
129
|
+
<span class="method-name">symbolize_keys!</span><span
|
130
|
+
class="method-args">()</span>
|
131
|
+
<span class="method-click-advice">click to toggle source</span>
|
132
|
+
</div>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<div class="method-description">
|
136
|
+
|
137
|
+
|
138
|
+
<div class="method-source-code" id="symbolize_keys-21-source">
|
139
|
+
<pre><span class="ruby-comment"># File lib/conductor/array.rb, line 4</span>
|
140
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">symbolize_keys!</span>
|
141
|
+
<span class="ruby-identifier">replace</span> <span class="ruby-identifier">symbolize_keys</span>
|
142
|
+
<span class="ruby-keyword">end</span></pre>
|
143
|
+
</div>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
</section>
|
150
|
+
|
151
|
+
</section>
|
152
|
+
</main>
|
153
|
+
|
154
|
+
|
155
|
+
<footer id="validator-badges" role="contentinfo">
|
156
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
157
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.6.2.
|
158
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
159
|
+
</footer>
|
160
|
+
|