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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a509f52ea42b9283d2d9d9b58ea8c58670eb98cf84e06ca79bce8e82f188b034
4
- data.tar.gz: 96aaf024a4a18719980dc7f9f75332fcc7b096a7c12774ea7b7a23af7e1d94bf
3
+ metadata.gz: bdacf4844a9cf65f3a99c6ece8fa1403c9f3f2a2ebca15c0a8e77fcfed1cf5a8
4
+ data.tar.gz: 1cb1976307736bf8c5ad00796652ad2eed3e0abda36348ff9d4bccb3677909f4
5
5
  SHA512:
6
- metadata.gz: 86474f9dc9331a377c949ac08c2bed16a2d0562b135d86150b0f6da007f5334597b7b6a8703bbde40343fa931af5f193b807e5768dd52a5dff2f646e286bc854
7
- data.tar.gz: 2d0816db323ceadae0f536dbf548e3a59b4ffa91ed5d1299125d35795a158dea17fc07bb205edb4070e3a7b4255873bddf4dd2d3912fbccb5963d85177788ede
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
- class IceAge
4
- VERSION = '0.0.2'
4
+ module IceAge
5
+ extend self
5
6
 
6
- class << self
7
+ def freeze
8
+ raise 'already frozen' if frozen?
7
9
 
8
- def freeze
9
- raise 'already frozen' if frozen?
10
+ @env = ENV.to_h.freeze
11
+ end
10
12
 
11
- @env = ENV.to_h.freeze
12
- end
13
+ def frozen?
14
+ !!@env
15
+ end
13
16
 
14
- def frozen?
15
- !!@env
16
- end
17
+ def restore
18
+ raise 'not frozen' unless frozen?
17
19
 
18
- def restore
19
- raise "#{self.class.name}.frozen never called!" unless frozen?
20
+ ENV.replace(@env)
21
+ end
20
22
 
21
- ENV.clear.update(@env)
22
- end
23
+ def endure!
24
+ raise 'not frozen' unless frozen?
23
25
 
24
- def endure!
25
- changes = (Set.new(ENV.to_h) - Set.new(@env)).to_h.keys
26
- unless changes.empty?
27
- msg = changes.map {|k| { k => { @env[k] => ENV[k] } }}.to_s
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
@@ -0,0 +1,3 @@
1
+ require 'ice_age'
2
+
3
+ IceAge.freeze
data/lib/ice_age/rspec.rb CHANGED
@@ -6,7 +6,7 @@ RSpec.configure do |config|
6
6
  IceAge.frozen? ? IceAge.endure! : IceAge.freeze
7
7
  end
8
8
 
9
- config.before do
9
+ config.after do
10
10
  IceAge.restore
11
11
  end
12
12
 
@@ -0,0 +1,3 @@
1
+ module IceAge
2
+ VERSION = '0.2.0'
3
+ end
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.2
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: 2020-09-14 00:00:00.000000000 Z
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
- homepage: https://github.com/dpep/rb_ice_age
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.3
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: []