elmassimo / better_settings Goto Github PK
View Code? Open in Web Editor NEW⚙ Settings for Ruby apps – fast, immutable, better.
Home Page: https://maximomussini.com/posts/better-settings/
License: MIT License
⚙ Settings for Ruby apps – fast, immutable, better.
Home Page: https://maximomussini.com/posts/better-settings/
License: MIT License
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
When upgrading to Rails 7 from Rails 6.1 I am unable to load Settings
in initializers.
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}"
Error output or similar when the error occurs:
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)
Provide console or browser screenshots of the problem.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.