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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.irbrc +2 -0
  3. data/CHANGELOG.md +26 -0
  4. data/README.rdoc +1 -1
  5. data/bin/conductor +68 -61
  6. data/html/Array.html +160 -0
  7. data/html/Conductor/Command.html +271 -0
  8. data/html/Conductor/Condition.html +787 -0
  9. data/html/Conductor/Config.html +170 -0
  10. data/html/Conductor/Env.html +217 -0
  11. data/html/Conductor/Script.html +278 -0
  12. data/html/Conductor.html +342 -0
  13. data/html/FalseClass.html +138 -0
  14. data/html/Hash.html +160 -0
  15. data/html/Object.html +136 -0
  16. data/html/README_rdoc.html +86 -0
  17. data/html/String.html +417 -0
  18. data/html/TrueClass.html +138 -0
  19. data/html/created.rid +14 -0
  20. data/html/css/fonts.css +167 -0
  21. data/html/css/rdoc.css +687 -0
  22. data/html/fonts/Lato-Light.ttf +0 -0
  23. data/html/fonts/Lato-LightItalic.ttf +0 -0
  24. data/html/fonts/Lato-Regular.ttf +0 -0
  25. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  26. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  27. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  28. data/html/images/add.png +0 -0
  29. data/html/images/arrow_up.png +0 -0
  30. data/html/images/brick.png +0 -0
  31. data/html/images/brick_link.png +0 -0
  32. data/html/images/bug.png +0 -0
  33. data/html/images/bullet_black.png +0 -0
  34. data/html/images/bullet_toggle_minus.png +0 -0
  35. data/html/images/bullet_toggle_plus.png +0 -0
  36. data/html/images/date.png +0 -0
  37. data/html/images/delete.png +0 -0
  38. data/html/images/find.png +0 -0
  39. data/html/images/loadingAnimation.gif +0 -0
  40. data/html/images/macFFBgHack.png +0 -0
  41. data/html/images/package.png +0 -0
  42. data/html/images/page_green.png +0 -0
  43. data/html/images/page_white_text.png +0 -0
  44. data/html/images/page_white_width.png +0 -0
  45. data/html/images/plugin.png +0 -0
  46. data/html/images/ruby.png +0 -0
  47. data/html/images/tag_blue.png +0 -0
  48. data/html/images/tag_green.png +0 -0
  49. data/html/images/transparent.png +0 -0
  50. data/html/images/wrench.png +0 -0
  51. data/html/images/wrench_orange.png +0 -0
  52. data/html/images/zoom.png +0 -0
  53. data/html/index.html +105 -0
  54. data/html/js/darkfish.js +97 -0
  55. data/html/js/navigation.js +105 -0
  56. data/html/js/navigation.js.gz +0 -0
  57. data/html/js/search.js +110 -0
  58. data/html/js/search_index.js +1 -0
  59. data/html/js/search_index.js.gz +0 -0
  60. data/html/js/searcher.js +229 -0
  61. data/html/js/searcher.js.gz +0 -0
  62. data/html/table_of_contents.html +345 -0
  63. data/lib/conductor/condition.rb +23 -4
  64. data/lib/conductor/env.rb +6 -6
  65. data/lib/conductor/string.rb +5 -5
  66. data/lib/conductor/version.rb +1 -1
  67. data/lib/conductor.rb +1 -0
  68. data/marked-conductor.gemspec +3 -3
  69. metadata +89 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc01f58de2ca4d81c45420e08128c3ae0dd3f125badce5d62a8cc568c599d202
4
- data.tar.gz: ad0724664a346aea50e4467d7a492737d885b6b2916f04077a73866b3ba0e915
3
+ metadata.gz: 7109f39eebaf5360cade0f07a0c9be229bef19f5ebd70aeac9cee944fbfd545a
4
+ data.tar.gz: abbe3d27d472dfbf3798b5a52399a51d156c58fe0c4baffa5e07613770446fb2
5
5
  SHA512:
