uatu 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/uatu.rb +12 -27
- metadata +36 -29
data/lib/uatu.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'listen'
|
2
2
|
|
3
3
|
class Uatu
|
4
4
|
|
@@ -18,45 +18,30 @@ class Uatu
|
|
18
18
|
|
19
19
|
puts "Watcher started"
|
20
20
|
@last_update = Time.now
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
mon.delete &(trigger_block :delete)
|
25
|
-
end
|
21
|
+
Listen.to(@options[:path]) do |mod, add, del|
|
22
|
+
trigger(mod + add + del)
|
23
|
+
end
|
26
24
|
end
|
27
25
|
|
28
26
|
private
|
29
|
-
|
30
|
-
def trigger_block(evt)
|
31
|
-
proc { |base, rel|
|
32
|
-
trigger base, rel, evt
|
33
|
-
}
|
34
|
-
end
|
35
27
|
|
36
|
-
def trigger(
|
37
|
-
|
38
|
-
path = File.realpath(rel, base)
|
39
|
-
rescue
|
40
|
-
# if the file does not exist (in case of a deletion)
|
41
|
-
path = rel
|
42
|
-
end
|
43
|
-
|
44
|
-
return if exclude? path
|
28
|
+
def trigger(paths)
|
29
|
+
# return if paths.any? { |p| exclude? p }
|
45
30
|
return unless time_elapsed?
|
46
31
|
|
47
|
-
puts "Changed %s" % [
|
32
|
+
puts "Changed %s" % [paths]
|
48
33
|
|
49
|
-
if include?
|
34
|
+
if paths.any? { |p| include? p }
|
50
35
|
run_script path if @options[:script]
|
51
36
|
run_command path if @options[:cmd]
|
52
37
|
@last_update = Time.now
|
53
38
|
end
|
54
39
|
end
|
55
40
|
|
56
|
-
def exclude? (path)
|
57
|
-
|
58
|
-
|
59
|
-
end
|
41
|
+
# def exclude? (path)
|
42
|
+
# return false unless @options[:exclude]
|
43
|
+
# File.fnmatch(@options[:exclude], path)
|
44
|
+
# end
|
60
45
|
|
61
46
|
def include? (path)
|
62
47
|
return true unless @options[:pattern]
|
metadata
CHANGED
@@ -1,58 +1,65 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: uatu
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.1
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.6.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Jeremy David
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
|
13
|
+
date: 2012-03-21 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: listen
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
19
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.4.7
|
22
24
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
description: ! "\n A simple gem to trigger a script upon file system change\n "
|
25
|
+
version_requirements: *id001
|
26
|
+
description: "\n A simple gem to trigger a script upon file system change\n "
|
26
27
|
email: uatu@jeremydavid.ch
|
27
|
-
executables:
|
28
|
+
executables:
|
28
29
|
- uatu
|
29
30
|
extensions: []
|
31
|
+
|
30
32
|
extra_rdoc_files: []
|
31
|
-
|
33
|
+
|
34
|
+
files:
|
32
35
|
- bin/uatu
|
33
36
|
- lib/uatu.rb
|
34
37
|
homepage: http://github.com/ltouroumov/uatu
|
35
38
|
licenses: []
|
39
|
+
|
36
40
|
post_install_message:
|
37
41
|
rdoc_options: []
|
38
|
-
|
42
|
+
|
43
|
+
require_paths:
|
39
44
|
- lib
|
40
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
46
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
46
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
52
|
none: false
|
48
|
-
requirements:
|
49
|
-
- -
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
version:
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
52
57
|
requirements: []
|
58
|
+
|
53
59
|
rubyforge_project:
|
54
60
|
rubygems_version: 1.8.11
|
55
61
|
signing_key:
|
56
62
|
specification_version: 3
|
57
63
|
summary: Script trigger upon changes
|
58
64
|
test_files: []
|
65
|
+
|