Skip to content

Commit

Permalink
Add support for trilogy (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkamel authored May 30, 2024
1 parent f78edbc commit b49d05d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 7 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
rails: ["rails5", "rails6", "rails7"]
database: ["sqlite", "postgres", "mysql"]
adapter: ["default"]
exclude:
- ruby: "3.0"
rails: "rails5"
- ruby: "3.1"
rails: "rails5"
- ruby: "3.2"
rails: "rails5"
- ruby: "3.3"
rails: "rails5"
include:
- ruby: "3.3"
rails: "rails7"
database: "mysql"
adapter: "trilogy"
services:
postgres:
image: styriadigital/postgres_hstore:10
Expand Down Expand Up @@ -43,6 +51,7 @@ jobs:
- name: test
env:
DATABASE: ${{ matrix.database }}
ADAPTER: ${{ matrix.adapter }}
run: |
bundle config set --local gemfile "gemfiles/${{ matrix.rails }}.gemfile"
bundle install
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# Changelog

Version 1.4.0:

* Add support for the trilogy mysql connection adapter

Version 1.3.0:

* Support json fields for postgres, mysql and sqlite
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails6.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ platforms :ruby do
gem "pg"
gem "rake"
gem "rubocop"
gem "sqlite3"
gem "sqlite3", "~> 1.7"
end

gemspec path: "../"
3 changes: 2 additions & 1 deletion gemfiles/rails7.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ platforms :ruby do
gem "factory_bot"
gem "minitest"
gem "mysql2"
gem "trilogy"
gem "pg"
gem "rake"
gem "rubocop"
gem "sqlite3"
gem "sqlite3", "~> 1.7"
end

gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/search_cop/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SearchCop
VERSION = "1.3.0"
VERSION = "1.4.0"
end
2 changes: 1 addition & 1 deletion lib/search_cop/visitors/visitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Visitor
def initialize(connection)
@connection = connection

extend(SearchCop::Visitors::Mysql) if @connection.adapter_name =~ /mysql/i
extend(SearchCop::Visitors::Mysql) if @connection.adapter_name =~ /mysql|trilogy/i
extend(SearchCop::Visitors::Postgres) if @connection.adapter_name =~ /postgres|postgis/i
extend(SearchCop::Visitors::Sqlite) if @connection.adapter_name =~ /sqlite/i
end
Expand Down
2 changes: 1 addition & 1 deletion test/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sqlite:
database: ":memory:"

mysql:
adapter: mysql2
adapter: <%= ENV["DATABASE"] == "mysql" && ENV["ADAPTER"] == "trilogy" ? "trilogy" : "mysql2" %>
database: search_cop
host: 127.0.0.1
username: root
Expand Down
3 changes: 2 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ class SearchCop::TestCase < Minitest::Unit::TestCase; end
require "active_record"
require "factory_bot"
require "yaml"
require "erb"

DATABASE = ENV["DATABASE"] || "sqlite"

ActiveRecord::Base.establish_connection YAML.load_file(File.expand_path("database.yml", __dir__))[DATABASE]
ActiveRecord::Base.establish_connection YAML.load(ERB.new(File.read(File.expand_path("database.yml", __dir__))).result)[DATABASE]

class User < ActiveRecord::Base; end

Expand Down

0 comments on commit b49d05d

Please sign in to comment.