minfra-cli 1.13.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -2
  3. data/.rubocop.yml +31 -0
  4. data/CHANGELOG.md +15 -0
  5. data/Gemfile.lock +1 -1
  6. data/README.md +13 -1
  7. data/exe/minfra +1 -3
  8. data/lib/deep_merge.rb +35 -36
  9. data/lib/hash.rb +19 -18
  10. data/lib/minfra/cli/ask.rb +18 -16
  11. data/lib/minfra/cli/cli_starter.rb +173 -0
  12. data/lib/minfra/cli/command.rb +4 -1
  13. data/lib/minfra/cli/commands/dev.rb +26 -15
  14. data/lib/minfra/cli/commands/kube.rb +97 -88
  15. data/lib/minfra/cli/commands/plugin.rb +9 -8
  16. data/lib/minfra/cli/commands/project/branch.rb +7 -5
  17. data/lib/minfra/cli/commands/project/tag.rb +7 -6
  18. data/lib/minfra/cli/commands/project.rb +40 -40
  19. data/lib/minfra/cli/commands/setup.rb +18 -18
  20. data/lib/minfra/cli/commands/stack/app_template.rb +10 -13
  21. data/lib/minfra/cli/commands/stack/client_template.rb +10 -8
  22. data/lib/minfra/cli/commands/stack/kube_stack_template.rb +49 -51
  23. data/lib/minfra/cli/commands/stack.rb +55 -46
  24. data/lib/minfra/cli/commands/tag.rb +9 -8
  25. data/lib/minfra/cli/common.rb +7 -10
  26. data/lib/minfra/cli/config.rb +36 -63
  27. data/lib/minfra/cli/core_ext.rb +7 -0
  28. data/lib/minfra/cli/document.rb +5 -2
  29. data/lib/minfra/cli/env.rb +24 -0
  30. data/lib/minfra/cli/errors.rb +10 -0
  31. data/lib/minfra/cli/helm_runner.rb +3 -1
  32. data/lib/minfra/cli/hiera_looker.rb +54 -0
  33. data/lib/minfra/cli/hook.rb +36 -24
  34. data/lib/minfra/cli/kubectl_runner.rb +3 -1
  35. data/lib/minfra/cli/logging.rb +5 -1
  36. data/lib/minfra/cli/main_command.rb +2 -1
  37. data/lib/minfra/cli/plugin.rb +74 -0
  38. data/lib/minfra/cli/plugins.rb +18 -87
  39. data/lib/minfra/cli/runner.rb +23 -23
  40. data/lib/minfra/cli/templater.rb +17 -17
  41. data/lib/minfra/cli/version.rb +3 -1
  42. data/lib/minfra/cli.rb +20 -114
  43. data/lib/orchparty/ast.rb +13 -14
  44. data/lib/orchparty/cli.rb +35 -33
  45. data/lib/orchparty/context.rb +15 -15
  46. data/lib/orchparty/dsl_parser.rb +7 -11
  47. data/lib/orchparty/dsl_parser_kubernetes.rb +46 -56
  48. data/lib/orchparty/plugin.rb +10 -9
  49. data/lib/orchparty/plugins/env.rb +14 -13
  50. data/lib/orchparty/transformations/all.rb +3 -1
  51. data/lib/orchparty/transformations/mixin.rb +24 -24
  52. data/lib/orchparty/transformations/remove_internal.rb +3 -2
  53. data/lib/orchparty/transformations/sort.rb +2 -1
  54. data/lib/orchparty/transformations/variable.rb +6 -5
  55. data/lib/orchparty/transformations.rb +2 -0
  56. data/lib/orchparty/version.rb +3 -1
  57. data/lib/orchparty.rb +14 -14
  58. metadata +9 -2
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
  require 'securerandom'
3
5
  module Orchparty
@@ -19,22 +21,21 @@ module Orchparty
19
21
 
20
22
  class Builder
21
23
  def self.build(*args, block)
22
- builder = self.new(*args)
24
+ builder = new(*args)
23
25
  builder.instance_eval(&block) if block
24
26
  builder._build
25
27
  end
26
28
 
27
29
  def assign_or_merge(node, key, value)
28
- if node[key]
29
- node[key] = node[key].deep_merge_concat(value)
30
- else
31
- node[key] = value
32
- end
30
+ node[key] = if node[key]
31
+ node[key].deep_merge_concat(value)
32
+ else
33
+ value
34
+ end
33
35
  end
