setler 0.0.14 → 0.0.15
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/.devcontainer/devcontainer.json +35 -0
- data/.github/dependabot.yml +20 -0
- data/.github/workflows/lint.yml +24 -0
- data/.github/workflows/test.yml +92 -0
- data/.markdownlint.json +7 -0
- data/.rubocop.yml +15 -0
- data/.ruby-version +1 -1
- data/.yamllint.yml +11 -0
- data/AGENTS.md +46 -0
- data/Appraisals +23 -5
- data/README.md +160 -0
- data/Rakefile +0 -5
- data/contributors.txt +1 -0
- data/gemfiles/rails_4.gemfile.lock +92 -25
- data/gemfiles/rails_5.gemfile +2 -1
- data/gemfiles/rails_5.gemfile.lock +119 -44
- data/gemfiles/rails_6.gemfile +10 -0
- data/gemfiles/rails_6.gemfile.lock +266 -0
- data/gemfiles/rails_7.gemfile +8 -0
- data/gemfiles/rails_7.gemfile.lock +311 -0
- data/gemfiles/rails_8.gemfile +8 -0
- data/gemfiles/rails_8.gemfile.lock +315 -0
- data/gemfiles/rails_edge.gemfile.lock +320 -0
- data/lib/setler/settings.rb +3 -3
- data/lib/setler/version.rb +1 -1
- data/setler.gemspec +17 -1
- data/test/settings_test.rb +1 -1
- metadata +63 -25
- data/.travis.yml +0 -22
- data/README.rdoc +0 -85
- data/gemfiles/rails_6_edge.gemfile.lock +0 -167
- /data/gemfiles/{rails_6_edge.gemfile → rails_edge.gemfile} +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b76d95a9b3af85f090cadfd02c7a7770a871cc648c996b6a330084e76df4b0c7
         | 
| 4 | 
            +
              data.tar.gz: 2e7445d697ff97fc66ff1d3689f5e65d77437934aaa447099299829d46eb89df
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: bbc515040203be9ccaff3ae4cc80cf28039657a3e7159b48634d2cc7b60e63e31f803f08763fcd966fb1d6c5f378fb1c17e827a7627b24f4692bc080600e6a79
         | 
| 7 | 
            +
              data.tar.gz: e1d1427f8d613bc4c919fb46d5180d3dccf9b18ff5db0ec436b20e3edc75156e9cbf930d5c270c7436301f923f1d09d7336b63774634fc604a557570152bd9fe
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            // For format details, see https://aka.ms/devcontainer.json. For config options, see the
         | 
| 2 | 
            +
            // README at: https://github.com/devcontainers/templates/tree/main/src/ruby
         | 
| 3 | 
            +
            {
         | 
| 4 | 
            +
            	"name": "Setler",
         | 
| 5 | 
            +
            	// Base dev container image docs: https://containers.dev/templates
         | 
| 6 | 
            +
            	"image": "mcr.microsoft.com/devcontainers/base:bullseye",
         | 
| 7 | 
            +
            	"features": {
         | 
| 8 | 
            +
            		"ghcr.io/devcontainers/features/ruby:1": {
         | 
| 9 | 
            +
            			"version": "3.4.7"
         | 
| 10 | 
            +
            		},
         | 
| 11 | 
            +
            		"ghcr.io/devcontainers/features/github-cli:1": {}
         | 
| 12 | 
            +
            	},
         | 
| 13 | 
            +
            	"postCreateCommand": "gem install bundler -v 2.4.22 --no-document && bundle _2.4.22_ install",
         | 
| 14 | 
            +
            	"customizations": {
         | 
| 15 | 
            +
            		"vscode": {
         | 
| 16 | 
            +
            			"extensions": [
         | 
| 17 | 
            +
            				"shopify.ruby-lsp",
         | 
| 18 | 
            +
            				"redhat.vscode-yaml",
         | 
| 19 | 
            +
            				"DavidAnson.vscode-markdownlint"
         | 
| 20 | 
            +
            			],
         | 
| 21 | 
            +
            			"settings": {
         | 
| 22 | 
            +
            				"editor.formatOnSave": true,
         | 
| 23 | 
            +
            				"rubyLsp": {
         | 
| 24 | 
            +
            					"rubyVersionManager": "none"
         | 
| 25 | 
            +
            				},
         | 
| 26 | 
            +
            				"[ruby]": {
         | 
| 27 | 
            +
            					"editor.defaultFormatter": "Shopify.ruby-lsp"
         | 
| 28 | 
            +
            				},
         | 
| 29 | 
            +
            				"[markdown]": {
         | 
| 30 | 
            +
            					"editor.defaultFormatter": "vscode.markdown-language-features"
         | 
| 31 | 
            +
            				}
         | 
| 32 | 
            +
            			}
         | 
| 33 | 
            +
            		}
         | 
| 34 | 
            +
            	}
         | 
| 35 | 
            +
            }
         | 
| @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            # To get started with Dependabot version updates, you'll need to specify which
         | 
| 2 | 
            +
            # package ecosystems to update and where the package manifests are located.
         | 
| 3 | 
            +
            # Please see the documentation for more information:
         | 
| 4 | 
            +
            # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
         | 
| 5 | 
            +
            # https://containers.dev/guide/dependabot
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            version: 2
         | 
| 8 | 
            +
            updates:
         | 
| 9 | 
            +
             - package-ecosystem: "bundler"
         | 
| 10 | 
            +
               directory: "/"
         | 
| 11 | 
            +
               schedule:
         | 
| 12 | 
            +
                 interval: weekly
         | 
| 13 | 
            +
             - package-ecosystem: "github-actions"
         | 
| 14 | 
            +
               directory: "/"
         | 
| 15 | 
            +
               schedule:
         | 
| 16 | 
            +
                 interval: weekly
         | 
| 17 | 
            +
             - package-ecosystem: "devcontainers"
         | 
| 18 | 
            +
               directory: "/"
         | 
| 19 | 
            +
               schedule:
         | 
| 20 | 
            +
                 interval: weekly
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            name: Lint
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              push:
         | 
| 5 | 
            +
                branches:
         | 
| 6 | 
            +
                  - main
         | 
| 7 | 
            +
              pull_request:
         | 
| 8 | 
            +
                branches:
         | 
| 9 | 
            +
                  - main
         | 
| 10 | 
            +
              workflow_dispatch:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            jobs:
         | 
| 13 | 
            +
              rubocop:
         | 
| 14 | 
            +
                name: Rubocop
         | 
| 15 | 
            +
                runs-on: ubuntu-latest
         | 
| 16 | 
            +
                steps:
         | 
| 17 | 
            +
                  - uses: actions/checkout@v5
         | 
| 18 | 
            +
                  - uses: ruby/setup-ruby@v1
         | 
| 19 | 
            +
                    with:
         | 
| 20 | 
            +
                      ruby-version: "3.4.7"
         | 
| 21 | 
            +
                      bundler: 2.5.10
         | 
| 22 | 
            +
                      bundler-cache: true
         | 
| 23 | 
            +
                  - name: Run RuboCop
         | 
| 24 | 
            +
                    run: bundle exec rubocop --format progress
         | 
| @@ -0,0 +1,92 @@ | |
| 1 | 
            +
            name: Tests
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              push:
         | 
| 5 | 
            +
                branches:
         | 
| 6 | 
            +
                  - main
         | 
| 7 | 
            +
              pull_request:
         | 
| 8 | 
            +
                branches:
         | 
| 9 | 
            +
                  - main
         | 
| 10 | 
            +
              workflow_dispatch:
         | 
| 11 | 
            +
              schedule:
         | 
| 12 | 
            +
                - cron: "0 9 * * 1"
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            jobs:
         | 
| 15 | 
            +
              test:
         | 
| 16 | 
            +
                name: Ruby ${{ matrix.ruby-version }}
         | 
| 17 | 
            +
                runs-on: ubuntu-latest
         | 
| 18 | 
            +
                continue-on-error: ${{ matrix.experimental }}
         | 
| 19 | 
            +
                strategy:
         | 
| 20 | 
            +
                  fail-fast: false
         | 
| 21 | 
            +
                  matrix:
         | 
| 22 | 
            +
                    include:
         | 
| 23 | 
            +
                      - ruby-version: "2.6.10"
         | 
| 24 | 
            +
                        bundler: "1.17.3"
         | 
| 25 | 
            +
                        appraisals: "rails-4"
         | 
| 26 | 
            +
                        experimental: false
         | 
| 27 | 
            +
                      - ruby-version: "2.7.8"
         | 
| 28 | 
            +
                        bundler: "2.4.22"
         | 
| 29 | 
            +
                        appraisals: "rails-5"
         | 
| 30 | 
            +
                        experimental: false
         | 
| 31 | 
            +
                      - ruby-version: "3.0.7"
         | 
| 32 | 
            +
                        bundler: "2.5.10"
         | 
| 33 | 
            +
                        appraisals: "rails-6"
         | 
| 34 | 
            +
                        experimental: false
         | 
| 35 | 
            +
                      - ruby-version: "3.1.7"
         | 
| 36 | 
            +
                        bundler: "2.5.10"
         | 
| 37 | 
            +
                        appraisals: "rails-6 rails-7"
         | 
| 38 | 
            +
                        experimental: false
         | 
| 39 | 
            +
                      - ruby-version: "3.2.9"
         | 
| 40 | 
            +
                        bundler: "2.5.10"
         | 
| 41 | 
            +
                        appraisals: "rails-6 rails-7 rails-8 rails-edge"
         | 
| 42 | 
            +
                        experimental: false
         | 
| 43 | 
            +
                      - ruby-version: "3.3.9"
         | 
| 44 | 
            +
                        bundler: "2.5.10"
         | 
| 45 | 
            +
                        appraisals: "rails-6 rails-7 rails-8 rails-edge"
         | 
| 46 | 
            +
                        experimental: false
         | 
| 47 | 
            +
                      - ruby-version: "3.4.7"
         | 
| 48 | 
            +
                        bundler: "2.5.10"
         | 
| 49 | 
            +
                        appraisals: "rails-7 rails-8 rails-edge"
         | 
| 50 | 
            +
                        experimental: false
         | 
