asciibuild 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/asciibuild +5 -1
- data/lib/asciibuild/extensions.rb +17 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d25e361a066c8441cf36861379f0fbd8267ca4b0
|
4
|
+
data.tar.gz: 1ddd0ac9f4239d900eca176ee6476f8de099c82a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ad1c41326d6ac1581e7490c52161adee5be8aedf898088c82ec5aeb8eab7b6a53cfd650ac837343cb6ab525f459761ae7e19aac5866fb4b3e35811fb94e937e
|
7
|
+
data.tar.gz: 38d9561df46e46c17d21a64f50181139726bef4d071af0c9ff35f03b4cd764eb350622f04ab9823e1a72f1a293863ce1488ecb4301acd41ba7ef17d8b8b41916
|
data/bin/asciibuild
CHANGED
@@ -26,6 +26,9 @@ options = {
|
|
26
26
|
OptionParser.new do |opts|
|
27
27
|
opts.banner = "Usage: asciibuild [options] file.adoc..."
|
28
28
|
|
29
|
+
opts.on('-d', '--outdir DIR', 'Directory to output processed documents to') do |d|
|
30
|
+
options[:to_dir] = d
|
31
|
+
end
|
29
32
|
opts.on('-s', '--stylesheet NAME', 'Stylesheet name') do |v|
|
30
33
|
attrs["stylesheet"] = find_stylesheet(v)
|
31
34
|
end
|
@@ -56,7 +59,8 @@ ARGV.each do |f|
|
|
56
59
|
basedir = File.join options[:to_dir], dirname
|
57
60
|
options[:to_dir] = basedir
|
58
61
|
attrs["outdir"] = basedir
|
59
|
-
|
62
|
+
outfile = "#{basename}-#{Time.now.getutc.to_i}.html"
|
63
|
+
options[:to_file] = outfile
|
60
64
|
|
61
65
|
Asciidoctor.convert_file f, options
|
62
66
|
end
|
@@ -37,6 +37,8 @@ def get_lang lang
|
|
37
37
|
'python'
|
38
38
|
when 'spark-shell'
|
39
39
|
'scala'
|
40
|
+
when 'docker-compose'
|
41
|
+
'yaml'
|
40
42
|
else
|
41
43
|
lang
|
42
44
|
end
|
@@ -48,6 +50,7 @@ def write_file attrs, default_name, body
|
|
48
50
|
open(name, mode) do |f|
|
49
51
|
f.write(body + "\n")
|
50
52
|
end
|
53
|
+
name
|
51
54
|
end
|
52
55
|
|
53
56
|
def normalize parent, attrs, lines
|
@@ -224,24 +227,30 @@ module Asciibuild
|
|
224
227
|
stderr_lines = []
|
225
228
|
|
226
229
|
cmd = case attrs[2]
|
230
|
+
when 'bash'
|
231
|
+
"bash -exs #{attrs['bash_opts']}"
|
227
232
|
when 'Dockerfile'
|
228
233
|
if not attrs['image']
|
229
234
|
raise 'Missing image name. Add attribute of image={name} to the [asciibuild,Dockerfile] style.'
|
230
235
|
end
|
231
|
-
fname = attrs
|
232
|
-
write_file attrs, 'Dockerfile', body
|
236
|
+
fname = write_file attrs, 'Dockerfile', body
|
233
237
|
"docker build -t #{attrs['image']} #{attrs['build_opts']} -f #{fname} ."
|
238
|
+
when 'docker-compose'
|
239
|
+
dc_cmd = attrs['command'] ||= 'build'
|
240
|
+
fname = write_file attrs, 'docker-compose.yml', body
|
241
|
+
"docker-compose -f #{fname} #{compose_opts} #{dc_cmd}"
|
234
242
|
when 'erlang'
|
235
|
-
write_file attrs, 'escript.erl', body
|
236
|
-
"escript #{
|
243
|
+
fname = write_file attrs, 'escript.erl', body
|
244
|
+
"escript #{fname} #{attrs['escript_opts']}"
|
245
|
+
when 'Makefile'
|
246
|
+
"make -f - #{attrs['make_opts']} #{attrs['target']}"
|
237
247
|
when 'pyspark'
|
238
248
|
"pyspark #{attrs['spark_opts']}"
|
239
249
|
when 'spark-shell'
|
240
250
|
"spark-shell #{attrs['spark_opts']}"
|
241
|
-
when 'bash'
|
242
|
-
"bash -exs #{attrs['bash_opts']}"
|
243
251
|
else
|
244
|
-
attrs[2]
|
252
|
+
opts = attrs["#{attrs[2]}_opts"]
|
253
|
+
"#{attrs[2]} #{opts}"
|
245
254
|
end
|
246
255
|
# Check to see if we run inside a container
|
247
256
|
if attrs['container']
|
@@ -274,7 +283,7 @@ module Asciibuild
|
|
274
283
|
lines << line.chomp
|
275
284
|
end
|
276
285
|
while line=stderr.gets do
|
277
|
-
puts line
|
286
|
+
STDERR.puts line
|
278
287
|
stderr_lines << line.chomp
|
279
288
|
end
|
280
289
|
|
@@ -299,7 +308,6 @@ module Asciibuild
|
|
299
308
|
|
300
309
|
after_end cmd, parent, normalize(parent, attrs, lines), attrs
|
301
310
|
end
|
302
|
-
|
303
311
|
end
|
304
312
|
|
305
313
|
Asciidoctor::Extensions.register do
|