6
- metadata.gz: b812adad30a746bc2b38f302047a595796d8ec2886b503a198b1384dd570d0b61d41de1029788c95b3f6a579c98c4571bef01c00c8f866aeb6245028676ab104
7
- data.tar.gz: 11f506aa92cdc7ea0c5f219b84d694615c32da729ba57dfafa0f4eb9aa258d33c69c36383d858b0d0764c03362eb7e6db0b3fe4862b441db3d326e5c5f678f36
6
+ metadata.gz: fc0d62a40dbd605af1af7a06144b9f0a598c1187a7892f3d3ec2d3cd56685e97900b64ee56c56d9d4fb8a3caedad9dcb2691b013214cdf35cfd806bad684ba08
7
+ data.tar.gz: 32040939e175a7e287c9c1fb9f8fc63e33fe0af4450a2f5d801a85f2f668046ceb157c265aaab38dfb553fcf917345a1062d3910716c188f2f5b25ad3baf37fb
data/.irbrc CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "irb/completion"
2
4
  require_relative "lib/conductor"
3
5
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ### 1.0.10
2
+
3
+ 2024-04-28 14:05
4
+
5
+ #### IMPROVED
6
+
7
+ - Return NOCUSTOM if changes are not made by scripts/commands, even though condition was matched
8
+ - Use YAML.load instead of .safe_load to allow more flexibility
9
+ - Trap errors reading YAML and fail gracefully
10
+
11
+ #### FIXED
12
+
13
+ - Encoding errors on string methods
14
+
15
+ ### 1.0.9
16
+
17
+ 2024-04-27 16:00
18
+
19
+ #### NEW
20
+
21
+ - Test for pandoc metadata (%%) with `is pandoc` or `is not pandoc`
22
+
23
+ #### FIXED
24
+
25
+ - Filename comparison not working
26
+
1
27
  ### 1.0.8
2
28
 
3
29
  2024-04-27 14:01
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = Marked Commander
1
+ = Marked Conductor
2
2
 
3
3
  A command line tool that functions as a custom processor handler for Marked 2.
4
4
 
data/bin/conductor CHANGED
@@ -1,88 +1,82 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env ruby -W1
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative '../lib/conductor'
5
- require 'optparse'
4
+ require_relative "../lib/conductor"
5
+ require "optparse"
6
6
 
7
- # raise 'No input on STDIN' unless Conductor.stdin
7
+ module Conductor
8
+ class << self
9
+ def execute_track(track)
10
+ if track[:sequence]
11
+ track[:sequence].each do |cmd|
12
+ if cmd[:script]
13
+ script = Script.new(cmd[:script])
8
14
 
9
- include Conductor
15
+ res = script.run
16
+ elsif cmd[:command]
17
+ command = Command.new(cmd[:command])
10
18
 
11
- config = Config.new
19
+ res = command.run
20
+ end
12
21
 
13
- stdin = Conductor.stdin
22
+ Conductor.stdin = res unless res.nil?
23
+ end
24
+ elsif track[:script]
25
+ script = Script.new(track[:script])
14
26
 
15
- def execute_track(track)
16
- if track[:sequence]
17
- track[:sequence].each do |cmd|
18
- if cmd[:script]
19
- script = Script.new(cmd[:script])
27
+ Conductor.stdin = script.run
28
+ elsif track[:command]
29
+ command = Command.new(track[:command])
20
30
 
21
- res = script.run
22
- elsif cmd[:command]
23
- command = Command.new(cmd[:command])
24
-
25
- res = command.run
31
+ Conductor.stdin = command.run
26
32
  end
27
33
 
28
- Conductor.stdin = res unless res.nil?
34
+ Conductor.stdin
29
35
  end
30
- elsif track[:script]
31
- script = Script.new(track[:script])
32
-
33
- Conductor.stdin = script.run
34
- elsif track[:command]
35
- command = Command.new(track[:command])
36
36
 