| 51 | 
            +
                      - ruby-version: "3.5.0-preview1"
         | 
| 52 | 
            +
                        bundler: "2.5.10"
         | 
| 53 | 
            +
                        appraisals: "rails-7 rails-8 rails-edge"
         | 
| 54 | 
            +
                        experimental: false
         | 
| 55 | 
            +
                steps:
         | 
| 56 | 
            +
                  - uses: actions/checkout@v5
         | 
| 57 | 
            +
                  - name: Set up Ruby
         | 
| 58 | 
            +
                    uses: ruby/setup-ruby@v1
         | 
| 59 | 
            +
                    with:
         | 
| 60 | 
            +
                      ruby-version: ${{ matrix.ruby-version }}
         | 
| 61 | 
            +
                      bundler: ${{ matrix.bundler }}
         | 
| 62 | 
            +
                      bundler-cache: true
         | 
| 63 | 
            +
                  - name: Install appraisal gems
         | 
| 64 | 
            +
                    shell: bash
         | 
| 65 | 
            +
                    run: |
         | 
| 66 | 
            +
                      set -euo pipefail
         | 
| 67 | 
            +
                      APPRAISALS="${{ matrix.appraisals }}"
         | 
| 68 | 
            +
                      DEFAULT_BUNDLER="${{ matrix.bundler }}"
         | 
| 69 | 
            +
                      for appraisal in $APPRAISALS; do
         | 
| 70 | 
            +
                        if [ "$appraisal" = "rails-4" ]; then
         | 
| 71 | 
            +
                          BUNDLER_VERSION="1.17.3"
         | 
| 72 | 
            +
                        else
         | 
| 73 | 
            +
                          BUNDLER_VERSION="$DEFAULT_BUNDLER"
         | 
| 74 | 
            +
                        fi
         | 
| 75 | 
            +
                        echo "Installing gems for ${appraisal} with bundler ${BUNDLER_VERSION}"
         | 
| 76 | 
            +
                        bundle _${BUNDLER_VERSION}_ exec appraisal "${appraisal}" bundle install
         | 
| 77 | 
            +
                      done
         | 
| 78 | 
            +
                  - name: Run appraisal tests
         | 
| 79 | 
            +
                    shell: bash
         | 
| 80 | 
            +
                    run: |
         | 
| 81 | 
            +
                      set -euo pipefail
         | 
| 82 | 
            +
                      APPRAISALS="${{ matrix.appraisals }}"
         | 
| 83 | 
            +
                      DEFAULT_BUNDLER="${{ matrix.bundler }}"
         | 
| 84 | 
            +
                      for appraisal in $APPRAISALS; do
         | 
| 85 | 
            +
                        if [ "$appraisal" = "rails-4" ]; then
         | 
| 86 | 
            +
                          BUNDLER_VERSION="1.17.3"
         | 
| 87 | 
            +
                        else
         | 
| 88 | 
            +
                          BUNDLER_VERSION="$DEFAULT_BUNDLER"
         | 
| 89 | 
            +
                        fi
         | 
| 90 | 
            +
                        echo "Running tests for ${appraisal} with bundler ${BUNDLER_VERSION}"
         | 
| 91 | 
            +
                        bundle _${BUNDLER_VERSION}_ exec appraisal "${appraisal}" rake test
         | 
| 92 | 
            +
                      done
         | 
    
        data/.markdownlint.json
    ADDED
    
    
    
        data/.rubocop.yml
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            AllCops:
         | 
| 2 | 
            +
              TargetRubyVersion: 2.6
         | 
| 3 | 
            +
              NewCops: disable
         | 
| 4 | 
            +
              DisabledByDefault: true
         | 
| 5 | 
            +
              Exclude:
         | 
| 6 | 
            +
                - "vendor/**/*"
         | 
| 7 | 
            +
                - "gemfiles/**/vendor/**/*"
         | 
| 8 | 
            +
                - "lib/generators/**/templates/**/*"
         | 
| 9 | 
            +
                - "tmp/**/*"
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            plugins:
         | 
| 12 | 
            +
              - rubocop-rake
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            Lint:
         | 
| 15 | 
            +
              Enabled: true
         | 
    
        data/.ruby-version
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            3.4.7
         | 
    
        data/.yamllint.yml
    ADDED
    
    
    
        data/AGENTS.md
    ADDED
    
    | @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            # Agent Playbook
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            This file gives coding agents the context they need to work in the Setler repo. Follow every
         | 
| 4 | 
            +
            instruction here unless the user provides something more specific.
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            ## Project Snapshot
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            - Setler is a Ruby gem that layers application and model settings on top of Active Record.
         | 
| 9 | 
            +
            - The codebase supports Rails 4.2, 5.2, and 6.1 through Appraisal-managed gemfiles.
         | 
| 10 | 
            +
            - Default container Ruby is 3.4.7 with Bundler 2.4.22; CI also exercises Ruby 2.6 through 3.5.
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ## Environment Setup
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            - Install gems with `bundle _2.4.22_ install` unless instructed to target another Ruby.
         | 
| 15 | 
            +
            - For appraisal-specific installs use `bundle _2.4.22_ exec appraisal rails-5 bundle install` and
         | 
