Giter Site home page Giter Site logo

elmassimo / better_settings Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 1.0 25 KB

⚙ Settings for Ruby apps – fast, immutable, better.

Home Page: https://maximomussini.com/posts/better-settings/

License: MIT License

Ruby 100.00%
immutability rails ruby settings yaml

better_settings's Introduction

Projects 🛠

My current focus is development experience, and how it can help us achieve increased productivity.

Vite.js

Vite.js with Ruby

Vue.js

  • vuex-stores: 🗄 Store objects for Vuex, a simple and more fluid API for state-management.

Rails

  • js_from_routes: 🛣️ Generate path helpers and API methods from your Rails routes
  • oj_serializers: ⚡️ Faster JSON serialization for Ruby on Rails. Easily migrate away from Active Model Serializers
  • types_from_serializers: ✅ Generate TypeScript interfaces from your JSON serializers
  • presenter_rails: 🔭 Expose your view models in a convenient way
  • queryable: ❔ Gives your queries a home and avoid tucking scopes inside your models
  • resourcerer: ✨ Works like magic to dry up your controllers
  • request_store_rails: 📦 Per-request global storage for Rails prepared for multi-threaded apps

Ruby

  • better_settings: ⚙ Settings for Ruby apps – fast, immutable, better
  • capybara-compose: ✅ Easily write fluent integration tests with Capybara
  • i18n_multitenant: 🌎 Provides a convenient way to use tenant-specific translations
  • pakiderm: 🐘 Pakiderm will never forget the return value

Demos / Templates / App Starters

Podcasts & Talks 📣

Writing ✍️

Here are some articles I've written:

better_settings's People

Contributors

elmassimo avatar pablomdiaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mochetts

better_settings's Issues

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?

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.

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

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.