asciibuild 0.5.0 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2c30824fc02df2f417b338f1009740077fcb7d9
4
- data.tar.gz: 98f4fdaaaacd26c26ef375dd99a117f21a8ac4ec
3
+ metadata.gz: d25e361a066c8441cf36861379f0fbd8267ca4b0
4
+ data.tar.gz: 1ddd0ac9f4239d900eca176ee6476f8de099c82a
5
5
  SHA512:
6
- metadata.gz: 8ce5ac3266186050381a94ad654102847f522a0c9109aca74616d88dc0eae2480ba219549f5a4492892cd4ac8d7275547c5d0964e0353685597517e9f65b2bf4
7
- data.tar.gz: 779badcf11c72d88359a2088beeb1d52f7e79b9cc687381258d73010b0c885a5bf4eb38634008a973c0faf4cc6371eb2de4f5a1055a1d1a7b2941ce95a5c1fde
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
- options[:to_file] = "#{basename}-#{Time.now.getutc.to_i}.html"
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['file'] ||= 'Dockerfile'
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 #{name} #{attrs['escript_opts']}"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciibuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Brisbin