34
36
  end
35
37
 
36
38
  class RootBuilder < Builder
37
-
38
39
  def initialize
39
40
  @root = AST.root
40
41
  end
@@ -63,15 +64,14 @@ module Orchparty
63
64
  end
64
65
 
65
66
  class MixinBuilder < Builder
66
-
67
67
  def initialize(name)
68
- @mixin = AST.mixin(name: name)
68
+ @mixin = AST.mixin(name:)
69
69
  end
70
70
 
71
71
  def template(path)
72
- chart_name = "_mixin_temp_name"
72
+ chart_name = '_mixin_temp_name'
73
73
  unless @mixin.services[chart_name]
74
- @mixin.services[chart_name] = AST.chart(name: chart_name, _type: "chart" )
74
+ @mixin.services[chart_name] = AST.chart(name: chart_name, _type: 'chart')
75
75
  @mixin._service_order << chart_name
76
76
  end
77
77
  chart = @mixin.services[chart_name]
@@ -80,15 +80,14 @@ module Orchparty
80
80
  end
81
81
 
82
82
  def service(name, &block)
83
-
84
- chart_name = "_mixin_temp_name"
83
+ chart_name = '_mixin_temp_name'
85
84
  unless @mixin.services[chart_name]
86
- @mixin.services[chart_name] = AST.chart(name: chart_name, _type: "chart" )
85
+ @mixin.services[chart_name] = AST.chart(name: chart_name, _type: 'chart')
87
86
  @mixin._service_order << chart_name
88
87
  end
89
88
  chart = @mixin.services[chart_name]
90
89
 
91
- result = ServiceBuilder.build(name, "chart-service", block)
90
+ result = ServiceBuilder.build(name, 'chart-service', block)
92
91
 
93
92
  name = "chart-#{chart.name}-#{name}"
94
93
  @mixin.services[name] = result
@@ -98,15 +97,14 @@ module Orchparty
98
97
  end
99
98
 
100
99
  def helm(name, &block)
101
- result = ServiceBuilder.build(name, "helm", block)
100
+ result = ServiceBuilder.build(name, 'helm', block)
102
101
  @mixin.services[name] = result
103
102
  @mixin._mixins[name] = result
104
103
  self
105
104
  end
106
105
 
107
-
108
106
  def apply(name, &block)
109
- result = ServiceBuilder.build(name, "apply", block)
107
+ result = ServiceBuilder.build(name, 'apply', block)
110
108
  @mixin.services[name] = result
111
109
  @mixin._mixins[name] = result
112
110
  self
@@ -130,9 +128,8 @@ module Orchparty
130
128
  end
131
129
 
132
130
  class ApplicationBuilder < Builder
133
-
134
131
  def initialize(name)
135
- @application = AST.application(name: name)
132
+ @application = AST.application(name:)
136
133
  end
137
134
 
138
135
  def mix(name)
@@ -160,7 +157,7 @@ module Orchparty
160
157
  end
161
158
 
162
159
  def helm(name, &block)
163
- result = ServiceBuilder.build(name, "helm", block)
160
+ result = ServiceBuilder.build(name, 'helm', block)
164
161
  @application.services[name] = result
165
162
  @application._service_order << name
166
163
  self
@@ -168,37 +165,36 @@ module Orchparty
168
165
 
169
166
  def label(&block)
170
167
  name = SecureRandom.hex
171
- result = ServiceWithoutNameBuilder.build("label", block)
168
+ result = ServiceWithoutNameBuilder.build('label', block)
172
169
  @application.services[name] = result
173
170
  @application._service_order << name
174
171
  self
175
172
  end
176
173
 
177
174
  def apply(name, &block)
178
- result = ServiceBuilder.build(name, "apply", block)
175
+ result = ServiceBuilder.build(name, 'apply', block)
179
176
  @application.services[name] = result
180
177
  @application._service_order << name
181
178
  self
182
179
  end
183
180
 
184
181
  def secret_generic(name, &block)
185
- result = ServiceBuilder.build(name, "secret_generic", block)
182
+ result = ServiceBuilder.build(name, 'secret_generic', block)
186
183
  @application.services[name] = result
187
184
  @application._service_order << name
188
185
  self
189
186
  end
190
187
 
191
-
192
188
  def wait(&block)
193
189
  name = SecureRandom.hex
194
- result = ServiceBuilder.build(name, "wait", block)
190
+ result = ServiceBuilder.build(name, 'wait', block)
195
191
  @application.services[name] = result