37
- Conductor.stdin = command.run
38
- end
39
-
40
- Conductor.stdin
41
- end
37
+ def conduct(tracks, res = nil, condition = nil)
38
+ tracks.each do |track|
39
+ cond = Condition.new(track[:condition])
42
40
 
43
- def conduct(tracks, res = nil, condition = nil)
44
- tracks.each do |track|
45
- cond = Condition.new(track[:condition])
41
+ next unless cond.true?
46
42
 
47
- next unless cond.true?
43
+ # Build "matched condition" message
44
+ title = track[:title] || track[:condition]
45
+ condition ||= [""]
46
+ condition << title
47
+ condition.push(track.key?(:continue) ? ", " : " -> ")
48
48
 
49
+ res = execute_track(track)
49
50
 
50
- # Build "matched condition" message
51
- title = track[:title] || track[:condition]
52
- condition ||= ['']
53
- condition << title
54
- condition.push(track.key?(:continue) ? ', ' : ' -> ')
51
+ if track[:tracks]
52
+ ts = track[:tracks]
55
53
 
56
- res = execute_track(track)
54
+ res, condition = conduct(ts, res, condition)
57
55
 
58
- if track[:tracks]
59
- ts = track[:tracks]
56
+ next if res.nil?
57
+ end
60
58
 
61
- res, condition = conduct(ts, res, condition)
59
+ break unless track[:continue]
60
+ end
62
61
 
63
- next if res.nil?
62
+ if res == Conductor.original_input
63
+ [nil, "No change in output"]
64
+ else
65
+ [res, condition]
66
+ end
64
67
  end
65
-
66
- break unless track[:continue]
67
68
  end
68
-
69
- [res, condition]
70
69
  end
71
70
 
72
- def clean_condition(condition)
73
- condition.join('').sub(/ *(->|,) *$/, '')
74
- end
75
-
76
- options = {}
77
- optparse = OptionParser.new do|opts|
71
+ optparse = OptionParser.new do |opts|
78
72
  opts.banner = "Called from Marked 2 as a Custom Pre/Processor"
79
73
 
80
- opts.on('-v', '--version', 'Show version number') do
74
+ opts.on("-v", "--version", "Show version number") do
81
75
  puts "conductor v#{Conductor::VERSION}"
82
76
  Process.exit 0
83
77
  end
84
78
 
85
- opts.on('-h', '--help', 'Display this screen') do
79
+ opts.on("-h", "--help", "Display this screen") do
86
80
  puts opts
87
81
  exit
88
82
  end
@@ -90,14 +84,27 @@ end
90
84
 
91
85
  optparse.parse!
92
86
 
87
+ config = Conductor::Config.new
88
+
89
+ Conductor.stdin
90
+ Conductor.original_input = Conductor.stdin
91
+
93
92
  tracks = config.tracks
94
- res, condition = conduct(tracks)
93
+ res, condition = Conductor.conduct(tracks)
94
+
95
+ def clean_condition(condition)
96
+ condition.join("").sub(/ *(->|,) *$/, "")
97
+ end
95
98
 
96
99
  if res.nil?
97
- $stderr.puts('No conditions satisfied')
98
- puts 'NOCUSTOM'
100
+ warn "No conditions satisfied"
101
+ puts "NOCUSTOM"
99
102
  else
100
- $stderr.puts("Met condition: #{clean_condition(condition)}")
101
- puts res
103
+ if res == Conductor.original_input
104
+ warn "No change in output"
105
+ puts "NOCUSTOM"
106
+ else
107
+ warn "Met condition: #{clean_condition(condition)}"
108
+ puts res
109
+ end
102
110
  end
