prefab-cloud-ruby 1.4.3 → 1.4.5
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 +4 -4
- data/.github/workflows/ruby.yml +3 -0
- data/CHANGELOG.md +8 -0
- data/VERSION +1 -1
- data/lib/prefab/config_value_unwrapper.rb +1 -2
- data/lib/prefab/errors/missing_env_var_error.rb +11 -0
- data/lib/prefab/logger_client.rb +7 -2
- data/lib/prefab/resolved_config_presenter.rb +5 -1
- data/lib/prefab-cloud-ruby.rb +1 -0
- data/prefab-cloud-ruby.gemspec +4 -3
- data/test/integration_test.rb +8 -1
- data/test/integration_test_helpers.rb +12 -10
- data/test/test_config_value_unwrapper.rb +3 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 99c0376c6062b2d2ae5c51c5f5cfd15841255e706946e01558cb0dde9e7a4672
         | 
| 4 | 
            +
              data.tar.gz: 699a13518c92d9c8fcc4f45b8c501b4d96836c49353c762fb50f7f4410546287
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c598fd1f773d2a846b78b06375e10b19053685a7b0a42fc1324a7e129ec27d5ab5494b795ceed32856144e58395f7414ae6540ff704ef1cb137f07f62ab5cfde
         | 
| 7 | 
            +
              data.tar.gz: 4d576e90e3823359b81211b70f70b566c5fe1489314733d0ebd0ed6b9af966299111d79f1eb38a5ce019153ff9241e3d5f86440031b30aace7187c7c63194c56
         | 
    
        data/.github/workflows/ruby.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.4. | 
| 1 | 
            +
            1.4.5
         | 
| @@ -68,8 +68,7 @@ module Prefab | |
| 68 68 | 
             
                    if :ENV_VAR == config_value.provided.source
         | 
| 69 69 | 
             
                      raw = ENV[config_value.provided.lookup]
         | 
| 70 70 | 
             
                      if raw.nil?
         | 
| 71 | 
            -
                         | 
| 72 | 
            -
                        new(Prefab::ConfigValueWrapper.wrap(""), resolver)
         | 
| 71 | 
            +
                        raise Prefab::Errors::MissingEnvVarError.new("Missing environment variable #{config_value.provided.lookup}")
         | 
| 73 72 | 
             
                      else
         | 
| 74 73 | 
             
                        coerced = coerce_into_type(raw, config, config_value.provided.lookup)
         | 
| 75 74 | 
             
                        new(Prefab::ConfigValueWrapper.wrap(coerced, confidential: config_value.confidential), resolver)
         | 
    
        data/lib/prefab/logger_client.rb
    CHANGED
    
    | @@ -75,9 +75,9 @@ module Prefab | |
| 75 75 |  | 
| 76 76 | 
             
                def log(message, path, progname, severity, log_context = {})
         | 
| 77 77 | 
             
                  severity ||= ::Logger::UNKNOWN
         | 
| 78 | 
            -
                  @log_path_aggregator&.push(path, severity)
         | 
| 79 78 |  | 
| 80 | 
            -
                  return true if  | 
| 79 | 
            +
                  return true if !should_log? severity, path
         | 
| 80 | 
            +
                  return true if @logdev.nil? || @silences[local_log_id]
         | 
| 81 81 |  | 
| 82 82 | 
             
                  progname = @progname if progname.nil?
         | 
| 83 83 |  | 
| @@ -96,6 +96,11 @@ module Prefab | |
| 96 96 | 
             
                  true
         | 
| 97 97 | 
             
                end
         | 
| 98 98 |  | 
| 99 | 
            +
                def should_log?(severity, path)
         | 
| 100 | 
            +
                  @log_path_aggregator&.push(path, severity)
         | 
| 101 | 
            +
                  severity >= level_of(path)
         | 
| 102 | 
            +
                end
         | 
| 103 | 
            +
             | 
| 99 104 | 
             
                def debug(progname = nil, **log_context, &block)
         | 
| 100 105 | 
             
                  add_internal(DEBUG, nil, progname, caller_locations(1, 1)[0], log_context, &block)
         | 
| 101 106 | 
             
                end
         | 
| @@ -65,7 +65,11 @@ module Prefab | |
| 65 65 | 
             
                        if v.nil?
         | 
| 66 66 | 
             
                          elements << 'tombstone'
         | 
| 67 67 | 
             
                        else
         | 
| 68 | 
            -
                          value =  | 
| 68 | 
            +
                          value = begin
         | 
| 69 | 
            +
                            @resolver.evaluate(v[:config])&.reportable_value
         | 
| 70 | 
            +
                          rescue StandardError => e
         | 
| 71 | 
            +
                            "ERROR EVALUATING: #{e.class} #{e.message}"
         | 
| 72 | 
            +
                          end
         | 
| 69 73 | 
             
                          elements << value.to_s.slice(0..34).ljust(35)
         | 
| 70 74 | 
             
                          elements << value.class.to_s.slice(0..6).ljust(7)
         | 
| 71 75 | 
             
                          elements << "Match: #{v[:match]}".slice(0..29).ljust(30)
         | 
    
        data/lib/prefab-cloud-ruby.rb
    CHANGED
    
    | @@ -20,6 +20,7 @@ require 'prefab/errors/initialization_timeout_error' | |
| 20 20 | 
             
            require 'prefab/errors/invalid_api_key_error'
         | 
| 21 21 | 
             
            require 'prefab/errors/missing_default_error'
         | 
| 22 22 | 
             
            require 'prefab/errors/env_var_parse_error'
         | 
| 23 | 
            +
            require 'prefab/errors/missing_env_var_error'
         | 
| 23 24 | 
             
            require 'prefab/errors/uninitialized_error'
         | 
| 24 25 | 
             
            require 'prefab/options'
         | 
| 25 26 | 
             
            require 'prefab/static_logger'
         | 
    
        data/prefab-cloud-ruby.gemspec
    CHANGED
    
    | @@ -2,16 +2,16 @@ | |
| 2 2 | 
             
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 3 | 
             
            # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            -
            # stub: prefab-cloud-ruby 1.4. | 
| 5 | 
            +
            # stub: prefab-cloud-ruby 1.4.5 ruby lib
         | 
| 6 6 |  | 
| 7 7 | 
             
            Gem::Specification.new do |s|
         | 
| 8 8 | 
             
              s.name = "prefab-cloud-ruby".freeze
         | 
| 9 | 
            -
              s.version = "1.4. | 
| 9 | 
            +
              s.version = "1.4.5"
         | 
| 10 10 |  | 
| 11 11 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
         | 
| 12 12 | 
             
              s.require_paths = ["lib".freeze]
         | 
| 13 13 | 
             
              s.authors = ["Jeff Dwyer".freeze]
         | 
| 14 | 
            -
              s.date = "2024-01- | 
| 14 | 
            +
              s.date = "2024-01-31"
         | 
| 15 15 | 
             
              s.description = "Feature Flags, Live Config, and Dynamic Log Levels as a service".freeze
         | 
| 16 16 | 
             
              s.email = "jdwyer@prefab.cloud".freeze
         | 
| 17 17 | 
             
              s.executables = ["console".freeze]
         | 
| @@ -54,6 +54,7 @@ Gem::Specification.new do |s| | |
| 54 54 | 
             
                "lib/prefab/errors/initialization_timeout_error.rb",
         | 
| 55 55 | 
             
                "lib/prefab/errors/invalid_api_key_error.rb",
         | 
| 56 56 | 
             
                "lib/prefab/errors/missing_default_error.rb",
         | 
| 57 | 
            +
                "lib/prefab/errors/missing_env_var_error.rb",
         | 
| 57 58 | 
             
                "lib/prefab/errors/uninitialized_error.rb",
         | 
| 58 59 | 
             
                "lib/prefab/evaluation.rb",
         | 
| 59 60 | 
             
                "lib/prefab/evaluation_summary_aggregator.rb",
         | 
    
        data/test/integration_test.rb
    CHANGED
    
    | @@ -9,7 +9,7 @@ class IntegrationTest | |
| 9 9 | 
             
                @input = parse_input(test_data['input'])
         | 
| 10 10 | 
             
                @expected = parse_expected(test_data['expected'])
         | 
| 11 11 | 
             
                @data = test_data['data']
         | 
| 12 | 
            -
                @expected_data = test_data['expected_data']
         | 
| 12 | 
            +
                @expected_data = test_data['expected_data'] || []
         | 
| 13 13 | 
             
                @aggregator = test_data['aggregator']
         | 
| 14 14 | 
             
                @endpoint = test_data['endpoint']
         | 
| 15 15 | 
             
                @test_client = capture_telemetry(base_client)
         | 
| @@ -96,6 +96,13 @@ class IntegrationTest | |
| 96 96 | 
             
                case error_type
         | 
| 97 97 | 
             
                when 'missing_default' then Prefab::Errors::MissingDefaultError
         | 
| 98 98 | 
             
                when 'initialization_timeout' then Prefab::Errors::InitializationTimeoutError
         | 
| 99 | 
            +
                when 'unable_to_decrypt' then OpenSSL::Cipher::CipherError
         | 
| 100 | 
            +
                when 'missing_env_var' then Prefab::Errors::MissingEnvVarError
         | 
| 101 | 
            +
                when 'unable_to_coerce_env_var' then Prefab::Errors::EnvVarParseError
         | 
| 102 | 
            +
                else
         | 
| 103 | 
            +
                  unless error_type.nil?
         | 
| 104 | 
            +
                    throw "Unknown error type: #{error_type}"
         | 
| 105 | 
            +
                  end
         | 
| 99 106 | 
             
                end
         | 
| 100 107 | 
             
              end
         | 
| 101 108 |  | 
| @@ -34,14 +34,16 @@ module IntegrationTestHelpers | |
| 34 34 | 
             
                end
         | 
| 35 35 | 
             
              end
         | 
| 36 36 |  | 
| 37 | 
            +
              SEVERITY_LOOKUP = Prefab::LogPathAggregator::SEVERITY_KEY.invert
         | 
| 38 | 
            +
             | 
| 37 39 | 
             
              def self.prepare_post_data(it)
         | 
| 38 40 | 
             
                case it.aggregator
         | 
| 39 41 | 
             
                when "log_path"
         | 
| 40 42 | 
             
                  aggregator = it.test_client.log_path_aggregator
         | 
| 41 43 |  | 
| 42 | 
            -
                  it.data.each do | | 
| 43 | 
            -
                    data. | 
| 44 | 
            -
                      count.times { aggregator.push( | 
| 44 | 
            +
                  it.data.each do |data|
         | 
| 45 | 
            +
                    data['counts'].each_pair do |severity, count|
         | 
| 46 | 
            +
                      count.times { aggregator.push(data['logger_name'], SEVERITY_LOOKUP[severity]) }
         | 
| 45 47 | 
             
                    end
         | 
| 46 48 | 
             
                  end
         | 
| 47 49 |  | 
| @@ -113,23 +115,23 @@ module IntegrationTestHelpers | |
| 113 115 | 
             
                when "example_contexts"
         | 
| 114 116 | 
             
                  aggregator = it.test_client.example_contexts_aggregator
         | 
| 115 117 |  | 
| 116 | 
            -
                  it.data.each do | | 
| 117 | 
            -
                    aggregator.record(Prefab::Context.new( | 
| 118 | 
            +
                  it.data.each do |key, values|
         | 
| 119 | 
            +
                    aggregator.record(Prefab::Context.new({ key => values }))
         | 
| 118 120 | 
             
                  end
         | 
| 119 121 |  | 
| 120 122 | 
             
                  expected_data = []
         | 
| 121 | 
            -
                  it.expected_data.each do | | 
| 123 | 
            +
                  it.expected_data.each do |k, vs|
         | 
| 122 124 | 
             
                    expected_data << PrefabProto::ExampleContext.new(
         | 
| 123 125 | 
             
                      timestamp: 0,
         | 
| 124 126 | 
             
                      contextSet: PrefabProto::ContextSet.new(
         | 
| 125 | 
            -
                        contexts:  | 
| 127 | 
            +
                        contexts: [
         | 
| 126 128 | 
             
                          PrefabProto::Context.new(
         | 
| 127 129 | 
             
                            type: k,
         | 
| 128 | 
            -
                            values: vs.map do | | 
| 129 | 
            -
                              [ | 
| 130 | 
            +
                            values: vs.each_pair.map do |key, value|
         | 
| 131 | 
            +
                              [key, Prefab::ConfigValueWrapper.wrap(value)]
         | 
| 130 132 | 
             
                            end.to_h
         | 
| 131 133 | 
             
                          )
         | 
| 132 | 
            -
                         | 
| 134 | 
            +
                        ]
         | 
| 133 135 | 
             
                      )
         | 
| 134 136 | 
             
                    )
         | 
| 135 137 | 
             
                  end
         | 
| @@ -154,7 +154,9 @@ class TestConfigValueUnwrapper < Minitest::Test | |
| 154 154 | 
             
                  lookup: "NON_EXISTENT_ENV_VAR_NAME"
         | 
| 155 155 | 
             
                )
         | 
| 156 156 | 
             
                config_value = PrefabProto::ConfigValue.new(provided: value)
         | 
| 157 | 
            -
                 | 
| 157 | 
            +
                assert_raises(Prefab::Errors::MissingEnvVarError) do
         | 
| 158 | 
            +
                  unwrap(config_value, CONFIG, EMPTY_CONTEXT)
         | 
| 159 | 
            +
                end
         | 
| 158 160 | 
             
              end
         | 
| 159 161 |  | 
| 160 162 | 
             
              def test_unwrapping_encrypted_values_decrypts
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: prefab-cloud-ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.4. | 
| 4 | 
            +
              version: 1.4.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jeff Dwyer
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-01- | 
| 11 | 
            +
            date: 2024-01-31 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: concurrent-ruby
         | 
| @@ -241,6 +241,7 @@ files: | |
| 241 241 | 
             
            - lib/prefab/errors/initialization_timeout_error.rb
         | 
| 242 242 | 
             
            - lib/prefab/errors/invalid_api_key_error.rb
         | 
| 243 243 | 
             
            - lib/prefab/errors/missing_default_error.rb
         | 
| 244 | 
            +
            - lib/prefab/errors/missing_env_var_error.rb
         | 
| 244 245 | 
             
            - lib/prefab/errors/uninitialized_error.rb
         | 
| 245 246 | 
             
            - lib/prefab/evaluation.rb
         | 
| 246 247 | 
             
            - lib/prefab/evaluation_summary_aggregator.rb
         |