196
192
  @application._service_order << name
197
193
  self
198
194
  end
199
195
 
200
196
  def chart(name, &block)
201
- @application.services[name] = ChartBuilder.build(name, @application, "chart", block)
197
+ @application.services[name] = ChartBuilder.build(name, @application, 'chart', block)
202
198
  @application._service_order << name
203
199
  self
204
200
  end
@@ -206,7 +202,7 @@ module Orchparty
206
202
  def template(path)
207
203
  chart_name = @application.name
208
204
  unless @application.services[chart_name]
209
- @application.services[chart_name] = AST.chart(name: chart_name, _type: "chart" )
205
+ @application.services[chart_name] = AST.chart(name: chart_name, _type: 'chart')
210
206
  @application._service_order << chart_name
211
207
  end
212
208
  chart = @application.services[chart_name]
@@ -217,12 +213,12 @@ module Orchparty
217
213
  def service(name, &block)
218
214
  chart_name = @application.name
219
215
  unless @application.services[chart_name]
220
- @application.services[chart_name] = AST.chart(name: chart_name, _type: "chart" )
216
+ @application.services[chart_name] = AST.chart(name: chart_name, _type: 'chart')
221
217
  @application._service_order << chart_name
222
218
  end
223
219
  chart = @application.services[chart_name]
224
220
 
225
- result = ServiceBuilder.build(name, "chart-service", block)
221
+ result = ServiceBuilder.build(name, 'chart-service', block)
226
222
 
227
223
  name = "chart-#{chart.name}-#{name}"
228
224
  @application.services[name] = result
@@ -237,7 +233,6 @@ module Orchparty
237
233
  end
238
234
 
239
235
  class HashBuilder < Builder
240
-
241
236
  def method_missing(_, *values, &block)
242
237
  if block_given?
243
238
  value = HashBuilder.build(block)
@@ -255,11 +250,11 @@ module Orchparty
255
250
  key, value = value.first
256
251
  begin
257
252
  @hash[key.to_sym] = value
258
- rescue
253
+ rescue StandardError
259
254
  warn "Problem with key: #{key} #{value}"
260
- raise
261
- end
262
-
255
+ raise
256
+ end
257
+
263
258
  else
264
259
  @hash ||= AST.array
265
260
  @hash << value
@@ -280,7 +275,6 @@ module Orchparty
280
275
  end
281
276
 
282
277
  class CommonBuilder < Builder
283
-
284
278
  def initialize(node)
285
279
  @node = node
286
280
  end
@@ -291,7 +285,7 @@ module Orchparty
291
285
 
292
286
  def method_missing(name, *values, &block)
293
287
  if block_given?
294
- assign_or_merge(@node, name, HashBuilder.build(block))
288
+ assign_or_merge(@node, name, HashBuilder.build(block))
295
289
  else
296
290
  assign_or_merge(@node, name, values.first)
297
291
  end
@@ -321,16 +315,14 @@ module Orchparty
321
315
  end
322
316
 
323
317
  class ServiceWithoutNameBuilder < CommonBuilder
324
-
325
- def initialize( type)
318
+ def initialize(type)
326
319
  super AST.service(_type: type)
327
320
  end
328
321
  end
329
322
 
330
323
  class ServiceBuilder < CommonBuilder
331
-
332
324
  def initialize(name, type)
333
- super AST.service(name: name, _type: type)
325
+ super AST.service(name:, _type: type)
334
326
  @node.files = {}
335
327
  end
336
328
 
@@ -344,32 +336,31 @@ module Orchparty
344
336
 
345
337
  def file(name, volume, &block)
346
338
  result = FileBuilder.build(name, volume, block)
347
- @node.files[name]=result
339
+ @node.files[name] = result
348
340
  self
349
341
  end
350
342
  end
351
343
 
352
344
  class FileBuilder < CommonBuilder
353
345
  def initialize(name, volume)
354
- super AST.service(filename: name, volume: volume)
346
+ super AST.service(filename: name, volume:)
355
347
  end
356
348
  end
357
349
 
358
350
  class ServiceMixinBuilder < CommonBuilder
359
-
360
351
  def initialize(name)
361
- super AST.service(name: name)
352
+ super AST.service(name:)
362
353
  end
363
354
  end
364
355
 
365
356
  class ChartBuilder < CommonBuilder
366
357
  def initialize(name, application, type)