103
-
data/html/Array.html ADDED
@@ -0,0 +1,160 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Array - Marked Conductor</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/navigation.js" defer></script>
15
+ <script src="./js/search.js" defer></script>
16
+ <script src="./js/search_index.js" defer></script>
17
+ <script src="./js/searcher.js" defer></script>
18
+ <script src="./js/darkfish.js" defer></script>
19
+
20
+ <link href="./css/fonts.css" rel="stylesheet">
21
+ <link href="./css/rdoc.css" rel="stylesheet">
22
+
23
+
24
+ <body id="top" role="document" class="class">
25
+ <nav role="navigation">
26
+ <div id="project-navigation">
27
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
28
+ <h2>
29
+ <a href="./index.html" rel="home">Home</a>
30
+ </h2>
31
+
32
+ <div id="table-of-contents-navigation">
33
+ <a href="./table_of_contents.html#pages">Pages</a>
34
+ <a href="./table_of_contents.html#classes">Classes</a>
35
+ <a href="./table_of_contents.html#methods">Methods</a>
36
+ </div>
37
+ </div>
38
+
39
+ <div id="search-section" role="search" class="project-section initially-hidden">
40
+ <form action="#" method="get" accept-charset="utf-8">
41
+ <div id="search-field-wrapper">
42
+ <input id="search-field" role="combobox" aria-label="Search"
43
+ aria-autocomplete="list" aria-controls="search-results"
44
+ type="text" name="search" placeholder="Search (/) for a class, method, ..." spellcheck="false"
45
+ title="Type to search, Up and Down to navigate, Enter to load">
46
+ </div>
47
+
48
+ <ul id="search-results" aria-label="Search Results"
49
+ aria-busy="false" aria-expanded="false"
50
+ aria-atomic="false" class="initially-hidden"></ul>
51
+ </form>
52
+ </div>
53
+
54
+ </div>
55
+
56
+
57
+
58
+ <div id="class-metadata">
59
+
60
+
61
+ <div id="parent-class-section" class="nav-section">
62
+ <h3>Parent</h3>
63
+
64
+ <p class="link"><a href="Object.html">Object</a>
65
+ </div>
66
+
67
+
68
+
69
+
70
+ <!-- Method Quickref -->
71
+ <div id="method-list-section" class="nav-section">
72
+ <h3>Methods</h3>
73
+
74
+ <ul class="link-list" role="directory">
75
+ <li ><a href="#method-i-symbolize_keys">#symbolize_keys</a>
76
+ <li ><a href="#method-i-symbolize_keys-21">#symbolize_keys!</a>
77
+ </ul>
78
+ </div>
79
+
80
+ </div>
81
+ </nav>
82
+
83
+ <main role="main" aria-labelledby="class-Array">
84
+ <h1 id="class-Array" class="class">
85
+ class Array
86
+ </h1>
87
+
88
+ <section class="description">
89
+
90
+ </section>
91
+
92
+ <section id="5Buntitled-5D" class="documentation-section">
93
+
94
+
95
+
96
+
97
+
98
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
99
+ <header>
100
+ <h3>Public Instance Methods</h3>
101
+ </header>
102
+
103
+ <div id="method-i-symbolize_keys" class="method-detail ">
104
+ <div class="method-header">
105
+ <div class="method-heading">
106
+ <span class="method-name">symbolize_keys</span><span
107
+ class="method-args">()</span>
108
+ <span class="method-click-advice">click to toggle source</span>
109
+ </div>
110
+ </div>
111
+
112
+ <div class="method-description">
113
+
114
+
115
+ <div class="method-source-code" id="symbolize_keys-source">
116
+ <pre><span class="ruby-comment"># File lib/conductor/array.rb, line 8</span>
117
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">symbolize_keys</span>
118
+ <span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">h</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>.<span class="ruby-identifier">symbolize_keys</span> }
119
+ <span class="ruby-keyword">end</span></pre>
120
+ </div>
121
+ </div>
122
+
123
+
124
+ </div>
125
+
126
+ <div id="method-i-symbolize_keys-21" class="method-detail ">
127
+ <div class="method-header">
128
+ <div class="method-heading">
129
+ <span class="method-name">symbolize_keys!</span><span
130
+ class="method-args">()</span>
131
+ <span class="method-click-advice">click to toggle source</span>
132
+ </div>
133
+ </div>
134
+
135
+ <div class="method-description">
136
+
137
+
138
+ <div class="method-source-code" id="symbolize_keys-21-source">
139
+ <pre><span class="ruby-comment"># File lib/conductor/array.rb, line 4</span>
140
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">symbolize_keys!</span>
141
+ <span class="ruby-identifier">replace</span> <span class="ruby-identifier">symbolize_keys</span>
142
+ <span class="ruby-keyword">end</span></pre>
143
+ </div>
144
+ </div>
145
+
146
+
147
+ </div>
148
+
149
+ </section>
150
+
151
+ </section>
152
+ </main>
153
+
154
+
155
+ <footer id="validator-badges" role="contentinfo">
156
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
157
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.6.2.
158
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
159
+ </footer>
160
+
@@ -0,0 +1,271 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>class Conductor::Command - 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::Command">
86
+ <h1 id="class-Conductor::Command" class="class">
87
+ class Conductor::Command
88
+ </h1>
89
+
90
+ <section class="description">
91
+
92
+ <p><a href="Command.html"><code>Command</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">(command)</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/command.rb, line 8</span>
147
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">command</span>)
148
+ <span class="ruby-identifier">parts</span> = <span class="ruby-constant">Shellwords</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">command</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">&quot; &quot;</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/command.rb, line 23</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">&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-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/command.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">which</span> = <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>)
211
+ <span class="ruby-identifier">which</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">path</span>
212
+ <span class="ruby-keyword">end</span>
213
+ <span class="ruby-keyword">end</span></pre>
214
+ </div>
215
+ </div>
216
+
217
+
218
+ </div>
219
+
220
+ <div id="method-i-run" class="method-detail ">
221
+ <div class="method-header">
222
+ <div class="method-heading">
223
+ <span class="method-name">run</span><span
224
+ class="method-args">()</span>
225
+ <span class="method-click-advice">click to toggle source</span>
226
+ </div>
227
+ </div>
228
+
229
+ <div class="method-description">
230
+
231
+
232
+ <div class="method-source-code" id="run-source">
233
+ <pre><span class="ruby-comment"># File lib/conductor/command.rb, line 31</span>
234
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run</span>
235
+ <span class="ruby-identifier">stdin</span> = <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span>
236
+
237
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;Command path not found&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@path</span>
238
+
239
+ <span class="ruby-identifier">use_stdin</span> = <span class="ruby-keyword">true</span>
240
+ <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\$\{?file\}?/</span>.<span class="ruby-identifier">match?</span>(<span class="ruby-identifier">args</span>)
241
+ <span class="ruby-identifier">use_stdin</span> = <span class="ruby-keyword">false</span>
242
+ <span class="ruby-identifier">args</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/\$\{?file\}?/</span>, <span class="ruby-node">%(&quot;#{Env.env[:filepath]}&quot;)</span>)
243
+ <span class="ruby-keyword">else</span>
244
+ <span class="ruby-identifier">raise</span> <span class="ruby-string">&quot;No input&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">stdin</span>
245
+
246
+ <span class="ruby-keyword">end</span>
247
+
248
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">use_stdin</span>
249
+ <span class="ruby-node">`echo #{Shellwords.escape(stdin)} | #{Env} #{path} #{args}`</span>
250
+ <span class="ruby-keyword">else</span>
251
+ <span class="ruby-node">`#{Env} #{path} #{args}`</span>
252
+ <span class="ruby-keyword">end</span>
253
+ <span class="ruby-keyword">end</span></pre>
254
+ </div>
255
+ </div>
256
+
257
+
258
+ </div>
259
+
260
+ </section>
261
+
262
+ </section>
263
+ </main>
264
+
265
+
266
+ <footer id="validator-badges" role="contentinfo">
267
+ <p><a href="https://validator.w3.org/check/referer">Validate</a>
268
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.6.2.
269
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
270
+ </footer>
271
+