Giter Club home page Giter Club logo

better_settings's Issues

Ruby 3.1 compatibility

The new ruby 3.1 use as default gem psych 4.0.3, with this version there is problem to load alias, i receive this error message
Unknown alias: defaults
To fix the problem you can change your yaml_to_hash method in this way:

    # Internal: Parses a yml file that can optionally use ERB templating.
    def yaml_to_hash(file_name)
      return {} if (content = File.open(file_name).read).empty?
      if Psych::VERSION > '4.0'
        YAML.load(ERB.new(content).result, aliases: true).to_hash
      else
        YAML.load(ERB.new(content).result).to_hash
      end
    end

In this way it works with ruby 3.1 and keep backwards compatibility

Rails 7 Won't allow Settings inside initilaizers

Description 📖

When upgrading to Rails 7 from Rails 6.1 I am unable to load Settings in initializers.

Reproduction 🐞

bundle exec rake zeitwerk:check 
rake aborted!
NameError: uninitialized constant Settings
Did you mean?  String
/core/config/initializers/sidekiq.rb:10:in `<main>'
# config/initilizers/sidekiq.rb
...
redis_host_string = "#{Settings.redis.scheme}://#{Settings.redis.host}:#{Settings.redis.port}/#{Settings.redis.sidekiq_db}"

Logs 📜

Error output or similar when the error occurs:

Output
bundle exec rake zeitwerk:check                                                                        ─╯
rake aborted!
NameError: uninitialized constant Settings
Did you mean?  String
/Users/tom/Workspace/core/config/initializers/sidekiq.rb:10:in `<main>'
/Users/tom/Workspace/core/config/environment.rb:5:in `<main>'
/Users/tom/.rbenv/versions/3.0.3/bin/bundle:23:in `load'
/Users/tom/.rbenv/versions/3.0.3/bin/bundle:23:in `<main>'
Tasks: TOP => zeitwerk:check => environment
(See full trace by running task with --trace)

Screenshots 📷

Provide console or browser screenshots of the problem.

1.0.2 breaks ruby compatibility <= 3.1

If this gem is going to be ruby 3.1 only that should not be released as part of a patch release. Perhaps releasing it as 2.0.0 would be better to denote the scope of the breaking changes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.