marked-conductor 1.0.8 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.irbrc +2 -0
- data/CHANGELOG.md +26 -0
- data/README.rdoc +1 -1
- data/bin/conductor +68 -61
- data/html/Array.html +160 -0
- data/html/Conductor/Command.html +271 -0
- data/html/Conductor/Condition.html +787 -0
- data/html/Conductor/Config.html +170 -0
- data/html/Conductor/Env.html +217 -0
- data/html/Conductor/Script.html +278 -0
- data/html/Conductor.html +342 -0
- data/html/FalseClass.html +138 -0
- data/html/Hash.html +160 -0
- data/html/Object.html +136 -0
- data/html/README_rdoc.html +86 -0
- data/html/String.html +417 -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 +23 -4
- data/lib/conductor/env.rb +6 -6
- data/lib/conductor/string.rb +5 -5
- data/lib/conductor/version.rb +1 -1
- data/lib/conductor.rb +1 -0
- data/marked-conductor.gemspec +3 -3
- metadata +89 -32
@@ -0,0 +1,278 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Conductor::Script - 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-c-new">::new</a>
|
76
|
+
<li ><a href="#method-i-args-3D">#args=</a>
|
77
|
+
<li ><a href="#method-i-path-3D">#path=</a>
|
78
|
+
<li ><a href="#method-i-run">#run</a>
|
79
|
+
</ul>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
</nav>
|
84
|
+
|
85
|
+
<main role="main" aria-labelledby="class-Conductor::Script">
|
86
|
+
<h1 id="class-Conductor::Script" class="class">
|
87
|
+
class Conductor::Script
|
88
|
+
</h1>
|
89
|
+
|
90
|
+
<section class="description">
|
91
|
+
|
92
|
+
<p><a href="Script.html"><code>Script</code></a> runner</p>
|
93
|
+
|
94
|
+
</section>
|
95
|
+
|
96
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<section class="attribute-method-details" class="method-section">
|
101
|
+
<header>
|
102
|
+
<h3>Attributes</h3>
|
103
|
+
</header>
|
104
|
+
|
105
|
+
<div id="attribute-i-args" class="method-detail">
|
106
|
+
<div class="method-heading attribute-method-heading">
|
107
|
+
<span class="method-name">args</span><span
|
108
|
+
class="attribute-access-type">[R]</span>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div class="method-description">
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div id="attribute-i-path" class="method-detail">
|
116
|
+
<div class="method-heading attribute-method-heading">
|
117
|
+
<span class="method-name">path</span><span
|
118
|
+
class="attribute-access-type">[R]</span>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="method-description">
|
122
|
+
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
</section>
|
126
|
+
|
127
|
+
|
128
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
129
|
+
<header>
|
130
|
+
<h3>Public Class Methods</h3>
|
131
|
+
</header>
|
132
|
+
|
133
|
+
<div id="method-c-new" class="method-detail ">
|
134
|
+
<div class="method-header">
|
135
|
+
<div class="method-heading">
|
136
|
+
<span class="method-name">new</span><span
|
137
|
+
class="method-args">(script)</span>
|
138
|
+
<span class="method-click-advice">click to toggle source</span>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div class="method-description">
|
143
|
+
|
144
|
+
|
145
|
+
<div class="method-source-code" id="new-source">
|
146
|
+
<pre><span class="ruby-comment"># File lib/conductor/script.rb, line 8</span>
|
147
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">script</span>)
|
148
|
+
<span class="ruby-identifier">parts</span> = <span class="ruby-constant">Shellwords</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">script</span>)
|
149
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">path</span> = <span class="ruby-identifier">parts</span>[<span class="ruby-value">0</span>]
|
150
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">args</span> = <span class="ruby-identifier">parts</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">" "</span>)
|
151
|
+
<span class="ruby-keyword">end</span></pre>
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
|
156
|
+
</div>
|
157
|
+
|
158
|
+
</section>
|
159
|
+
|
160
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
161
|
+
<header>
|
162
|
+
<h3>Public Instance Methods</h3>
|
163
|
+
</header>
|
164
|
+
|
165
|
+
<div id="method-i-args-3D" class="method-detail ">
|
166
|
+
<div class="method-header">
|
167
|
+
<div class="method-heading">
|
168
|
+
<span class="method-name">args=</span><span
|
169
|
+
class="method-args">(array)</span>
|
170
|
+
<span class="method-click-advice">click to toggle source</span>
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div class="method-description">
|
175
|
+
|
176
|
+
|
177
|
+
<div class="method-source-code" id="args-3D-source">
|
178
|
+
<pre><span class="ruby-comment"># File lib/conductor/script.rb, line 30</span>
|
179
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">args=</span>(<span class="ruby-identifier">array</span>)
|
180
|
+
<span class="ruby-ivar">@args</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">array</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
181
|
+
<span class="ruby-identifier">array</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">" "</span>)
|
182
|
+
<span class="ruby-keyword">else</span>
|
183
|
+
<span class="ruby-identifier">array</span>
|
184
|
+
<span class="ruby-keyword">end</span>
|
185
|
+
<span class="ruby-keyword">end</span></pre>
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<div id="method-i-path-3D" class="method-detail ">
|
193
|
+
<div class="method-header">
|
194
|
+
<div class="method-heading">
|
195
|
+
<span class="method-name">path=</span><span
|
196
|
+
class="method-args">(path)</span>
|
197
|
+
<span class="method-click-advice">click to toggle source</span>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div class="method-description">
|
202
|
+
|
203
|
+
|
204
|
+
<div class="method-source-code" id="path-3D-source">
|
205
|
+
<pre><span class="ruby-comment"># File lib/conductor/script.rb, line 14</span>
|
206
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">path=</span>(<span class="ruby-identifier">path</span>)
|
207
|
+
<span class="ruby-ivar">@path</span> = <span class="ruby-keyword">if</span> <span class="ruby-regexp">%r{^[%/]}</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">path</span>)
|
208
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
|
209
|
+
<span class="ruby-keyword">else</span>
|
210
|
+
<span class="ruby-identifier">script_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">"~/.config/conductor/scripts"</span>)
|
211
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">script_dir</span>, <span class="ruby-identifier">path</span>))
|
212
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">script_dir</span>, <span class="ruby-identifier">path</span>)
|
213
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-constant">TTY</span><span class="ruby-operator">::</span><span class="ruby-constant">Which</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
|
214
|
+
<span class="ruby-constant">TTY</span><span class="ruby-operator">::</span><span class="ruby-constant">Which</span>.<span class="ruby-identifier">which</span>(<span class="ruby-identifier">path</span>)
|
215
|
+
<span class="ruby-keyword">else</span>
|
216
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"Path to #{path} not found"</span>
|
217
|
+
|
218
|
+
<span class="ruby-keyword">end</span>
|
219
|
+
<span class="ruby-keyword">end</span>
|
220
|
+
<span class="ruby-keyword">end</span></pre>
|
221
|
+
</div>
|
222
|
+
</div>
|
223
|
+
|
224
|
+
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<div id="method-i-run" class="method-detail ">
|
228
|
+
<div class="method-header">
|
229
|
+
<div class="method-heading">
|
230
|
+
<span class="method-name">run</span><span
|
231
|
+
class="method-args">()</span>
|
232
|
+
<span class="method-click-advice">click to toggle source</span>
|
233
|
+
</div>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div class="method-description">
|
237
|
+
|
238
|
+
|
239
|
+
<div class="method-source-code" id="run-source">
|
240
|
+
<pre><span class="ruby-comment"># File lib/conductor/script.rb, line 38</span>
|
241
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run</span>
|
242
|
+
<span class="ruby-identifier">stdin</span> = <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span>
|
243
|
+
|
244
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"Script path not defined"</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@path</span>
|
245
|
+
|
246
|
+
<span class="ruby-identifier">use_stdin</span> = <span class="ruby-keyword">true</span>
|
247
|
+
<span class="ruby-keyword">if</span> <span class="ruby-regexp">/\$\{?file\}?/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">args</span>)
|
248
|
+
<span class="ruby-identifier">use_stdin</span> = <span class="ruby-keyword">false</span>
|
249
|
+
<span class="ruby-identifier">args</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/\$\{?file\}?/</span>, <span class="ruby-constant">Env</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value">:filepath</span>])
|
250
|
+
<span class="ruby-keyword">else</span>
|
251
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-string">"No input"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">stdin</span>
|
252
|
+
|
253
|
+
<span class="ruby-keyword">end</span>
|
254
|
+
|
255
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">use_stdin</span>
|
256
|
+
<span class="ruby-node">`echo #{Shellwords.escape(stdin)} | #{Env} #{path} #{args}`</span>
|
257
|
+
<span class="ruby-keyword">else</span>
|
258
|
+
<span class="ruby-node">`#{Env} #{path} #{args}`</span>
|
259
|
+
<span class="ruby-keyword">end</span>
|
260
|
+
<span class="ruby-keyword">end</span></pre>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
|
264
|
+
|
265
|
+
</div>
|
266
|
+
|
267
|
+
</section>
|
268
|
+
|
269
|
+
</section>
|
270
|
+
</main>
|
271
|
+
|
272
|
+
|
273
|
+
<footer id="validator-badges" role="contentinfo">
|
274
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
275
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.6.2.
|
276
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
277
|
+
</footer>
|
278
|
+
|
data/html/Conductor.html
ADDED
@@ -0,0 +1,342 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module Conductor - 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="module">
|
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
|
+
|
62
|
+
|
63
|
+
|
64
|
+
<!-- Method Quickref -->
|
65
|
+
<div id="method-list-section" class="nav-section">
|
66
|
+
<h3>Methods</h3>
|
67
|
+
|
68
|
+
<ul class="link-list" role="directory">
|
69
|
+
<li ><a href="#method-c-conduct">::conduct</a>
|
70
|
+
<li ><a href="#method-c-execute_track">::execute_track</a>
|
71
|
+
<li ><a href="#method-c-stdin">::stdin</a>
|
72
|
+
<li ><a href="#method-i-create_config">#create_config</a>
|
73
|
+
<li ><a href="#method-i-sample_config">#sample_config</a>
|
74
|
+
</ul>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
</div>
|
78
|
+
</nav>
|
79
|
+
|
80
|
+
<main role="main" aria-labelledby="module-Conductor">
|
81
|
+
<h1 id="module-Conductor" class="module">
|
82
|
+
module Conductor
|
83
|
+
</h1>
|
84
|
+
|
85
|
+
<section class="description">
|
86
|
+
|
87
|
+
</section>
|
88
|
+
|
89
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
90
|
+
|
91
|
+
|
92
|
+
<section class="constants-list">
|
93
|
+
<header>
|
94
|
+
<h3>Constants</h3>
|
95
|
+
</header>
|
96
|
+
<dl>
|
97
|
+
<dt id="VERSION">VERSION
|
98
|
+
<dd>
|
99
|
+
</dl>
|
100
|
+
</section>
|
101
|
+
|
102
|
+
<section class="attribute-method-details" class="method-section">
|
103
|
+
<header>
|
104
|
+
<h3>Attributes</h3>
|
105
|
+
</header>
|
106
|
+
|
107
|
+
<div id="attribute-c-original_input" class="method-detail">
|
108
|
+
<div class="method-heading attribute-method-heading">
|
109
|
+
<span class="method-name">original_input</span><span
|
110
|
+
class="attribute-access-type">[RW]</span>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<div class="method-description">
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div id="attribute-c-stdin" class="method-detail">
|
118
|
+
<div class="method-heading attribute-method-heading">
|
119
|
+
<span class="method-name">stdin</span><span
|
120
|
+
class="attribute-access-type">[W]</span>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div class="method-description">
|
124
|
+
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
</section>
|
128
|
+
|
129
|
+
|
130
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
131
|
+
<header>
|
132
|
+
<h3>Public Class Methods</h3>
|
133
|
+
</header>
|
134
|
+
|
135
|
+
<div id="method-c-conduct" class="method-detail ">
|
136
|
+
<div class="method-header">
|
137
|
+
<div class="method-heading">
|
138
|
+
<span class="method-name">conduct</span><span
|
139
|
+
class="method-args">(tracks, res = nil, condition = nil)</span>
|
140
|
+
<span class="method-click-advice">click to toggle source</span>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div class="method-description">
|
145
|
+
|
146
|
+
|
147
|
+
<div class="method-source-code" id="conduct-source">
|
148
|
+
<pre><span class="ruby-comment"># File bin/conductor, line 37</span>
|
149
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">conduct</span>(<span class="ruby-identifier">tracks</span>, <span class="ruby-identifier">res</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">condition</span> = <span class="ruby-keyword">nil</span>)
|
150
|
+
<span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">track</span><span class="ruby-operator">|</span>
|
151
|
+
<span class="ruby-identifier">cond</span> = <span class="ruby-constant">Condition</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:condition</span>])
|
152
|
+
|
153
|
+
<span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">cond</span>.<span class="ruby-identifier">true?</span>
|
154
|
+
|
155
|
+
<span class="ruby-comment"># Build "matched condition" message</span>
|
156
|
+
<span class="ruby-identifier">title</span> = <span class="ruby-identifier">track</span>[<span class="ruby-value">:title</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:condition</span>]
|
157
|
+
<span class="ruby-identifier">condition</span> <span class="ruby-operator">||=</span> [<span class="ruby-string">""</span>]
|
158
|
+
<span class="ruby-identifier">condition</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">title</span>
|
159
|
+
<span class="ruby-identifier">condition</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">track</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value">:continue</span>) <span class="ruby-operator">?</span> <span class="ruby-string">", "</span> <span class="ruby-operator">:</span> <span class="ruby-string">" -> "</span>)
|
160
|
+
|
161
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">execute_track</span>(<span class="ruby-identifier">track</span>)
|
162
|
+
|
163
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:tracks</span>]
|
164
|
+
<span class="ruby-identifier">ts</span> = <span class="ruby-identifier">track</span>[<span class="ruby-value">:tracks</span>]
|
165
|
+
|
166
|
+
<span class="ruby-identifier">res</span>, <span class="ruby-identifier">condition</span> = <span class="ruby-identifier">conduct</span>(<span class="ruby-identifier">ts</span>, <span class="ruby-identifier">res</span>, <span class="ruby-identifier">condition</span>)
|
167
|
+
|
168
|
+
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span>
|
169
|
+
<span class="ruby-keyword">end</span>
|
170
|
+
|
171
|
+
<span class="ruby-keyword">break</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:continue</span>]
|
172
|
+
<span class="ruby-keyword">end</span>
|
173
|
+
|
174
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">res</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">original_input</span>
|
175
|
+
[<span class="ruby-keyword">nil</span>, <span class="ruby-string">"No change in output"</span>]
|
176
|
+
<span class="ruby-keyword">else</span>
|
177
|
+
[<span class="ruby-identifier">res</span>, <span class="ruby-identifier">condition</span>]
|
178
|
+
<span class="ruby-keyword">end</span>
|
179
|
+
<span class="ruby-keyword">end</span></pre>
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div id="method-c-execute_track" class="method-detail ">
|
187
|
+
<div class="method-header">
|
188
|
+
<div class="method-heading">
|
189
|
+
<span class="method-name">execute_track</span><span
|
190
|
+
class="method-args">(track)</span>
|
191
|
+
<span class="method-click-advice">click to toggle source</span>
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div class="method-description">
|
196
|
+
|
197
|
+
|
198
|
+
<div class="method-source-code" id="execute_track-source">
|
199
|
+
<pre><span class="ruby-comment"># File bin/conductor, line 9</span>
|
200
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">execute_track</span>(<span class="ruby-identifier">track</span>)
|
201
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:sequence</span>]
|
202
|
+
<span class="ruby-identifier">track</span>[<span class="ruby-value">:sequence</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">cmd</span><span class="ruby-operator">|</span>
|
203
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">cmd</span>[<span class="ruby-value">:script</span>]
|
204
|
+
<span class="ruby-identifier">script</span> = <span class="ruby-constant">Script</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>[<span class="ruby-value">:script</span>])
|
205
|
+
|
206
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">script</span>.<span class="ruby-identifier">run</span>
|
207
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">cmd</span>[<span class="ruby-value">:command</span>]
|
208
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-constant">Command</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>[<span class="ruby-value">:command</span>])
|
209
|
+
|
210
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">command</span>.<span class="ruby-identifier">run</span>
|
211
|
+
<span class="ruby-keyword">end</span>
|
212
|
+
|
213
|
+
<span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">res</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span>
|
214
|
+
<span class="ruby-keyword">end</span>
|
215
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:script</span>]
|
216
|
+
<span class="ruby-identifier">script</span> = <span class="ruby-constant">Script</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:script</span>])
|
217
|
+
|
218
|
+
<span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">script</span>.<span class="ruby-identifier">run</span>
|
219
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:command</span>]
|
220
|
+
<span class="ruby-identifier">command</span> = <span class="ruby-constant">Command</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:command</span>])
|
221
|
+
|
222
|
+
<span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">command</span>.<span class="ruby-identifier">run</span>
|
223
|
+
<span class="ruby-keyword">end</span>
|
224
|
+
|
225
|
+
<span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span>
|
226
|
+
<span class="ruby-keyword">end</span></pre>
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div id="method-c-stdin" class="method-detail ">
|
234
|
+
<div class="method-header">
|
235
|
+
<div class="method-heading">
|
236
|
+
<span class="method-name">stdin</span><span
|
237
|
+
class="method-args">()</span>
|
238
|
+
<span class="method-click-advice">click to toggle source</span>
|
239
|
+
</div>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div class="method-description">
|
243
|
+
|
244
|
+
|
245
|
+
<div class="method-source-code" id="stdin-source">
|
246
|
+
<pre><span class="ruby-comment"># File lib/conductor.rb, line 26</span>
|
247
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">stdin</span>
|
248
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-string">"input on STDIN required"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">fcntl</span>(<span class="ruby-constant">Fcntl</span><span class="ruby-operator">::</span><span class="ruby-constant">F_GETFL</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">zero?</span>
|
249
|
+
<span class="ruby-ivar">@stdin</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">read</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">"utf-8"</span>)
|
250
|
+
<span class="ruby-keyword">end</span></pre>
|
251
|
+
</div>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</section>
|
258
|
+
|
259
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
260
|
+
<header>
|
261
|
+
<h3>Public Instance Methods</h3>
|
262
|
+
</header>
|
263
|
+
|
264
|
+
<div id="method-i-create_config" class="method-detail ">
|
265
|
+
<div class="method-header">
|
266
|
+
<div class="method-heading">
|
267
|
+
<span class="method-name">create_config</span><span
|
268
|
+
class="method-args">(config_file)</span>
|
269
|
+
<span class="method-click-advice">click to toggle source</span>
|
270
|
+
</div>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<div class="method-description">
|
274
|
+
|
275
|
+
|
276
|
+
<div class="method-source-code" id="create_config-source">
|
277
|
+
<pre><span class="ruby-comment"># File lib/conductor/config.rb, line 19</span>
|
278
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create_config</span>(<span class="ruby-identifier">config_file</span>)
|
279
|
+
<span class="ruby-identifier">config_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">config_file</span>)
|
280
|
+
<span class="ruby-identifier">scripts_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">config_dir</span>, <span class="ruby-string">"scripts"</span>))
|
281
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">config_dir</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">config_dir</span>)
|
282
|
+
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">scripts_dir</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">scripts_dir</span>)
|
283
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">config_file</span>, <span class="ruby-string">"w"</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">sample_config</span> }
|
284
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Sample config created at #{config_file}"</span>
|
285
|
+
|
286
|
+
<span class="ruby-constant">Process</span>.<span class="ruby-identifier">exit</span> <span class="ruby-value">0</span>
|
287
|
+
<span class="ruby-keyword">end</span></pre>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
<div id="method-i-sample_config" class="method-detail ">
|
295
|
+
<div class="method-header">
|
296
|
+
<div class="method-heading">
|
297
|
+
<span class="method-name">sample_config</span><span
|
298
|
+
class="method-args">()</span>
|
299
|
+
<span class="method-click-advice">click to toggle source</span>
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div class="method-description">
|
304
|
+
|
305
|
+
|
306
|
+
<div class="method-source-code" id="sample_config-source">
|
307
|
+
<pre><span class="ruby-comment"># File lib/conductor/config.rb, line 30</span>
|
308
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sample_config</span>
|
309
|
+
<span class="ruby-identifier"><<~EOCONFIG</span>
|
310
|
+
<span class="ruby-value"> tracks:
|
311
|
+
- condition: phase is pre
|
312
|
+
tracks:
|
313
|
+
- condition: tree contains .obsidian
|
314
|
+
tracks:
|
315
|
+
- condition: extension is md
|
316
|
+
script: obsidian-md-filter
|
317
|
+
- condition: extension is md
|
318
|
+
command: rdiscount $file
|
319
|
+
- condition: yaml includes comments
|
320
|
+
script: blog-processor
|
321
|
+
- condition: any
|
322
|
+
command: echo 'NOCUSTOM'
|
323
|
+
</span><span class="ruby-identifier"> EOCONFIG</span>
|
324
|
+
<span class="ruby-keyword">end</span></pre>
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
|
329
|
+
</div>
|
330
|
+
|
331
|
+
</section>
|
332
|
+
|
333
|
+
</section>
|
334
|
+
</main>
|
335
|
+
|
336
|
+
|
337
|
+
<footer id="validator-badges" role="contentinfo">
|
338
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
339
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.6.2.
|
340
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
341
|
+
</footer>
|
342
|
+
|