marked-conductor 1.0.10 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/html/String.html CHANGED
@@ -122,10 +122,12 @@
122
122
  </div>
123
123
 
124
124
  <div class="method-description">
125
-
125
+ <p>Test if a string is a boolean</p>
126
+
127
+ <p>@return [Boolean] test result</p>
126
128
 
127
129
  <div class="method-source-code" id="bool-3F-source">
128
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 41</span>
130
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 77</span>
129
131
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool?</span>
130
132
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^(?:y(?:es)?|no?|t(?:rue)?|f(?:alse)?)$/</span>)
131
133
  <span class="ruby-keyword">end</span></pre>
@@ -145,10 +147,12 @@
145
147
  </div>
146
148
 
147
149
  <div class="method-description">
148
-
150
+ <p>Convert a string boolean to symbol</p>
151
+
152
+ <p>@return [Symbol] symbolized version</p>
149
153
 
150
154
  <div class="method-source-code" id="bool_to_symbol-source">
151
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 5</span>
155
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 10</span>
152
156
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool_to_symbol</span>
153
157
  <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
154
158
  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/(NOT|!!)/</span>
@@ -175,12 +179,14 @@
175
179
  </div>
176
180
 
177
181
  <div class="method-description">
178
-
182
+ <p>Test a string to see if it’s a UTC date</p>
183
+
184
+ <p>@return [Boolean] test result</p>
179
185
 
180
186
  <div class="method-source-code" id="date-3F-source">
181
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 16</span>
187
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 26</span>
182
188
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">date?</span>
183
- <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\d{4}-\d{2}-\d{2}/</span>)
189
+ <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\d{4}-\d{2}-\d{2}( \d\d:\d\d)?$/</span>)
184
190
  <span class="ruby-keyword">end</span></pre>
185
191
  </div>
186
192
  </div>
@@ -198,10 +204,12 @@
198
204
  </div>
199
205
 
200
206
  <div class="method-description">
201
-
207
+ <p>Test if a string starts with MMD metadata</p>
208
+
209
+ <p>@return [Boolean] test result</p>
202
210
 
203
211
  <div class="method-source-code" id="meta-3F-source">
204
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 49</span>
212
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 95</span>
205
213
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">meta?</span>
206
214
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\w+: +\S+/m</span>)
207
215
  <span class="ruby-keyword">end</span></pre>
@@ -221,10 +229,12 @@
221
229
  </div>
222
230
 
223
231
  <div class="method-description">
224
-
232
+ <p>Test if a string is a number</p>
233
+
234
+ <p>@return [Boolean] test result</p>
225
235
 
226
236
  <div class="method-source-code" id="number-3F-source">
227
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 37</span>
237
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 68</span>
228
238
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">number?</span>
229
239
  <span class="ruby-identifier">to_f</span>.<span class="ruby-identifier">positive?</span>
230
240
  <span class="ruby-keyword">end</span></pre>
@@ -244,10 +254,12 @@
244
254
  </div>
245
255
 
246
256
  <div class="method-description">
247
-
257
+ <p>Remove time from string</p>
258
+
259
+ <p>@return [String] string with time removed</p>
248
260
 
249
261
  <div class="method-source-code" id="strip_time-source">
250
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 28</span>
262
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 54</span>
251
263
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strip_time</span>
252
264
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ \d{1,2}(:\d\d)? *([ap]m)?/i</span>, <span class="ruby-string">&quot;&quot;</span>)
253
265
  <span class="ruby-keyword">end</span></pre>
@@ -267,10 +279,12 @@
267
279
  </div>
268
280
 
269
281
  <div class="method-description">
270
-
282
+ <p>Test a string to see if it includes a time</p>
283
+
284
+ <p>@return [Boolean] test result</p>
271
285
 
272
286
  <div class="method-source-code" id="time-3F-source">
273
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 20</span>
287
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 35</span>
274
288
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">time?</span>
275
289
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/ \d{1,2}(:\d\d)? *([ap]m)?/i</span>)
276
290
  <span class="ruby-keyword">end</span></pre>
@@ -295,7 +309,7 @@
295
309
  <p>@return [Boolean] Bool representation of the object.</p>
296
310
 
297
311
  <div class="method-source-code" id="to_bool-source">
298
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 62</span>
312
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 114</span>
299
313
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_bool</span>
300
314
  <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>)
301
315
  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^[yt]/i</span>
@@ -320,10 +334,12 @@
320
334
  </div>
321
335
 
322
336
  <div class="method-description">
323
-
337
+ <p>Destructive version of <a href="String.html#method-i-to_bool"><code>to_bool</code></a></p>
338
+
339
+ <p>@see <a href="String.html#method-i-to_bool"><code>to_bool</code></a></p>
324
340
 
325
341
  <div class="method-source-code" id="to_bool-21-source">
326
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 53</span>
342
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 105</span>
327
343
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_bool!</span>
328
344
  <span class="ruby-identifier">replace</span> <span class="ruby-identifier">to_bool</span>
329
345
  <span class="ruby-keyword">end</span></pre>
@@ -343,10 +359,15 @@
343
359
  </div>
344
360
 
