Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- dependencies
groups:
ruby-gems:
patterns:
- "*"

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 5
labels:
- dependencies
groups:
github-actions:
patterns:
- "*"
55 changes: 20 additions & 35 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,43 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ['3.1', '3.2', '3.3']
ruby-version: ['3.2', '3.3', '3.4']
gemfile:
- gemfiles/rails_7_0.gemfile
- gemfiles/rails_7_1.gemfile
- gemfiles/rails_7_2.gemfile
- gemfiles/rails_8_0.gemfile
- gemfiles/activerecord_7_0.gemfile
- gemfiles/rails_8_1.gemfile
- gemfiles/activerecord_7_1.gemfile
- gemfiles/activerecord_7_2.gemfile
- gemfiles/activerecord_8_0.gemfile
exclude:
- ruby-version: '3.1'
gemfile: gemfiles/rails_8_0.gemfile
- ruby-version: '3.1'
gemfile: gemfiles/activerecord_8_0.gemfile
- gemfiles/activerecord_8_1.gemfile

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install gems
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
run: bundle install

- name: Run tests
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
run: bundle exec rake
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Install gems
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
run: bundle install
- name: Run tests
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
run: bundle exec rake
3 changes: 3 additions & 0 deletions .rumdl.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[global]
exclude = ["AGENTS.md", "GEMINI.md", "CHANGELOG.md", "prompts/", "docs/**/*"]
disable = ["MD013", "MD033"]
20 changes: 10 additions & 10 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ skip_gems_snippet = <<~GEMS
end
GEMS

appraise 'rails-7-0' do
gem 'rails', '~> 7.0.0'
gem 'sqlite3', '~> 1.6'
eval(skip_gems_snippet)
end

appraise 'rails-7-1' do
gem 'rails', '~> 7.1.0'
gem 'sqlite3', '~> 2.0'
Expand All @@ -31,10 +25,9 @@ appraise 'rails-8-0' do
eval(skip_gems_snippet)
end

appraise 'activerecord-7-0' do
gem 'activerecord', '~> 7.0.0'
gem 'rake'
gem 'sqlite3', '~> 1.6'
appraise 'rails-8-1' do
gem 'rails', '~> 8.1.0'
gem 'sqlite3', '~> 2.0'
eval(skip_gems_snippet)
end

Expand All @@ -58,4 +51,11 @@ appraise 'activerecord-8-0' do
gem 'sqlite3', '~> 2.0'
eval(skip_gems_snippet)
end

appraise 'activerecord-8-1' do
gem 'activerecord', '~> 8.1.0'
gem 'rake'
gem 'sqlite3', '~> 2.0'
eval(skip_gems_snippet)
end
# rubocop:enable Security/Eval
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ gemspec
# gem 'byebug', group: [:development, :test]
#

# https://stackoverflow.com/questions/79360526/uninitialized-constant-activesupportloggerthreadsafelevellogger-nameerror
gem 'concurrent-ruby', '1.3.4'
gem 'minitest'
gem 'minitest-focus'
gem 'minitest-reporters'
gem 'tzinfo-data'

group :local_development do
gem 'appraisal'
gem 'overcommit'
gem 'pry'
gem 'rails', '>= 7.0'
gem 'rails', '>= 7.1'
gem 'reek'
gem 'rubocop', '~> 1.69.0'
gem 'rubocop', '~> 1.85'
gem 'sqlite3', '>= 1.4'
end
37 changes: 26 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# PpSql

