marked-conductor 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.irbrc +8 -2
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +34 -0
- data/Gemfile.lock +47 -3
- data/README.md +31 -1
- data/README.rdoc +6 -0
- data/Rakefile +38 -1
- data/bin/conductor +44 -15
- data/lib/conductor/array.rb +0 -1
- data/lib/conductor/command.rb +14 -14
- data/lib/conductor/condition.rb +143 -34
- data/lib/conductor/config.rb +4 -4
- data/lib/conductor/env.rb +35 -33
- data/lib/conductor/hash.rb +1 -1
- data/lib/conductor/script.rb +21 -21
- data/lib/conductor/string.rb +10 -10
- data/lib/conductor/version.rb +1 -1
- data/lib/conductor.rb +21 -19
- data/marked-conductor.gemspec +18 -10
- data/src/_README.md +31 -1
- metadata +121 -2
data/lib/conductor/condition.rb
CHANGED
@@ -11,6 +11,13 @@ module Conductor
|
|
11
11
|
parse_condition
|
12
12
|
end
|
13
13
|
|
14
|
+
##
|
15
|
+
## @brief Splits booleans and tests components.
|
16
|
+
##
|
17
|
+
## @param condition The condition to test
|
18
|
+
##
|
19
|
+
## @return [Boolean] test result
|
20
|
+
##
|
14
21
|
def split_booleans(condition)
|
15
22
|
split = condition.split(/ ((?:AND )?NOT|AND|OR) /)
|
16
23
|
|
@@ -21,7 +28,7 @@ module Conductor
|
|
21
28
|
bool = nil
|
22
29
|
prev = false
|
23
30
|
split.each do |cond|
|
24
|
-
if
|
31
|
+
if /((?:AND )?NOT|AND|OR|&&|\|\||!!)/.match?(cond)
|
25
32
|
bool = cond.bool_to_symbol
|
26
33
|
next
|
27
34
|
end
|
@@ -44,6 +51,15 @@ module Conductor
|
|
44
51
|
end
|
45
52
|
end
|
46
53
|
|
54
|
+
##
|
55
|
+
## @brief Test operators
|
56
|
+
##
|
57
|
+
## @param value1 Value
|
58
|
+
## @param value2 Value to test
|
59
|
+
## @param operator The operator
|
60
|
+
##
|
61
|
+
## @return [Boolean] test result
|
62
|
+
##
|
47
63
|
def test_operator(value1, value2, operator)
|
48
64
|
case operator
|
49
65
|
when :gt
|
@@ -63,13 +79,46 @@ module Conductor
|
|
63
79
|
end
|
64
80
|
end
|
65
81
|
|
82
|
+
##
|
83
|
+
## @brief Splits a natural language condition.
|
84
|
+
##
|
85
|
+
## @param condition The condition
|
86
|
+
## @return [Array] Value, value to compare, operator
|
87
|
+
##
|
66
88
|
def split_condition(condition)
|
89
|
+
if condition.match(/(?:((?:does )?not)?(?:ha(?:s|ve)|contains?|includes?) +)?(yaml|headers|frontmatter|mmd|meta(?:data)?|pandoc)(:\S+)?/i)
|
90
|
+
m = Regexp.last_match
|
91
|
+
op = m[1].nil? ? :contains : :not_contains
|
92
|
+
type = case m[2]
|
93
|
+
when /^m/i
|
94
|
+
"mmd"
|
95
|
+
when /^p/i
|
96
|
+
"pandoc"
|
97
|
+
else
|
98
|
+
"yaml"
|
99
|
+
end
|
100
|
+
return ["#{type}#{m[3]}", nil, op]
|
101
|
+
end
|
102
|
+
|
67
103
|
res = condition.match(/^(?<val1>.*?)(?:(?: +(?<op>(?:is|does)(?: not)?(?: an?|type(?: of)?|equals?(?: to))?|!?==?|[gl]t|(?:greater|less)(?: than)?|<|>|(?:starts|ends) with|(?:ha(?:s|ve) )?(?:prefix|suffix)|has|contains?|includes?) +)(?<val2>.*?))?$/i)
|
68
|
-
[res[
|
104
|
+
[res["val1"], res["val2"], operator_to_symbol(res["op"])]
|
69
105
|
end
|
70
106
|
|
107
|
+
##
|
108
|
+
## @brief Test for type of value
|
109
|
+
##
|
110
|
+
## @param val1 value
|
111
|
+
## @param val2 value to test against
|
112
|
+
## @param operator The operator
|
113
|
+
##
|
71
114
|
def test_type(val1, val2, operator)
|
72
115
|
res = case val2
|
116
|
+
when /number/
|
117
|
+
val1.is_a?(Numeric)
|
118
|
+
when /int(eger)?/
|
119
|
+
val1.is_a?(Integer)
|
120
|
+
when /(float|decimal)/
|
121
|
+
val1.is_a?(Float)
|
73
122
|
when /array/i
|
74
123
|
val1.is_a?(Array)
|
75
124
|
when /(string|text)/i
|
@@ -80,12 +129,21 @@ module Conductor
|
|
80
129
|
operator == :type_of ? res : !res
|
81
130
|
end
|
82
131
|
|
132
|
+
##
|
133
|
+
## @brief Compare a string based on operator
|
134
|
+
##
|
135
|
+
## @param val1 The string to test against
|
136
|
+
## @param val2 The value to test
|
137
|
+
## @param operator The operator
|
138
|
+
##
|
139
|
+
## @return [Boolean] test result
|
140
|
+
##
|
83
141
|
def test_string(val1, val2, operator)
|
84
142
|
return operator == :not_equal ? val1.nil? : !val1.nil? if val2.nil?
|
85
143
|
|
86
144
|
return operator == :not_equal if val1.nil?
|
87
145
|
|
88
|
-
val2 = val2.force_encoding(
|
146
|
+
val2 = val2.force_encoding("utf-8")
|
89
147
|
|
90
148
|
if val1.date?
|
91
149
|
if val2.time?
|
@@ -109,12 +167,12 @@ module Conductor
|
|
109
167
|
return res unless res.nil?
|
110
168
|
end
|
111
169
|
|
112
|
-
val2 = if
|
113
|
-
val2.gsub(%r{(^/|/$)},
|
170
|
+
val2 = if %r{^/.*?/$}.match?(val2.strip)
|
171
|
+
val2.gsub(%r{(^/|/$)}, "")
|
114
172
|
else
|
115
173
|
Regexp.escape(val2)
|
116
174
|
end
|
117
|
-
val1 = val1.dup.to_s.force_encoding(
|
175
|
+
val1 = val1.dup.to_s.force_encoding("utf-8")
|
118
176
|
case operator
|
119
177
|
when :contains
|
120
178
|
val1 =~ /#{val2}/i
|
@@ -135,6 +193,17 @@ module Conductor
|
|
135
193
|
end
|
136
194
|
end
|
137
195
|
|
196
|
+
##
|
197
|
+
## @brief Test for the existince of a
|
198
|
+
## file/directory in the parent tree
|
199
|
+
##
|
200
|
+
## @param origin Starting directory
|
201
|
+
## @param value The file/directory to search
|
202
|
+
## for
|
203
|
+
## @param operator The operator
|
204
|
+
##
|
205
|
+
## @return [Boolean] test result
|
206
|
+
##
|
138
207
|
def test_tree(origin, value, operator)
|
139
208
|
return true if File.exist?(File.join(origin, value))
|
140
209
|
|
@@ -142,13 +211,22 @@ module Conductor
|
|
142
211
|
|
143
212
|
if Dir.exist?(File.join(dir, value))
|
144
213
|
true
|
145
|
-
elsif [Dir.home,
|
214
|
+
elsif [Dir.home, "/"].include?(dir)
|
146
215
|
false
|
147
216
|
else
|
148
217
|
test_tree(dir, value, operator)
|
149
218
|
end
|
150
219
|
end
|
151
220
|
|
221
|
+
##
|
222
|
+
## @brief Test "truthiness"
|
223
|
+
##
|
224
|
+
## @param value1 Value to test against
|
225
|
+
## @param value2 Value to test
|
226
|
+
## @param operator The operator
|
227
|
+
##
|
228
|
+
## @return [Boolean] test result
|
229
|
+
##
|
152
230
|
def test_truthy(value1, value2, operator)
|
153
231
|
return false unless value2&.bool?
|
154
232
|
|
@@ -159,34 +237,64 @@ module Conductor
|
|
159
237
|
operator == :not_equal ? !res : res
|
160
238
|
end
|
161
239
|
|
240
|
+
##
|
241
|
+
## @brief Test for presence of yaml, optionall for
|
242
|
+
## a key, optionally for a key's value
|
243
|
+
##
|
244
|
+
## @param content Text content containing YAML
|
245
|
+
## @param value The value to test for
|
246
|
+
## @param key The key to test for
|
247
|
+
## @param operator The operator
|
248
|
+
##
|
249
|
+
## @return [Boolean] test result
|
250
|
+
##
|
162
251
|
def test_yaml(content, value, key, operator)
|
163
252
|
yaml = YAML.safe_load(content.split(/^(?:---|\.\.\.)/)[1])
|
164
253
|
|
165
|
-
return operator == :not_equal
|
254
|
+
return operator == :not_equal unless yaml
|
166
255
|
|
167
256
|
if key
|
168
257
|
value1 = yaml[key]
|
169
|
-
return operator == :not_equal
|
258
|
+
return operator == :not_equal if value1.nil?
|
259
|
+
|
260
|
+
if value.nil?
|
261
|
+
has_key = !value1.nil?
|
262
|
+
return operator == :not_equal ? !has_key : has_key
|
263
|
+
end
|
170
264
|
|
171
|
-
value1 = value1.join(',') if value1.is_a?(Array)
|
172
265
|
if %i[type_of not_type_of].include?(operator)
|
173
|
-
test_type(value1, value, operator)
|
174
|
-
|
266
|
+
return test_type(value1, value, operator)
|
267
|
+
end
|
268
|
+
|
269
|
+
value1 = value1.join(",") if value1.is_a?(Array)
|
270
|
+
|
271
|
+
if value1.bool?
|
175
272
|
test_truthy(value1, value, operator)
|
176
|
-
elsif value1.number? &&
|
273
|
+
elsif value1.number? && value.number? && %i[gt lt equal not_equal].include?(operator)
|
177
274
|
test_operator(value1, value, operator)
|
178
275
|
else
|
179
276
|
test_string(value1, value, operator)
|
180
277
|
end
|
181
278
|
else
|
182
279
|
res = value ? yaml.key?(value) : true
|
183
|
-
operator == :not_equal ? !res : res
|
280
|
+
(operator == :not_equal) ? !res : res
|
184
281
|
end
|
185
282
|
end
|
186
283
|
|
284
|
+
##
|
285
|
+
## @brief Test for MultiMarkdown metadata,
|
286
|
+
## optionally key and value
|
287
|
+
##
|
288
|
+
## @param content [String] The text content
|
289
|
+
## @param value [String] The value to test for
|
290
|
+
## @param key [String] The key to test for
|
291
|
+
## @param operator [Symbol] The operator
|
292
|
+
##
|
293
|
+
## @return [Boolean] test result
|
294
|
+
##
|
187
295
|
def test_meta(content, value, key, operator)
|
188
296
|
headers = []
|
189
|
-
content.split(
|
297
|
+
content.split("\n").each do |line|
|
190
298
|
break if line == /^ *\n$/ || line !~ /\w+: *\S/
|
191
299
|
|
192
300
|
headers << line
|
@@ -199,8 +307,8 @@ module Conductor
|
|
199
307
|
meta = {}
|
200
308
|
headers.each do |h|
|
201
309
|
parts = h.split(/ *: */)
|
202
|
-
k = parts[0].strip.downcase.gsub(/ +/,
|
203
|
-
v = parts[1..].join(
|
310
|
+
k = parts[0].strip.downcase.gsub(/ +/, "")
|
311
|
+
v = parts[1..].join(":").strip
|
204
312
|
meta[k] = v
|
205
313
|
end
|
206
314
|
|
@@ -212,6 +320,11 @@ module Conductor
|
|
212
320
|
end
|
213
321
|
end
|
214
322
|
|
323
|
+
def test_pandoc(content, operator)
|
324
|
+
res = content.match(/^%% /)
|
325
|
+
%i[not_contains not_equal].include?(operator) ? !res.nil? : res.nil?
|
326
|
+
end
|
327
|
+
|
215
328
|
def test_condition(condition)
|
216
329
|
type, value, operator = split_condition(condition)
|
217
330
|
|
@@ -231,26 +344,20 @@ module Conductor
|
|
231
344
|
test_tree(@env[:origin], value, operator)
|
232
345
|
when /^(path|dir)/i
|
233
346
|
test_string(@env[:filepath], value, operator) ? true : false
|
347
|
+
when /^(file)?name/i
|
348
|
+
test_string(@env[:filename], value, operator) ? true : false
|
234
349
|
when /^phase/i
|
235
350
|
test_string(@env[:phase], value, :starts_with) ? true : false
|
236
351
|
when /^text/i
|
237
|
-
test_string(
|
238
|
-
when /^(yaml|headers|frontmatter)(?::(.*?))?$/i
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
when /^(mmd|meta(?:data)?)(?::(.*?))?$/i
|
247
|
-
m = Regexp.last_match
|
248
|
-
|
249
|
-
key = m[2] || nil
|
250
|
-
|
251
|
-
content = IO.read(@env[:filepath]).force_encoding('utf-8')
|
252
|
-
|
253
|
-
content.meta? ? test_meta(content, value, key, operator) : false
|
352
|
+
test_string(Conductor.stdin, value, operator) ? true : false
|
353
|
+
when /^(?:yaml|headers|frontmatter)(?::(.*?))?$/i
|
354
|
+
key = Regexp.last_match(1) || nil
|
355
|
+
Conductor.stdin.yaml? ? test_yaml(Conductor.stdin, value, key, operator) : false
|
356
|
+
when /^(?:mmd|meta(?:data)?)(?::(.*?))?$/i
|
357
|
+
key = Regexp.last_match(1) || nil
|
358
|
+
Conductor.stdin.meta? ? test_meta(Conductor.stdin, value, key, operator) : false
|
359
|
+
when /^pandoc/
|
360
|
+
test_pandoc(Conductor.stdin, operator)
|
254
361
|
else
|
255
362
|
false
|
256
363
|
end
|
@@ -264,6 +371,8 @@ module Conductor
|
|
264
371
|
:gt
|
265
372
|
when /(lt|less( than)?|<|(?:is )?before)/i
|
266
373
|
:lt
|
374
|
+
when /not (ha(?:s|ve)|contains|includes|match(es)?)/i
|
375
|
+
:not_contains
|
267
376
|
when /(ha(?:s|ve)|contains|includes|match(es)?|\*=)/i
|
268
377
|
:contains
|
269
378
|
when /not (suffix|ends? with)/i
|
data/lib/conductor/config.rb
CHANGED
@@ -6,22 +6,22 @@ module Conductor
|
|
6
6
|
attr_reader :config, :tracks
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
config_file = File.expand_path(
|
9
|
+
config_file = File.expand_path("~/.config/conductor/tracks.yaml")
|
10
10
|
|
11
11
|
create_config(config_file) unless File.exist?(config_file)
|
12
12
|
|
13
13
|
@config ||= YAML.safe_load(IO.read(config_file))
|
14
14
|
|
15
|
-
@tracks = @config[
|
15
|
+
@tracks = @config["tracks"].symbolize_keys
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def create_config(config_file)
|
20
20
|
config_dir = File.dirname(config_file)
|
21
|
-
scripts_dir = File.dirname(File.join(config_dir,
|
21
|
+
scripts_dir = File.dirname(File.join(config_dir, "scripts"))
|
22
22
|
FileUtils.mkdir_p(config_dir) unless File.directory?(config_dir)
|
23
23
|
FileUtils.mkdir_p(scripts_dir) unless File.directory?(scripts_dir)
|
24
|
-
File.open(config_file,
|
24
|
+
File.open(config_file, "w") { |f| f.puts sample_config }
|
25
25
|
puts "Sample config created at #{config_file}"
|
26
26
|
|
27
27
|
Process.exit 0
|
data/lib/conductor/env.rb
CHANGED
@@ -3,52 +3,54 @@
|
|
3
3
|
module Conductor
|
4
4
|
module Env
|
5
5
|
def self.env
|
6
|
-
@env ||= if ENV[
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
6
|
+
@env ||= if ENV["CONDUCTOR_TEST"] == "true"
|
7
|
+
load_test_env
|
8
|
+
else
|
9
|
+
@env ||= {
|
10
|
+
home: ENV["HOME"],
|
11
|
+
css_path: ENV["MARKED_CSS_PATH"],
|
12
|
+
ext: ENV["MARKED_EXT"],
|
13
|
+
includes: ENV["MARKED_INCLUDES"],
|
14
|
+
origin: ENV["MARKED_ORIGIN"],
|
15
|
+
filepath: ENV["MARKED_PATH"],
|
16
|
+
filename: File.basename(ENV["MARKED_PATH"]),
|
17
|
+
phase: ENV["MARKED_PHASE"],
|
18
|
+
outline: ENV["OUTLINE"],
|
19
|
+
path: ENV["PATH"]
|
20
|
+
}
|
21
|
+
end
|
21
22
|
|
22
23
|
@env
|
23
24
|
end
|
24
25
|
|
25
26
|
def self.load_test_env
|
26
27
|
@env = {
|
27
|
-
home:
|
28
|
-
css_path:
|
29
|
-
ext:
|
28
|
+
home: "/Users/ttscoff",
|
29
|
+
css_path: "/Applications/Marked 2.app/Contents/Resources/swiss.css",
|
30
|
+
ext: "md",
|
30
31
|
includes: [],
|
31
|
-
origin:
|
32
|
-
filepath:
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
origin: "/Users/ttscoff/Desktop/Code/nvultra-docs/content/",
|
33
|
+
filepath: "/Users/ttscoff/Desktop/Code/nvultra-docs/content/advanced-features.md",
|
34
|
+
filename: "advanced-features.md",
|
35
|
+
phase: "PROCESS",
|
36
|
+
outline: "NONE",
|
37
|
+
path: "/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/Desktop/Code/nvultra-docs/content/"
|
36
38
|
}
|
37
39
|
end
|
38
40
|
|
39
41
|
def self.to_s
|
40
42
|
out_h = {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
"HOME" => @env[:home],
|
44
|
+
"MARKED_CSS_PATH" => @env[:css_path],
|
45
|
+
"MARKED_EXT" => @env[:ext],
|
46
|
+
"MARKED_ORIGIN" => @env[:origin],
|
47
|
+
"MARKED_INCLUDES" => @env[:includes],
|
48
|
+
"MARKED_PATH" => @env[:filepath],
|
49
|
+
"MARKED_PHASE" => @env[:phase],
|
50
|
+
"OUTLINE" => @env[:outline],
|
51
|
+
"PATH" => @env[:path]
|
50
52
|
}
|
51
|
-
out_h.map { |k, v| %(#{k}="#{v}") }.join(
|
53
|
+
out_h.map { |k, v| %(#{k}="#{v}") }.join(" ")
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
data/lib/conductor/hash.rb
CHANGED
data/lib/conductor/script.rb
CHANGED
@@ -8,44 +8,44 @@ module Conductor
|
|
8
8
|
def initialize(script)
|
9
9
|
parts = Shellwords.split(script)
|
10
10
|
self.path = parts[0]
|
11
|
-
self.args = parts[1..].join(
|
11
|
+
self.args = parts[1..].join(" ")
|
12
12
|
end
|
13
13
|
|
14
14
|
def path=(path)
|
15
|
-
@path = if
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
15
|
+
@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
|
28
28
|
end
|
29
29
|
|
30
30
|
def args=(array)
|
31
31
|
@args = if array.is_a?(Array)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
array.join(" ")
|
33
|
+
else
|
34
|
+
array
|
35
|
+
end
|
36
36
|
end
|
37
37
|
|
38
38
|
def run
|
39
39
|
stdin = Conductor.stdin
|
40
40
|
|
41
|
-
raise
|
41
|
+
raise "Script path not defined" unless @path
|
42
42
|
|
43
43
|
use_stdin = true
|
44
|
-
if
|
44
|
+
if /\$\{?file\}?/.match?(args)
|
45
45
|
use_stdin = false
|
46
46
|
args.sub!(/\$\{?file\}?/, Env.env[:filepath])
|
47
47
|
else
|
48
|
-
raise
|
48
|
+
raise "No input" unless stdin
|
49
49
|
|
50
50
|
end
|
51
51
|
|
data/lib/conductor/string.rb
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
class ::String
|
5
5
|
def bool_to_symbol
|
6
6
|
case self
|
7
|
-
when /NOT/
|
7
|
+
when /(NOT|!!)/
|
8
8
|
:not
|
9
|
-
when /AND/
|
9
|
+
when /(AND|&&)/
|
10
10
|
:and
|
11
11
|
else
|
12
12
|
:or
|
@@ -14,32 +14,32 @@ class ::String
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def date?
|
17
|
-
dup.force_encoding(
|
17
|
+
dup.force_encoding("utf-8").match?(/^\d{4}-\d{2}-\d{2}/)
|
18
18
|
end
|
19
19
|
|
20
20
|
def time?
|
21
|
-
dup.force_encoding(
|
21
|
+
dup.force_encoding("utf-8").match(/ \d{1,2}(:\d\d)? *([ap]m)?/i)
|
22
22
|
end
|
23
23
|
|
24
24
|
def to_date
|
25
|
-
Chronic.parse(
|
25
|
+
Chronic.parse(dup.force_encoding("utf-8"))
|
26
26
|
end
|
27
27
|
|
28
28
|
def strip_time
|
29
|
-
dup.force_encoding(
|
29
|
+
dup.force_encoding("utf-8").sub(/ \d{1,2}(:\d\d)? *([ap]m)?/i, "")
|
30
30
|
end
|
31
31
|
|
32
32
|
def to_day(time = :end)
|
33
|
-
t = time == :end ?
|
34
|
-
Chronic.parse("#{
|
33
|
+
t = time == :end ? "23:59" : "00:00"
|
34
|
+
Chronic.parse("#{strip_time} #{t}")
|
35
35
|
end
|
36
36
|
|
37
37
|
def number?
|
38
|
-
to_f
|
38
|
+
to_f.positive?
|
39
39
|
end
|
40
40
|
|
41
41
|
def bool?
|
42
|
-
dup.force_encoding(
|
42
|
+
dup.force_encoding("utf-8").match?(/^(?:y(?:es)?|no?|t(?:rue)?|f(?:alse)?)$/)
|
43
43
|
end
|
44
44
|
|
45
45
|
def meta?
|
data/lib/conductor/version.rb
CHANGED
data/lib/conductor.rb
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
13
|
-
require_relative
|
14
|
-
require_relative
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
18
|
-
require_relative
|
19
|
-
require_relative
|
3
|
+
require "tty-which"
|
4
|
+
require "yaml"
|
5
|
+
require "shellwords"
|
6
|
+
require "fcntl"
|
7
|
+
require "time"
|
8
|
+
require "chronic"
|
9
|
+
require "fileutils"
|
10
|
+
require_relative "conductor/version"
|
11
|
+
require_relative "conductor/env"
|
12
|
+
require_relative "conductor/config"
|
13
|
+
require_relative "conductor/hash"
|
14
|
+
require_relative "conductor/array"
|
15
|
+
require_relative "conductor/boolean"
|
16
|
+
require_relative "conductor/string"
|
17
|
+
require_relative "conductor/script"
|
18
|
+
require_relative "conductor/command"
|
19
|
+
require_relative "conductor/condition"
|
20
20
|
|
21
21
|
module Conductor
|
22
22
|
class << self
|
23
|
+
attr_writer :stdin
|
24
|
+
|
23
25
|
def stdin
|
24
|
-
warn
|
25
|
-
@stdin ||= $stdin.read.strip.force_encoding(
|
26
|
+
warn "input on STDIN required" unless $stdin.stat.size.positive? || $stdin.fcntl(Fcntl::F_GETFL, 0).zero?
|
27
|
+
@stdin ||= $stdin.read.strip.force_encoding("utf-8")
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
data/marked-conductor.gemspec
CHANGED
@@ -3,15 +3,15 @@
|
|
3
3
|
require_relative "lib/conductor/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
6
|
+
spec.name = "marked-conductor"
|
7
|
+
spec.version = Conductor::VERSION
|
8
|
+
spec.authors = ["Brett Terpstra"]
|
9
|
+
spec.email = ["me@brettterpstra.com"]
|
10
10
|
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
spec.homepage
|
14
|
-
spec.license
|
11
|
+
spec.summary = "A custom processor manager for Marked 2 (Mac)"
|
12
|
+
spec.description = "Conductor allows easy configuration of multiple scripts that are run as custom pre/processors for Marked based on conditional statements."
|
13
|
+
spec.homepage = "https://github.com/ttscoff/marked-conductor"
|
14
|
+
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = ">= 2.6.0"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
@@ -25,12 +25,20 @@ Gem::Specification.new do |spec|
|
|
25
25
|
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
26
|
end
|
27
27
|
end
|
28
|
-
spec.bindir
|
29
|
-
spec.executables
|
28
|
+
spec.bindir = "bin"
|
29
|
+
spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
spec.add_development_dependency "pry", "~> 0.14.2"
|
33
33
|
spec.add_development_dependency "awesome_print", "~> 1.9.2"
|
34
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
35
|
+
spec.add_development_dependency "gem-release", "~> 2.2"
|
36
|
+
spec.add_development_dependency "parse_gemspec-cli", "~> 1.0"
|
37
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
38
|
+
spec.add_development_dependency "yard", "~> 0.9", ">= 0.9.26"
|
39
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
40
|
+
spec.add_development_dependency "simplecov", "~> 0.21"
|
41
|
+
spec.add_development_dependency "simplecov-console", "~> 0.9"
|
34
42
|
|
35
43
|
# Uncomment to register a new dependency of your gem
|
36
44
|
spec.add_dependency "tty-which", "~> 0.5.0"
|