redis-server 0.0.3 → 0.0.4

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.
Files changed (2) hide show
  1. data/bin/redis +34 -11
  2. metadata +5 -5
data/bin/redis CHANGED
@@ -15,13 +15,7 @@ class RedisController
15
15
  @pid_path = options.fetch(:pid_path) { File.join(@db_dir, 'redis.pid') }
16
16
  @port = options.fetch(:port, 6379)
17
17
 
18
- @daemon = DaemonController.new(
19
- :identifier => 'Redis server',
20
- :start_command => "#{MYSELF} generate-config --daemonize | #{File.join(REDIS_EXEC_ROOT, 'redis-server')} -",
21
- :ping_command => lambda { TCPSocket.new('localhost', @port) },
22
- :pid_file => @pid_path,
23
- :log_file => @log_path
24
- )
18
+
25
19
  end
26
20
 
27
21
  def generate_config(options = {})
@@ -56,21 +50,39 @@ class RedisController
56
50
  end
57
51
 
58
52
  def start
59
- @daemon.start
53
+ daemon.start
60
54
  end
61
55
 
62
56
  def stop
63
- @daemon.stop
57
+ daemon.stop
64
58
  end
65
59
 
66
60
  def run
67
- exec "#{MYSELF} generate-config | #{File.join(REDIS_EXEC_ROOT, 'redis-server')} -"
61
+ exec "#{MYSELF} generate-config | #{bin('redis-server')} -"
68
62
  end
69
63
 
70
64
  def cli
71
- exec File.join(REDIS_EXEC_ROOT, 'redis-cli')
65
+ exec bin('redis-cli')
66
+ end
67
+
68
+ def bin(binary)
69
+ path = File.join(REDIS_EXEC_ROOT, binary)
70
+ raise Errno::ENOENT.new(path) unless File.file?(path)
71
+ path
72
72
  end
73
73
 
74
+ private
75
+
76
+ def daemon
77
+ @daemon ||= DaemonController.new(
78
+ :identifier => 'Redis server',
79
+ :start_command => "#{MYSELF} generate-config --daemonize | #{bin('redis-server')} -",
80
+ :ping_command => lambda { TCPSocket.new('localhost', @port) },
81
+ :pid_file => @pid_path,
82
+ :log_file => @log_path
83
+ )
84
+ end
85
+
74
86
  end
75
87
 
76
88
  $redis_controller = RedisController.new
@@ -108,6 +120,17 @@ class RedisCommand < Clamp::Command
108
120
  $redis_controller.cli
109
121
  end
110
122
  end
123
+
124
+ subcommand 'bin', "Output the path to a redis binary" do
125
+ parameter "[BINARY]", "binary to find", :default => 'redis-server'
126
+
127
+ def execute
128
+ puts $redis_controller.bin(binary)
129
+ rescue Errno::ENOENT
130
+ STDERR.puts $!
131
+ exit 1
132
+ end
133
+ end
111
134
 
112
135
  end
113
136
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp
16
- requirement: &14797940 !ruby/object:Gem::Requirement
16
+ requirement: &14842720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.2.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *14797940
24
+ version_requirements: *14842720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: daemon_controller
27
- requirement: &14797460 !ruby/object:Gem::Requirement
27
+ requirement: &14841960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 0.2.6
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *14797460
35
+ version_requirements: *14841960
36
36
  description: ! ' Gem to install the redis server; makes things
37
37
  easy.
38
38