climate_control 1.1.0 → 1.1.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 +4 -4
- data/README.md +17 -0
- data/lib/climate_control/version.rb +1 -1
- data/lib/climate_control.rb +7 -3
- data/spec/acceptance/climate_control_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1052215413e209a2ce0531a9b293d56f51df36db70688af69ae15e70571a043d
|
4
|
+
data.tar.gz: ed855bfdddc57fc46532edc296d9a8de6a2a3653f5b148ab10849433aeb61026
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e292d7055db48aaa3cf664f447c6826d3ccf59cc1142dc71a89e8b8e97dbac26d553ebd2912a1f8b2a15b3f75b71de5f3345244cc0cb2f4dd8970f47b73b12c1
|
7
|
+
data.tar.gz: 96f9e0f2e8193c29d708f94c1cdced3d7a1b305ae0cb781729895b838be70233a0082f767f840a5d943e5b206cc55539606de156e4b301bab787e29ab45507b4
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Climate Control
|
2
2
|
|
3
|
+

|
4
|
+
|
3
5
|
Easily manage your environment.
|
4
6
|
|
5
7
|
## Installation
|
@@ -151,3 +153,18 @@ This project uses [StandardRB](https://github.com/testdouble/standard) to ensure
|
|
151
153
|
## License
|
152
154
|
|
153
155
|
climate_control is copyright 2012-2021 Joshua Clayton and thoughtbot, inc. It is free software and may be redistributed under the terms specified in the [LICENSE](https://github.com/thoughtbot/climate_control/blob/main/LICENSE) file.
|
156
|
+
|
157
|
+
About thoughtbot
|
158
|
+
----------------
|
159
|
+
|
160
|
+

|
161
|
+
|
162
|
+
climate_control is maintained and funded by thoughtbot, inc.
|
163
|
+
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
164
|
+
|
165
|
+
We love open source software!
|
166
|
+
See [our other projects][community] or
|
167
|
+
[hire us][hire] to design, develop, and grow your product.
|
168
|
+
|
169
|
+
[community]: https://thoughtbot.com/community?utm_source=github
|
170
|
+
[hire]: https://thoughtbot.com/hire-us?utm_source=github
|
data/lib/climate_control.rb
CHANGED
@@ -13,9 +13,13 @@ module ClimateControl
|
|
13
13
|
|
14
14
|
SEMAPHORE.synchronize do
|
15
15
|
previous = ENV.to_hash
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
|
17
|
+
begin
|
18
|
+
copy environment_overrides
|
19
|
+
ensure
|
20
|
+
middle = ENV.to_hash
|
21
|
+
end
|
22
|
+
|
19
23
|
block.call
|
20
24
|
ensure
|
21
25
|
after = ENV
|
@@ -167,6 +167,21 @@ describe "Climate control" do
|
|
167
167
|
}.to raise_error ClimateControl::UnassignableValueError, /attempted to assign .*Thing.* to FOO but failed \(#{message}\)$/
|
168
168
|
end
|
169
169
|
|
170
|
+
it "restores the ENV even when an error was raised when assigning values" do
|
171
|
+
ENV["KEY_TO_OVERRIDE"] = "initial_value_1"
|
172
|
+
ENV["KEY_THAT_WILL_ERROR_OUT"] = "initial_value_2"
|
173
|
+
|
174
|
+
expect {
|
175
|
+
with_modified_env(
|
176
|
+
KEY_TO_OVERRIDE: "overwriten_value_1",
|
177
|
+
KEY_THAT_WILL_ERROR_OUT: :value_that_will_error_out
|
178
|
+
) {}
|
179
|
+
}.to raise_error ClimateControl::UnassignableValueError
|
180
|
+
|
181
|
+
expect(ENV["KEY_TO_OVERRIDE"]).to eq("initial_value_1")
|
182
|
+
expect(ENV["KEY_THAT_WILL_ERROR_OUT"]).to eq("initial_value_2")
|
183
|
+
end
|
184
|
+
|
170
185
|
def with_modified_env(options = {}, &block)
|
171
186
|
ClimateControl.modify(options, &block)
|
172
187
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: climate_control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Clayton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-05-
|
12
|
+
date: 2022-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|