ruby-terraform 0.58.0 → 0.59.0.pre.1

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
  SHA256:
3
- metadata.gz: a169d8302479fd0aa777ea6f3a7f2fe5243e49fd54a1d45548be4fae4937c1cb
4
- data.tar.gz: ee71f858ae3783e6d0bf83f1e7ae3a5083d083ca885cc5465ac065dd7a1a84e7
3
+ metadata.gz: 31791b88071aedec456f114396f8066b555ddcaddaa3e9d3d4fa100560a92262
4
+ data.tar.gz: 1d2d327bacc5593010b5dd9bc51e7dd44c729b6f614eb92fc415102973cbcb6f
5
5
  SHA512:
6
- metadata.gz: fdbcf07a395455bf0d6ffad1811fe836b5921183426fa65818a7939ffcb605691c949eadc66d47f6899b0bd6475d2a8c6dc03649da667cbd2b1b294e85374f3d
7
- data.tar.gz: b853e31c72eb7bb358d203b98d68087de8b752ee24d1b78d474136a4aae71e64cc335275f1a8867d3deab7fcf58f78e8a5f904c1382447b8840696d6665366f4
6
+ metadata.gz: 54d68b310141085f68296b7f35cb40d64cfc07398d2679f07e055d07dca8bbbcdde21b611d468a2a0067101b8c39583dc7a5640625ec123ddff50150327e2d91
7
+ data.tar.gz: b0c44a9823117cc4365a29d22631bb615e4432eb08e0b0d049322565694440d92830b808236923c159e937f7149436cf6edf705bc9f538e1d469b02d65b709ad
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-terraform (0.58.0)
4
+ ruby-terraform (0.59.0.pre.1)
5
5
  lino (>= 1.1, < 2)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -50,6 +50,7 @@ Currently, there is partial support for the following commands:
50
50
  * `RubyTerraform::Commands::Refresh`: executes `terraform refresh`
51
51
  * `RubyTerraform::Commands::Import`: executes `terraform import`
52
52
  * `RubyTerraform::Commands::RemoteConfig`: executes `terraform remote config`
53
+ * `RubyTerraform::Commands::FMT`: executes `terraform fmt`
53
54
  * `RubyTerraform::Commands::Validate`: executes `terraform validate`
54
55
  * `RubyTerraform::Commands::Workspace`: executes `terraform workspace`
55
56
 
@@ -384,7 +385,38 @@ arguments:
384
385
  * `no_color`: whether or not the output from the command should be in color;
385
386
  defaults to `false`.
386
387
 
388
+ ### RubyTerraform::Commands::FMT
387
389
 
390
+ The FMT command formats the terraform directory specified. It can be called in the following ways:
391
+
392
+ ```ruby
393
+ RubyTerraform.fmt(
394
+ directory: 'infra/networking',
395
+ vars: {
396
+ region: 'eu-central'
397
+ })
398
+ RubyTerraform::Commands::FMT.new.execute(
399
+ directory: 'infra/networking',
400
+ vars: {
401
+ region: 'eu-central'
402
+ })
403
+ ```
404
+
405
+ The fmt command supports the following options passed as keyword arguments:
406
+ * `directory`: the directory containing terraform configuration to be formatted; required.
407
+ * `recursive`: Processes files in subdirectories;
408
+ defaults to `false`.
409
+ * `list`: Don't list files whose formatting differs;
410
+ defaults to `false`.
411
+ * `write`: Don't write to source files;
412
+ defaults to `false`.
413
+ * `check`: Checks if the input is formatted, exit status will be 0 if all input is properly formatted and non zero otherwise;
414
+ defaults to `false`.
415
+ * `diff`: Displays a diff of the formatting changes;
416
+ defaults to `false`.
417
+ * `no_color`: whether or not the output from the command should be in color;
418
+ defaults to `false`.
419
+
388
420
  ### RubyTerraform::Commands::Validate
389
421
 
390
422
  The validate command validates terraform configuration in the provided terraform
@@ -72,6 +72,10 @@ module RubyTerraform
72
72
  def import(opts = {})
73
73
  Commands::Import.new.execute(opts)
74
74
  end
75
+
76
+ def fmt(opts = {})
77
+ Commands::FMT.new.execute(opts)
78
+ end
75
79
  end
76
80
  extend ClassMethods
77
81
 
@@ -11,6 +11,7 @@ require_relative 'commands/remote_config'
11
11
  require_relative 'commands/show'
12
12
  require_relative 'commands/workspace'
13
13
  require_relative 'commands/import'
14
+ require_relative 'commands/fmt'
14
15
 
15
16
  module RubyTerraform
16
17
  module Commands
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lino'
4
+ require_relative 'base'
5
+
6
+ module RubyTerraform
7
+ module Commands
8
+ class FMT < Base
9
+ def configure_command(builder, opts)
10
+ directory = opts[:directory]
11
+ check = opts[:check]
12
+ diff = opts[:diff]
13
+ list = opts[:list]
14
+ no_color = opts[:no_color]
15
+ recursive = opts[:recursive]
16
+ write = opts[:write]
17
+
18
+ builder.with_subcommand('fmt') do |sub|
19
+ sub = sub.with_option('-list', list) if list
20
+ sub = sub.with_option('-write', write) if write
21
+
22
+ sub = sub.with_flag('-check') if check
23
+ sub = sub.with_flag('-diff') if diff
24
+ sub = sub.with_flag('-no-color') if no_color
25
+ sub = sub.with_flag('-recursive') if recursive
26
+ sub
27
+ end.with_argument(directory)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module RubyTerraform
2
- VERSION = "0.58.0"
2
+ VERSION = "0.59.0.pre.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.58.0
4
+ version: 0.59.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lino
@@ -172,6 +172,7 @@ files:
172
172
  - lib/ruby_terraform/commands/base.rb
173
173
  - lib/ruby_terraform/commands/clean.rb
174
174
  - lib/ruby_terraform/commands/destroy.rb
175
+ - lib/ruby_terraform/commands/fmt.rb
175
176
  - lib/ruby_terraform/commands/get.rb
176
177
  - lib/ruby_terraform/commands/import.rb
177
178
  - lib/ruby_terraform/commands/init.rb
@@ -209,9 +210,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
210
  version: '2.6'
210
211
  required_rubygems_version: !ruby/object:Gem::Requirement
211
212
  requirements:
212
- - - ">="
213
+ - - ">"
213
214
  - !ruby/object:Gem::Version
214
- version: '0'
215
+ version: 1.3.1
215
216
  requirements: []
216
217
  rubygems_version: 3.0.1
217
218
  signing_key: