kubernetes_template_rendering 0.1.0.pre.1 → 0.1.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd6a61ce9b0278d451c6e402ffab894a703846d04704061be05b1bdd30ddfef1
4
- data.tar.gz: '079c1784c5357f79fa1e6d6e5a15ef00ea6f2bdf72f37b1ff3949283d3d328ef'
3
+ metadata.gz: fc30ea703d6feacb6fc23a4ad942e1e5118deeecb2eb839f122b781fa9627e22
4
+ data.tar.gz: 558a7dea6fad9beb97148a57d97d1e99ecee4cadde256b8eac716d32f8453b1b
5
5
  SHA512:
6
- metadata.gz: 2eee87d74893f113a7b999c312457001cc5a8df0fed38b3827b7e773b5f243f2f73625b69ceb7e330576a4438671aa7f7c6491bf80b1b3e82b2167ab31d272ed
7
- data.tar.gz: 17698c156cc055c8d0e42c1194f88d1ba99b1152712c2ee212393222ac5a93c75ca1029f424cf01f86993f95113fec39183546f4aef04a3d46f3f02de8e6190c
6
+ metadata.gz: 56f00c1e62e0cac407e4ba3486d240929c4673abe4ab2b955fd2da39789aa54d7eb21a6eab8f8a5b694d85c9273077a29362c8c6b6ce3d8ca9d8efd1d443a502
7
+ data.tar.gz: 3614ee029ec93b6011066771ae3ffeee13fb033257ccdb3554b51905088b6e4536f39aea6032e18ce131f89f20372aab8da9cb5e1ce645c5956e8de3bcd66c63
@@ -25,12 +25,13 @@ module KubernetesTemplateRendering
25
25
  op.banner = "Usage: #{$PROGRAM_NAME} --rendered-directory=<directory> <template directory>"
26
26
 
27
27
  op.on("--rendered-directory=RENDERED_DIRECTORY", "set the directory where rendered output is written") { args.rendered_directory = _1 }
28
- op.on("--[no-]fork", "disable/enable fork") { |fork| args.fork = fork }
28
+ op.on("--[no-]fork", "disable/enable fork") { args.fork = _1 }
29
29
  op.on("--makeflags=MAKEFLAGS", "pass through makeflags so that we can infer fork preference from -j") { args.makeflags = _1 }
30
30
  op.on("--jsonnet_library_path=JSONNET_LIBRARY_PATH", "set the jsonnet library path") { args.jsonnet_library_path = _1 }
31
31
  op.on("--cluster_type=CLUSTER_TYPE", "set the specific cluster type to render") { args.cluster_type = _1 }
32
32
  op.on("--region=REGION", "set the specific region to render") { args.region = _1 }
33
33
  op.on("--color=COLOR", "set the specific color to render") { args.color = _1 }
34
+ op.on("--[no-]prune", "enable/disable pruning of untouched resources") { args.prune = _1 }
34
35
 
35
36
  op.on("--variable-override=KEY:VALUE", "override a variable value set within definitions.yaml") do |override|
36
37
  args.variable_overrides ||= {}
@@ -11,7 +11,8 @@ module KubernetesTemplateRendering
11
11
  :cluster_type,
12
12
  :region,
13
13
  :color,
14
- :variable_overrides
14
+ :variable_overrides,
15
+ :prune
15
16
  ) do
16
17
  def valid?
17
18
  rendered_directory && template_directory
@@ -25,6 +26,10 @@ module KubernetesTemplateRendering
25
26
  end
26
27
  end
27
28
 
29
+ def prune?
30
+ !!prune
31
+ end
32
+
28
33
  def render_files?
29
34
  true
30
35
  end
@@ -63,6 +63,7 @@ module KubernetesTemplateRendering
63
63
  end
64
64
 
65
65
  def render_create_directory(args, output_directory)
66
+ prune_directory(output_directory) if args.prune?
66
67
  create_directory(output_directory)
67
68
  puts "Rendering templates to: #{Color.magenta(output_directory)}"
68
69
  puts "Variable assignments:"
@@ -167,6 +168,17 @@ module KubernetesTemplateRendering
167
168
  end
168
169
  end
169
170
 
171
+ def prune_directory(directory)
172
+ if File.exist?(directory)
173
+ puts <<~MESSAGE
174
+
175
+ The `prune` flag is set to true, #{Color.green('pruning')} directory #{Color.magenta(directory)} before rendering
176
+
177
+ MESSAGE
178
+ FileUtils.rm_rf("#{directory}/*")
179
+ end
180
+ end
181
+
170
182
  def resources(output_directory)
171
183
  @resources[output_directory] ||= standard_resources(output_directory) + grouped_resources(output_directory)
172
184
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KubernetesTemplateRendering
4
- VERSION = "0.1.0.pre.1"
4
+ VERSION = "0.1.0.pre.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kubernetes_template_rendering
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.1
4
+ version: 0.1.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Octothorpe