367
- super AST.chart(name: name, _type: type )
358
+ super AST.chart(name:, _type: type)
368
359
  @application = application
369
360
  end
370
361
 
371
362
  def service(name, &block)
372
- result = ServiceBuilder.build(name, "chart-service", block)
363
+ result = ServiceBuilder.build(name, 'chart-service', block)
373
364
 
374
365
  name = "chart-#{@node.name}-#{name}"
375
366
  @application.services[name] = result
@@ -390,15 +381,15 @@ module Orchparty
390
381
  def secrets(name, deploy: :helm, &block)
391
382
  case deploy
392
383
  when :helm
393
- result = ServiceBuilder.build(name, "chart-secret", block)
394
- @application.services[name] = result
395
- @application._service_order << name
396
- @node._services << name
397
- self
384
+ result = ServiceBuilder.build(name, 'chart-secret', block)
385
+ @application.services[name] = result
386
+ @application._service_order << name
387
+ @node._services << name
388
+ self
398
389
  when :apply
399
- result = ServiceBuilder.build(name, "apply", block)
390
+ result = ServiceBuilder.build(name, 'apply', block)
400
391
  file = Tempfile.create(name)
401
- result.tmp_file=file.path
392
+ result.tmp_file = file.path
402
393
  file.puts "apiVersion: v1\nkind: Secret\nmetadata:\n name: #{name}\ntype: Opaque\ndata:"
403
394
  result._.each do |key, value|
404
395
  file.puts " #{key}: #{Base64.strict_encode64(value.respond_to?(:call) ? value.call : value)}"
@@ -407,12 +398,11 @@ module Orchparty
407
398
  @application.services[name] = result
408
399
  @application._service_order << name
409
400
  when :none
410
-
401
+
411
402
  else
412
403
  raise "unknown secret type: #{type}, known tpyes: [helm, apply]"
413
404
  end
414
405
  end
415
-
416
406
  end
417
407
  end
418
408
  end
@@ -1,16 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Orchparty
2
4
  module Plugin
3
5
  @plugins = {}
4
6
 
5
7
  def self.load_plugin(name)
6
- begin
7
- require "orchparty/plugins/#{name}"
8
- raise "Plugin didn't correctly register itself" unless @plugins[name]
9
- @plugins[name]
10
- rescue LoadError
11
- puts "could not load the plugin #{name}, you might install it as a gem or you need to write it by your self ;)"
12
- false
13
- end
8
+ require "orchparty/plugins/#{name}"
9
+ raise "Plugin didn't correctly register itself" unless @plugins[name]
10
+
11
+ @plugins[name]
12
+ rescue LoadError
13
+ puts "could not load the plugin #{name}, you might install it as a gem or you need to write it by your self ;)"
14
+ false
14
15
  end
15
16
 
16
17
  def self.plugins
@@ -21,4 +22,4 @@ module Orchparty
21
22
  @plugins[name] = mod
22
23
  end
23
24
  end
24
- end
25
+ end
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'shellwords'
2
4
  module Orchparty
3
5
  module Plugin
4
6
  module Env
5
7
  def self.desc
6
- "generate environment variables"
8
+ 'generate environment variables'
7
9
  end
8
10
 
9
11
  def self.define_flags(c)
10
- c.flag [:output,:o], :desc => 'Set the output file'
11
- c.flag [:service,:s], :desc => 'Set the service to generate environment variables from.'
12
- c.flag [:seperator,:sep], :desc => 'How to join the environment variables', default_value: "\\n"
12
+ c.flag %i[output o], desc: 'Set the output file'
13
+ c.flag %i[service s], desc: 'Set the service to generate environment variables from.'
14
+ c.flag %i[seperator sep], desc: 'How to join the environment variables', default_value: '\\n'
13
15
  end
14
16
 
15
17
  def self.generate(ast, options)
@@ -22,18 +24,17 @@ module Orchparty
22
24
  end
23
25
 
24
26
  def self.env_output(application, options)
25
- if options[:service]
26
- services = [ application.services[options[:service]] ]
27
- else
28
- services = application.services.values
29
- end
27
+ services = if options[:service]
28
+ [application.services[options[:service]]]
29
+ else
30
+ application.services.values
31
+ end
30
32
 
31
- options[:sep] = "\n" if options[:sep] == "\\n"
33
+ options[:sep] = "\n" if options[:sep] == '\\n'
32
34
 
