smparkes-watchr 0.5.7.6 → 0.5.7.7
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/bin/watchr +4 -0
- data/lib/watchr.rb +2 -1
- data/lib/watchr/event_handlers/em.rb +6 -0
- data/lib/watchr/script.rb +14 -1
- data/watchr.gemspec +1 -1
- metadata +1 -1
data/bin/watchr
CHANGED
@@ -66,6 +66,10 @@ opts = OptionParser.new do |opts|
|
|
66
66
|
end
|
67
67
|
}
|
68
68
|
|
69
|
+
opts.on('-1', '--once', "Run load patterns and then exit") {
|
70
|
+
Watchr.options.once = true
|
71
|
+
}
|
72
|
+
|
69
73
|
opts.on_tail('-h', '--help', "Print inline help") { puts opts; exit }
|
70
74
|
opts.on_tail('-v', '--version', "Print version" ) { puts Watchr::Bin.version; exit }
|
71
75
|
|
data/lib/watchr.rb
CHANGED
@@ -46,8 +46,9 @@ module Watchr
|
|
46
46
|
#--
|
47
47
|
# On first use, initialize the options struct and default option values.
|
48
48
|
def options
|
49
|
-
@options ||= Struct.new(:debug).new
|
49
|
+
@options ||= Struct.new(:debug,:once).new
|
50
50
|
@options.debug ||= false
|
51
|
+
@options.once.nil? and @options.once = false
|
51
52
|
@options
|
52
53
|
end
|
53
54
|
|
data/lib/watchr/script.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
module Watchr
|
2
2
|
|
3
|
+
class << self
|
4
|
+
def batches
|
5
|
+
@batches ||= {}
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
9
|
+
|
3
10
|
# A script object wraps a script file, and is used by a controller.
|
4
11
|
#
|
5
12
|
# ===== Examples
|
@@ -23,7 +30,9 @@ module Watchr
|
|
23
30
|
end
|
24
31
|
@timer = EM::Timer.new(0.001) do
|
25
32
|
deliver
|
33
|
+
Watchr.batches.delete self
|
26
34
|
end
|
35
|
+
Watchr.batches[self] = self
|
27
36
|
@events << [ data, event ]
|
28
37
|
end
|
29
38
|
|
@@ -52,7 +61,11 @@ module Watchr
|
|
52
61
|
self.batch ||= Batch.new self
|
53
62
|
batch.call data, event
|
54
63
|
else
|
55
|
-
action.
|
64
|
+
if action.arity == 1
|
65
|
+
action.call data
|
66
|
+
else
|
67
|
+
action.call data, event
|
68
|
+
end
|
56
69
|
end
|
57
70
|
end
|
58
71
|
|
data/watchr.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'smparkes-watchr'
|
4
|
-
s.version = '0.5.7.
|
4
|
+
s.version = '0.5.7.7'
|
5
5
|
s.summary = "Modern continious testing (flexible alternative to autotest)"
|
6
6
|
s.description = "Modern continious testing (flexible alternative to autotest)."
|
7
7
|
s.author = "mynyml"
|