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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dcba8fbc1368e6fd3a2c4117d6a787609b4127e
4
- data.tar.gz: 4984ebb6012624af504492ce5ad5597b471f362b
3
+ metadata.gz: a5322fd2cb97b205175ee63a9c39119a09542698
4
+ data.tar.gz: 914e4964cd6e3aa1ebe5731e12c70cd77ba93822
5
5
  SHA512:
6
- metadata.gz: 5e34905fd1150c7d69c77be9292505a7f67f08c8b46924047971a2af18665c8bbf8f9c0d8a8349e0eec2891410b443a45005ce9b9b27ae1e58cb56d37ed81baa
7
- data.tar.gz: 471ef8ad632e75fcc1048d497aabbe5959a86e9dd226edf6014ee70c371eee66fbd9592704920b217fe55aa9d4711aaeb9d0e0c0706e142868445baae6561517
6
+ metadata.gz: 865e4c23951427edba0d9cd0a00a29b7f7d229465942380311a50c8d0fcd51097c39e235e8975a74fe402f142f6132a8ad2c88c32c3d47764dc2167f17491330
7
+ data.tar.gz: dd998e33d76405b7161a49b6df14d052c2325b9584dedeb0ceca2241d3065050f25e84dcb82b3a436340d380616c187281c32c57b11fd3931f3bdf7c1fff28a9
@@ -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 don't exist:
64
- return true if @outputs.any?{|path| !path.exist?}
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
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Build
22
22
  module Graph
23
- VERSION = "1.0.4"
23
+ VERSION = "1.0.5"
24
24
  end
25
25
  end
@@ -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
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-02-10 00:00:00.000000000 Z
11
+ date: 2016-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: process-group