345
361
  <div class="method-description">
346
-
362
+ <p>Convert a natural language string to a Date</p>
363
+
364
+ <pre class="ruby"><span class="ruby-identifier">object</span>
365
+ </pre>
366
+
367
+ <p>@return [Date] Resulting Date object</p>
347
368
 
348
369
  <div class="method-source-code" id="to_date-source">
349
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 24</span>
370
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 45</span>
350
371
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_date</span>
351
372
  <span class="ruby-constant">Chronic</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>))
352
373
  <span class="ruby-keyword">end</span></pre>
@@ -369,7 +390,7 @@
369
390
 
370
391
 
371
392
  <div class="method-source-code" id="to_day-source">
372
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 32</span>
393
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 58</span>
373
394
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_day</span>(<span class="ruby-identifier">time</span> = <span class="ruby-value">:end</span>)
374
395
  <span class="ruby-identifier">t</span> = <span class="ruby-identifier">time</span> <span class="ruby-operator">==</span> <span class="ruby-value">:end</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;23:59&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;00:00&quot;</span>
375
396
  <span class="ruby-constant">Chronic</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;#{strip_time} #{t}&quot;</span>)
@@ -390,10 +411,12 @@
390
411
  </div>
391
412
 
392
413
  <div class="method-description">
393
-
414
+ <p>Test if string starts with YAML</p>
415
+
416
+ <p>@return [Boolean] test result</p>
394
417
 
395
418
  <div class="method-source-code" id="yaml-3F-source">
396
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 45</span>
419
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 86</span>
397
420
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">yaml?</span>
398
421
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^---/m</span>)
399
422
  <span class="ruby-keyword">end</span></pre>
data/html/created.rid CHANGED
@@ -1,14 +1,14 @@
1
- Sun, 28 Apr 2024 14:05:58 -0500
1
+ Wed, 01 May 2024 13:06:18 -0500
2
2
  README.rdoc Sun, 28 Apr 2024 13:21:34 -0500
3
- lib/conductor.rb Sun, 28 Apr 2024 13:46:38 -0500
3
+ lib/conductor.rb Wed, 01 May 2024 13:05:15 -0500
4
4
  lib/conductor/array.rb Sat, 27 Apr 2024 11:54:28 -0500
5
5
  lib/conductor/boolean.rb Thu, 25 Apr 2024 14:25:59 -0500
6
6
  lib/conductor/command.rb Sat, 27 Apr 2024 11:54:28 -0500
7
- lib/conductor/condition.rb Sun, 28 Apr 2024 13:52:45 -0500
7
+ lib/conductor/condition.rb Mon, 29 Apr 2024 09:19:15 -0500
8
8
  lib/conductor/config.rb Sat, 27 Apr 2024 11:54:28 -0500
9
- lib/conductor/env.rb Sun, 28 Apr 2024 13:31:54 -0500
9
+ lib/conductor/env.rb Mon, 29 Apr 2024 09:28:21 -0500
10
10
  lib/conductor/hash.rb Sat, 27 Apr 2024 11:54:28 -0500
11
- lib/conductor/script.rb Sat, 27 Apr 2024 11:54:28 -0500
12
- lib/conductor/string.rb Sun, 28 Apr 2024 13:50:26 -0500
13
- lib/conductor/version.rb Sat, 27 Apr 2024 16:00:44 -0500
14
- bin/conductor Sun, 28 Apr 2024 14:01:55 -0500
11
+ lib/conductor/script.rb Sun, 28 Apr 2024 16:21:49 -0500
12
+ lib/conductor/string.rb Mon, 29 Apr 2024 09:46:03 -0500
13
+ lib/conductor/version.rb Mon, 29 Apr 2024 09:46:58 -0500
14
+ bin/conductor Sun, 28 Apr 2024 16:24:45 -0500
@@ -1 +1 @@
1
- var search_data = {"index":{"searchIndex":["array","conductor","command","condition","config","env","script","falseclass","hash","object","string","trueclass","args=()","args=()","bool?()","bool?()","bool?()","bool_to_symbol()","clean_condition()","conduct()","create_config()","date?()","env()","execute_track()","load_test_env()","meta?()","new()","new()","new()","new()","number?()","operator_to_symbol()","parse_condition()","path=()","path=()","run()","run()","sample_config()","split_booleans()","split_condition()","stdin()","strip_time()","symbolize_keys()","symbolize_keys()","symbolize_keys!()","symbolize_keys!()","test_condition()","test_meta()","test_operator()","test_pandoc()","test_string()","test_tree()","test_truthy()","test_type()","test_yaml()","time?()","to_bool()","to_bool!()","to_date()","to_day()","to_s()","true?()","yaml?()","readme"],"longSearchIndex":["array","conductor","conductor::command","conductor::condition","conductor::config","conductor::env","conductor::script","falseclass","hash","object","string","trueclass","conductor::command#args=()","conductor::script#args=()","falseclass#bool?()","string#bool?()","trueclass#bool?()","string#bool_to_symbol()","object#clean_condition()","conductor::conduct()","conductor#create_config()","string#date?()","conductor::env::env()","conductor::execute_track()","conductor::env::load_test_env()","string#meta?()","conductor::command::new()","conductor::condition::new()","conductor::config::new()","conductor::script::new()","string#number?()","conductor::condition#operator_to_symbol()","conductor::condition#parse_condition()","conductor::command#path=()","conductor::script#path=()","conductor::command#run()","conductor::script#run()","conductor#sample_config()","conductor::condition#split_booleans()","conductor::condition#split_condition()","conductor::stdin()","string#strip_time()","array#symbolize_keys()","hash#symbolize_keys()","array#symbolize_keys!()","hash#symbolize_keys!()","conductor::condition#test_condition()","conductor::condition#test_meta()","conductor::condition#test_operator()","conductor::condition#test_pandoc()","conductor::condition#test_string()","conductor::condition#test_tree()","conductor::condition#test_truthy()","conductor::condition#test_type()","conductor::condition#test_yaml()","string#time?()","string#to_bool()","string#to_bool!()","string#to_date()","string#to_day()","conductor::env::to_s()","conductor::condition#true?()","string#yaml?()",""],"info":[["Array","","Array.html","",""],["Conductor","","Conductor.html","",""],["Conductor::Command","","Conductor/Command.html","","<p>Command runner\n"],["Conductor::Condition","","Conductor/Condition.html","",""],["Conductor::Config","","Conductor/Config.html","","<p>Configuration methods\n"],["Conductor::Env","","Conductor/Env.html","",""],["Conductor::Script","","Conductor/Script.html","","<p>Script runner\n"],["FalseClass","","FalseClass.html","","<p>False class\n"],["Hash","","Hash.html","",""],["Object","","Object.html","",""],["String","","String.html","","<p>String helpers\n"],["TrueClass","","TrueClass.html","","<p>True class\n"],["args=","Conductor::Command","Conductor/Command.html#method-i-args-3D","(array)",""],["args=","Conductor::Script","Conductor/Script.html#method-i-args-3D","(array)",""],["bool?","FalseClass","FalseClass.html#method-i-bool-3F","()",""],["bool?","String","String.html#method-i-bool-3F","()",""],["bool?","TrueClass","TrueClass.html#method-i-bool-3F","()",""],["bool_to_symbol","String","String.html#method-i-bool_to_symbol","()",""],["clean_condition","Object","Object.html#method-i-clean_condition","(condition)",""],["conduct","Conductor","Conductor.html#method-c-conduct","(tracks, res = nil, condition = nil)",""],["create_config","Conductor","Conductor.html#method-i-create_config","(config_file)",""],["date?","String","String.html#method-i-date-3F","()",""],["env","Conductor::Env","Conductor/Env.html#method-c-env","()",""],["execute_track","Conductor","Conductor.html#method-c-execute_track","(track)",""],["load_test_env","Conductor::Env","Conductor/Env.html#method-c-load_test_env","()",""],["meta?","String","String.html#method-i-meta-3F","()",""],["new","Conductor::Command","Conductor/Command.html#method-c-new","(command)",""],["new","Conductor::Condition","Conductor/Condition.html#method-c-new","(condition)",""],["new","Conductor::Config","Conductor/Config.html#method-c-new","()",""],["new","Conductor::Script","Conductor/Script.html#method-c-new","(script)",""],["number?","String","String.html#method-i-number-3F","()",""],["operator_to_symbol","Conductor::Condition","Conductor/Condition.html#method-i-operator_to_symbol","(operator)",""],["parse_condition","Conductor::Condition","Conductor/Condition.html#method-i-parse_condition","()",""],["path=","Conductor::Command","Conductor/Command.html#method-i-path-3D","(path)",""],["path=","Conductor::Script","Conductor/Script.html#method-i-path-3D","(path)",""],["run","Conductor::Command","Conductor/Command.html#method-i-run","()",""],["run","Conductor::Script","Conductor/Script.html#method-i-run","()",""],["sample_config","Conductor","Conductor.html#method-i-sample_config","()",""],["split_booleans","Conductor::Condition","Conductor/Condition.html#method-i-split_booleans","(condition)","<p>@brief Splits booleans and tests components.\n<p>@param condition The condition to test\n<p>@return …\n"],["split_condition","Conductor::Condition","Conductor/Condition.html#method-i-split_condition","(condition)","<p>@brief Splits a natural language condition.\n<p>@param condition The condition @return [Array] …\n"],["stdin","Conductor","Conductor.html#method-c-stdin","()",""],["strip_time","String","String.html#method-i-strip_time","()",""],["symbolize_keys","Array","Array.html#method-i-symbolize_keys","()",""],["symbolize_keys","Hash","Hash.html#method-i-symbolize_keys","()",""],["symbolize_keys!","Array","Array.html#method-i-symbolize_keys-21","()",""],["symbolize_keys!","Hash","Hash.html#method-i-symbolize_keys-21","()",""],["test_condition","Conductor::Condition","Conductor/Condition.html#method-i-test_condition","(condition)",""],["test_meta","Conductor::Condition","Conductor/Condition.html#method-i-test_meta","(content, value, key, operator)","<p>@brief Test for MultiMarkdown metadata,\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">optionally</span> <span class=\"ruby-identifier\">key</span> <span class=\"ruby-keyword\">and</span> <span class=\"ruby-identifier\">value</span>\n</pre>\n<p>@param content [String] The …\n"],["test_operator","Conductor::Condition","Conductor/Condition.html#method-i-test_operator","(value1, value2, operator)","<p>@brief Test operators\n<p>@param value1 Value @param value2 Value to test @param …\n"],["test_pandoc","Conductor::Condition","Conductor/Condition.html#method-i-test_pandoc","(content, operator)",""],["test_string","Conductor::Condition","Conductor/Condition.html#method-i-test_string","(val1, val2, operator)","<p>@brief Compare a string based on operator\n<p>@param val1 The string to test against @param …\n"],["test_tree","Conductor::Condition","Conductor/Condition.html#method-i-test_tree","(origin, value, operator)","<p>@brief Test for the existince of a\n\n<pre>file/directory in the parent tree</pre>\n<p>@param origin Starting …\n"],["test_truthy","Conductor::Condition","Conductor/Condition.html#method-i-test_truthy","(value1, value2, operator)","<p>@brief Test “truthiness”\n<p>@param value1 Value to test against @param value2 …\n"],["test_type","Conductor::Condition","Conductor/Condition.html#method-i-test_type","(val1, val2, operator)","<p>@brief Test for type of value\n<p>@param val1 value @param val2 value to test against …\n"],["test_yaml","Conductor::Condition","Conductor/Condition.html#method-i-test_yaml","(content, value, key, operator)","<p>@brief Test for presence of yaml, optionall for\n\n<pre>a key, optionally for a key&#39;s value</pre>\n<p>@param content …\n"],["time?","String","String.html#method-i-time-3F","()",""],["to_bool","String","String.html#method-i-to_bool","()","<p>Returns a bool representation of the string.\n<p>@return [Boolean] Bool representation of the object. …\n"],["to_bool!","String","String.html#method-i-to_bool-21","()",""],["to_date","String","String.html#method-i-to_date","()",""],["to_day","String","String.html#method-i-to_day","(time = :end)",""],["to_s","Conductor::Env","Conductor/Env.html#method-c-to_s","()",""],["true?","Conductor::Condition","Conductor/Condition.html#method-i-true-3F","()",""],["yaml?","String","String.html#method-i-yaml-3F","()",""],["README","","README_rdoc.html","","<p>Marked Conductor\n<p>A command line tool that functions as a custom processor handler for Marked 2.\n"]]}}
1
+ var search_data = {"index":{"searchIndex":["array","conductor","command","condition","config","env","script","falseclass","hash","object","string","trueclass","args=()","args=()","bool?()","bool?()","bool?()","bool_to_symbol()","clean_condition()","conduct()","create_config()","date?()","env()","execute_track()","load_test_env()","meta?()","new()","new()","new()","new()","number?()","operator_to_symbol()","parse_condition()","path=()","path=()","run()","run()","sample_config()","split_booleans()","split_condition()","stdin()","strip_time()","symbolize_keys()","symbolize_keys()","symbolize_keys!()","symbolize_keys!()","test_condition()","test_meta()","test_operator()","test_pandoc()","test_string()","test_tree()","test_truthy()","test_type()","test_yaml()","time?()","to_bool()","to_bool!()","to_date()","to_day()","to_s()","true?()","yaml?()","readme"],"longSearchIndex":["array","conductor","conductor::command","conductor::condition","conductor::config","conductor::env","conductor::script","falseclass","hash","object","string","trueclass","conductor::command#args=()","conductor::script#args=()","falseclass#bool?()","string#bool?()","trueclass#bool?()","string#bool_to_symbol()","object#clean_condition()","conductor::conduct()","conductor#create_config()","string#date?()","conductor::env::env()","conductor::execute_track()","conductor::env::load_test_env()","string#meta?()","conductor::command::new()","conductor::condition::new()","conductor::config::new()","conductor::script::new()","string#number?()","conductor::condition#operator_to_symbol()","conductor::condition#parse_condition()","conductor::command#path=()","conductor::script#path=()","conductor::command#run()","conductor::script#run()","conductor#sample_config()","conductor::condition#split_booleans()","conductor::condition#split_condition()","conductor::stdin()","string#strip_time()","array#symbolize_keys()","hash#symbolize_keys()","array#symbolize_keys!()","hash#symbolize_keys!()","conductor::condition#test_condition()","conductor::condition#test_meta()","conductor::condition#test_operator()","conductor::condition#test_pandoc()","conductor::condition#test_string()","conductor::condition#test_tree()","conductor::condition#test_truthy()","conductor::condition#test_type()","conductor::condition#test_yaml()","string#time?()","string#to_bool()","string#to_bool!()","string#to_date()","string#to_day()","conductor::env::to_s()","conductor::condition#true?()","string#yaml?()",""],"info":[["Array","","Array.html","",""],["Conductor","","Conductor.html","","<p>Main Conductor class\n"],["Conductor::Command","","Conductor/Command.html","","<p>Command runner\n"],["Conductor::Condition","","Conductor/Condition.html","",""],["Conductor::Config","","Conductor/Config.html","","<p>Configuration methods\n"],["Conductor::Env","","Conductor/Env.html","","<p>Environment variables\n"],["Conductor::Script","","Conductor/Script.html","","<p>Script runner\n"],["FalseClass","","FalseClass.html","","<p>False class\n"],["Hash","","Hash.html","",""],["Object","","Object.html","",""],["String","","String.html","","<p>String helpers\n"],["TrueClass","","TrueClass.html","","<p>True class\n"],["args=","Conductor::Command","Conductor/Command.html#method-i-args-3D","(array)",""],["args=","Conductor::Script","Conductor/Script.html#method-i-args-3D","(array)","<p>Set the args array\n<p>@param array The array\n"],["bool?","FalseClass","FalseClass.html#method-i-bool-3F","()",""],["bool?","String","String.html#method-i-bool-3F","()","<p>Test if a string is a boolean\n<p>@return [Boolean] test result\n"],["bool?","TrueClass","TrueClass.html#method-i-bool-3F","()",""],["bool_to_symbol","String","String.html#method-i-bool_to_symbol","()","<p>Convert a string boolean to symbol\n<p>@return [Symbol] symbolized version\n"],["clean_condition","Object","Object.html#method-i-clean_condition","(condition)","<p>Clean up conditions for output\n<p>@param condition The condition\n"],["conduct","Conductor","Conductor.html#method-c-conduct","(tracks, res = nil, condition = nil)","<p>Main function to parse conditions and\n\n<pre>execute actions. Executes recursively for\nsub-tracks.</pre>\n<p>@param …\n"],["create_config","Conductor","Conductor.html#method-i-create_config","(config_file)",""],["date?","String","String.html#method-i-date-3F","()","<p>Test a string to see if it’s a UTC date\n<p>@return [Boolean] test result\n"],["env","Conductor::Env","Conductor/Env.html#method-c-env","()","<p>Define @env using Marked environment variables\n"],["execute_track","Conductor","Conductor.html#method-c-execute_track","(track)","<p>Execute commands/scripts in the track\n<p>@param track The track\n<p>@return Resulting STDOUT output …\n"],["load_test_env","Conductor::Env","Conductor/Env.html#method-c-load_test_env","()","<p>Loads a test environment.\n"],["meta?","String","String.html#method-i-meta-3F","()","<p>Test if a string starts with MMD metadata\n<p>@return [Boolean] test result\n"],["new","Conductor::Command","Conductor/Command.html#method-c-new","(command)",""],["new","Conductor::Condition","Conductor/Condition.html#method-c-new","(condition)","<p>Initializes the given condition.\n<p>@param condition The condition\n"],["new","Conductor::Config","Conductor/Config.html#method-c-new","()",""],["new","Conductor::Script","Conductor/Script.html#method-c-new","(script)","<p>Initializes the given script.\n<p>@param script The script/path\n"],["number?","String","String.html#method-i-number-3F","()","<p>Test if a string is a number\n<p>@return [Boolean] test result\n"],["operator_to_symbol","Conductor::Condition","Conductor/Condition.html#method-i-operator_to_symbol","(operator)",""],["parse_condition","Conductor::Condition","Conductor/Condition.html#method-i-parse_condition","()",""],["path=","Conductor::Command","Conductor/Command.html#method-i-path-3D","(path)",""],["path=","Conductor::Script","Conductor/Script.html#method-i-path-3D","(path)","<p>Set script path, automatically expands/tests\n<p>@param path The path\n"],["run","Conductor::Command","Conductor/Command.html#method-i-run","()",""],["run","Conductor::Script","Conductor/Script.html#method-i-run","()","<p>Execute the script\n<p>@return [String] script results (STDOUT)\n"],["sample_config","Conductor","Conductor.html#method-i-sample_config","()",""],["split_booleans","Conductor::Condition","Conductor/Condition.html#method-i-split_booleans","(condition)","<p>Splits booleans and tests components.\n<p>@param condition The condition to test\n<p>@return [Boolean] …\n"],["split_condition","Conductor::Condition","Conductor/Condition.html#method-i-split_condition","(condition)","<p>Splits a natural language condition.\n<p>@param condition The condition @return [Array] Value, value …\n"],["stdin","Conductor","Conductor.html#method-c-stdin","()",""],["strip_time","String","String.html#method-i-strip_time","()","<p>Remove time from string\n<p>@return [String] string with time removed\n"],["symbolize_keys","Array","Array.html#method-i-symbolize_keys","()",""],["symbolize_keys","Hash","Hash.html#method-i-symbolize_keys","()",""],["symbolize_keys!","Array","Array.html#method-i-symbolize_keys-21","()",""],["symbolize_keys!","Hash","Hash.html#method-i-symbolize_keys-21","()",""],["test_condition","Conductor::Condition","Conductor/Condition.html#method-i-test_condition","(condition)",""],["test_meta","Conductor::Condition","Conductor/Condition.html#method-i-test_meta","(content, value, key, operator)","<p>Test for MultiMarkdown metadata,\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">optionally</span> <span class=\"ruby-identifier\">key</span> <span class=\"ruby-keyword\">and</span> <span class=\"ruby-identifier\">value</span>\n</pre>\n<p>@param content [String] The text content …\n"],["test_operator","Conductor::Condition","Conductor/Condition.html#method-i-test_operator","(value1, value2, operator)","<p>Test operators\n<p>@param value1 Value @param value2 Value to test @param operator …\n"],["test_pandoc","Conductor::Condition","Conductor/Condition.html#method-i-test_pandoc","(content, operator)",""],["test_string","Conductor::Condition","Conductor/Condition.html#method-i-test_string","(val1, val2, operator)","<p>Compare a string based on operator\n<p>@param val1 The string to test against @param val2 …\n"],["test_tree","Conductor::Condition","Conductor/Condition.html#method-i-test_tree","(origin, value, operator)","<p>Test for the existince of a\n\n<pre>file/directory in the parent tree</pre>\n<p>@param origin Starting directory …\n"],["test_truthy","Conductor::Condition","Conductor/Condition.html#method-i-test_truthy","(value1, value2, operator)","<p>Test “truthiness”\n<p>@param value1 Value to test against @param value2 Value to …\n"],["test_type","Conductor::Condition","Conductor/Condition.html#method-i-test_type","(val1, val2, operator)","<p>Test for type of value\n<p>@param val1 value @param val2 value to test against @param …\n"],["test_yaml","Conductor::Condition","Conductor/Condition.html#method-i-test_yaml","(content, value, key, operator)","<p>Test for presence of yaml, optionall for\n\n<pre>a key, optionally for a key&#39;s value</pre>\n<p>@param content Text …\n"],["time?","String","String.html#method-i-time-3F","()","<p>Test a string to see if it includes a time\n<p>@return [Boolean] test result\n"],["to_bool","String","String.html#method-i-to_bool","()","<p>Returns a bool representation of the string.\n<p>@return [Boolean] Bool representation of the object. …\n"],["to_bool!","String","String.html#method-i-to_bool-21","()","<p>Destructive version of #to_bool\n<p>@see #to_bool\n"],["to_date","String","String.html#method-i-to_date","()","<p>Convert a natural language string to a Date\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">object</span>\n</pre>\n<p>@return [Date] Resulting Date object\n"],["to_day","String","String.html#method-i-to_day","(time = :end)",""],["to_s","Conductor::Env","Conductor/Env.html#method-c-to_s","()","<p>env to string\n<p>@return [String] shell-compatible string representation of @env\n"],["true?","Conductor::Condition","Conductor/Condition.html#method-i-true-3F","()","<p>Tests condition\n<p>@return [Boolean] test result\n"],["yaml?","String","String.html#method-i-yaml-3F","()","<p>Test if string starts with YAML\n<p>@return [Boolean] test result\n"],["README","","README_rdoc.html","","<p>Marked Conductor\n<p>A command line tool that functions as a custom processor handler for Marked 2.\n"]]}}
Binary file
@@ -2,17 +2,28 @@
2
2
 
3
3
  module Conductor
4
4
  class Condition
5
+
6
+ ##
7
+ ## Initializes the given condition.
8
+ ##
9
+ ## @param condition The condition
10
+ ##
5
11
  def initialize(condition)
6
12
  @condition = condition
7
13
  @env = Conductor::Env.env
8
14
  end
9
15
 
16
+ ##
17
+ ## Tests condition
18
+ ##
19
+ ## @return [Boolean] test result
20
+ ##
10
21
  def true?
11
22
  parse_condition
12
23
  end
13
24
 
14
25
  ##
15
- ## @brief Splits booleans and tests components.
26
+ ## Splits booleans and tests components.
16
27
  ##
17
28
  ## @param condition The condition to test
18
29
  ##
@@ -52,7 +63,7 @@ module Conductor
52
63
  end
53
64
 
54
65
  ##
55
- ## @brief Test operators
66
+ ## Test operators
56
67
  ##
57
68
  ## @param value1 Value
58
69
  ## @param value2 Value to test
@@ -80,7 +91,7 @@ module Conductor
80
91
  end
81
92
 
82
93
  ##
83
- ## @brief Splits a natural language condition.
94
+ ## Splits a natural language condition.
84
95
  ##
85
96
  ## @param condition The condition
86
97
  ## @return [Array] Value, value to compare, operator
@@ -105,7 +116,7 @@ module Conductor
105
116
  end
106
117
 
107
118
  ##
108
- ## @brief Test for type of value
119
+ ## Test for type of value
109
120
  ##
110
121
  ## @param val1 value
111
122
  ## @param val2 value to test against
@@ -130,7 +141,7 @@ module Conductor
130
141
  end
131
142
 
132
143
  ##
133
- ## @brief Compare a string based on operator
144
+ ## Compare a string based on operator
134
145
  ##
135
146
  ## @param val1 The string to test against
136
147
  ## @param val2 The value to test
@@ -194,7 +205,7 @@ module Conductor
194
205
  end
195
206
 
196
207
  ##
197
- ## @brief Test for the existince of a
208
+ ## Test for the existince of a
198
209
  ## file/directory in the parent tree
199
210
  ##
200
211
  ## @param origin Starting directory
@@ -219,7 +230,7 @@ module Conductor
219
230
  end
220
231
 
221
232
  ##
222
- ## @brief Test "truthiness"
233
+ ## Test "truthiness"
223
234
  ##
224
235
  ## @param value1 Value to test against
225
236
  ## @param value2 Value to test
@@ -238,7 +249,7 @@ module Conductor
238
249
  end
239
250
 
240
251
  ##
241
- ## @brief Test for presence of yaml, optionall for
252
+ ## Test for presence of yaml, optionall for
242
253
  ## a key, optionally for a key's value
243
254
  ##
244
255
  ## @param content Text content containing YAML
@@ -286,7 +297,7 @@ module Conductor
286
297
  end
287
298
 
288
299
  ##
289
- ## @brief Test for MultiMarkdown metadata,
300
+ ## Test for MultiMarkdown metadata,
290
301
  ## optionally key and value
291
302
  ##
292
303
  ## @param content [String] The text content
data/lib/conductor/env.rb CHANGED
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conductor
4
+ # Environment variables
4
5
  module Env
6
+ ##
7
+ ## Define @env using Marked environment variables
8
+ ##
5
9
  def self.env
6
- @env ||= if ENV["CONDUCTOR_TEST"] == "true"
10
+ if ENV["CONDUCTOR_TEST"] == "true"
7
11
  load_test_env
8
12
  else
9
13
  @env ||= {
@@ -23,23 +27,31 @@ module Conductor
23
27
  @env
24
28
  end
25
29
 
30
+ ##
31
+ ## Loads a test environment.
32
+ ##
26
33
  def self.load_test_env
27
34
  @env = {
28
35
  home: "/Users/ttscoff",
29
36
  css_path: "/Applications/Marked 2.app/Contents/Resources/swiss.css",
30
37
  ext: "md",
31
38
  includes: [],
32
- origin: "/Users/ttscoff/Desktop/Code/nvultra-docs/content/",
33
- filepath: "/Users/ttscoff/Desktop/Code/nvultra-docs/content/advanced-features.md",
39
+ origin: "/Users/ttscoff/Sites/dev/bt/source/_posts/",
40
+ filepath: "/Users/ttscoff/Sites/dev/bt/source/_posts/2024-04-01-automating-the-dimspirations-workflow.md",
34
41
  filename: "advanced-features.md",
35
42
  phase: "PROCESS",
36
43
  outline: "NONE",
37
- path: "/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/Desktop/Code/nvultra-docs/content/"
44
+ path: "/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/Sites/dev/bt/source/_posts"
38
45
  }
39
46
  end
40
47
 
48
+ ##
49
+ ## env to string
50
+ ##
51
+ ## @return [String] shell-compatible string representation of @env
52
+ ##
41
53
  def self.to_s
42
- out_h = {
54
+ {
43
55
  "HOME" => @env[:home],
44
56
  "MARKED_CSS_PATH" => @env[:css_path],
45
57
  "MARKED_EXT" => @env[:ext],
@@ -49,8 +61,7 @@ module Conductor
49
61
  "MARKED_PHASE" => @env[:phase],
50
62
  "OUTLINE" => @env[:outline],
51
63
  "PATH" => @env[:path]
52
- }
53
- out_h.map { |k, v| %(#{k}="#{v}") }.join(" ")
64
+ }.map { |k, v| %(#{k}="#{v}") }.join(" ")
54
65
  end
55
66
  end
56
67
  end
@@ -5,41 +5,63 @@ module Conductor
5
5
  class Script
6
6
  attr_reader :args, :path
7
7
 
8
+ ##
9
+ ## Initializes the given script.
10
+ ##
11
+ ## @param script The script/path
12
+ ##
8
13
  def initialize(script)
9
14
  parts = Shellwords.split(script)
10
15
  self.path = parts[0]
11
16
  self.args = parts[1..].join(" ")
12
17
  end
13
18
 
19
+ ##
20
+ ## Set script path, automatically expands/tests
21
+ ##
22
+ ## @param path The path
23
+ ##
14
24
  def path=(path)
15
25
  @path = if %r{^[%/]}.match?(path)
16
- File.expand_path(path)
17
- else
18
- script_dir = File.expand_path("~/.config/conductor/scripts")
19
- if File.exist?(File.join(script_dir, path))
20
- File.join(script_dir, path)
21
- elsif TTY::Which.exist?(path)
22
- TTY::Which.which(path)
23
- else
24
- raise "Path to #{path} not found"
25
-
26
- end
27
- end
26
+ File.expand_path(path)
27
+ else
28
+ script_dir = File.expand_path("~/.config/conductor/scripts")
29
+ if File.exist?(File.join(script_dir, path))
30
+ File.join(script_dir, path)
31
+ elsif TTY::Which.exist?(path)
32
+ TTY::Which.which(path)
33
+ else
34
+ raise "Path to #{path} not found"
35
+
36
+ end
37
+ end
28
38
  end
29
39
 
40
+ ##
41
+ ## Set the args array
42
+ ##
43
+ ## @param array The array
44
+ ##
30
45
  def args=(array)
31
46
  @args = if array.is_a?(Array)
32
- array.join(" ")
33
- else
34
- array
35
- end
47
+ array.join(" ")
48
+ else
49
+ array
50
+ end
36
51
  end
37
52
 
53
+ ##
54
+ ## Execute the script
55
+ ##
56
+ ## @return [String] script results (STDOUT)
57
+ ##
38
58
  def run
39
59
  stdin = Conductor.stdin
40
60
 
41
61
  raise "Script path not defined" unless @path
42
62
 
63
+ raise "Script not executable" unless File.executable?(@path)
64
+
43
65
  use_stdin = true
44
66
  if /\$\{?file\}?/.match?(args)
45
67
  use_stdin = false
@@ -50,9 +72,9 @@ module Conductor
50
72
  end
51
73
 
52
74
  if use_stdin
53
- `echo #{Shellwords.escape(stdin)} | #{Env} #{path} #{args}`
75
+ `echo #{Shellwords.escape(stdin)} | #{Env} #{@path} #{@args}`
54
76
  else
55
- `#{Env} #{path} #{args}`
77
+ `#{Env} #{@path} #{@args}`
56
78
  end
57
79
  end
58
80
  end
@@ -2,6 +2,11 @@
2
2
 
3
3
  # String helpers
4
4
  class ::String
5
+ ##
6
+ ## Convert a string boolean to symbol
7
+ ##
8
+ ## @return [Symbol] symbolized version
9
+ ##
5
10
  def bool_to_symbol
6
11
  case self
7
12
  when /(NOT|!!)/
@@ -13,18 +18,39 @@ class ::String
13
18
  end
14
19
  end
15
20
 
21
+ ##
22
+ ## Test a string to see if it's a UTC date
23
+ ##
24
+ ## @return [Boolean] test result
25
+ ##
16
26
  def date?
17
- dup.force_encoding("utf-8").match?(/^\d{4}-\d{2}-\d{2}/)
27
+ dup.force_encoding("utf-8").match?(/^\d{4}-\d{2}-\d{2}( \d\d:\d\d)?$/)
18
28
  end
19
29
 
30
+ ##
31
+ ## Test a string to see if it includes a time
32
+ ##
33
+ ## @return [Boolean] test result
34
+ ##
20
35
  def time?
21
36
  dup.force_encoding("utf-8").match(/ \d{1,2}(:\d\d)? *([ap]m)?/i)
22
37
  end
23
38
 
39
+ ##
40
+ ## Convert a natural language string to a Date
41
+ ## object
42
+ ##
43
+ ## @return [Date] Resulting Date object
44
+ ##
24
45
  def to_date
25
46
  Chronic.parse(dup.force_encoding("utf-8"))
26
47
  end
27
48
 
49
+ ##
50
+ ## Remove time from string
51
+ ##
52
+ ## @return [String] string with time removed
53
+ ##
28
54
  def strip_time
29
55
  dup.force_encoding("utf-8").sub(/ \d{1,2}(:\d\d)? *([ap]m)?/i, "")
30
56
  end
@@ -34,22 +60,48 @@ class ::String
34
60
  Chronic.parse("#{strip_time} #{t}")
35
61
  end
36
62
 
63
+ ##
64
+ ## Test if a string is a number
65
+ ##
66
+ ## @return [Boolean] test result
67
+ ##
37
68
  def number?
38
69
  to_f.positive?
39
70
  end
40
71
 
72
+ ##
73
+ ## Test if a string is a boolean
74
+ ##
75
+ ## @return [Boolean] test result
76
+ ##
41
77
  def bool?
42
78
  dup.force_encoding("utf-8").match?(/^(?:y(?:es)?|no?|t(?:rue)?|f(?:alse)?)$/)
43
79
  end
44
80
 
81
+ ##
82
+ ## Test if string starts with YAML
83
+ ##
84
+ ## @return [Boolean] test result
85
+ ##
45
86
  def yaml?
46
87
  dup.force_encoding('utf-8').match?(/^---/m)
47
88
  end
48
89
 
90
+ ##
91
+ ## Test if a string starts with MMD metadata
92
+ ##
93
+ ## @return [Boolean] test result
94
+ ##
49
95
  def meta?
50
96
  dup.force_encoding('utf-8').match?(/^\w+: +\S+/m)
51
97
  end
52
98
 
99
+ ##
100
+ ## Destructive version of #to_bool
101
+ ##
102
+ ##
103
+ ## @see #to_bool
104
+ ##
53
105
  def to_bool!
54
106
  replace to_bool
55
107
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conductor
4
- VERSION = '1.0.10'
4
+ VERSION = '1.0.12'
5
5
  end
data/lib/conductor.rb CHANGED
@@ -25,7 +25,7 @@ module Conductor
25
25
 
26
26
  def stdin
27
27
  warn "input on STDIN required" unless $stdin.stat.size.positive? || $stdin.fcntl(Fcntl::F_GETFL, 0).zero?
28
- @stdin ||= $stdin.read.strip.force_encoding("utf-8")
28
+ @stdin ||= $stdin.read.force_encoding("utf-8")
29
29
  end
30
30
  end
31
31
  end