-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from i7an/cast_booleans
Cast boolean values
- Loading branch information
Showing
20 changed files
with
257 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
--color | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## [3.0.0] - 2024-12-04 | ||
|
||
- Predicate methods now cast the value to a boolean | ||
```ruby | ||
Global.foo.enabled # => "0" | ||
Global.foo.enabled? # => false | ||
``` | ||
- Dropped Ruby 2.7 support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
$LOAD_PATH.push File.expand_path('lib', __dir__) | ||
require 'global/version' | ||
require_relative 'lib/global/version' | ||
|
||
Gem::Specification.new do |s| | ||
s.name = 'global' | ||
s.version = Global::VERSION | ||
s.required_ruby_version = '>= 3.0.0' | ||
s.authors = ['Railsware LLC'] | ||
s.email = '[email protected]' | ||
|
||
s.description = 'Simple way to load your configs from yaml/aws/gcp' | ||
|
||
s.homepage = 'https://github.com/railsware/global' | ||
s.licenses = ['MIT'] | ||
s.summary = 'Simple way to load your configs from yaml/aws/gcp' | ||
|
||
s.metadata['rubygems_mfa_required'] = 'true' | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } | ||
s.require_paths = ['lib'] | ||
|
||
s.homepage = 'https://github.com/railsware/global' | ||
s.licenses = ['MIT'] | ||
|
||
s.add_development_dependency 'aws-sdk-ssm', '~> 1' | ||
s.add_development_dependency 'google-cloud-secret_manager', '~> 0' | ||
s.add_development_dependency 'rake', '~> 12.3.1' | ||
s.add_development_dependency 'rspec', '>= 3.0' | ||
s.add_development_dependency 'rubocop', '~> 0.81.0' | ||
s.add_development_dependency 'simplecov', '~> 0.16.1' | ||
|
||
s.add_runtime_dependency 'activesupport', '>= 2.0' | ||
s.add_dependency 'activesupport', '>= 2.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Global | ||
|
||
VERSION = '2.1.0' | ||
VERSION = '3.0.0' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,37 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require 'google/cloud/secret_manager' | ||
require 'google/cloud/secret_manager/v1' | ||
require 'global/backend/gcp_secret_manager' | ||
|
||
RSpec.describe Global::Backend::GcpSecretManager do | ||
let(:client) { double } | ||
|
||
subject do | ||
subject(:secret_manager) do | ||
described_class.new(prefix: 'prod-myapp-', client: client, project_id: 'example') | ||
end | ||
|
||
before do | ||
@match_item = double | ||
allow(@match_item).to receive(:name).and_return('prod-myapp-example-test_key') | ||
let(:client) { instance_double(Google::Cloud::SecretManager::V1::SecretManagerService::Client) } | ||
|
||
@secret_data = double | ||
allow(@secret_data).to receive_message_chain(:payload, :data).and_return('secret value') | ||
before do | ||
# rubocop:disable RSpec/VerifiedDoubles | ||
match_item = double(name: 'prod-myapp-example-test_key') | ||
not_match_item = double(name: 'different_key') | ||
|
||
@not_match_item = double | ||
allow(@not_match_item).to receive(:name).and_return('different_key') | ||
secret_data = double(data: 'secret value') | ||
secret_version_response = double(payload: secret_data) | ||
|
||
@list = double | ||
allow(@list).to receive(:next_page_token).and_return('') | ||
allow(@list).to receive(:each).and_yield(@match_item).and_yield(@not_match_item) | ||
page = instance_double(Gapic::PagedEnumerable) | ||
allow(page).to receive(:next_page_token).and_return('') | ||
allow(page).to receive(:each).and_yield(match_item).and_yield(not_match_item) | ||
|
||
allow(client).to receive(:project_path).and_return('projects/example') | ||
allow(client).to receive(:secret_version_path) | ||
.with(project: 'example', secret: 'prod-myapp-example-test_key', secret_version: 'latest') | ||
.and_return('some_key_path') | ||
allow(client).to receive(:access_secret_version).with(name: 'some_key_path').and_return(@secret_data) | ||
allow(client).to receive(:list_secrets).and_return(@list) | ||
allow(client).to receive(:access_secret_version).with(name: 'some_key_path').and_return(secret_version_response) | ||
allow(client).to receive_messages(project_path: 'projects/example', list_secrets: page) | ||
# rubocop:enable RSpec/VerifiedDoubles | ||
end | ||
|
||
it 'reads parameters from the secret manager' do | ||
expect(subject.load).to eq({ example: { test_key: 'secret value' }}) | ||
expect(secret_manager.load).to eq({ example: { test_key: 'secret value' }}) | ||
end | ||
end |
Oops, something went wrong.