nutkins 0.8.1 → 0.9.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: 9f6f7c532a577c1197ee2c0a70e473768b6a62de
4
- data.tar.gz: 5bc0353b28487ecbb350b018b1366f9e2e32cccf
3
+ metadata.gz: 1bd8ba58c448c0926badec45b1f9b008e64f3b24
4
+ data.tar.gz: 224e661371deed2e36281e9371370b7d3df757fb
5
5
  SHA512:
6
- metadata.gz: df4a28b2f1e73a0002925ba716cf07f3123dfe2b8e73ae395869efc5fcb7f47efcb1d908f8370380058b6137a71491c83eca7bacd7f12db1e7104bb0346bb505
7
- data.tar.gz: eee76a3dbf64326de23f47eb0056261d32eaabd908faa00b9538178d31de321e5ed61d70260fe45a13638de15fed6eb109188cf9a7114d47f494d0b58bd304e2
6
+ metadata.gz: c3a1d0b249945812bd1e62d16400f99f2d89ec7e1acac4c68f87c3f7096f861c9dad186e9a7e74e805ca1c7d7123149e28eb4e75dc68c09578bbc92bc5f4ed5c
7
+ data.tar.gz: 667e711943593dd8f1d6b10b883225402dc6b5d8b6ded9a95abf90fdd1c517080dde6811ea58c012f2a1df29a8460268988e1c315b319db982e0b3c71d809d0c
@@ -24,8 +24,14 @@ module Nutkins::DockerBuilder
24
24
  cache_is_dirty = false
25
25
  build_commands = cfg["build"]["commands"]
26
26
  build_commands.each do |build_cmd|
27
- cmd = /^\w+/.match(build_cmd).to_s.downcase
28
- cmd_args = build_cmd[(cmd.length + 1)..-1].strip
27
+ unless build_cmd.kind_of? Hash or build_cmd.keys.length != 1
28
+ raise "build command should be single value hash e.g. 'run:bash'"
29
+ end
30
+
31
+ # build command as object, e.g. run: bash
32
+ cmd = build_cmd.keys.first.downcase
33
+ cmd_args = build_cmd[cmd]
34
+
29
35
  # docker run is always used and forms the basis of the cache key
30
36
  run_args = nil
31
37
  env_args = nil
@@ -34,8 +40,11 @@ module Nutkins::DockerBuilder
34
40
 
35
41
  case cmd
36
42
  when "run"
37
- cmd_args.gsub! /\n+/, ' '
38
- run_args = cmd_args
43
+ if cmd_args.kind_of? String
44
+ run_args = cmd_args.gsub /\n+/, ' '
45
+ else
46
+ run_args = cmd_args.join ' && '
47
+ end
39
48
  when "add"
40
49
  *add_files, add_files_dest = cmd_args.split ' '
41
50
  add_files = add_files.map { |src| Dir.glob src }.flatten
@@ -45,8 +54,8 @@ module Nutkins::DockerBuilder
45
54
  src + ':' + Digest::MD5.file(src).to_s
46
55
  end.push(add_files_dest).join(' ')
47
56
  when "cmd", "entrypoint", "env", "expose", "label", "onbuild", "user", "volume", "workdir"
48
- run_args = "#(nop) #{build_cmd}"
49
- env_args = build_cmd
57
+ env_args = cmd + ' ' + (cmd_args.kind_of?(String) ? cmd_args : JSON.dump(cmd_args))
58
+ run_args = "#(nop) #{env_args}"
50
59
  else
51
60
  raise "unsupported command: #{cmd}"
52
61
  # TODO add metadata flags
@@ -64,7 +73,7 @@ module Nutkins::DockerBuilder
64
73
  parent_img_id = cache_img_id
65
74
  next
66
75
  else
67
- puts "not in cache, starting from #{parent_img_id}"
76
+ puts "not in cache: #{run_args} - starting from #{parent_img_id}"
68
77
  cache_is_dirty = true
69
78
  end
70
79
  end
@@ -1,3 +1,3 @@
1
1
  module Nutkins
2
- VERSION = "0.8.1"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutkins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pike
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler