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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7109f39eebaf5360cade0f07a0c9be229bef19f5ebd70aeac9cee944fbfd545a
4
- data.tar.gz: abbe3d27d472dfbf3798b5a52399a51d156c58fe0c4baffa5e07613770446fb2
3
+ metadata.gz: e298518419f5939cc95271b652adc94345fb2da14741828d93d61c4199097407
4
+ data.tar.gz: 07a2162d2bec5d47cd2cc12859b8e92326462af6b93a80215d716b300e671d8c
5
5
  SHA512:
6
- metadata.gz: fc0d62a40dbd605af1af7a06144b9f0a598c1187a7892f3d3ec2d3cd56685e97900b64ee56c56d9d4fb8a3caedad9dcb2691b013214cdf35cfd806bad684ba08
7
- data.tar.gz: 32040939e175a7e287c9c1fb9f8fc63e33fe0af4450a2f5d801a85f2f668046ceb157c265aaab38dfb553fcf917345a1062d3910716c188f2f5b25ad3baf37fb
6
+ metadata.gz: 63685957ebef16b86d3d0b7e83b658aeddfc221b6ae65d290a6579e9633bcaeb2fcdde2f0d0fc1967098bf221e79a0913b80b1a42772d226e3f85e42262e8b46
7
+ data.tar.gz: 0137d914194e3159d745c6479de1182db4f26a2fa6d633e7dc42c1553469ce033818bcfca5fc4a11926b7eabb441456b86dc1a48b690da2701668d4c46ad616c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ### 1.0.12
2
+
3
+ 2024-05-01 13:06
4
+
5
+ #### FIXED
6
+
7
+ - Attempt to fix encoding error
8
+
9
+ ### 1.0.11
10
+
11
+ 2024-04-29 09:46
12
+
13
+ #### FIXED
14
+
15
+ - Reversed symbols when outputting condition matches to STDERR
16
+ - Only assume date if it's not part of a filename
17
+
1
18
  ### 1.0.10
2
19
 
3
20
  2024-04-28 14:05
data/bin/conductor CHANGED
@@ -4,8 +4,16 @@
4
4
  require_relative "../lib/conductor"
5
5
  require "optparse"
6
6
 
7
+ # Main Conductor class
7
8
  module Conductor
8
9
  class << self
10
+ ##
11
+ ## Execute commands/scripts in the track
12
+ ##
13
+ ## @param track The track
14
+ ##
15
+ ## @return Resulting STDOUT output
16
+ ##
9
17
  def execute_track(track)
10
18
  if track[:sequence]
11
19
  track[:sequence].each do |cmd|
@@ -34,6 +42,17 @@ module Conductor
34
42
  Conductor.stdin
35
43
  end
36
44
 
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
+ ##
37
56
  def conduct(tracks, res = nil, condition = nil)
38
57
  tracks.each do |track|
39
58
  cond = Condition.new(track[:condition])
@@ -44,7 +63,7 @@ module Conductor
44
63
  title = track[:title] || track[:condition]
45
64
  condition ||= [""]
46
65
  condition << title
47
- condition.push(track.key?(:continue) ? ", " : " -> ")
66
+ condition.push(track.key?(:continue) ? " -> " : ", ")
48
67
 
49
68
  res = execute_track(track)
50
69
 
@@ -92,6 +111,11 @@ Conductor.original_input = Conductor.stdin
92
111
  tracks = config.tracks
93
112
  res, condition = Conductor.conduct(tracks)
94
113
 
114
+ ##
115
+ ## Clean up conditions for output
116
+ ##
117
+ ## @param condition The condition
118
+ ##
95
119
  def clean_condition(condition)
96
120
  condition.join("").sub(/ *(->|,) *$/, "")
97
121
  end
@@ -123,10 +123,12 @@
123
123
  </div>
124
124
 
125
125
  <div class="method-description">
126
-
126
+ <p>Initializes the given condition.</p>
127
+
128
+ <p>@param condition The condition</p>
127
129
 
128
130
  <div class="method-source-code" id="new-source">
129
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 5</span>
131
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 11</span>
130
132
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">condition</span>)
131
133
  <span class="ruby-ivar">@condition</span> = <span class="ruby-identifier">condition</span>
132
134
  <span class="ruby-ivar">@env</span> = <span class="ruby-constant">Conductor</span><span class="ruby-operator">::</span><span class="ruby-constant">Env</span>.<span class="ruby-identifier">env</span>
@@ -157,7 +159,7 @@
157
159
 
158
160
 
159
161
  <div class="method-source-code" id="operator_to_symbol-source">
160
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 370</span>
162
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 381</span>
161
163
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">operator_to_symbol</span>(<span class="ruby-identifier">operator</span>)
162
164
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">operator</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">operator</span>.<span class="ruby-identifier">nil?</span>
163
165
 
@@ -207,7 +209,7 @@
207
209
 
208
210
 
209
211
  <div class="method-source-code" id="parse_condition-source">
210
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 401</span>
212
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 412</span>
211
213
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">parse_condition</span>
212
214
  <span class="ruby-identifier">cond</span> = <span class="ruby-ivar">@condition</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\((.*?)\)/</span>) <span class="ruby-keyword">do</span>
213
215
  <span class="ruby-identifier">condition</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>(<span class="ruby-value">1</span>)
@@ -232,14 +234,14 @@
232
234
  </div>
233
235
 
234
236
  <div class="method-description">
235
- <p>@brief Splits booleans and tests components.</p>
237
+ <p>Splits booleans and tests components.</p>
236
238
 
237
239
  <p>@param condition The condition to test</p>
238
240
 
239
241
  <p>@return [Boolean] test result</p>
240
242
 
241
243
  <div class="method-source-code" id="split_booleans-source">
242
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 21</span>
244
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 32</span>
243
245
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">split_booleans</span>(<span class="ruby-identifier">condition</span>)
244
246
  <span class="ruby-identifier">split</span> = <span class="ruby-identifier">condition</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/ ((?:AND )?NOT|AND|OR) /</span>)
245
247
 
@@ -288,12 +290,12 @@
288
290
  </div>
289
291
 
290
292
  <div class="method-description">
291
- <p>@brief Splits a natural language condition.</p>
293
+ <p>Splits a natural language condition.</p>
292
294
 
293
295
  <p>@param condition The condition @return [Array] Value, value to compare, operator</p>
294
296
 
295
297
  <div class="method-source-code" id="split_condition-source">
296
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 88</span>
298
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 99</span>
297
299
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">split_condition</span>(<span class="ruby-identifier">condition</span>)
298
300
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">condition</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(?:((?:does )?not)?(?:ha(?:s|ve)|contains?|includes?) +)?(yaml|headers|frontmatter|mmd|meta(?:data)?|pandoc)(:\S+)?/i</span>)
299
301
  <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
@@ -331,7 +333,7 @@
331
333
 
332
334
 
333
335
  <div class="method-source-code" id="test_condition-source">
334
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 332</span>
336
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 343</span>
335
337
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_condition</span>(<span class="ruby-identifier">condition</span>)
336
338
  <span class="ruby-identifier">type</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">operator</span> = <span class="ruby-identifier">split_condition</span>(<span class="ruby-identifier">condition</span>)
337
339
 
@@ -385,7 +387,7 @@
385
387
  </div>
386
388
 
387
389
  <div class="method-description">
388
- <p>@brief Test for MultiMarkdown metadata,</p>
390
+ <p>Test for MultiMarkdown metadata,</p>
389
391
 
390
392
  <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>
391
393
  </pre>
@@ -395,7 +397,7 @@
395
397
  <p>@return [Boolean] test result</p>
396
398
 
397
399
  <div class="method-source-code" id="test_meta-source">
