command_timer 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,42 +30,12 @@ module CommandTimer
30
30
 
31
31
  def run_observer
32
32
  puts "===================="
33
- puts "= Start observer, input S to stop it."
33
+ puts "= Start observer, press <Ctrl-C> to stop it."
34
34
  puts "= #{@observer}"
35
35
  puts "===================="
36
- observer_thread = Thread.new do
37
- if @grep
38
- run_grep
39
- else
40
- system @observer
41
- end
36
+ IO.popen @observer do |pipe|
42
37
  end
43
- observer_thread.run
44
- interaction_thread = Thread.new do
45
- input = ""
46
- until ["s", "S", "stop"].include?(input) do
47
- input = STDIN.gets.chomp
48
- end
49
- end
50
- interaction_thread.run
51
- while observer_thread.alive? and interaction_thread.alive? do
52
- end
53
- observer_thread.kill
54
- interaction_thread.kill
55
38
  puts "Observer stopped."
56
39
  end
57
-
58
- def run_grep
59
- current_count = 0
60
- grep_str = @grep.split(",").first
61
- end_count = @grep.split(",").last.to_i
62
- IO.popen @observer do |f|
63
- while line = f.gets
64
- puts line
65
- current_count += 1 if line.include?(grep_str)
66
- break if current_count >= end_count
67
- end
68
- end
69
- end
70
40
  end
71
41
  end
@@ -1,3 +1,3 @@
1
1
  module CommandTimer
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command_timer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-13 00:00:00.000000000 Z
12
+ date: 2012-07-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Simple tool to execute commands on schedule
15
15
  email: