mux_tf 0.8.1 → 0.8.3
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/once_helper.rb +41 -0
- data/lib/mux_tf/plan_formatter.rb +17 -14
- data/lib/mux_tf/version.rb +1 -1
- data/lib/mux_tf.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bfb6996988528294d8aabd2a79b6a5ca1c6f608a2b16e3c9528ca824d5f3840
|
4
|
+
data.tar.gz: 63c0f292a9464ba91b90bd9b0ce3e17905e827faf927c76fb47ac77d8817645b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41bd544cb898a3a4e96776ce9c57c89f1358dfb40088ce87e3cf221ac2032766db1e104918c552190d656f4c60b48cb9860dbab69f99fc28960d77b0404cc16d
|
7
|
+
data.tar.gz: 9577359e60f72f485d148e03cfbd046a658afffac71f78321d30015abf855a205fb9a859693ee6d9116f2c73da3cc430c28e45ce2e817d0e26a5ba77e65391af
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module MuxTf
|
2
|
+
class OnceHelper
|
3
|
+
# once = OnceHelper.new
|
4
|
+
# once.for(:phase).once { ... }.otherwise { ... }
|
5
|
+
|
6
|
+
class StateEvaluator
|
7
|
+
def initialize(once_helper, new_state)
|
8
|
+
if once_helper.state != new_state
|
9
|
+
once_helper.state = new_state
|
10
|
+
@path = :once
|
11
|
+
else
|
12
|
+
@path = :otherwise
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def once(&block)
|
17
|
+
if @path == :then
|
18
|
+
yield
|
19
|
+
end
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def otherwise(&block)
|
24
|
+
if @path == :otherwise
|
25
|
+
yield
|
26
|
+
end
|
27
|
+
self
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
@state = nil
|
33
|
+
end
|
34
|
+
|
35
|
+
attr_accessor :state
|
36
|
+
|
37
|
+
def for(new_state)
|
38
|
+
StateEvaluator.new(self, new_state)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -9,7 +9,7 @@ module MuxTf
|
|
9
9
|
def pretty_plan(filename, targets: [])
|
10
10
|
pastel = Pastel.new
|
11
11
|
|
12
|
-
|
12
|
+
once = OnceHelper.new
|
13
13
|
|
14
14
|
meta = {}
|
15
15
|
|
@@ -17,6 +17,7 @@ module MuxTf
|
|
17
17
|
parser.state(:info, /^Acquiring state lock/)
|
18
18
|
parser.state(:error, /(╷|Error locking state|Error:)/, %i[none blank info reading])
|
19
19
|
parser.state(:reading, /: (Reading...|Read complete after)/, %i[none info reading])
|
20
|
+
parser.state(:none, /^$/, [:reading])
|
20
21
|
parser.state(:refreshing, /^.+: Refreshing state... \[id=/, %i[none info reading])
|
21
22
|
parser.state(:refreshing, /Refreshing Terraform state in-memory prior to plan.../, %i[none blank info reading])
|
22
23
|
parser.state(:refresh_done, /^----------+$/, [:refreshing])
|
@@ -24,6 +25,9 @@ module MuxTf
|
|
24
25
|
parser.state(:plan_info, /Terraform will perform the following actions:/, [:refresh_done, :none])
|
25
26
|
parser.state(:plan_summary, /^Plan:/, [:plan_info])
|
26
27
|
|
28
|
+
parser.state(:plan_legend, /^Terraform used the selected providers to generate the following execution$/)
|
29
|
+
parser.state(:none, /^$/, [:plan_legend])
|
30
|
+
|
27
31
|
parser.state(:error_lock_info, /Lock Info/, [:error])
|
28
32
|
parser.state(:error, /^$/, [:error_lock_info])
|
29
33
|
|
@@ -61,10 +65,7 @@ module MuxTf
|
|
61
65
|
meta["error"] = "lock"
|
62
66
|
log Paint[line, :red], depth: 2
|
63
67
|
when :plan_error
|
64
|
-
|
65
|
-
puts
|
66
|
-
phase = :plan_error
|
67
|
-
end
|
68
|
+
once.for(state).once { puts }
|
68
69
|
meta["error"] = "refresh"
|
69
70
|
log Paint[line, :red], depth: 2
|
70
71
|
when :error_lock_info
|
@@ -73,20 +74,22 @@ module MuxTf
|
|
73
74
|
end
|
74
75
|
log Paint[line, :red], depth: 2
|
75
76
|
when :refreshing
|
76
|
-
|
77
|
-
phase = :refreshing
|
77
|
+
once.for(state).once {
|
78
78
|
log "Refreshing state ", depth: 2, newline: false
|
79
|
-
|
79
|
+
}.otherwise {
|
80
80
|
print "."
|
81
|
-
|
81
|
+
}
|
82
|
+
when :plan_legend
|
83
|
+
once.for(state).once { puts }
|
84
|
+
log line, depth: 2
|
82
85
|
when :refresh_done
|
83
|
-
|
84
|
-
phase = :refresh_done
|
86
|
+
once.for(state).once {
|
85
87
|
puts
|
86
|
-
|
87
|
-
#
|
88
|
-
|
88
|
+
}.otherwise {
|
89
|
+
#nothing
|
90
|
+
}
|
89
91
|
when :plan_info
|
92
|
+
once.for(state).once { puts }
|
90
93
|
log line, depth: 2
|
91
94
|
when :plan_summary
|
92
95
|
log line, depth: 2
|
data/lib/mux_tf/version.rb
CHANGED
data/lib/mux_tf.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mux_tf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Banasik
|
@@ -141,6 +141,7 @@ 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
|
144
145
|
- lib/mux_tf/plan_formatter.rb
|
145
146
|
- lib/mux_tf/plan_summary_handler.rb
|
146
147
|
- lib/mux_tf/resource_tokenizer.rb
|