398
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 299</span>
400
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 310</span>
399
401
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_meta</span>(<span class="ruby-identifier">content</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">operator</span>)
400
402
  <span class="ruby-identifier">headers</span> = []
401
403
  <span class="ruby-identifier">content</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">&quot;\n&quot;</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
@@ -439,14 +441,14 @@
439
441
  </div>
440
442
 
441
443
  <div class="method-description">
442
- <p>@brief Test operators</p>
444
+ <p>Test operators</p>
443
445
 
444
446
  <p>@param value1 Value @param value2 Value to test @param operator The operator</p>
445
447
 
446
448
  <p>@return [Boolean] test result</p>
447
449
 
448
450
  <div class="method-source-code" id="test_operator-source">
449
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 63</span>
451
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 74</span>
450
452
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_operator</span>(<span class="ruby-identifier">value1</span>, <span class="ruby-identifier">value2</span>, <span class="ruby-identifier">operator</span>)
451
453
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">operator</span>
452
454
  <span class="ruby-keyword">when</span> <span class="ruby-value">:gt</span>
@@ -484,7 +486,7 @@
484
486
 
485
487
 
486
488
  <div class="method-source-code" id="test_pandoc-source">
487
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 327</span>
489
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 338</span>
488
490
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_pandoc</span>(<span class="ruby-identifier">content</span>, <span class="ruby-identifier">operator</span>)
489
491
  <span class="ruby-identifier">res</span> = <span class="ruby-identifier">content</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^%% /</span>)
490
492
  <span class="ruby-node">%i[not_contains not_equal]</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">operator</span>) <span class="ruby-operator">?</span> <span class="ruby-operator">!</span><span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span>
@@ -505,14 +507,14 @@
505
507
  </div>
506
508
 
507
509
  <div class="method-description">
508
- <p>@brief Compare a string based on operator</p>
510
+ <p>Compare a string based on operator</p>
509
511
 
510
512
  <p>@param val1 The string to test against @param val2 The value to test @param operator The operator</p>
511
513
 
512
514
  <p>@return [Boolean] test result</p>
513
515
 
514
516
  <div class="method-source-code" id="test_string-source">
515
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 141</span>
517
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 152</span>
516
518
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_string</span>(<span class="ruby-identifier">val1</span>, <span class="ruby-identifier">val2</span>, <span class="ruby-identifier">operator</span>)
517
519
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">operator</span> <span class="ruby-operator">==</span> <span class="ruby-value">:not_equal</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">val1</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">:</span> <span class="ruby-operator">!</span><span class="ruby-identifier">val1</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">val2</span>.<span class="ruby-identifier">nil?</span>
518
520
 
@@ -583,7 +585,7 @@
583
585
  </div>
584
586
 
585
587
  <div class="method-description">
586
- <p>@brief Test for the existince of a</p>
588
+ <p>Test for the existince of a</p>
587
589
 
588
590
  <pre>file/directory in the parent tree</pre>
589
591
 
@@ -596,7 +598,7 @@
596
598
  <p>@return [Boolean] test result</p>
597
599
 
598
600
  <div class="method-source-code" id="test_tree-source">
599
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 207</span>
601
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 218</span>
600
602
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_tree</span>(<span class="ruby-identifier">origin</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">operator</span>)
601
603
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <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">origin</span>, <span class="ruby-identifier">value</span>))
602
604
 
@@ -626,14 +628,14 @@
626
628
  </div>
627
629
 
628
630
  <div class="method-description">
629
- <p>@brief Test “truthiness”</p>
631
+ <p>Test “truthiness”</p>
630
632
 
631
633
  <p>@param value1 Value to test against @param value2 Value to test @param operator The operator</p>
632
634
 
633
635
  <p>@return [Boolean] test result</p>
634
636
 
635
637
  <div class="method-source-code" id="test_truthy-source">
636
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 230</span>
638
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 241</span>
637
639
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_truthy</span>(<span class="ruby-identifier">value1</span>, <span class="ruby-identifier">value2</span>, <span class="ruby-identifier">operator</span>)
638
640
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">value2</span>&amp;.<span class="ruby-identifier">bool?</span>
639
641
 
@@ -659,12 +661,12 @@
659
661
  </div>
660
662
 
661
663
  <div class="method-description">
662
- <p>@brief Test for type of value</p>
664
+ <p>Test for type of value</p>
663
665
 
664
666
  <p>@param val1 value @param val2 value to test against @param operator The operator</p>
665
667
 
666
668
  <div class="method-source-code" id="test_type-source">
667
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 114</span>
669
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 125</span>
668
670
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_type</span>(<span class="ruby-identifier">val1</span>, <span class="ruby-identifier">val2</span>, <span class="ruby-identifier">operator</span>)
669
671
  <span class="ruby-identifier">res</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">val2</span>
670
672
  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/number/</span>
@@ -698,7 +700,7 @@
698
700
  </div>
699
701
 
700
702
  <div class="method-description">
701
- <p>@brief Test for presence of yaml, optionall for</p>
703
+ <p>Test for presence of yaml, optionall for</p>
702
704
 
703
705
  <pre>a key, optionally for a key&#39;s value</pre>
704
706
 
@@ -707,7 +709,7 @@
707
709
  <p>@return [Boolean] test result</p>
708
710
 
709
711
  <div class="method-source-code" id="test_yaml-source">
710
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 251</span>
712
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 262</span>
711
713
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">test_yaml</span>(<span class="ruby-identifier">content</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">operator</span>)
712
714
  <span class="ruby-keyword">begin</span>
713
715
  <span class="ruby-identifier">yaml</span> = <span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">content</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/^(?:---|\.\.\.)/</span>)[<span class="ruby-value">1</span>])
@@ -760,10 +762,12 @@
760
762
  </div>
761
763
 
762
764
  <div class="method-description">
763
-
765
+ <p>Tests condition</p>
766
+
767
+ <p>@return [Boolean] test result</p>
764
768
 
765
769
  <div class="method-source-code" id="true-3F-source">
766
- <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 10</span>
770
+ <pre><span class="ruby-comment"># File lib/conductor/condition.rb, line 21</span>
767
771
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">true?</span>
768
772
  <span class="ruby-identifier">parse_condition</span>
769
773
  <span class="ruby-keyword">end</span></pre>
@@ -82,6 +82,8 @@
82
82
 
83
83
  <section class="description">
84
84
 
85
+ <p>Environment variables</p>
86
+
85
87
  </section>
86
88
 
87
89
  <section id="5Buntitled-5D" class="documentation-section">
@@ -105,12 +107,12 @@
105
107
  </div>
106
108
 
107
109
  <div class="method-description">
108
-
110
+ <p>Define @env using Marked environment variables</p>
109
111
 
110
112
  <div class="method-source-code" id="env-source">
111
- <pre><span class="ruby-comment"># File lib/conductor/env.rb, line 5</span>
113
+ <pre><span class="ruby-comment"># File lib/conductor/env.rb, line 9</span>
112
114
  <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">env</span>
113
- <span class="ruby-ivar">@env</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;CONDUCTOR_TEST&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;true&quot;</span>
115
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-string">&quot;CONDUCTOR_TEST&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;true&quot;</span>
114
116
  <span class="ruby-identifier">load_test_env</span>
115
117
  <span class="ruby-keyword">else</span>
