yggdrasil-engine 0.0.7-arm64-darwin → 0.0.8.beta.2-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6650b4cace4208d856c8d47a9727e92e74a1e20aacd2511723aab5a1a108027f
4
- data.tar.gz: 65c9ecec12da3fee825f3bc2751a07b17a6deef77bf31241c3a4cfd60ce19253
3
+ metadata.gz: b2b32f0cdf760ca26d130a54c7d2092bc97d79ef18f5a3f0daa8cb86feaf5034
4
+ data.tar.gz: 8e740cbed242fd1e4efaae01c6e2e70618761a629129b898fc3d1ab0a2185226
5
5
  SHA512:
6
- metadata.gz: 6ac4138ba6919407c494f7fb5a3ef0fa52d9acc1b00f6d4df4a05ca023452c351ec79a7906a439bedf8a9c762c53ba84a84ebf2daef8a199aab46d9a329d9093
7
- data.tar.gz: 967c20f1bf4416b23f6f4de7f0f53c14bc06cf3128344abf0fc0939576966bd4578d6d28bc391e10ae721e14247ad8654c71e6d08c469d182a8f83d43ae01f06
6
+ metadata.gz: 53a4c1b2fcb5fa74634c378fba04d23438a1a7ab06fce8f38880a294750c43a5f5ee4782776b2bcb01ed7251c6a67110f61c4469b9f7477a02fd0df1e3830d17
7
+ data.tar.gz: 30191aab0fdab27d605d92b7bdac28d35eea3a54f688c29e799cc83906f2da1ec35b4a4de6ccea0038a08dc094f559f254eecbe596aea84e18db0559903b7e4e
Binary file
@@ -10,29 +10,34 @@ def platform_specific_lib
10
10
  os = RbConfig::CONFIG['host_os']
11
11
  cpu = RbConfig::CONFIG['host_cpu']
12
12
 
13
- extension = case os
14
- when /darwin|mac os/
15
- 'dylib'
16
- when /linux/
17
- 'so'
18
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
19
- 'dll'
20
- else
21
- raise "unsupported platform #{os}"
22
- end
13
+ extension, prefix = case os
14
+ when /darwin|mac os/
15
+ ['dylib', 'lib']
16
+ when /linux/
17
+ ['so', 'lib']
18
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
19
+ ['dll', '']
20
+ else
21
+ raise "unsupported platform #{os}"
22
+ end
23
23
 
24
24
  arch_suffix = case cpu
25
- when /x86_64/
26
- 'x86_64'
27
- when /arm/
28
- 'arm64'
29
- when /aarch64/
30
- 'aarch64'
31
- else
32
- raise "unsupported architecture #{cpu}"
33
- end
34
-
35
- "libyggdrasilffi_#{arch_suffix}.#{extension}"
25
+ when /x86_64/
26
+ 'x86_64'
27
+ when /arm|aarch64/
28
+ 'arm64'
29
+ else
30
+ raise "unsupported architecture #{cpu}"
31
+ end
32
+
33
+ lib_type_suffix = if os =~ /linux/
34
+ musl = system("ldd /bin/sh | grep -q musl") # Check if musl is in use
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,11 +1,11 @@
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.beta.2
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Unleash
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2023-06-28 00:00:00.000000000 Z
@@ -39,8 +39,9 @@ files:
39
39
  homepage: http://github.com/username/my_gem
40
40
  licenses:
41
41
  - MIT
42
- metadata: {}
43
- post_install_message:
42
+ metadata:
43
+ yggdrasil_core_version: 0.14.0
44
+ post_install_message:
44
45
  rdoc_options: []
45
46
  require_paths:
46
47
  - lib
@@ -51,12 +52,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
51
52
  version: '0'
52
53
  required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  requirements:
54
- - - ">="
55
+ - - ">"
55
56
  - !ruby/object:Gem::Version
56
- version: '0'
57
+ version: 1.3.1
57
58
  requirements: []
58
- rubygems_version: 3.5.22
59
- signing_key:
59
+ rubygems_version: 3.3.5
60
+ signing_key:
60
61
  specification_version: 4
61
62
  summary: Unleash engine for evaluating feature toggles
62
63
  test_files: []