guard-redis 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -2
- data/lib/guard/redis.rb +10 -3
- data/lib/guard/redis/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Guard::Redis
|
1
|
+
# Guard::Redis [![Build Status](https://secure.travis-ci.org/whazzmaster/guard-redis.png)](http://travis-ci.org/whazzmaster/guard-redis)
|
2
2
|
|
3
3
|
Redis guard manages your development [Redis](http://redis.io) server, and will automatically restart if necessary.
|
4
4
|
|
@@ -29,4 +29,8 @@ Guard::Redis doesn't watch any files; it's purpose is to ensure that redis-serve
|
|
29
29
|
:executable => "/path/to/redis/server/executable" # Set the custom path to the redis server executable
|
30
30
|
:port => 9999 # Set a custom port number the redis server is running on
|
31
31
|
:pidfile => "/var/pid/redis.pid" # Set a custom path the where the pidfile is written
|
32
|
-
~~~~
|
32
|
+
~~~~
|
33
|
+
|
34
|
+
## Contributers
|
35
|
+
|
36
|
+
https://github.com/whazzmaster/guard-redis/graphs/contributors
|
data/lib/guard/redis.rb
CHANGED
@@ -5,18 +5,21 @@ module Guard
|
|
5
5
|
class Redis < Guard
|
6
6
|
def start
|
7
7
|
puts "Starting Redis on port #{port}"
|
8
|
+
@pid = nil
|
8
9
|
IO.popen("#{executable} -", 'w+') do |server|
|
10
|
+
@pid = server.pid
|
9
11
|
server.write(config)
|
10
12
|
server.close_write
|
11
13
|
end
|
12
14
|
puts "Redis is running with PID #{pid}"
|
13
|
-
|
15
|
+
last_operation_succeeded?
|
14
16
|
end
|
15
17
|
|
16
18
|
def stop
|
17
19
|
if pid
|
18
20
|
puts "Sending TERM signal to Redis (#{pid})"
|
19
21
|
Process.kill("TERM", pid)
|
22
|
+
@pid = nil
|
20
23
|
true
|
21
24
|
end
|
22
25
|
end
|
@@ -36,7 +39,7 @@ module Guard
|
|
36
39
|
|
37
40
|
def pidfile_path
|
38
41
|
options.fetch(:pidfile) {
|
39
|
-
File.expand_path('tmp/redis.pid', File.dirname(__FILE__))
|
42
|
+
File.expand_path('/tmp/redis.pid', File.dirname(__FILE__))
|
40
43
|
}
|
41
44
|
end
|
42
45
|
|
@@ -49,7 +52,7 @@ END
|
|
49
52
|
end
|
50
53
|
|
51
54
|
def pid
|
52
|
-
File.exist?(pidfile_path) && File.read(pidfile_path).to_i
|
55
|
+
(File.exist?(pidfile_path) && File.read(pidfile_path).to_i) || @pid
|
53
56
|
end
|
54
57
|
|
55
58
|
def executable
|
@@ -59,5 +62,9 @@ END
|
|
59
62
|
def port
|
60
63
|
options.fetch(:port) { 6379 }
|
61
64
|
end
|
65
|
+
|
66
|
+
def last_operation_succeeded?
|
67
|
+
$?.success?
|
68
|
+
end
|
62
69
|
end
|
63
70
|
end
|
data/lib/guard/redis/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: guard-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Zachery Moneypenny
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2012-11-24 00:00:00 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirement: &id002 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ">"
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 2.2.2
|
36
36
|
type: :runtime
|