116
118
  <span class="ruby-ivar">@env</span> <span class="ruby-operator">||=</span> {
@@ -145,22 +147,22 @@
145
147
  </div>
146
148
 
147
149
  <div class="method-description">
148
-
150
+ <p>Loads a test environment.</p>
149
151
 
150
152
  <div class="method-source-code" id="load_test_env-source">
151
- <pre><span class="ruby-comment"># File lib/conductor/env.rb, line 26</span>
153
+ <pre><span class="ruby-comment"># File lib/conductor/env.rb, line 33</span>
152
154
  <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">load_test_env</span>
153
155
  <span class="ruby-ivar">@env</span> = {
154
156
  <span class="ruby-value">home:</span> <span class="ruby-string">&quot;/Users/ttscoff&quot;</span>,
155
157
  <span class="ruby-value">css_path:</span> <span class="ruby-string">&quot;/Applications/Marked 2.app/Contents/Resources/swiss.css&quot;</span>,
156
158
  <span class="ruby-value">ext:</span> <span class="ruby-string">&quot;md&quot;</span>,
157
159
  <span class="ruby-value">includes:</span> [],
158
- <span class="ruby-value">origin:</span> <span class="ruby-string">&quot;/Users/ttscoff/Desktop/Code/nvultra-docs/content/&quot;</span>,
159
- <span class="ruby-value">filepath:</span> <span class="ruby-string">&quot;/Users/ttscoff/Desktop/Code/nvultra-docs/content/advanced-features.md&quot;</span>,
160
+ <span class="ruby-value">origin:</span> <span class="ruby-string">&quot;/Users/ttscoff/Sites/dev/bt/source/_posts/&quot;</span>,
161
+ <span class="ruby-value">filepath:</span> <span class="ruby-string">&quot;/Users/ttscoff/Sites/dev/bt/source/_posts/2024-04-01-automating-the-dimspirations-workflow.md&quot;</span>,
160
162
  <span class="ruby-value">filename:</span> <span class="ruby-string">&quot;advanced-features.md&quot;</span>,
161
163
  <span class="ruby-value">phase:</span> <span class="ruby-string">&quot;PROCESS&quot;</span>,
162
164
  <span class="ruby-value">outline:</span> <span class="ruby-string">&quot;NONE&quot;</span>,
163
- <span class="ruby-value">path:</span> <span class="ruby-string">&quot;/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/Desktop/Code/nvultra-docs/content/&quot;</span>
165
+ <span class="ruby-value">path:</span> <span class="ruby-string">&quot;/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/Sites/dev/bt/source/_posts&quot;</span>
164
166
  }
165
167
  <span class="ruby-keyword">end</span></pre>
166
168
  </div>
@@ -179,12 +181,14 @@
179
181
  </div>
180
182
 
181
183
  <div class="method-description">
182
-
184
+ <p>env to string</p>
185
+
186
+ <p>@return [String] shell-compatible string representation of @env</p>
183
187
 
184
188
  <div class="method-source-code" id="to_s-source">
185
- <pre><span class="ruby-comment"># File lib/conductor/env.rb, line 41</span>
189
+ <pre><span class="ruby-comment"># File lib/conductor/env.rb, line 53</span>
186
190
  <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">to_s</span>
187
- <span class="ruby-identifier">out_h</span> = {
191
+ {
188
192
  <span class="ruby-string">&quot;HOME&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value">:home</span>],
189
193
  <span class="ruby-string">&quot;MARKED_CSS_PATH&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value">:css_path</span>],
190
194
  <span class="ruby-string">&quot;MARKED_EXT&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value">:ext</span>],
@@ -194,8 +198,7 @@
194
198
  <span class="ruby-string">&quot;MARKED_PHASE&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value">:phase</span>],
195
199
  <span class="ruby-string">&quot;OUTLINE&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value">:outline</span>],
196
200
  <span class="ruby-string">&quot;PATH&quot;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-ivar">@env</span>[<span class="ruby-value">:path</span>]
197
- }
198
- <span class="ruby-identifier">out_h</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">%(#{k}=&quot;#{v}&quot;)</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot; &quot;</span>)
201
+ }.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-node">%(#{k}=&quot;#{v}&quot;)</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot; &quot;</span>)
199
202
  <span class="ruby-keyword">end</span></pre>
200
203
  </div>
201
204
  </div>
@@ -140,10 +140,12 @@
140
140
  </div>
141
141
 
142
142
  <div class="method-description">
143
-
143
+ <p>Initializes the given script.</p>
144
+
145
+ <p>@param script The script/path</p>
144
146
 
145
147
  <div class="method-source-code" id="new-source">
146
- <pre><span class="ruby-comment"># File lib/conductor/script.rb, line 8</span>
148
+ <pre><span class="ruby-comment"># File lib/conductor/script.rb, line 13</span>
147
149
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">script</span>)
148
150
  <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
151
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">path</span> = <span class="ruby-identifier">parts</span>[<span class="ruby-value">0</span>]
@@ -172,16 +174,18 @@
172
174
  </div>
173
175
 
174
176
  <div class="method-description">
175
-
177
+ <p>Set the args array</p>
178
+
179
+ <p>@param array The array</p>
176
180
 
177
181
  <div class="method-source-code" id="args-3D-source">
178
- <pre><span class="ruby-comment"># File lib/conductor/script.rb, line 30</span>
182
+ <pre><span class="ruby-comment"># File lib/conductor/script.rb, line 45</span>
179
183
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">args=</span>(<span class="ruby-identifier">array</span>)
180
184
  <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">&quot; &quot;</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-identifier">array</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot; &quot;</span>)
186
+ <span class="ruby-keyword">else</span>
187
+ <span class="ruby-identifier">array</span>
188
+ <span class="ruby-keyword">end</span>
185
189
  <span class="ruby-keyword">end</span></pre>
186
190
  </div>
187
191
  </div>
@@ -199,24 +203,26 @@
199
203
  </div>
200
204
 
201
205
  <div class="method-description">
202
-
206
+ <p>Set script path, automatically expands/tests</p>
207
+
208
+ <p>@param path The path</p>
203
209
 
204
210
  <div class="method-source-code" id="path-3D-source">
205
- <pre><span class="ruby-comment"># File lib/conductor/script.rb, line 14</span>
211
+ <pre><span class="ruby-comment"># File lib/conductor/script.rb, line 24</span>
206
212
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">path=</span>(<span class="ruby-identifier">path</span>)
207
213
  <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">&quot;~/.config/conductor/scripts&quot;</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">&quot;Path to #{path} not found&quot;</span>
217
-
218
- <span class="ruby-keyword">end</span>
219
- <span class="ruby-keyword">end</span>
214
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
215
+ <span class="ruby-keyword">else</span>
216
+ <span class="ruby-identifier">script_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&quot;~/.config/conductor/scripts&quot;</span>)
217
+ <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>))
218
+ <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>)
219
+ <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>)
220
+ <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>)
221
+ <span class="ruby-keyword">else</span>
222
+ <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Path to #{path} not found&quot;</span>
223
+
224
+ <span class="ruby-keyword">end</span>
225
+ <span class="ruby-keyword">end</span>
220
226
  <span class="ruby-keyword">end</span></pre>
221
227
  </div>
222
228
  </div>
@@ -234,15 +240,19 @@
234
240
  </div>
235
241
 
236
242
  <div class="method-description">
237
-
243
+ <p>Execute the script</p>
244
+
245
+ <p>@return [String] script results (STDOUT)</p>
238
246
 
239
247
  <div class="method-source-code" id="run-source">
240
- <pre><span class="ruby-comment"># File lib/conductor/script.rb, line 38</span>
248
+ <pre><span class="ruby-comment"># File lib/conductor/script.rb, line 58</span>
241
249
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run</span>
242
250
  <span class="ruby-identifier">stdin</span> = <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span>
243
251
 
244
252
  <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Script path not defined&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@path</span>
245
253
 
254
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Script not executable&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">executable?</span>(<span class="ruby-ivar">@path</span>)
255
+
246
256
  <span class="ruby-identifier">use_stdin</span> = <span class="ruby-keyword">true</span>
247
257
  <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
258
  <span class="ruby-identifier">use_stdin</span> = <span class="ruby-keyword">false</span>
@@ -253,9 +263,9 @@
253
263
  <span class="ruby-keyword">end</span>
254
264
 
255
265
  <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>
266
+ <span class="ruby-node">`echo #{Shellwords.escape(stdin)} | #{Env} #{@path} #{@args}`</span>
257
267
  <span class="ruby-keyword">else</span>