33
- envs = services.map(&:environment).compact.inject({}) {|a, v| a.merge(v) }
34
- envs.map{|k,v| "#{k.to_s}=#{v.is_a?(String) ? v.shellescape : v }"}.join(options[:sep])
35
+ envs = services.map(&:environment).compact.inject({}) { |a, v| a.merge(v) }
36
+ envs.map { |k, v| "#{k}=#{v.is_a?(String) ? v.shellescape : v}" }.join(options[:sep])
35
37
  end
36
-
37
38
  end
38
39
  end
39
40
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Orchparty
2
4
  module Transformations
3
5
  class All
@@ -5,7 +7,7 @@ module Orchparty
5
7
  ast.applications.each do |_, application|
6
8
  application.services.transform_values! do |service|
7
9
  if application.all.is_a?(Hash)
8
- AST.service(application.all.deep_merge_concat(service))
10
+ AST.service(application.all.deep_merge_concat(service))
9
11
  else
10
12
  service
11
13
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Orchparty
2
4
  module Transformations
3
5
  class Mixin
@@ -15,26 +17,24 @@ module Orchparty
15
17
  end
16
18
 
17
19
  def resolve_chart_name(mixin, application)
18
- # warn "ERROR: #{mixin} #{application}"
19
- if mixin.services[:_mixin_temp_name]
20
- mixin.services[application.name.to_s] = mixin.services.delete("_mixin_temp_name")
21
- mixin.services[application.name.to_s][:name] = application.name.to_s
22
- mixin._service_order.delete("_mixin_temp_name")
23
- mixin._service_order << application.name.to_s
24
- end
25
- mixin
20
+ # warn "ERROR: #{mixin} #{application}"
21
+ if mixin.services[:_mixin_temp_name]
22
+ mixin.services[application.name.to_s] = mixin.services.delete('_mixin_temp_name')
23
+ mixin.services[application.name.to_s][:name] = application.name.to_s
24
+ mixin._service_order.delete('_mixin_temp_name')
25
+ mixin._service_order << application.name.to_s
26
+ end
27
+ mixin
26
28
  end
27
29
 
28
30
  def transform_application(application, ast)
29
31
  application.services = application.services.transform_values! do |service|
30
32
  current = AST.service
31
33
  service.delete(:_mix).compact.each do |mix|
32
- begin
33
34
  current = current.deep_merge_concat(resolve_mixin(mix, application, ast))
34
- rescue
35
- warn "problems with #{mix}"
36
- raise
37
- end
35
+ rescue StandardError
36
+ warn "problems with #{mix}"
37
+ raise
38
38
  end
39
39
  current.deep_merge_concat(service)
40
40
  end
@@ -42,17 +42,17 @@ module Orchparty
42
42
  end
43
43
 
44
44
  def resolve_mixin(mix, application, ast)
45
- mixin = if mix.include? "."
46
- mixin_name, mixin_service_name = mix.split(".")
47
- if ast._mixins[mixin_name]
48
- ast._mixins[mixin_name]._mixins[mixin_service_name]
49
- else
50
- warn "ERROR: Could not find mixin '#{mixin_name}'."
51
- exit 1
52
- end
53
- else
54
- application._mixins[mix]
55
- end
45
+ mixin = if mix.include? '.'
46
+ mixin_name, mixin_service_name = mix.split('.')
47
+ if ast._mixins[mixin_name]
48
+ ast._mixins[mixin_name]._mixins[mixin_service_name]
49
+ else
50
+ warn "ERROR: Could not find mixin '#{mixin_name}'."
51
+ exit 1
52
+ end
53
+ else
54
+ application._mixins[mix]
55
+ end
56
56
  if mixin.nil?
57
57
  warn "ERROR: Could not find mixin '#{mix}'."
58
58
  exit 1
@@ -1,12 +1,13 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  module Orchparty
3
4
  module Transformations
4
5
  class RemoveInternal
5
6
  def transform(ast)
6
7
  ast.applications.each do |_, application|
7
- application.delete_if {|k, _| k.to_s.start_with?("_")}
8
+ application.delete_if { |k, _| k.to_s.start_with?('_') }
8
9
  application.services = application.services.each do |_, service|
9
- service.delete_if {|k, _| k.to_s.start_with?("_")}
10
+ service.delete_if { |k, _| k.to_s.start_with?('_') }
10
11
  end
11
12
  end
12
13
  ast
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
 
2
3
  module Orchparty
3
4
  module Transformations
4
5
  class Sort
5
6
  def transform(ast)
