build 2.4.4 → 2.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/build/rule.rb +6 -4
- data/lib/build/version.rb +1 -1
- data/spec/build/rule_spec.rb +18 -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: 0a7dc5ba6382c7406b79f7a5963fab483b90f7420cd337e3d3e5c912b6a8dc1e
|
4
|
+
data.tar.gz: 2667f5375ed38172f5abe47f595951c82b545d58b27cbcb449b5f1fd8b367ef8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0be1a4642c4b95e46abfc8d49f2a80c77acb819aa906e4912e1161f0422af22bd50056910b80f60e8475c27e28402f64aa15feed23bfc838704916341c0e7a5e
|
7
|
+
data.tar.gz: ab49021a6454da45bf8f299cf62b81aa44201e652bc2720d329b97189a5154485f20f064b42cc2bd9dd241adcda32fc36107d718d573a8e1e2513b4d188699fd
|
data/lib/build/rule.rb
CHANGED
@@ -88,13 +88,15 @@ module Build
|
|
88
88
|
def compute(arguments, scope)
|
89
89
|
if implicit?
|
90
90
|
# Can be replaced if supplied:
|
91
|
-
arguments[@name] || scope.instance_exec(arguments, &@dynamic)
|
91
|
+
arguments[@name] || scope.instance_exec(arguments, &@dynamic) || @options[:default]
|
92
92
|
elsif dynamic?
|
93
93
|
# Argument is optional:
|
94
|
-
scope.instance_exec(arguments[@name], arguments, &@dynamic)
|
95
|
-
|
94
|
+
scope.instance_exec(arguments[@name], arguments, &@dynamic) || @options[:default]
|
95
|
+
elsif arguments.key?(@name)
|
96
96
|
arguments[@name]
|
97
|
-
|
97
|
+
else
|
98
|
+
@options[:default]
|
99
|
+
end
|
98
100
|
end
|
99
101
|
|
100
102
|
def hash
|
data/lib/build/version.rb
CHANGED
data/spec/build/rule_spec.rb
CHANGED
@@ -32,4 +32,22 @@ RSpec.describe Build::Rule do
|
|
32
32
|
expect(rule.applicable?(source: 'foo', destination: 'bar')).to be_truthy
|
33
33
|
expect(rule.applicable?(source: 'foo')).to be_falsey
|
34
34
|
end
|
35
|
+
|
36
|
+
it "respects false argument" do
|
37
|
+
rule = Build::Rule.new("compile", "cpp")
|
38
|
+
|
39
|
+
rule.parameter :install, default: true
|
40
|
+
|
41
|
+
expect(
|
42
|
+
rule.normalize({}, binding)
|
43
|
+
).to be == {install: true}
|
44
|
+
|
45
|
+
expect(
|
46
|
+
rule.normalize({install: true}, binding)
|
47
|
+
).to be == {install: true}
|
48
|
+
|
49
|
+
expect(
|
50
|
+
rule.normalize({install: false}, binding)
|
51
|
+
).to be == {install: false}
|
52
|
+
end
|
35
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: build-graph
|