diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6be6ec7..bde848f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,6 +36,8 @@ jobs: include: - ruby: head experimental: true + - ruby: truffleruby + experimental: true steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index c88ee28..a4966c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added +- Support for `truffleruby`; ## [0.30.0] - 2024-12-14 ### Changed diff --git a/Gemfile.lock b/Gemfile.lock index 218629a..7645085 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - qonfig (0.29.1) + qonfig (0.30.0) base64 (>= 0.2) GEM diff --git a/gemfiles/with_external_deps.gemfile.lock b/gemfiles/with_external_deps.gemfile.lock index 3c82fae..20e7dab 100644 --- a/gemfiles/with_external_deps.gemfile.lock +++ b/gemfiles/with_external_deps.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - qonfig (0.29.1) + qonfig (0.30.0) base64 (>= 0.2) GEM diff --git a/gemfiles/without_external_deps.gemfile.lock b/gemfiles/without_external_deps.gemfile.lock index 260503f..8c23a05 100644 --- a/gemfiles/without_external_deps.gemfile.lock +++ b/gemfiles/without_external_deps.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - qonfig (0.29.1) + qonfig (0.30.0) base64 (>= 0.2) GEM diff --git a/spec/features/run_code_with_temporary_settings_spec.rb b/spec/features/run_code_with_temporary_settings_spec.rb index 21c1d2c..f4d4f2a 100644 --- a/spec/features/run_code_with_temporary_settings_spec.rb +++ b/spec/features/run_code_with_temporary_settings_spec.rb @@ -22,83 +22,85 @@ expect(config.settings.api.login).to eq('D@iVeR') end - specify 'thread-safety' do - config = Qonfig::DataSet.build do - setting :api do - setting :token, 'test123' - setting :login, 'D@iVeR' - end + unless RUBY_ENGINE.include?('truffleruby') + specify 'thread-safety' do + config = Qonfig::DataSet.build do + setting :api do + setting :token, 'test123' + setting :login, 'D@iVeR' + end - setting :credentials do - setting :user, 'admin' - setting :password, '1234asdf' + setting :credentials do + setting :user, 'admin' + setting :password, '1234asdf' + end end - end - ThreadGroup.new.tap do |thread_group| - 10.times do - thread_group.add(Thread.new do - # NOTE: change settings temporary - config.with(api: { token: '777555' }, credentials: { password: 'test123' }) do - config.settings.credentials.user = 'nimda' - end - end) + ThreadGroup.new.tap do |thread_group| + 10.times do + thread_group.add(Thread.new do + # NOTE: change settings temporary + config.with(api: { token: '777555' }, credentials: { password: 'test123' }) do + config.settings.credentials.user = 'nimda' + end + end) - thread_group.add(Thread.new do - # NOTE: settings are not changed :) - expect(config.settings.credentials.user).to eq('admin') - expect(config.settings.credentials.password).to eq('1234asdf') - expect(config.settings.api.token).to eq('test123') - expect(config.settings.api.login).to eq('D@iVeR') - end) + thread_group.add(Thread.new do + # NOTE: settings are not changed :) + expect(config.settings.credentials.user).to eq('admin') + expect(config.settings.credentials.password).to eq('1234asdf') + expect(config.settings.api.token).to eq('test123') + expect(config.settings.api.login).to eq('D@iVeR') + end) - thread_group.add(Thread.new do - # NOTE: change settings temporary - config.with do - config.settings.api.login = 'provider' - config.settings.api.token = 'super_puper_123' - end - end) + thread_group.add(Thread.new do + # NOTE: change settings temporary + config.with do + config.settings.api.login = 'provider' + config.settings.api.token = 'super_puper_123' + end + end) - thread_group.add(Thread.new do - # NOTE: settings are not changed :) - expect(config.settings.credentials.user).to eq('admin') - expect(config.settings.credentials.password).to eq('1234asdf') - expect(config.settings.api.token).to eq('test123') - expect(config.settings.api.login).to eq('D@iVeR') - end) + thread_group.add(Thread.new do + # NOTE: settings are not changed :) + expect(config.settings.credentials.user).to eq('admin') + expect(config.settings.credentials.password).to eq('1234asdf') + expect(config.settings.api.token).to eq('test123') + expect(config.settings.api.login).to eq('D@iVeR') + end) - thread_group.add(Thread.new do - config.with(api: { login: '0exp' }, credentials: { user: 'D@iVeR' }) do - config.settings.api.token = 'kekpek123' - config.settings.credentials.password = 'admin' - end - end) + thread_group.add(Thread.new do + config.with(api: { login: '0exp' }, credentials: { user: 'D@iVeR' }) do + config.settings.api.token = 'kekpek123' + config.settings.credentials.password = 'admin' + end + end) - thread_group.add(Thread.new do - # NOTE: settings are not changed :) - expect(config.settings.credentials.user).to eq('admin') - expect(config.settings.credentials.password).to eq('1234asdf') - expect(config.settings.api.token).to eq('test123') - expect(config.settings.api.login).to eq('D@iVeR') - end) + thread_group.add(Thread.new do + # NOTE: settings are not changed :) + expect(config.settings.credentials.user).to eq('admin') + expect(config.settings.credentials.password).to eq('1234asdf') + expect(config.settings.api.token).to eq('test123') + expect(config.settings.api.login).to eq('D@iVeR') + end) - thread_group.add(Thread.new do - # NOTE: change settings temporary - config.with(api: { login: 'mobile_legends' }, credentials: { user: 'dota2' }) do - config.settings.api.token = 'league_of_legends' - config.settings.credentials.password = 'overwatch' - end - end) + thread_group.add(Thread.new do + # NOTE: change settings temporary + config.with(api: { login: 'mobile_legends' }, credentials: { user: 'dota2' }) do + config.settings.api.token = 'league_of_legends' + config.settings.credentials.password = 'overwatch' + end + end) - thread_group.add(Thread.new do - # NOTE: settings are not changed :) - expect(config.settings.credentials.user).to eq('admin') - expect(config.settings.credentials.password).to eq('1234asdf') - expect(config.settings.api.token).to eq('test123') - expect(config.settings.api.login).to eq('D@iVeR') - end) - end - end.list.map(&:join) + thread_group.add(Thread.new do + # NOTE: settings are not changed :) + expect(config.settings.credentials.user).to eq('admin') + expect(config.settings.credentials.password).to eq('1234asdf') + expect(config.settings.api.token).to eq('test123') + expect(config.settings.api.login).to eq('D@iVeR') + end) + end + end.list.map(&:join) + end end end diff --git a/spec/features/save_to_file/save_to_json_spec.rb b/spec/features/save_to_file/save_to_json_spec.rb index 76dafe3..2abd607 100644 --- a/spec/features/save_to_file/save_to_json_spec.rb +++ b/spec/features/save_to_file/save_to_json_spec.rb @@ -108,22 +108,44 @@ # NOTE: step 2) read saved file file_data = File.read(config_file_path) - expect(file_data).to eq(<<~JSON.strip) - { - "true_bollean": true, - "false_boolean": false, - "empty_object": {}, - "filled_object": { - "a": 1, - "b": null, - "c": true, - "d": "1", - "e": false - }, - "null_data": null, - "collection": [ "1", 2, true, false, null, [], {}] - } - JSON + expected_json = + if RUBY_ENGINE.include?('truffleruby') + <<~JSON.strip + { + "true_bollean": true, + "false_boolean": false, + "empty_object": {}, + "filled_object": { + "a": 1, + "b": null, + "c": true, + "d": "1", + "e": false + }, + "null_data": null, + "collection": ["1",2,true,false,null,[],{}] + } + JSON + else + <<~JSON.strip + { + "true_bollean": true, + "false_boolean": false, + "empty_object": {}, + "filled_object": { + "a": 1, + "b": null, + "c": true, + "d": "1", + "e": false + }, + "null_data": null, + "collection": [ "1", 2, true, false, null, [], {}] + } + JSON + end + + expect(file_data).to eq(expected_json) end end