simple-redis-server 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a9ba1fa1720ceb0f04f267b564e8ee9c1ecf2d0d
4
+ data.tar.gz: c48f2681a0dc800685b831e610b14c9660bef7fa
5
+ SHA512:
6
+ metadata.gz: 1f69cb4de96ba22283c3fa0aeb8262c3b215d99927fed09e99de5fd784f06897b6fe95ebf712f0c74579d3fcd4baf5b622c6e66f1a432ab6103c6e89bce2d226
7
+ data.tar.gz: acb87c92dad03538dc02e2ebf6dd1a0ae6cced304bad80667e9b0d26ea28ad9514197a62562c0fbc1fb166ebe617bf7e83af6235c8fcb2ac7d79538ff804cd6e
@@ -15,10 +15,10 @@ class Redis::Server
15
15
  @config[:'daemonize'] ||= "no"
16
16
  @config[:'bind'] ||= "127.0.0.1"
17
17
  @config[:'port'] ||= "#{find_available_port}"
18
- @config[:'logfile'] ||= Tempfile.new('redis-slave-logfile').path
18
+ @config[:'logfile'] ||= Tempfile.new('redis-server-logfile').path
19
19
  @config[:'save'] ||= "900 1"
20
20
  @config[:'rdbcompression'] ||= "yes"
21
- @config[:'dbfilename'] ||= "dump.rdb"
21
+ @config[:'dbfilename'] ||= "redis_server.rdb"
22
22
  @config[:'dir'] ||= Dir.tmpdir
23
23
  @config[:'appendonly'] ||= "no"
24
24
  @config[:'appendfsync'] ||= "no"
@@ -28,24 +28,38 @@ class Redis::Server
28
28
 
29
29
  def start
30
30
  return if started?
31
- @process = ChildProcess.new('redis-server -')
31
+ @process = ChildProcess.new('redis-server','-')
32
32
  process.duplex = true
33
33
  process.start
34
- at_exit{ process.send(:send_kill) }
34
+ at_exit{
35
+ save
36
+ stop
37
+ }
35
38
  process.io.stdin.puts config.to_s
36
39
  process.io.stdin.close
37
40
  @started = process.alive?
38
41
  end
39
42
 
43
+ def start!
44
+ start
45
+ started? or raise "failed to start redis server"
46
+ end
47
+
48
+ def save
49
+ connection.save if connection
50
+ end
51
+
40
52
  def stop
41
- return unless started?
42
- process.stop
53
+ process.stop if started?
43
54
  end
44
55
 
45
- def connect options={}
46
- options[:host] ||= config[:bind]
47
- options[:port] ||= config[:port]
56
+ def connection
57
+ @connection ||= connect if started?
58
+ end
48
59
 
60
+ def connect options={}
61
+ options[:host] ||= config[:bind]
62
+ options[:port] ||= config[:port]
49
63
  Redis.new(options)
50
64
  end
51
65
 
@@ -1,5 +1,5 @@
1
1
  class Redis
2
2
  class Server
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -17,4 +17,6 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_runtime_dependency "redis"
19
19
  gem.add_runtime_dependency "childprocess"
20
+
21
+ gem.add_development_dependency "rake"
20
22
  end
metadata CHANGED
@@ -1,38 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-redis-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jared Grippe
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-06 00:00:00.000000000 Z
11
+ date: 2013-10-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: redis
16
- requirement: &2165825840 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *2165825840
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: childprocess
27
- requirement: &2165343420 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *2165343420
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
36
55
  description: starts a redis server
37
56
  email:
38
57
  - jared@deadlyicon.com
@@ -52,27 +71,25 @@ files:
52
71
  - simple-redis-server.gemspec
53
72
  homepage: ''
54
73
  licenses: []
74
+ metadata: {}
55
75
  post_install_message:
56
76
  rdoc_options: []
57
77
  require_paths:
58
78
  - lib
59
79
  required_ruby_version: !ruby/object:Gem::Requirement
60
- none: false
61
80
  requirements:
62
- - - ! '>='
81
+ - - '>='
63
82
  - !ruby/object:Gem::Version
64
83
  version: '0'
65
84
  required_rubygems_version: !ruby/object:Gem::Requirement
66
- none: false
67
85
  requirements:
68
- - - ! '>='
86
+ - - '>='
69
87
  - !ruby/object:Gem::Version
70
88
  version: '0'
71
89
  requirements: []
72
90
  rubyforge_project:
73
- rubygems_version: 1.8.10
91
+ rubygems_version: 2.0.3
74
92
  signing_key:
75
- specification_version: 3
93
+ specification_version: 4
76
94
  summary: starts a redis server
77
95
  test_files: []
78
- has_rdoc: