rbthemis 0.14.0 → 0.15.0

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbthemis.rb +44 -1
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce9e7a79cbd9d5a20ac03d992e38eee0bce439935932380b12f492c0befebe57
4
- data.tar.gz: 59fc9dbede5cbc75a322cc19c0a3f840abb647666bc9091d41a06bd87157b108
3
+ metadata.gz: 737ccca2cb74d04c18abe43c4aa5ee65def9cef6c0d3bcd89410c76abf12e7fa
4
+ data.tar.gz: ce08155c7d83bbda14acc0a79185b7943b1ee6d39c28a28c99b92082accf216e
5
5
  SHA512:
6
- metadata.gz: a526bb4961c016345413f58cbf9219c58775ce43aaebecb5fcab37cafd4fbffbd4018256e84fdbb31ea5ac0fe129ebe7e68bf5e6a7fbd140203131d7587ec6a9
7
- data.tar.gz: c70fecab51b95f5d2131c54621308fe941a113f9df6ae0f35c2b0e8c5fd71fe7ebf73817baa574910819821a844541aac0b1e259f82b8a9184fc6e7b4c8f6caf
6
+ metadata.gz: a60a03fbd1947834c2cce2399f1c58ef71c1714feed534bd4cfe9f6445036eb1824bed92e60900249f89e785532d1d6233625c64b95309e19b16c27bfddb85d5
7
+ data.tar.gz: ffd1759217dab678e0554aa30566feaec18bbcc6e7b172072f1d77b101d1e95bac0d502db9d6fe971d41bd2770bf27eaddae7fb773c39265fedaf39020c7d4ff
data/lib/rbthemis.rb CHANGED
@@ -32,7 +32,50 @@ end
32
32
 
33
33
  module ThemisImport
34
34
  extend FFI::Library
35
- ffi_lib 'themis'
35
+
36
+ def self.canonical_themis_paths
37
+ host_os = RbConfig::CONFIG['host_os']
38
+ paths = []
39
+ if host_os.start_with? 'linux'
40
+ # Default library installation path for "make install"
41
+ paths.append '/usr/local/lib/libthemis.so.0'
42
+ # Don't bother figuring out the "right" absolute path, since
43
+ # that depends on the distro and non-distro-provided Rubies
44
+ # don't know about the right paths at all. The ones installed
45
+ # via RVM certainly don't. Use soname and let ld figure it out.
46
+ paths.append 'libthemis.so.0'
47
+ end
48
+ if host_os.start_with? 'darwin'
49
+ # Default library installation path for "make install"
50
+ paths.append '/usr/local/lib/libthemis.0.dylib'
51
+ # These are install names of libraries installed via Homebrew
52
+ # Add both M1 and Intel paths so that x86 Ruby works on M1
53
+ paths.append '/opt/homebrew/opt/libthemis/lib/libthemis.0.dylib'
54
+ paths.append '/usr/local/opt/libthemis/lib/libthemis.0.dylib'
55
+ # Last try, look for ABI-qualified name
56
+ paths.append 'libthemis.0.dylib'
57
+ end
58
+ return paths
59
+ end
60
+
61
+ def self.load_themis
62
+ for path in canonical_themis_paths
63
+ begin
64
+ return ffi_lib path
65
+ rescue LoadError
66
+ next
67
+ end
68
+ end
69
+ warn <<~EOF
70
+ WARN: failed to load the canonical Themis Core library
71
+
72
+ Proceeding to find 'themis' library in standard paths.
73
+ This might cause ABI mismatch and crash the process.
74
+ EOF
75
+ return ffi_lib 'themis'
76
+ end
77
+
78
+ load_themis
36
79
 
37
80
  callback :get_pub_key_by_id_type,
38
81
  [:pointer, :int, :pointer, :int, :pointer], :int
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbthemis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CossackLabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-24 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -59,8 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  requirements:
62
- - libthemis, v0.14.0
63
- rubygems_version: 3.1.4
62
+ - libthemis, v0.15.0
63
+ rubygems_version: 3.3.25
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: Data security library for network communication and data storage for Ruby