mux_tf 0.8.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,34 +1,40 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "yaml/store"
2
4
 
3
- module YAML
4
- # Explaination from @h4xnoodle:
5
- #
6
- # Since ruby 3+ and psych 4+, the yaml loading became extra safe so the
7
- # expired_at timestamp in the yaml cache is no longer parsing for whatever reason.
8
- #
9
- # Attempts were made with
10
- #
11
- # `@store = YAML::Store.new path`
12
- # =>
13
- # `@store = YAML::Store.new(path, { aliases: true, permitted_classes: [Time] })`
14
- # to get it to work but that didn't help, so decided to just bypass the safe
15
- # loading, since the file is controlled by us for the version checking.
16
- #
17
- # This is to override the way that psych seems to be loading YAML.
18
- # Instead of using 'load' which needs work to permit the 'Time' class
19
- # (which from above I tried that and it wasn't working so I decided to just
20
- # bypass and use what it was doing before).
21
- # This brings us back to the equivalent that was working before in that unsafe
22
- # load was used before the psych upgrade.
23
- #
24
- # This change: https://my.diffend.io/gems/psych/3.3.2/4.0.0
25
- # is the changes that 'cause the problem' and so I'm 'fixing it' by using the old equivalent.
26
- #
27
- # Maybe the yaml cache needs more work to have
28
- # `YAML::Store.new(path, { aliases: true, permitted_classes: [Time] }) work.`
29
- #
30
- class << self
31
- alias_method :load, :unsafe_load
5
+ # Ruby 2.7's YAML doesn't have a :unsafe_load method .. so we skip all that
6
+ if YAML.singleton_methods.include?(:unsafe_load)
7
+ module YAML
8
+ # Explaination from @h4xnoodle:
9
+ #
10
+ # Since ruby 3+ and psych 4+, the yaml loading became extra safe so the
11
+ # expired_at timestamp in the yaml cache is no longer parsing for whatever reason.
12
+ #
13
+ # Attempts were made with
14
+ #
15
+ # `@store = YAML::Store.new path`
16
+ # =>
17
+ # `@store = YAML::Store.new(path, { aliases: true, permitted_classes: [Time] })`
18
+ # to get it to work but that didn't help, so decided to just bypass the safe
19
+ # loading, since the file is controlled by us for the version checking.
20
+ #
21
+ # This is to override the way that psych seems to be loading YAML.
22
+ # Instead of using 'load' which needs work to permit the 'Time' class
23
+ # (which from above I tried that and it wasn't working so I decided to just
24
+ # bypass and use what it was doing before).
25
+ # This brings us back to the equivalent that was working before in that unsafe
26
+ # load was used before the psych upgrade.
27
+ #
28
+ # This change: https://my.diffend.io/gems/psych/3.3.2/4.0.0
29
+ # is the changes that 'cause the problem' and so I'm 'fixing it' by using the old equivalent.
30
+ #
31
+ # Maybe the yaml cache needs more work to have
32
+ # `YAML::Store.new(path, { aliases: true, permitted_classes: [Time] }) work.`
33
+ #
34
+ class << self
35
+ undef load # avoid a warning about the next line redefining load
36
+ alias load unsafe_load
37
+ end
32
38
  end
33
39
  end
34
40
 
@@ -55,13 +61,12 @@ module MuxTf
55
61
  end
56
62
 
57
63
  if info.nil? || info[:expires_at] < Time.now
58
- if block_given?
59
- value = yield
60
- set(key, value, ttl: ttl)
61
- return value
62
- else
63
- raise KeyError, info.nil? ? "no value at key: #{key}" : "value expired at key: #{key}"
64
- end
64
+ raise KeyError, info.nil? ? "no value at key: #{key}" : "value expired at key: #{key}" unless block_given?
65
+
66
+ value = yield
67
+ set(key, value, ttl: ttl)
68
+ return value
69
+
65
70
  end
66
71
 
67
72
  info[:value]
data/lib/mux_tf.rb CHANGED
@@ -6,6 +6,8 @@ require "shellwords"
6
6
  require "optparse"
7
7
  require "json"
8
8
  require "open3"
9
+ require "digest/md5"
10
+ require "tmpdir"
9
11
 
10
12
  require "piotrb_cli_utils"
11
13
  require "stateful_parser"
@@ -20,6 +22,7 @@ require "tty-table"
20
22
  require "dotenv"
21
23
 
22
24
  require_relative "./mux_tf/version"
25
+ require_relative "./mux_tf/plan_filename_generator"
23
26
  require_relative "./mux_tf/once_helper"
24
27
  require_relative "./mux_tf/resource_tokenizer"
25
28
  require_relative "./mux_tf/cli"
data/mux_tf.gemspec CHANGED
@@ -13,10 +13,11 @@ Gem::Specification.new do |spec|
13
13
  # spec.description = 'TODO: Write a longer description or delete this line.'
14
14
  spec.homepage = "https://github.com/piotrb/mux_tf"
15
15
  spec.license = "MIT"
16
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
16
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
17
17
 
18
18
  # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
19
19
 
20
+ spec.metadata["rubygems_mfa_required"] = "true"
20
21
  spec.metadata["homepage_uri"] = spec.homepage
21
22
  spec.metadata["source_code_uri"] = spec.homepage
22
23
  # spec.metadata['changelog_uri'] = "TODO: Put your gem's CHANGELOG.md URL here."
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.8.4
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Banasik
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-01 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- description:
125
+ description:
126
126
  email:
127
127
  - piotr@jane.app
128
128
  executables:
@@ -142,6 +142,7 @@ files:
142
142
  - lib/mux_tf/cli/mux.rb
143
143
  - lib/mux_tf/cli/plan_summary.rb
144
144
  - lib/mux_tf/once_helper.rb
145
+ - lib/mux_tf/plan_filename_generator.rb
145
146
  - lib/mux_tf/plan_formatter.rb
146
147
  - lib/mux_tf/plan_summary_handler.rb
147
148
  - lib/mux_tf/resource_tokenizer.rb
@@ -155,9 +156,10 @@ homepage: https://github.com/piotrb/mux_tf
155
156
  licenses:
156
157
  - MIT
157
158
  metadata:
159
+ rubygems_mfa_required: 'true'
158
160
  homepage_uri: https://github.com/piotrb/mux_tf
159
161
  source_code_uri: https://github.com/piotrb/mux_tf
160
- post_install_message:
162
+ post_install_message:
161
163
  rdoc_options: []
162
164
  require_paths:
163
165
  - lib
@@ -165,15 +167,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
167
  requirements:
166
168
  - - ">="
167
169
  - !ruby/object:Gem::Version
168
- version: 2.3.0
170
+ version: 2.7.0
169
171
  required_rubygems_version: !ruby/object:Gem::Requirement
170
172
  requirements:
171
173
  - - ">="
172
174
  - !ruby/object:Gem::Version
173
175
  version: '0'
174
176
  requirements: []
175
- rubygems_version: 3.4.10
176
- signing_key:
177
+ rubygems_version: 3.2.22
178
+ signing_key:
177
179
  specification_version: 4
178
180
  summary: Terraform Multiplexing Scripts
179
181
  test_files: []