yggdrasil-engine 0.0.7-x86_64-linux → 0.0.8-x86_64-linux

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76e7926f9d62ef113233096df9c92a40c333e790d9544cd018bfd720ab7a8e85
4
- data.tar.gz: 8dab6516821cc8c5a7d77e72540547a51f2d4fae20d8f04c6be1873d56f329f5
3
+ metadata.gz: 9218b5d755d51bbb1c43dfe7b6868c242dcc3d4877081f6c1386c404fc72e65c
4
+ data.tar.gz: 8869db2d374ac993a2bbbd0a46861f75ee71b31adb1669ca22d81fc1669183be
5
5
  SHA512:
6
- metadata.gz: cd75cfdd91ba030beeb20daf11024c2643f20563de3ad1aecac56d575ef117277db39e512ed7ae31bc4eae812bf7f07d3143ed8950a5f4966362d77e05ee1c28
7
- data.tar.gz: 27f5aa23c284fa8295a2f3ce46a92ac58c50727fe5df367701da57b5ba3ecbf0b25668ae193ee3552b6d9971dfeb28f68b7b46ad0a9ef41d22175d8b4593b464
6
+ metadata.gz: 8e2859072136067adba1ea5b8df2cfb6d6a65214facb0bea1efaff2519e1d1d88cebe23a264ac7b4a0c9fe094472e7091a391933403337aa5b15af157e36a332
7
+ data.tar.gz: ab80e182d68d8611f5454b782c03e6b82718f6f2af220ba9926ba6c478cf092a369083813c7d371ab93df50810ba1a6f4069441c73dc2b26bf392a1f005f4618
Binary file
@@ -10,13 +10,13 @@ def platform_specific_lib
10
10
  os = RbConfig::CONFIG['host_os']
11
11
  cpu = RbConfig::CONFIG['host_cpu']
12
12
 
13
- extension = case os
13
+ extension, prefix = case os
14
14
  when /darwin|mac os/
15
- 'dylib'
15
+ ['dylib', 'lib']
16
16
  when /linux/
17
- 'so'
17
+ ['so', 'lib']
18
18
  when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
19
- 'dll'
19
+ ['dll', '']
20
20
  else
21
21
  raise "unsupported platform #{os}"
22
22
  end
@@ -24,15 +24,20 @@ def platform_specific_lib
24
24
  arch_suffix = case cpu
25
25
  when /x86_64/
26
26
  'x86_64'
27
- when /arm/
27
+ when /arm|aarch64/
28
28
  'arm64'
29
- when /aarch64/
30
- 'aarch64'
31
29
  else
32
30
  raise "unsupported architecture #{cpu}"
33
31
  end
34
32
 
35
- "libyggdrasilffi_#{arch_suffix}.#{extension}"
33
+ lib_type_suffix = if os =~ /linux/
34
+ musl = system("ldd /bin/sh | grep -q musl")
35
+ musl ? "-musl" : ""
36
+ else
37
+ ""
38
+ end
39
+
40
+ "#{prefix}yggdrasilffi_#{arch_suffix}#{lib_type_suffix}.#{extension}"
36
41
  end
37
42
 
38
43
  def to_variant(raw_variant)
@@ -61,6 +66,8 @@ class YggdrasilEngine
61
66
  attach_function :count_toggle, %i[pointer string bool], :void
62
67
  attach_function :count_variant, %i[pointer string string], :void
63
68
 
69
+ attach_function :list_known_toggles, [:pointer], :pointer
70
+
64
71
  def initialize
65
72
  @engine = YggdrasilEngine.new_engine
66
73
  @custom_strategy_handler = CustomStrategyHandler.new
@@ -125,6 +132,13 @@ class YggdrasilEngine
125
132
  metrics[:value]
126
133
  end
127
134
 
135
+ def list_known_toggles
136
+ response_ptr = YggdrasilEngine.list_known_toggles(@engine)
137
+ response_json = response_ptr.read_string
138
+ YggdrasilEngine.free_response(response_ptr)
139
+ JSON.parse(response_json, symbolize_names: true)
140
+ end
141
+
128
142
  def register_custom_strategies(strategies)
129
143
  @custom_strategy_handler.register_custom_strategies(strategies)
130
144
  end
@@ -93,6 +93,16 @@ RSpec.describe YggdrasilEngine do
93
93
 
94
94
  expect(metric[:variants][:disabled]).to eq(1)
95
95
  end
96
+
97
+ it 'should list all the features that were loaded' do
98
+ suite_path = File.join('../client-specification/specifications', '01-simple-examples.json')
99
+ suite_data = JSON.parse(File.read(suite_path))
100
+
101
+ yggdrasil_engine.take_state(suite_data['state'].to_json)
102
+
103
+ toggles = yggdrasil_engine.list_known_toggles()
104
+ expect(toggles.length).to eq(3)
105
+ end
96
106
  end
97
107
  end
98
108
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yggdrasil-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Unleash
@@ -39,7 +39,8 @@ files:
39
39
  homepage: http://github.com/username/my_gem
40
40
  licenses:
41
41
  - MIT
42
- metadata: {}
42
+ metadata:
43
+ yggdrasil_core_version: 0.14.0
43
44
  post_install_message:
44
45
  rdoc_options: []
45
46
  require_paths: