build-graph 1.0.4 → 1.0.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/graph/node.rb +6 -2
- data/lib/build/graph/version.rb +1 -1
- data/spec/build/graph/node_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5322fd2cb97b205175ee63a9c39119a09542698
|
4
|
+
data.tar.gz: 914e4964cd6e3aa1ebe5731e12c70cd77ba93822
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 865e4c23951427edba0d9cd0a00a29b7f7d229465942380311a50c8d0fcd51097c39e235e8975a74fe402f142f6132a8ad2c88c32c3d47764dc2167f17491330
|
7
|
+
data.tar.gz: dd998e33d76405b7161a49b6df14d052c2325b9584dedeb0ceca2241d3065050f25e84dcb82b3a436340d380616c187281c32c57b11fd3931f3bdf7c1fff28a9
|
data/lib/build/graph/node.rb
CHANGED
@@ -50,6 +50,10 @@ module Build
|
|
50
50
|
@inputs.map{|path| path.modified_time}.max
|
51
51
|
end
|
52
52
|
|
53
|
+
def missing?
|
54
|
+
@inputs.any?{|path| !path.exist?} || @outputs.any?{|path| !path.exist?}
|
55
|
+
end
|
56
|
+
|
53
57
|
# This is a canonical dirty function. All outputs must exist and must be newer than all inputs. This function is not efficient, in the sense that it must query all files on disk for last modified time.
|
54
58
|
def dirty?
|
55
59
|
if inherit_outputs?
|
@@ -60,8 +64,8 @@ module Build
|
|
60
64
|
|
61
65
|
# I'm not entirely sure this is the correct approach. If input is a glob that matched zero items, but might match items that are older than outputs, what is the correct output from this function?
|
62
66
|
else
|
63
|
-
# Dirty if any outputs
|
64
|
-
return true if
|
67
|
+
# Dirty if any inputs or outputs missing:
|
68
|
+
return true if missing?
|
65
69
|
|
66
70
|
# Dirty if input modified after any output:
|
67
71
|
if input_modified_time = self.modified_time
|
data/lib/build/graph/version.rb
CHANGED
@@ -64,5 +64,25 @@ module Build::Graph::NodeSpec
|
|
64
64
|
|
65
65
|
listing_output.first.delete
|
66
66
|
end
|
67
|
+
|
68
|
+
it "should be dirty if input files are missing" do
|
69
|
+
input = Paths.directory(__dir__, ["missing-input.txt"])
|
70
|
+
output = Glob.new(__dir__, "*.rb")
|
71
|
+
|
72
|
+
node = Node.new(input, output, "a")
|
73
|
+
|
74
|
+
expect(node.missing?).to be true
|
75
|
+
expect(node.dirty?).to be true
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should be dirty if output files are missing" do
|
79
|
+
input = Glob.new(__dir__, "*.rb")
|
80
|
+
output = Paths.directory(__dir__, ["missing-output.txt"])
|
81
|
+
|
82
|
+
node = Node.new(input, output, "a")
|
83
|
+
|
84
|
+
expect(node.missing?).to be true
|
85
|
+
expect(node.dirty?).to be true
|
86
|
+
end
|
67
87
|
end
|
68
88
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build-graph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.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: 2016-
|
11
|
+
date: 2016-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: process-group
|