6
- AST::Node.new ast.deep_sort_by_key_and_sort_array(["command", "entrypoint"]) {|a, b| a.to_s <=> b.to_s }
7
+ AST::Node.new ast.deep_sort_by_key_and_sort_array(%w[command entrypoint]) { |a, b| a.to_s <=> b.to_s }
7
8
  end
8
9
  end
9
10
  end
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Orchparty
2
4
  module Transformations
3
5
  class Variable
4
-
5
6
  def initialize(opts = {})
6
7
  @force_variable_definition = opts[:force_variable_definition]
7
8
  end
@@ -21,11 +22,11 @@ module Orchparty
21
22
  def resolve(application, subject, service)
22
23
  subject.deep_transform_values! do |v|
23
24
  if v.respond_to?(:call)
24
- eval_value(build_context(application: application, service: service), v)
25
+ eval_value(build_context(application:, service:), v)
25
26
  elsif v.is_a? Array
26
27
  v.map do |v|
27
28
  if v.respond_to?(:call)
28
- eval_value(build_context(application: application, service: service), v)
29
+ eval_value(build_context(application:, service:), v)
29
30
  else
30
31
  v
31
32
  end
@@ -42,10 +43,10 @@ module Orchparty
42
43
 
43
44
  def build_context(application:, service:)
44
45
  variables = application._variables || {}
45
- variables = variables.merge({application: application.merge(application._variables)})
46
+ variables = variables.merge({ application: application.merge(application._variables) })
46
47
  if service
47
48
  variables = variables.merge(service._variables)
48
- variables = variables.merge({service: service.merge(service._variables)})
49
+ variables = variables.merge({ service: service.merge(service._variables) })
49
50
  end
50
51
  context = Context.new(variables)
51
52
  context._force_variable_definition = @force_variable_definition
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ostruct'
2
4
  require 'orchparty/transformations/all'
3
5
  require 'orchparty/transformations/variable'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Orchparty
2
- VERSION = "2.1.0"
4
+ VERSION = '2.1.0'
3
5
  end
data/lib/orchparty.rb CHANGED
@@ -12,14 +12,14 @@ require 'orchparty/kubernetes_application'
12
12
  require 'hash'
13
13
 
14
14
  module Orchparty
15
-
16
15
  def self.options
17
16
  @@options
18
17
  end
18
+
19
19
  def self.options=(opt)
20
- @@options=opt
20
+ @@options = opt
21
21
  end
22
-
22
+
23
23
  class App
24
24
  attr_reader :options
25
25
 
@@ -30,9 +30,9 @@ module Orchparty
30
30
  @file_name = file_name
31
31
  @status_dir = status_dir
32
32
  @options = options
33
-
34
- Orchparty.options=options
35
-
33
+
34
+ Orchparty.options = options
35
+
36
36
  load_plugins
37
37
  end
38
38
 
@@ -41,7 +41,7 @@ module Orchparty
41
41
  end
42
42
 
43
43
  def print(method:, out_io:)
44
- app(out_io: out_io).print(method)
44
+ app(out_io:).print(method)
45
45
  end
46
46
 
47
47
  def install
@@ -54,26 +54,26 @@ module Orchparty
54
54
 
55
55
  private
56
56
 
57
- def app(out_io: STDOUT)
57
+ def app(out_io: $stdout)
58
58
  parsed = Orchparty::Kubernetes::DSLParser.new(@file_name).parse
59
59
  app_config = Transformations.transform_kubernetes(parsed, force_variable_definition: @force_variable_definition).applications[@application_name]
60
60
  KubernetesApplication.new(
61
- app_config: app_config,
62
- namespace: @application_name,
63
- cluster_name: @cluster_name,
61
+ app_config:,
62
+ namespace: @application_name,
63
+ cluster_name: @cluster_name,
64
64
  file_name: @file_name,
65
65
  status_dir: @status_dir,
66
- out_io: out_io
66
+ out_io:
67
67
  )
68
68
  end
69
-
69
+
70
70
  def generate(plugin_name, options, plugin_options)
71
71
  plugins[plugin_name].generate(ast(options), plugin_options)
72
72
  end
73
73
 
74
74
  def ast(filename:, application:, force_variable_definition: nil)
75
75
  Transformations.transform(Orchparty::DSLParser.new(filename).parse,
76
- force_variable_definition: force_variable_definition).applications[application]
76
+ force_variable_definition:).applications[application]
77
77
  end
78
78
 
79
79
  def load_plugins