mysql_isolated_server 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/boot_isolated_server +1 -1
- data/lib/mysql_isolated_server.rb +10 -6
- data/lib/mysql_isolated_server/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 863d2316779205d27fe664054028571cb1f2ed9a
|
4
|
+
data.tar.gz: 76b68adfd94069a2bed8f6c87847db7cf8ab0264
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 095538f3c91dc94b0c1979896fa3b8eb5c37702f38e63a50508746cae4d3a15d92ab699ed0fee48f60e7e92a5f01f514fd46c75d5dfcb945f59b9ccd6d844fbe
|
7
|
+
data.tar.gz: 1f56358d3b3ec4e0afee945ada82f31b40f1d7baddd8b7f8a044c839036890724fc2943ab9782f0a10ad70b9c54f03409dce840e91d91437aeb76cdd28d2ed5e
|
data/bin/boot_isolated_server
CHANGED
@@ -27,18 +27,22 @@ class MysqlIsolatedServer
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.thread_boot(*params)
|
30
|
-
bin = File.dirname(__FILE__) + "/../bin/boot_isolated_server"
|
30
|
+
bin = [File.dirname(__FILE__) + "/../bin/boot_isolated_server"]
|
31
31
|
mysql_dir, mysql_port = nil, nil
|
32
32
|
restore_env = {}
|
33
33
|
|
34
|
+
if `which ruby` =~ (/rvm/)
|
35
|
+
bin = ["rvm", "1.8.7", "do", "ruby"] + bin
|
36
|
+
end
|
37
|
+
|
38
|
+
params = ["--pid", $$.to_s] + params
|
39
|
+
|
34
40
|
Thread.abort_on_exception = true
|
35
41
|
Thread.new do
|
36
42
|
ENV.keys.grep(/GEM|BUNDLE|RUBYOPT/).each do |k|
|
37
43
|
restore_env[k] = ENV.delete(k)
|
38
44
|
end
|
39
|
-
|
40
|
-
|
41
|
-
pipe = IO.popen(["#{bin}"].concat(params), "r") do |pipe|
|
45
|
+
pipe = IO.popen(bin + params, "r") do |pipe|
|
42
46
|
mysql_dir = pipe.readline.split(' ').last
|
43
47
|
mysql_port = pipe.readline.split(' ').last.to_i
|
44
48
|
sleep
|
@@ -136,17 +140,17 @@ class MysqlIsolatedServer
|
|
136
140
|
connection.query("SET GLOBAL server_id=#{@server_id}")
|
137
141
|
end
|
138
142
|
|
143
|
+
include Socket::Constants
|
139
144
|
def grab_free_port
|
140
145
|
while true
|
141
146
|
candidate=9000 + rand(50_000)
|
142
147
|
|
143
148
|
begin
|
144
|
-
socket = Socket.new(
|
149
|
+
socket = Socket.new(AF_INET, SOCK_STREAM, 0)
|
145
150
|
socket.bind(Socket.pack_sockaddr_in(candidate, '127.0.0.1'))
|
146
151
|
socket.close
|
147
152
|
return candidate
|
148
153
|
rescue Exception => e
|
149
|
-
puts e
|
150
154
|
end
|
151
155
|
end
|
152
156
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql_isolated_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Osheroff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A small library that allows you to easily spin up new local mysql servers
|
14
14
|
for testing purposes.
|