ice_age 0.0.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ice_age.rb +27 -22
- data/lib/ice_age/freeze.rb +3 -0
- data/lib/ice_age/rspec.rb +1 -1
- data/lib/ice_age/version.rb +3 -0
- metadata +38 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdacf4844a9cf65f3a99c6ece8fa1403c9f3f2a2ebca15c0a8e77fcfed1cf5a8
|
4
|
+
data.tar.gz: 1cb1976307736bf8c5ad00796652ad2eed3e0abda36348ff9d4bccb3677909f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3c508685bc49e270034c7c44a745f8d7b7e7e7dfbf36e1ac4d06af753c266052f63f8b5cd63ee2fec0ba32228df5f3e7ad71ba3b0bc5f200d1b4ad383cf77a7
|
7
|
+
data.tar.gz: 6db65ab8e9734cf1a958a64461ec5bd04d01c0a7e0ef27e4c5f1efc2cf42bfa43c9af56ec92b26e0ba2c03a52a9dac409a58cc6834ff3c05b249582813da56f3
|
data/lib/ice_age.rb
CHANGED
@@ -1,37 +1,42 @@
|
|
1
|
+
require 'ice_age/version'
|
1
2
|
require 'set'
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
module IceAge
|
5
|
+
extend self
|
5
6
|
|
6
|
-
|
7
|
+
def freeze
|
8
|
+
raise 'already frozen' if frozen?
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
+
@env = ENV.to_h.freeze
|
11
|
+
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
def frozen?
|
14
|
+
!!@env
|
15
|
+
end
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
+
def restore
|
18
|
+
raise 'not frozen' unless frozen?
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
ENV.replace(@env)
|
21
|
+
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
def endure!
|
24
|
+
raise 'not frozen' unless frozen?
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
raise 'ENV changed after freeze: ' + msg
|
29
|
-
end
|
26
|
+
changes = (Set.new(ENV.to_h) - Set.new(@env)).to_h.keys - WHITELIST
|
27
|
+
unless changes.empty?
|
28
|
+
msg = changes.map {|k| { k => { @env[k] => ENV[k] } }}.to_s
|
29
|
+
raise 'ENV changed after freeze: ' + msg
|
30
30
|
end
|
31
|
-
|
32
31
|
end
|
33
|
-
end
|
34
32
|
|
33
|
+
WHITELIST = [
|
34
|
+
'COLUMNS',
|
35
|
+
'DISABLE_PRY',
|
36
|
+
'LINES',
|
37
|
+
].freeze
|
38
|
+
private_constant :WHITELIST
|
39
|
+
end
|
35
40
|
|
36
41
|
# load framework plugins
|
37
42
|
begin
|
data/lib/ice_age/rspec.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ice_age
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Pepper
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: codecov
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: pry
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,19 +66,35 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: Freeze your ENVironment for testing.
|
56
|
-
email:
|
84
|
+
email:
|
57
85
|
executables: []
|
58
86
|
extensions: []
|
59
87
|
extra_rdoc_files: []
|
60
88
|
files:
|
61
89
|
- lib/ice_age.rb
|
90
|
+
- lib/ice_age/freeze.rb
|
62
91
|
- lib/ice_age/rspec.rb
|
63
|
-
|
92
|
+
- lib/ice_age/version.rb
|
93
|
+
homepage: https://github.com/dpep/ice_age_rb
|
64
94
|
licenses:
|
65
95
|
- MIT
|
66
96
|
metadata: {}
|
67
|
-
post_install_message:
|
97
|
+
post_install_message:
|
68
98
|
rdoc_options: []
|
69
99
|
require_paths:
|
70
100
|
- lib
|
@@ -79,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
109
|
- !ruby/object:Gem::Version
|
80
110
|
version: '0'
|
81
111
|
requirements: []
|
82
|
-
rubygems_version: 3.0.
|
83
|
-
signing_key:
|
112
|
+
rubygems_version: 3.0.8
|
113
|
+
signing_key:
|
84
114
|
specification_version: 4
|
85
115
|
summary: IceAge
|
86
116
|
test_files: []
|