| 16 | 
            +
              `bundle _2.4.22_ exec appraisal rails-6-edge bundle install`.
         | 
| 17 | 
            +
            - Rails 4 appraisal requires Ruby 2.6 + Bundler 1.17.3; do not attempt it unless explicitly asked.
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            ## Required Checks
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            - Run `bundle exec rubocop --format progress` before finishing any task that changes Ruby code.
         | 
| 22 | 
            +
            - Run the relevant Appraisal test commands, for example:
         | 
| 23 | 
            +
              - `bundle _2.4.22_ exec appraisal rails-5 rake test`
         | 
| 24 | 
            +
              - `bundle _2.4.22_ exec appraisal rails-6-edge rake test`
         | 
| 25 | 
            +
            - Add or update regression tests when you change behavior. Never lower coverage thresholds.
         | 
| 26 | 
            +
            - Document doc-only edits in the README or changelog when behavior changes.
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            ## Coding Conventions
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            - Stay with ASCII unless a file already uses Unicode and it is required for the fix.
         | 
| 31 | 
            +
            - Keep comments minimal; only add them when the code is non-obvious.
         | 
| 32 | 
            +
            - Do not revert or overwrite user edits you did not author.
         | 
| 33 | 
            +
            - Prefer existing patterns in `lib/setler/*.rb` and follow established Rails style.
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            ## Workflow Expectations
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            - Break work into small commits and reference affected files in explanations.
         | 
| 38 | 
            +
            - If tests or lint fail, fix the underlying issue instead of muting the check.
         | 
| 39 | 
            +
            - Mention any commands you could not run so the human can follow up.
         | 
| 40 | 
            +
            - When unsure about product intent or cross-file impacts, ask the user before proceeding.
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            ## Safety & Data
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            - Only read and write repository content and publicly available documentation.
         | 
| 45 | 
            +
            - Never introduce secrets, tokens, or proprietary data into prompts or files.
         | 
| 46 | 
            +
            - Respect third-party licenses; avoid copying large blocks from external sources.
         | 
    
        data/Appraisals
    CHANGED
    
    | @@ -1,14 +1,32 @@ | |
| 1 1 | 
             
            appraise "rails-4" do
         | 
| 2 2 | 
             
              gem "rails", "4.2.11.1"
         | 
| 3 | 
            -
              gem  | 
| 3 | 
            +
              gem "sqlite3", "1.3.13"
         | 
| 4 4 | 
             
            end
         | 
| 5 5 |  | 
| 6 6 | 
             
            appraise "rails-5" do
         | 
| 7 7 | 
             
              gem "rails", "5.2.3"
         | 
| 8 | 
            -
              gem  | 
| 8 | 
            +
              gem "sqlite3", "1.5.4"
         | 
| 9 | 
            +
              gem "mimemagic", "0.3.10"
         | 
| 9 10 | 
             
            end
         | 
| 10 11 |  | 
| 11 | 
            -
            appraise "rails-6 | 
| 12 | 
            -
              gem  | 
| 13 | 
            -
              gem  | 
| 12 | 
            +
            appraise "rails-6" do
         | 
| 13 | 
            +
              gem "rails", "6.1.7.9"
         | 
| 14 | 
            +
              gem "sqlite3", "1.5.4"
         | 
| 15 | 
            +
              gem "concurrent-ruby", "1.3.4"
         | 
| 16 | 
            +
              gem "bigdecimal", "3.3.1"
         | 
| 17 | 
            +
            end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            appraise "rails-7" do
         | 
| 20 | 
            +
              gem "rails", "~> 7.2"
         | 
| 21 | 
            +
              gem "sqlite3"
         | 
| 22 | 
            +
            end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            appraise "rails-8" do
         | 
| 25 | 
            +
              gem "rails", "~> 8.1"
         | 
| 26 | 
            +
              gem "sqlite3"
         | 
| 27 | 
            +
            end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            appraise "rails-edge" do
         | 
| 30 | 
            +
              gem "rails", git: "https://github.com/rails/rails"
         | 
| 31 | 
            +
              gem "sqlite3"
         | 
| 14 32 | 
             
            end
         | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,160 @@ | |
| 1 | 
            +
            # Setler
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Setler is a gem that lets you easily implement the "Feature Flags" pattern or add settings to individual models. This is a cleanroom implementation of what the `rails-settings` gem does. It's been forked all over the place, and my favorite version of it doesn't have any tests and doesn't work with settings associated with models.
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            [](https://github.com/ckdake/setler/actions/workflows/test.yml)
         | 
| 6 | 
            +
            [](https://github.com/ckdake/setler/actions/workflows/lint.yml)
         | 
| 7 | 
            +
            [](https://rubygems.org/gems/setler)
         | 
| 8 | 
            +
            [](https://rubygems.org/gems/setler)
         | 
| 9 | 
            +
            [](https://rubygems.org/gems/setler)
         | 
| 10 | 
            +
            [](https://opensource.org/licenses/MIT)
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            While Setler enables you to create both app-level and model-level settings, they are two separate things and don't mix. For example, if you create defaults for the app, they won't appear as defaults for individual models.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            ## Setup
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            Install the gem by adding this to your Gemfile:
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            ```ruby
         | 
| 19 | 
            +
            gem "setler"
         | 
| 20 | 
            +
            ```
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            Generate the model:
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            ```bash
         | 
| 25 | 
            +
            rails g setler <model_name>
         | 
| 26 | 
            +
            ```
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            Run the migration:
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            ```bash
         | 
| 31 | 
            +
            rake db:migrate
         | 
| 32 | 
            +
            ```
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            If you are using the `protected_attributes` gem you must add `attr_protected` to the top of your Setler model.
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            ## Usage
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            Create/Update settings:
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            ```ruby
         | 
| 41 | 
            +
            # Method calls and []= are synonymous
         | 
| 42 | 
            +
            Featureflags.bacon_dispenser_enabled = true
         | 
| 43 | 
            +
            Settings[:allowed_meats] = ['bacon', 'crunchy bacon']
         | 
| 44 | 
            +
            ```
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            Read settings:
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            ```ruby
         | 
| 49 | 
            +
            Featureflags.bacon_dispenser_enabled # true
         | 
| 50 | 
            +
            Settings[:allowed_meats].include?('bacon')  # true
         | 
| 51 | 
            +
            ```
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            Destroy them:
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            ```ruby
         | 
| 56 | 
            +
            Featureflags.destroy :bacon_dispenser_enabled
         | 
| 57 | 
            +
            Settings.destroy :allowed_meats
         | 
| 58 | 
            +
            ```
         | 
| 59 | 
            +
             | 
| 60 | 
            +
            List all settings:
         | 
| 61 | 
            +
             | 
| 62 | 
            +
            ```ruby
         | 
| 63 | 
            +
            Featureflags.all_settings
         | 
| 64 | 
            +
            Settings.all_settings
         | 
| 65 | 
            +
            ```
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            Set defaults in an initializer with something like:
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            ```ruby
         | 
| 70 | 
            +
            Featureflags.defaults[:bacon_dispenser_enabled] = false
         | 
| 71 | 
            +
            Settings.defaults[:allowed_meats] = ['itsnotbacon']
         | 
| 72 | 
            +
            ```
         | 
| 73 | 
            +
             | 
| 74 | 
            +
            To revert to the default after changing a setting, destroy it. Note: updating the setting to `nil` or `false` no longer makes it the default setting (> 0.0.6), but changes the setting to `nil` or `false`.
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            Add them to any ActiveRecord object:
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            ```ruby
         | 
| 79 | 
            +
            class User < ActiveRecord::Base
         | 
| 80 | 
            +
              has_setler :settings
         | 
| 81 | 
            +
            end
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            user = User.first
         | 
| 84 | 
            +
            user.settings.favorite_meat = :bacon
         | 
| 85 | 
            +
            user.settings.favorite_meat  # :bacon
         | 
| 86 | 
            +
            user.settings.all # { "favorite_meat" => :bacon }
         | 
| 87 | 
            +
            ```
         | 
| 88 | 
            +
             | 
| 89 | 
            +
            TODO: And look them up:
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            ```ruby
         | 
| 92 | 
            +
            User.with_settings_for('favorite_meat') # => scope of users with the favorite_meat setting
         | 
| 93 | 
            +
            ```
         | 
| 94 | 
            +
             | 
| 95 | 
            +
            ## Development Environment
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            Setler includes a ready-to-use Dev Container that provisions Ruby 3.4.7 alongside Bundler 2.4.22. When using VS Code with the Dev Containers extension (or GitHub Codespaces), choose **Reopen in Container** and the setup scripts will run `bundle _2.4.22_ install` so the gem dependencies are available immediately. The container also enables *format on save* with Ruby LSP, YAML, and Markdown tooling preinstalled for a consistent editing experience. Rails 4 support relies on Bundler 1.17.3 and Ruby 2.6; our CI matrix exercises that combination, and you can mirror it locally with a Ruby 2.6 toolchain if needed.
         | 
| 98 | 
            +
             | 
| 99 | 
            +
            Developing locally? Install the Ruby version pinned in `.ruby-version` and the matching Bundler release, then run:
         | 
| 100 | 
            +
             | 
| 101 | 
            +
            ```bash
         | 
| 102 | 
            +
            gem install bundler -v 2.4.22
         | 
| 103 | 
            +
            bundle _2.4.22_ install
         | 
| 104 | 
            +
            bundle _2.4.22_ exec appraisal rails-5 bundle install
         | 
| 105 | 
            +
            bundle _2.4.22_ exec appraisal rails-6-edge bundle install
         | 
| 106 | 
            +
            ```
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            To run the Rails 4 appraisal locally, switch to Ruby 2.6 and use Bundler 1.17.3, for example: `bundle _1.17.3_ exec appraisal rails-4 bundle install` followed by `bundle _1.17.3_ exec appraisal rails-4 rake test`.
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            Our GitHub Actions workflow exercises the library against Rails 4.2, 5.2, and 6.1 across the latest patch releases of
         | 
| 111 | 
            +
            Ruby 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, and the Ruby 3.5 preview. Rails versions that are unsupported on newer
         | 
| 112 | 
            +
            interpreters are only executed on compatible Rubies, and the Ruby 3.5 job is marked experimental while the release
         | 
| 113 | 
            +
            stabilizes. Ruby 2.6 runs only the Rails 4 appraisal (with Bundler 1.17.3) because newer Bundler releases require Ruby
         | 
| 114 | 
            +
            2.7+, while the Ruby 2.7 job covers Rails 5 and 6 using Bundler 2.4.x and the Ruby 3.x jobs use Bundler 2.5.x.
         | 
| 115 | 
            +
             | 
| 116 | 
            +
            ## AI Assistance
         | 
| 117 | 
            +
             | 
| 118 | 
            +
            We welcome responsible AI-assisted contributions. Human authors remain accountable for every line added to the
         | 
| 119 | 
            +
            repository—even when an agent drafts the code. Before opening a pull request, confirm that:
         | 
| 120 | 
            +
             | 
| 121 | 
            +
            - Tests are added or expanded to exercise the behavior you changed.
         | 
| 122 | 
            +
            - `bundle exec rubocop --format progress` passes without disabling cops.
         | 
| 123 | 
            +
            - Relevant Appraisal suites finish cleanly locally or in CI, and any failures are addressed.
         | 
| 124 | 
            +
            - Documentation (including this README) reflects behavior changes when applicable.
         | 
| 125 | 
            +
            - Your contributions are compatabile with the MIT license.
         | 
| 126 | 
            +
             | 
| 127 | 
            +
            Agents collaborating on this repository follow the automation-focused directions in `AGENTS.md`. Refer to that file
         | 
| 128 | 
            +
            when coordinating with AI tooling.
         | 
| 129 | 
            +
             | 
| 130 | 
            +
            ### Linting
         | 
| 131 | 
            +
             | 
| 132 | 
            +
            Automated linting runs in CI and locally with `bundle exec rubocop --format progress` (Lint department only by default).
         | 
| 133 | 
            +
             | 
| 134 | 
            +
            ## Gem Development
         | 
| 135 | 
            +
             | 
| 136 | 
            +
            Getting started is pretty straightforward:
         | 
| 137 | 
            +
             | 
| 138 | 
            +
            1. Check out the code: `git clone git://github.com/ckdake/setler.git`
         | 
| 139 | 
            +
            1. Install dependencies: `bundle _2.4.22_ install`
         | 
| 140 | 
            +
            1. Install the per-Rails dependencies:
         | 
| 141 | 
            +
             | 
| 142 | 
            +
              ```bash
         | 
| 143 | 
            +
              bundle _2.4.22_ exec appraisal rails-5 bundle install
         | 
| 144 | 
            +
              bundle _2.4.22_ exec appraisal rails-6-edge bundle install
         | 
| 145 | 
            +
              ```
         | 
| 146 | 
            +
             | 
| 147 | 
            +
            1. Run the tests for the supported Rails versions you just installed:
         | 
| 148 | 
            +
             | 
| 149 | 
            +
              ```bash
         | 
| 150 | 
            +
              bundle _2.4.22_ exec appraisal rails-5 rake test
         | 
| 151 | 
            +
              bundle _2.4.22_ exec appraisal rails-6-edge rake test
         | 
| 152 | 
            +
              ```
         | 
| 153 | 
            +
             | 
| 154 | 
            +
            1. Run the linters described above before opening a pull request.
         | 
| 155 | 
            +
             | 
| 156 | 
            +
            If you'd like to contribute code, make your changes and submit a pull request that includes appropriate tests.
         | 
| 157 | 
            +
             | 
| 158 | 
            +
            To build the gem: `rake build`
         | 
| 159 | 
            +
             | 
| 160 | 
            +
            To release a gem to GitHub and RubyGems: `rake release`
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/contributors.txt
    CHANGED
    
    
| @@ -1,10 +1,9 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: ..
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                setler (0.0. | 
| 4 | 
            +
                setler (0.0.15)
         | 
| 5 5 | 
             
                  activerecord (>= 3.0.0)
         | 
| 6 6 | 
             
                  rails (>= 3.0.0)
         | 
| 7 | 
            -
                  sprockets (= 3.7.2)
         | 
| 8 7 |  | 
| 9 8 | 
             
            GEM
         | 
| 10 9 | 
             
              remote: https://rubygems.org/
         | 
| @@ -43,30 +42,61 @@ GEM | |
| 43 42 | 
             
                  minitest (~> 5.1)
         | 
| 44 43 | 
             
                  thread_safe (~> 0.3, >= 0.3.4)
         | 
| 45 44 | 
             
                  tzinfo (~> 1.1)
         | 
| 46 | 
            -
                appraisal (2. | 
| 45 | 
            +
                appraisal (2.5.0)
         | 
| 47 46 | 
             
                  bundler
         | 
| 48 47 | 
             
                  rake
         | 
| 49 48 | 
             
                  thor (>= 0.14.0)
         | 
| 50 49 | 
             
                arel (6.0.4)
         | 
| 51 | 
            -
                 | 
| 52 | 
            -
                 | 
| 50 | 
            +
                ast (2.4.3)
         | 
| 51 | 
            +
                brakeman (5.4.1)
         | 
| 52 | 
            +
                builder (3.3.0)
         | 
| 53 | 
            +
                concurrent-ruby (1.3.5)
         | 
| 53 54 | 
             
                crass (1.0.6)
         | 
| 54 | 
            -
                 | 
| 55 | 
            +
                date (3.5.0)
         | 
| 56 | 
            +
                docile (1.4.1)
         | 
| 55 57 | 
             
                erubis (2.7.0)
         | 
| 56 58 | 
             
                globalid (0.4.2)
         | 
| 57 59 | 
             
                  activesupport (>= 4.2.0)
         | 
| 58 60 | 
             
                i18n (0.9.5)
         | 
| 59 61 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 60 | 
            -
                 | 
| 62 | 
            +
                json (2.7.6)
         | 
| 63 | 
            +
                logger (1.7.0)
         | 
| 64 | 
            +
                loofah (2.24.1)
         | 
| 61 65 | 
             
                  crass (~> 1.0.2)
         | 
| 62 | 
            -
                  nokogiri (>= 1. | 
| 63 | 
            -
                mail (2. | 
| 66 | 
            +
                  nokogiri (>= 1.12.0)
         | 
| 67 | 
            +
                mail (2.9.0)
         | 
| 68 | 
            +
                  logger
         | 
| 64 69 | 
             
                  mini_mime (>= 0.1.1)
         | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
                 | 
| 69 | 
            -
             | 
| 70 | 
            +
                  net-imap
         | 
| 71 | 
            +
                  net-pop
         | 
| 72 | 
            +
                  net-smtp
         | 
| 73 | 
            +
                mini_mime (1.1.5)
         | 
| 74 | 
            +
                mini_portile2 (2.8.9)
         | 
| 75 | 
            +
                minitest (5.25.4)
         | 
| 76 | 
            +
                net-imap (0.3.9)
         | 
| 77 | 
            +
                  date
         | 
| 78 | 
            +
                  net-protocol
         | 
| 79 | 
            +
                net-pop (0.1.2)
         | 
| 80 | 
            +
                  net-protocol
         | 
| 81 | 
            +
                net-protocol (0.2.2)
         | 
| 82 | 
            +
                  timeout
         | 
| 83 | 
            +
                net-smtp (0.5.1)
         | 
| 84 | 
            +
                  net-protocol
         | 
| 85 | 
            +
                nokogiri (1.13.10)
         | 
| 86 | 
            +
                  mini_portile2 (~> 2.8.0)
         | 
| 87 | 
            +
                  racc (~> 1.4)
         | 
| 88 | 
            +
                panolint (0.1.6)
         | 
| 89 | 
            +
                  brakeman (>= 4.8, < 6.0)
         | 
| 90 | 
            +
                  rubocop (>= 0.83, < 2.0)
         | 
| 91 | 
            +
                  rubocop-performance (~> 1.5)
         | 
| 92 | 
            +
                  rubocop-rails (~> 2.5)
         | 
| 93 | 
            +
                  rubocop-rake (~> 0.5)
         | 
| 94 | 
            +
                  rubocop-rspec (~> 2.0)
         | 
| 95 | 
            +
                parallel (1.24.0)
         | 
| 96 | 
            +
                parser (3.3.10.0)
         | 
| 97 | 
            +
                  ast (~> 2.4.1)
         | 
| 98 | 
            +
                  racc
         | 
| 99 | 
            +
                racc (1.8.1)
         | 
| 70 100 | 
             
                rack (1.6.13)
         | 
| 71 101 | 
             
                rack-test (0.6.3)
         | 
| 72 102 | 
             
                  rack (>= 1.0)
         | 
| @@ -81,36 +111,70 @@ GEM | |
| 81 111 | 
             
                  bundler (>= 1.3.0, < 2.0)
         | 
| 82 112 | 
             
                  railties (= 4.2.11.1)
         | 
| 83 113 | 
             
                  sprockets-rails
         | 
| 84 | 
            -
                rails-deprecated_sanitizer (1.0. | 
| 114 | 
            +
                rails-deprecated_sanitizer (1.0.4)
         | 
| 85 115 | 
             
                  activesupport (>= 4.2.0.alpha)
         | 
| 86 116 | 
             
                rails-dom-testing (1.0.9)
         | 
| 87 117 | 
             
                  activesupport (>= 4.2.0, < 5.0)
         | 
| 88 118 | 
             
                  nokogiri (~> 1.6)
         | 
| 89 119 | 
             
                  rails-deprecated_sanitizer (>= 1.0.1)
         | 
| 90 | 
            -
                rails-html-sanitizer (1. | 
| 91 | 
            -
                  loofah (~> 2. | 
| 120 | 
            +
                rails-html-sanitizer (1.5.0)
         | 
| 121 | 
            +
                  loofah (~> 2.19, >= 2.19.1)
         | 
| 92 122 | 
             
                railties (4.2.11.1)
         | 
| 93 123 | 
             
                  actionpack (= 4.2.11.1)
         | 
| 94 124 | 
             
                  activesupport (= 4.2.11.1)
         | 
| 95 125 | 
             
                  rake (>= 0.8.7)
         | 
| 96 126 | 
             
                  thor (>= 0.18.1, < 2.0)
         | 
| 97 | 
            -
                 | 
| 98 | 
            -
                 | 
| 127 | 
            +
                rainbow (3.1.1)
         | 
| 128 | 
            +
                rake (13.3.1)
         | 
| 129 | 
            +
                regexp_parser (2.11.3)
         | 
| 130 | 
            +
                rexml (3.4.4)
         | 
| 131 | 
            +
                rubocop (1.50.2)
         | 
| 132 | 
            +
                  json (~> 2.3)
         | 
| 133 | 
            +
                  parallel (~> 1.10)
         | 
| 134 | 
            +
                  parser (>= 3.2.0.0)
         | 
| 135 | 
            +
                  rainbow (>= 2.2.2, < 4.0)
         | 
| 136 | 
            +
                  regexp_parser (>= 1.8, < 3.0)
         | 
| 137 | 
            +
                  rexml (>= 3.2.5, < 4.0)
         | 
| 138 | 
            +
                  rubocop-ast (>= 1.28.0, < 2.0)
         | 
| 139 | 
            +
                  ruby-progressbar (~> 1.7)
         | 
| 140 | 
            +
                  unicode-display_width (>= 2.4.0, < 3.0)
         | 
| 141 | 
            +
                rubocop-ast (1.30.0)
         | 
| 142 | 
            +
                  parser (>= 3.2.1.0)
         | 
| 143 | 
            +
                rubocop-capybara (2.18.0)
         | 
| 144 | 
            +
                  rubocop (~> 1.41)
         | 
| 145 | 
            +
                rubocop-performance (1.17.1)
         | 
| 146 | 
            +
                  rubocop (>= 1.7.0, < 2.0)
         | 
| 147 | 
            +
                  rubocop-ast (>= 0.4.0)
         | 
| 148 | 
            +
                rubocop-rails (2.19.1)
         | 
| 149 | 
            +
                  activesupport (>= 4.2.0)
         | 
| 150 | 
            +
                  rack (>= 1.1)
         | 
| 151 | 
            +
                  rubocop (>= 1.33.0, < 2.0)
         | 
| 152 | 
            +
                rubocop-rake (0.6.0)
         | 
| 153 | 
            +
                  rubocop (~> 1.0)
         | 
| 154 | 
            +
                rubocop-rspec (2.20.0)
         | 
| 155 | 
            +
                  rubocop (~> 1.33)
         | 
| 156 | 
            +
                  rubocop-capybara (~> 2.17)
         | 
| 157 | 
            +
                ruby-progressbar (1.13.0)
         | 
| 158 | 
            +
                simplecov (0.22.0)
         | 
| 99 159 | 
             
                  docile (~> 1.1)
         | 
| 100 | 
            -
                  simplecov-html (~> 0.11 | 
| 101 | 
            -
             | 
| 102 | 
            -
                 | 
| 160 | 
            +
                  simplecov-html (~> 0.11)
         | 
| 161 | 
            +
                  simplecov_json_formatter (~> 0.1)
         | 
| 162 | 
            +
                simplecov-html (0.13.2)
         | 
| 163 | 
            +
                simplecov_json_formatter (0.1.4)
         | 
| 164 | 
            +
                sprockets (4.1.1)
         | 
| 103 165 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 104 166 | 
             
                  rack (> 1, < 3)
         | 
| 105 | 
            -
                sprockets-rails (3.2. | 
| 167 | 
            +
                sprockets-rails (3.2.2)
         | 
| 106 168 | 
             
                  actionpack (>= 4.0)
         | 
| 107 169 | 
             
                  activesupport (>= 4.0)
         | 
| 108 170 | 
             
                  sprockets (>= 3.0.0)
         | 
| 109 171 | 
             
                sqlite3 (1.3.13)
         | 
| 110 | 
            -
                thor (1.0 | 
| 172 | 
            +
                thor (1.4.0)
         | 
| 111 173 | 
             
                thread_safe (0.3.6)
         | 
| 112 | 
            -
                 | 
| 174 | 
            +
                timeout (0.4.4)
         | 
| 175 | 
            +
                tzinfo (1.2.11)
         | 
| 113 176 | 
             
                  thread_safe (~> 0.1)
         | 
| 177 | 
            +
                unicode-display_width (2.6.0)
         | 
| 114 178 |  | 
| 115 179 | 
             
            PLATFORMS
         | 
| 116 180 | 
             
              ruby
         | 
| @@ -118,8 +182,11 @@ PLATFORMS | |
| 118 182 | 
             
            DEPENDENCIES
         | 
| 119 183 | 
             
              appraisal
         | 
| 120 184 | 
             
              minitest
         | 
| 185 | 
            +
              panolint
         | 
| 121 186 | 
             
              rails (= 4.2.11.1)
         | 
| 122 187 | 
             
              rake
         | 
| 188 | 
            +
              rubocop (~> 1.39)
         | 
| 189 | 
            +
              rubocop-rake
         | 
| 123 190 | 
             
              setler!
         | 
| 124 191 | 
             
              simplecov
         | 
| 125 192 | 
             
              sqlite3 (= 1.3.13)
         |