258
- <span class="ruby-node">`#{Env} #{path} #{args}`</span>
268
+ <span class="ruby-node">`#{Env} #{@path} #{@args}`</span>
259
269
  <span class="ruby-keyword">end</span>
260
270
  <span class="ruby-keyword">end</span></pre>
261
271
  </div>
data/html/Conductor.html CHANGED
@@ -84,6 +84,8 @@
84
84
 
85
85
  <section class="description">
86
86
 
87
+ <p>Main <a href="Conductor.html"><code>Conductor</code></a> class</p>
88
+
87
89
  </section>
88
90
 
89
91
  <section id="5Buntitled-5D" class="documentation-section">
@@ -142,10 +144,17 @@
142
144
  </div>
143
145
 
144
146
  <div class="method-description">
145
-
147
+ <p>Main function to parse conditions and</p>
148
+
149
+ <pre>execute actions. Executes recursively for
150
+ sub-tracks.</pre>
151
+
152
+ <p>@param tracks The tracks to process @param res The current result @param condition The current condition</p>
153
+
154
+ <p>@return [Array] result, matched condition(s)</p>
146
155
 
147
156
  <div class="method-source-code" id="conduct-source">
148
- <pre><span class="ruby-comment"># File bin/conductor, line 37</span>
157
+ <pre><span class="ruby-comment"># File bin/conductor, line 56</span>
149
158
  <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
159
  <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
160
  <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>])
@@ -156,7 +165,7 @@
156
165
  <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
166
  <span class="ruby-identifier">condition</span> <span class="ruby-operator">||=</span> [<span class="ruby-string">&quot;&quot;</span>]
158
167
  <span class="ruby-identifier">condition</span> <span class="ruby-operator">&lt;&lt;</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">&quot;, &quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot; -&gt; &quot;</span>)
168
+ <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">&quot; -&gt; &quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;, &quot;</span>)
160
169
 
161
170
  <span class="ruby-identifier">res</span> = <span class="ruby-identifier">execute_track</span>(<span class="ruby-identifier">track</span>)
162
171
 
@@ -193,10 +202,14 @@
193
202
  </div>
194
203
 
195
204
  <div class="method-description">
196
-
205
+ <p>Execute commands/scripts in the track</p>
206
+
207
+ <p>@param track The track</p>
208
+
209
+ <p>@return Resulting STDOUT output</p>
197
210
 
198
211
  <div class="method-source-code" id="execute_track-source">
199
- <pre><span class="ruby-comment"># File bin/conductor, line 9</span>
212
+ <pre><span class="ruby-comment"># File bin/conductor, line 17</span>
200
213
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">execute_track</span>(<span class="ruby-identifier">track</span>)
201
214
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:sequence</span>]
202
215
  <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>
@@ -246,7 +259,7 @@
246
259
  <pre><span class="ruby-comment"># File lib/conductor.rb, line 26</span>
247
260
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">stdin</span>
248
261
  <span class="ruby-identifier">warn</span> <span class="ruby-string">&quot;input on STDIN required&quot;</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">&quot;utf-8&quot;</span>)
262
+ <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">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>)
250
263
  <span class="ruby-keyword">end</span></pre>
251
264
  </div>
252
265
  </div>
data/html/Object.html CHANGED
@@ -109,10 +109,12 @@
109
109
  </div>
110
110
 
111
111
  <div class="method-description">
112
-
112
+ <p>Clean up conditions for output</p>
113
+
114
+ <p>@param condition The condition</p>
113
115
 
114
116
  <div class="method-source-code" id="clean_condition-source">
115
- <pre><span class="ruby-comment"># File bin/conductor, line 95</span>
117
+ <pre><span class="ruby-comment"># File bin/conductor, line 119</span>
116
118
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">clean_condition</span>(<span class="ruby-identifier">condition</span>)
117
119
  <span class="ruby-identifier">condition</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;&quot;</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ *(-&gt;|,) *$/</span>, <span class="ruby-string">&quot;&quot;</span>)
118
120
  <span class="ruby-keyword">end</span></pre>