build-environment 1.12.1 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/build/environment/evaluator.rb +7 -0
- data/lib/build/environment/version.rb +1 -1
- data/spec/build/environment/evaluator_spec.rb +30 -18
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b0a2e29f0f56710ef70f68f29274237dcdb9fe0a37425280adb8fadf11ded99
|
4
|
+
data.tar.gz: 1c9f18a94aeaca0a1a484b9a3f0ac97068074dd737311634325a5a200e2ace0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42ae4a31779fc52ecfc4aaa8616c1948c80c1cd2a9fd6c76a48832ba870f0e2c6e8613bd0c743484c46b7a7be259659b2c638c1e75341cda39ae688130282e01
|
7
|
+
data.tar.gz: 1337f8d7706cc6461c850b801e07ce7a68ac11571ec3af92f137a95d5384a6dbcb36f805e779b0ad8017ca0259442176c86bc513490af6fbf038af376fe055ee
|
@@ -26,6 +26,13 @@ module Build
|
|
26
26
|
@cache = {}
|
27
27
|
end
|
28
28
|
|
29
|
+
def initialize_dup(other)
|
30
|
+
@environment = other.instance_variable_get(:@environment)
|
31
|
+
@cache = other.instance_variable_get(:@cache).dup
|
32
|
+
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
29
36
|
def respond_to?(name, include_private = false)
|
30
37
|
@environment.include?(name) || super
|
31
38
|
end
|
@@ -20,33 +20,45 @@
|
|
20
20
|
|
21
21
|
require 'build/environment'
|
22
22
|
|
23
|
+
require 'securerandom'
|
24
|
+
|
23
25
|
RSpec.describe Build::Environment::Evaluator do
|
24
|
-
|
25
|
-
|
26
|
+
let(:environment) do
|
27
|
+
Build::Environment.new do
|
26
28
|
fruit {"apples"}
|
29
|
+
dinner :fruit
|
27
30
|
end
|
28
|
-
|
29
|
-
expect(environment.flatten.evaluator.fruit).to be == "apples"
|
30
31
|
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
expect(environment.flatten.evaluator.dinner).to be == "apples"
|
33
|
+
subject {environment.flatten.evaluator}
|
34
|
+
|
35
|
+
it "can evaluate procs" do
|
36
|
+
expect(subject.fruit).to be == "apples"
|
39
37
|
end
|
40
38
|
|
41
|
-
it "
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
it "can dereference symbols" do
|
40
|
+
expect(subject.dinner).to be == "apples"
|
41
|
+
end
|
42
|
+
|
43
|
+
context "computed values" do
|
44
|
+
let(:environment) do
|
45
|
+
Build::Environment.new do
|
46
|
+
secret {SecureRandom.hex(32)}
|
47
|
+
end
|
45
48
|
end
|
46
49
|
|
47
|
-
|
50
|
+
it "caches the computed value" do
|
51
|
+
secret = subject.secret
|
52
|
+
|
53
|
+
expect(subject.secret).to be == secret
|
54
|
+
end
|
48
55
|
|
49
|
-
|
50
|
-
|
56
|
+
describe '#dup' do
|
57
|
+
it "retains existing cache" do
|
58
|
+
secret = subject.secret
|
59
|
+
|
60
|
+
expect(subject.dup.secret).to be == secret
|
61
|
+
end
|
62
|
+
end
|
51
63
|
end
|
52
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build-environment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: covered
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
120
|
+
rubygems_version: 3.1.2
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: A nested hash data structure for controlling build environments.
|