ffi-hiredis_vip-core 0.1.0.pre3 → 0.1.0.pre4
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.
- checksums.yaml +4 -4
- data/lib/ffi/hiredis_vip/core.rb +55 -5
- data/lib/ffi/hiredis_vip/core/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: 663a312faeb9876f597a3d3ec243a78a6f8a1a1a
|
4
|
+
data.tar.gz: 03c4726d35b3a48335f2f52c7da6e5da5de43c00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29af71e9d5f9fee7fd73f7df585d17df858390b126eca07b923b76f6e96c89f2e93427c20da8268c6eaa4b973efb6bde5caea4941daa10994089b60d85efee34
|
7
|
+
data.tar.gz: 19adb10cc75ecee01a98df7d5b1874bb47d29a64e15931dc2f9bcc56cc8cad4784d319261c293093d71ef6e2c07925fa6e08240452e2756aada88c62eca02441
|
data/lib/ffi/hiredis_vip/core.rb
CHANGED
@@ -8,10 +8,61 @@ module FFI
|
|
8
8
|
module Core
|
9
9
|
extend ::FFI::Library
|
10
10
|
ffi_lib_flags :now, :global
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
|
12
|
+
##
|
13
|
+
# ffi-rzmq-core for reference
|
14
|
+
#
|
15
|
+
# https://github.com/chuckremes/ffi-rzmq-core/blob/master/lib/ffi-rzmq-core/libzmq.rb
|
16
|
+
#
|
17
|
+
begin
|
18
|
+
# bias the library discovery to a path inside the gem first, then
|
19
|
+
# to the usual system paths
|
20
|
+
inside_gem = File.join(File.dirname(__FILE__), '..', '..', 'ext')
|
21
|
+
local_path = FFI::Platform::IS_WINDOWS ? ENV['PATH'].split(';') : ENV['PATH'].split(':')
|
22
|
+
env_path = [ ENV['HIREDIS_VIP_LIB_PATH'] ].compact
|
23
|
+
rbconfig_path = RbConfig::CONFIG["libdir"]
|
24
|
+
homebrew_path = nil
|
25
|
+
|
26
|
+
# RUBYOPT set by RVM breaks 'brew' so we need to unset it.
|
27
|
+
rubyopt = ENV.delete('RUBYOPT')
|
28
|
+
|
29
|
+
begin
|
30
|
+
stdout, stderr, status = Open3.capture3("brew", "--prefix")
|
31
|
+
homebrew_path = if status.success?
|
32
|
+
"#{stdout.chomp}/lib"
|
33
|
+
else
|
34
|
+
'/usr/local/homebrew/lib'
|
35
|
+
end
|
36
|
+
rescue
|
37
|
+
# Homebrew doesn't exist
|
38
|
+
end
|
39
|
+
|
40
|
+
# Restore RUBYOPT after executing 'brew' above.
|
41
|
+
ENV['RUBYOPT'] = rubyopt
|
42
|
+
|
43
|
+
# Search for libhiredis_vip in the following order...
|
44
|
+
HIREDIS_VIP_LIB_PATHS = ([inside_gem] + env_path + local_path + [rbconfig_path] + [
|
45
|
+
'/usr/local/lib', '/opt/local/lib', homebrew_path, '/usr/lib64'
|
46
|
+
]).compact.map{|path| "#{path}/libhiredis_vip.#{FFI::Platform::LIBSUFFIX}"}
|
47
|
+
ffi_lib(HIREDIS_VIP_LIB_PATHS + %w{libhiredis_vip})
|
48
|
+
|
49
|
+
rescue LoadError
|
50
|
+
if HIREDIS_VIP_LIB_PATHS.any? {|path|
|
51
|
+
File.file? File.join(path, "libhiredis_vip.#{FFI::Platform::LIBSUFFIX}")}
|
52
|
+
warn "Unable to load this gem. The libhiredis_vip library exists, but cannot be loaded."
|
53
|
+
warn "If this is Windows:"
|
54
|
+
warn "- Check that you have MSVC runtime installed or statically linked"
|
55
|
+
warn "- Check that your DLL is compiled for #{FFI::Platform::ADDRESS_SIZE} bit"
|
56
|
+
else
|
57
|
+
warn "Unable to load this gem. The libhiredis_vip library (or DLL) could not be found."
|
58
|
+
warn "If this is a Windows platform, make sure libhiredis_vip.dll is on the PATH."
|
59
|
+
warn "If the DLL was built with mingw, make sure the other two dependent DLLs,"
|
60
|
+
warn "libgcc_s_sjlj-1.dll and libstdc++6.dll, are also on the PATH."
|
61
|
+
warn "For non-Windows platforms, make sure libhiredis_vip is located in this search path:"
|
62
|
+
warn HIREDIS_VIP_LIB_PATHS.inspect
|
63
|
+
end
|
64
|
+
raise LoadError, "The libhiredis_vip library (or DLL) could not be loaded"
|
65
|
+
end
|
15
66
|
|
16
67
|
RedisClusterFlags = enum :HIRCLUSTER_FLAG_NULL, 0x0,
|
17
68
|
:HIRCLUSTER_FLAG_ADD_SLAVE, 0x1000, #/* The flag to decide whether add slave node in redisClusterContext->nodes. This is set in the
|
@@ -50,7 +101,6 @@ module FFI
|
|
50
101
|
end
|
51
102
|
|
52
103
|
attach_function :freeReplyObject, [:pointer], :void, :blocking => true
|
53
|
-
|
54
104
|
attach_function :redisReplyElement, [:pointer, :size_t], RedisReply.ptr, :blocking => true
|
55
105
|
attach_function :redisConnect, [:string, :int], :pointer, :blocking => true
|
56
106
|
attach_function :redisReconnect, [:pointer], RedisOkType, :blocking => true # :pointer => redisContext
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-hiredis_vip-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Dewitt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|