[![Version ][rubygems_badge]][rubygems]
[![Codacy Badge ][codacy_badge]][codacy]
[![Reviewed by Hound ][hound_badge]][hound]
[<img src="https://api.gitsponsors.com/api/badge/img?id=78002099" height="20">](https://api.gitsponsors.com/api/badge/link?p=J9d+7zEGJS+BQMhX3FZDy2lWmzWp75oJZulj80NsvTrAkDEWcEC5PzkwUCDB/oqWGOfl1rwmFSi7crAJTxB6ww==)
[![Version][rubygems_badge]][rubygems]
[![Codacy Badge][codacy_badge]][codacy]
[![Reviewed by Hound][hound_badge]][hound]
[img src="https://api.gitsponsors.com/api/badge/img?id=78002099" height="20"](https://api.gitsponsors.com/api/badge/link?p=J9d+7zEGJS+BQMhX3FZDy2lWmzWp75oJZulj80NsvTrAkDEWcEC5PzkwUCDB/oqWGOfl1rwmFSi7crAJTxB6ww==)

Replace standard `ActiveRecord#to_sql` method with
[`anbt-sql-formatter`][anbt-sql-formatter-link]
Expand All @@ -22,21 +22,21 @@ Ruby 3.1+

## Rails

Rails 7.0+ (optional), will be injected automatically
Rails / ActiveRecord 7.1+ (optional), will be injected automatically

## Legacy

You can use version `~> 0.2` of this gem with Ruby 2.2, 2.3 and/or Rails 4.0, 4.1

## Usage

```
```text
Post.first.to_sql
```

for easy and clean usage with custom string you can use:

```
```text
class MyAwesomeDecoratedString < String
include PpSql::ToSqlBeautify
end
Expand All @@ -46,7 +46,7 @@ end

add in Gemfile

```
```text
gem 'pp_sql', group: :development
```

Expand All @@ -73,7 +73,7 @@ in initializers.

I found usefull this trick:

```
```text
class ApplicationRecord < ActiveRecord::Base
include PpSql::ToSqlBeautify if defined?(Rails::Console)

Expand All @@ -87,8 +87,23 @@ end

## Contributing

Running the tests requires sqlite. To run the tests for different combinations of dependency
versions, run `bundle exec appraisal install` followed by `bundle exec appraisal rake`.
Running the tests requires sqlite.

To refresh the generated appraisal gemfiles:

```bash
bundle exec appraisal generate
```

To run the maintained dependency matrix locally:

```bash
bundle exec appraisal install
bundle exec appraisal rake
```

GitHub Actions runs the Rails / ActiveRecord `7.1`, `7.2`, `8.0`, and `8.1`
matrix on Ruby `3.2`, `3.3`, and `3.4`.

## License

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/activerecord_7_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "concurrent-ruby", "1.3.4"
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "tzinfo-data"
gem "activerecord", "~> 7.1.0"
gem "rake"
gem "sqlite3", "~> 2.0"
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/activerecord_7_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "concurrent-ruby", "1.3.4"
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "tzinfo-data"
gem "activerecord", "~> 7.2.0"
gem "rake"
gem "sqlite3", "~> 2.0"
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/activerecord_8_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "concurrent-ruby", "1.3.4"
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "tzinfo-data"
gem "activerecord", "~> 8.0.0"
gem "rake"
gem "sqlite3", "~> 2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

source "https://rubygems.org"

gem "concurrent-ruby", "1.3.4"
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "activerecord", "~> 7.0.0"
gem "tzinfo-data"
gem "activerecord", "~> 8.1.0"
gem "rake"
gem "sqlite3", "~> 1.6"
gem "sqlite3", "~> 2.0"

group :local_development do

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_7_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "concurrent-ruby", "1.3.4"
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "tzinfo-data"
gem "rails", "~> 7.1.0"
gem "sqlite3", "~> 2.0"

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_7_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "concurrent-ruby", "1.3.4"
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "tzinfo-data"
gem "rails", "~> 7.2.0"
gem "sqlite3", "~> 2.0"

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_8_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source "https://rubygems.org"

gem "concurrent-ruby", "1.3.4"
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "tzinfo-data"
gem "rails", "~> 8.0.0"
gem "sqlite3", "~> 2.0"

Expand Down
6 changes: 3 additions & 3 deletions gemfiles/rails_7_0.gemfile → gemfiles/rails_8_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

source "https://rubygems.org"

gem "concurrent-ruby", "1.3.4"
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "rails", "~> 7.0.0"
gem "sqlite3", "~> 1.6"
gem "tzinfo-data"
gem "rails", "~> 8.1.0"
gem "sqlite3", "~> 2.0"

group :local_development do

Expand Down
2 changes: 1 addition & 1 deletion lib/pp_sql/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module PpSql
VERSION = '2.1.0'
VERSION = '2.2.0'
end
1 change: 1 addition & 0 deletions test/pp_sql_rails_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
module TeatApp
class Application < Rails::Application
config.eager_load = false
config.load_defaults Gem::Version.new(Rails.version).segments.first(2).join('.').to_f
initialize!
end
end
Expand Down
Loading