From 2a8ded94916118cf0de8520137a4a7e2cedcc710 Mon Sep 17 00:00:00 2001 From: Jacob Burroughs Date: Wed, 1 Mar 2023 16:36:49 -0600 Subject: [PATCH 1/3] Support newer rails and test against it --- .github/workflows/test-postgresql.yml | 17 ++++++++++------- Gemfile | 2 +- .../api/endpoints/teams_endpoint.rb | 2 +- .../models/team/methods.rb | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-postgresql.yml b/.github/workflows/test-postgresql.yml index 3d05f86..725f517 100644 --- a/.github/workflows/test-postgresql.yml +++ b/.github/workflows/test-postgresql.yml @@ -6,23 +6,25 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - entry: - - { ruby: 2.6.2, postgresql: 11 } - - { ruby: 3.1.1, postgresql: 11 } - - { ruby: 3.1.1, postgresql: 14 } - name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }}) + ruby: ['2.6.2', '3.1.1'] + postgresql: [11, 14] + active_record: ['~> 6.0.0', '~> 6.1.0', '~> 7.0.0'] + exclude: + - ruby: '2.6.2' + active_record: '~> 7.0.0' + name: test (ruby=${{ matrix.ruby }}, postgresql=${{ matrix.postgresql }}, active_record=${{ matrix.active_record }}) steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.entry.ruby }} + ruby-version: ${{ matrix.ruby }} - uses: browser-actions/setup-geckodriver@latest with: token: ${{ secrets.GITHUB_TOKEN }} - run: geckodriver --version - uses: harmon758/postgresql-action@v1 with: - postgresql version: ${{ matrix.entry.postgresql }} + postgresql version: ${{ matrix.postgresql }} postgresql db: slack_ruby_bot_server_test postgresql user: test postgresql password: password @@ -30,6 +32,7 @@ jobs: uses: GabrielBB/xvfb-action@v1 env: DATABASE_ADAPTER: activerecord + ACTIVERECORD_VERSION: ${{ matrix.active_record }} DATABASE_URL: postgres://test:password@localhost/slack_ruby_bot_server_test with: run: | diff --git a/Gemfile b/Gemfile index 64337f9..2eeb9df 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ when 'mongoid' then gem 'mongoid-scroll' gem 'mongoid-shell' when 'activerecord' then - gem 'activerecord', '~> 6.0.0' + gem 'activerecord', ENV['ACTIVERECORD_VERSION'] || '~> 6.0.0' gem 'otr-activerecord' gem 'pagy_cursor' gem 'pg' diff --git a/lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb b/lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb index 06f493c..7147f80 100644 --- a/lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb +++ b/lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb @@ -84,7 +84,7 @@ class TeamsEndpoint < Grape::API if team team.ping_if_active! - team.update_attributes!( + team.update!( oauth_version: oauth_version, oauth_scope: oauth_scope, activated_user_id: user_id, diff --git a/lib/slack-ruby-bot-server/models/team/methods.rb b/lib/slack-ruby-bot-server/models/team/methods.rb index d62bbf0..2b2dc1f 100644 --- a/lib/slack-ruby-bot-server/models/team/methods.rb +++ b/lib/slack-ruby-bot-server/models/team/methods.rb @@ -13,11 +13,11 @@ module Methods validates_presence_of :team_id def deactivate! - update_attributes!(active: false) + update!(active: false) end def activate!(token) - update_attributes!(active: true, token: token) + update!(active: true, token: token) end def to_s From 2b7e3da7caa479ad5a98edda2d246ca55492b972 Mon Sep 17 00:00:00 2001 From: Jacob Burroughs Date: Thu, 2 Mar 2023 08:00:38 -0600 Subject: [PATCH 2/3] Address feedback --- .github/workflows/test-postgresql.yml | 18 ++++++++---------- CHANGELOG.md | 1 + README.md | 1 + 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-postgresql.yml b/.github/workflows/test-postgresql.yml index 725f517..f395bec 100644 --- a/.github/workflows/test-postgresql.yml +++ b/.github/workflows/test-postgresql.yml @@ -6,25 +6,23 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: ['2.6.2', '3.1.1'] - postgresql: [11, 14] - active_record: ['~> 6.0.0', '~> 6.1.0', '~> 7.0.0'] - exclude: - - ruby: '2.6.2' - active_record: '~> 7.0.0' - name: test (ruby=${{ matrix.ruby }}, postgresql=${{ matrix.postgresql }}, active_record=${{ matrix.active_record }}) + entry: + - { ruby: 2.6.2, postgresql: 11, active_record: '~> 6.0.0' } + - { ruby: 3.1.1, postgresql: 11, active_record: '~> 6.1.0' } + - { ruby: 3.1.1, postgresql: 14, active_record: '~> 7.0.0' } + name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }}, active_record=${{ matrix.entry.active_record }}) steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby }} + ruby-version: ${{ matrix.entry.ruby }} - uses: browser-actions/setup-geckodriver@latest with: token: ${{ secrets.GITHUB_TOKEN }} - run: geckodriver --version - uses: harmon758/postgresql-action@v1 with: - postgresql version: ${{ matrix.postgresql }} + postgresql version: ${{ matrix.entry.postgresql }} postgresql db: slack_ruby_bot_server_test postgresql user: test postgresql password: password @@ -32,7 +30,7 @@ jobs: uses: GabrielBB/xvfb-action@v1 env: DATABASE_ADAPTER: activerecord - ACTIVERECORD_VERSION: ${{ matrix.active_record }} + ACTIVERECORD_VERSION: ${{ matrix.entry.active_record }} DATABASE_URL: postgres://test:password@localhost/slack_ruby_bot_server_test with: run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index c8ff75f..e4c7394 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### 2.0.2 (Next) * [#163](https://github.com/slack-ruby/slack-ruby-bot-server/pull/163): Updated releasing documentation - [@crazyoptimist](https://github.com/crazyoptimist). +* [#164](https://github.com/slack-ruby/slack-ruby-bot-server/pull/164): Support newer rails and test against it - [@maths22](https://github.com/maths22). * Your contribution here. #### 2.0.1 (2023/02/20) diff --git a/README.md b/README.md index f88abd8..258b5e8 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ gem 'slack-ruby-bot-server' #### ActiveRecord Use ActiveRecord with, for example, PostgreSQL via [pg](https://github.com/ged/ruby-pg). Add the `activerecord`, `pg`, `otr-activerecord` and `pagy_cursor` gems to your Gemfile. +Currently supports ActiveRecord/Rails major versions 6.0, 6.1 and 7.0. ``` gem 'pg' From ea5f44b57cb38f71711d4771c06f7c4d289edd7a Mon Sep 17 00:00:00 2001 From: Jacob Burroughs Date: Thu, 2 Mar 2023 08:42:17 -0600 Subject: [PATCH 3/3] Address more feedback --- CHANGELOG.md | 4 ++-- lib/slack-ruby-bot-server/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4c7394..bfc212b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ ### Changelog -### 2.0.2 (Next) +### 2.1.0 (Next) * [#163](https://github.com/slack-ruby/slack-ruby-bot-server/pull/163): Updated releasing documentation - [@crazyoptimist](https://github.com/crazyoptimist). -* [#164](https://github.com/slack-ruby/slack-ruby-bot-server/pull/164): Support newer rails and test against it - [@maths22](https://github.com/maths22). +* [#164](https://github.com/slack-ruby/slack-ruby-bot-server/pull/164): Support rails 6.1 and 7.0 and test against it - [@maths22](https://github.com/maths22). * Your contribution here. #### 2.0.1 (2023/02/20) diff --git a/lib/slack-ruby-bot-server/version.rb b/lib/slack-ruby-bot-server/version.rb index 0bb275c..088276d 100644 --- a/lib/slack-ruby-bot-server/version.rb +++ b/lib/slack-ruby-bot-server/version.rb @@ -1,3 +1,3 @@ module SlackRubyBotServer - VERSION = '2.0.2'.freeze + VERSION = '2.1.0'.freeze end