mux_tf 0.11.0 → 0.12.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 +4 -4
- data/lib/mux_tf/plan_formatter.rb +19 -13
- data/lib/mux_tf/version.rb +1 -1
- data/lib/mux_tf.rb +0 -1
- metadata +2 -3
- data/lib/mux_tf/once_helper.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 924f8b4cc0e90b4c636e3ffcc806c0e48036380ac81ee83b1dc21a437950e76e
|
4
|
+
data.tar.gz: 3bea784dc0db5091efa2dcba48c653b812d618b88c8dc04b997b59cc8e810e0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dbd88ebf68ae0bb27116ce5b553a04668a746cfdd89ed1e646fc6f75961cf8c61d66f2a4ba46d0baaa17c6fdaa3b99704485632a5787a492037e75707e06b1a
|
7
|
+
data.tar.gz: bd9bf482078f080477f1871b02c256ad06b7bcb4e323adb8ee35fe056b9f8fd34bec4993c6b1611fac161b09b80db11c3d36395fdb42bef0d174e3ec666f8745
|
@@ -9,8 +9,6 @@ module MuxTf
|
|
9
9
|
def pretty_plan(filename, targets: []) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
10
10
|
pastel = Pastel.new
|
11
11
|
|
12
|
-
once = OnceHelper.new
|
13
|
-
|
14
12
|
meta = {}
|
15
13
|
|
16
14
|
parser = StatefulParser.new(normalizer: pastel.method(:strip))
|
@@ -23,6 +21,10 @@ module MuxTf
|
|
23
21
|
[:none, :blank, :info, :reading])
|
24
22
|
parser.state(:refresh_done, /^----------+$/, [:refreshing])
|
25
23
|
parser.state(:refresh_done, /^$/, [:refreshing])
|
24
|
+
|
25
|
+
parser.state(:output_info, /^Changes to Outputs:$/, [:refresh_done])
|
26
|
+
parser.state(:refresh_done, /^$/, [:output_info])
|
27
|
+
|
26
28
|
parser.state(:plan_info, /Terraform will perform the following actions:/, [:refresh_done, :none])
|
27
29
|
parser.state(:plan_summary, /^Plan:/, [:plan_info])
|
28
30
|
|
@@ -34,8 +36,12 @@ module MuxTf
|
|
34
36
|
|
35
37
|
parser.state(:plan_error, /^╷|Error: /, [:refreshing, :refresh_done])
|
36
38
|
|
39
|
+
last_state = nil
|
40
|
+
|
37
41
|
status = tf_plan(out: filename, detailed_exitcode: true, compact_warnings: true, targets: targets) { |raw_line|
|
38
42
|
parser.parse(raw_line.rstrip) do |state, line|
|
43
|
+
first_in_state = last_state != state
|
44
|
+
|
39
45
|
case state
|
40
46
|
when :none
|
41
47
|
if line.blank?
|
@@ -66,35 +72,35 @@ module MuxTf
|
|
66
72
|
meta["error"] = "lock"
|
67
73
|
log Paint[line, :red], depth: 2
|
68
74
|
when :plan_error
|
69
|
-
|
75
|
+
puts if first_in_state
|
70
76
|
meta["error"] = "refresh"
|
71
77
|
log Paint[line, :red], depth: 2
|
72
78
|
when :error_lock_info
|
73
79
|
meta[$LAST_MATCH_INFO[1]] = $LAST_MATCH_INFO[2] if line =~ /([A-Z]+\S+)+:\s+(.+)$/
|
74
80
|
log Paint[line, :red], depth: 2
|
75
81
|
when :refreshing
|
76
|
-
|
82
|
+
if first_in_state
|
77
83
|
log "Refreshing state ", depth: 2, newline: false
|
78
|
-
|
84
|
+
else
|
79
85
|
print "."
|
80
|
-
|
86
|
+
end
|
81
87
|
when :plan_legend
|
82
|
-
|
88
|
+
puts if first_in_state
|
83
89
|
log line, depth: 2
|
84
90
|
when :refresh_done
|
85
|
-
|
86
|
-
puts
|
87
|
-
}.otherwise {
|
88
|
-
# nothing
|
89
|
-
}
|
91
|
+
puts if first_in_state
|
90
92
|
when :plan_info # rubocop:disable Lint/DuplicateBranch
|
91
|
-
|
93
|
+
puts if first_in_state
|
94
|
+
log line, depth: 2
|
95
|
+
when :output_info # rubocop:disable Lint/DuplicateBranch
|
96
|
+
puts if first_in_state
|
92
97
|
log line, depth: 2
|
93
98
|
when :plan_summary
|
94
99
|
log line, depth: 2
|
95
100
|
else
|
96
101
|
p [state, pastel.strip(line)]
|
97
102
|
end
|
103
|
+
last_state = state
|
98
104
|
end
|
99
105
|
}
|
100
106
|
[status.status, meta]
|
data/lib/mux_tf/version.rb
CHANGED
data/lib/mux_tf.rb
CHANGED
@@ -23,7 +23,6 @@ require "dotenv"
|
|
23
23
|
|
24
24
|
require_relative "./mux_tf/version"
|
25
25
|
require_relative "./mux_tf/plan_filename_generator"
|
26
|
-
require_relative "./mux_tf/once_helper"
|
27
26
|
require_relative "./mux_tf/resource_tokenizer"
|
28
27
|
require_relative "./mux_tf/cli"
|
29
28
|
require_relative "./mux_tf/tmux"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mux_tf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Banasik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -141,7 +141,6 @@ files:
|
|
141
141
|
- lib/mux_tf/cli/current.rb
|
142
142
|
- lib/mux_tf/cli/mux.rb
|
143
143
|
- lib/mux_tf/cli/plan_summary.rb
|
144
|
-
- lib/mux_tf/once_helper.rb
|
145
144
|
- lib/mux_tf/plan_filename_generator.rb
|
146
145
|
- lib/mux_tf/plan_formatter.rb
|
147
146
|
- lib/mux_tf/plan_summary_handler.rb
|
data/lib/mux_tf/once_helper.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module MuxTf
|
4
|
-
class OnceHelper
|
5
|
-
# once = OnceHelper.new
|
6
|
-
# once.for(:phase).once { ... }.otherwise { ... }
|
7
|
-
|
8
|
-
class StateEvaluator
|
9
|
-
def initialize(once_helper, new_state)
|
10
|
-
if once_helper.state == new_state
|
11
|
-
@path = :otherwise
|
12
|
-
else
|
13
|
-
once_helper.state = new_state
|
14
|
-
@path = :once
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def once
|
19
|
-
yield if @path == :then
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
def otherwise
|
24
|
-
yield if @path == :otherwise
|
25
|
-
self
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def initialize
|
30
|
-
@state = nil
|
31
|
-
end
|
32
|
-
|
33
|
-
attr_accessor :state
|
34
|
-
|
35
|
-
def for(new_state)
|
36
|
-
StateEvaluator.new(self, new_state)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|