build-files 1.0.1 → 1.0.2

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: 1f34f08a51af0bb5ea2b5d9c9a0db153043814c2
4
- data.tar.gz: e04880fa3fcead461fa957855ae762aa0954101a
3
+ metadata.gz: a6489c135e1494d5c883e30ab38832d3a9c2afb9
4
+ data.tar.gz: a946aca100d97c1d35bf79aedf97af756d30a205
5
5
  SHA512:
6
- metadata.gz: cf6faf14761ae2b0b4856e9669687ec676d1462080ea4150ec32a213e2a6ad6f6e66cfa880a24ab2459e91cfeedb76043511add720cb4e7b7a632d36aa7c335f
7
- data.tar.gz: 2f27d02ca86929aa603c4f02f7462fb1b0a337065ce8ffed855f7204d39da025b346489538a7a04acdec06eccaf44d0f546188ee7d95ae5cd7f8f54b98775dd8
6
+ metadata.gz: 4d9c032e0525bd3f738965bdc030fb210f4c9f164c292b166bc0b9af701e1b14d201e8307d03c0afef26a1ef33dcb1479e04681e680181a3865c1f9bcb9bb285
7
+ data.tar.gz: f0a7d3c974368967e49ed50e5c0db127830ef8addf8c54efe1e464c6cf5074a622f4f4e0e84c850a2888d9ade1d6be1d53eef763e5687af04cffe28a4b1fea1f
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format documentation
3
+ --backtrace
4
+ --warnings
data/.travis.yml CHANGED
@@ -1,5 +1,14 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - "2.0"
4
- - "2.1"
4
+ - 2.0.0
5
+ - 2.1.8
6
+ - 2.2.4
7
+ - 2.3.0
8
+ - ruby-head
9
+ - rbx-2
5
10
  env: COVERAGE=true
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: "rbx-2"
14
+
data/build-files.gemspec CHANGED
@@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = '>= 2.0'
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.3"
24
- spec.add_development_dependency "rspec", "~> 3.0.0.rc1"
24
+ spec.add_development_dependency "rspec", "~> 3.4.0"
25
25
  spec.add_development_dependency "rake"
26
26
  end
@@ -45,9 +45,13 @@ module Build
45
45
  def remove!
46
46
  monitor.delete(self)
47
47
  end
48
-
48
+
49
+ # Inform the handle that it might have been modified.
49
50
  def changed!
50
- @on_changed.call(@state) if @state.update!
51
+ # If @state.update! did not find any changes, don't invoke the callback:
52
+ if @state.update!
53
+ @on_changed.call(@state)
54
+ end
51
55
  end
52
56
  end
53
57
 
@@ -75,6 +79,7 @@ module Build
75
79
  @directories[directory].each do |handle|
76
80
  @logger.debug{"Handle changed: #{handle.inspect}"}
77
81
 
82
+ # Changes here may not actually require an update to the handle:
78
83
  handle.changed!(*args)
79
84
  end
80
85
  end
@@ -116,16 +121,20 @@ module Build
116
121
  handle
117
122
  end
118
123
 
119
- def run(options = {}, &block)
120
- default_driver = case RUBY_PLATFORM
121
- when /linux/i; :inotify
122
- when /darwin/i; :fsevent
123
- else; :polling
124
+ def default_driver
125
+ case RUBY_PLATFORM
126
+ when /linux/i then :inotify
127
+ when /darwin/i then :fsevent
128
+ else :polling
124
129
  end
125
-
130
+ end
131
+
132
+ def run(options = {}, &block)
126
133
  if driver = (options[:driver] || default_driver)
127
134
  method_name = "run_with_#{driver}"
128
135
  Files.send(method_name, self, options, &block)
136
+ else
137
+ raise ArgumentError.new("Could not find driver for platform #{RUBY_PLATFORM}!")
129
138
  end
130
139
  end
131
140
 
@@ -167,7 +176,7 @@ module Build
167
176
  catch(:interrupt) do
168
177
  while true
169
178
  monitor.roots.each do |root|
170
- notifier.watch root, :create, :modify, :delete do |event|
179
+ notifier.watch root, :create, :modify, :attrib, :delete do |event|
171
180
  monitor.update([root])
172
181
 
173
182
  yield
@@ -126,8 +126,6 @@ module Build
126
126
  attr :oldest_time
127
127
  attr :newest_time
128
128
 
129
- attr :missing
130
-
131
129
  def missing?
132
130
  !@missing.empty?
133
131
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Build
22
22
  module Files
23
- VERSION = "1.0.1"
23
+ VERSION = "1.0.2"
24
24
  end
25
25
  end
@@ -150,9 +150,12 @@ module Build::Files::ListSpec
150
150
  glob = Glob.new(__dir__, "*.rb")
151
151
 
152
152
  paths = glob.with extension: ".txt"
153
+ path = paths.first
153
154
 
154
- expect(paths.first[0]).to be == (glob.first)
155
- expect(paths.first[1]).to be == (glob.first.append ".txt")
155
+ expect(path).to be_kind_of Array
156
+
157
+ expect(path[0]).to be == glob.first
158
+ expect(path[1]).to be == glob.first.append(".txt")
156
159
  end
157
160
 
158
161
  it "should define an empty set of files" do
@@ -53,17 +53,17 @@ module Build::Files::MonitorSpec
53
53
  end
54
54
 
55
55
  touched = false
56
+ triggered = 0
56
57
 
57
58
  thread = Thread.new do
58
- sleep 0.1
59
-
60
- path.touch
61
-
62
- touched = true
59
+ while triggered == 0 or touched == false
60
+ sleep 0.1 if touched
61
+
62
+ path.touch
63
+ touched = true
64
+ end
63
65
  end
64
66
 
65
- triggered = 0
66
-
67
67
  monitor.run(driver: driver) do
68
68
  triggered += 1
69
69
 
@@ -92,9 +92,6 @@ module Build::Files::PathSpec
92
92
  end
93
93
 
94
94
  it "should give the shortest path for outer paths" do
95
- spec_path = Path.new(__FILE__)
96
- source_path = Path.new(File.expand_path("../../../lib/build/files/list.rb"))
97
-
98
95
  input = Path.new("/a/b/c/file.cpp")
99
96
  output = Path.new("/a/b/c/d/e/")
100
97
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-files
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-13 00:00:00.000000000 Z
11
+ date: 2016-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0.rc1
33
+ version: 3.4.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0.rc1
40
+ version: 3.4.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".rspec"
62
63
  - ".simplecov"
63
64
  - ".travis.yml"
64
65
  - Gemfile
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  version: '0'
103
104
  requirements: []
104
105
  rubyforge_project:
105
- rubygems_version: 2.2.2
106
+ rubygems_version: 2.4.6
106
107
  signing_key:
107
108
  specification_version: 4
108
109
  summary: Build::Files is a set of idiomatic classes for dealing with paths and monitoring