pg_search 2.3.5 → 2.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2c29f81bcee1e1547d17ae1eda7c5a71e1f43d4891cc1e66ec8e7f648473698
4
- data.tar.gz: 68e7d896513f774004f9259fcc2aa88cb6fc687783be02bd9abbb21466e6c989
3
+ metadata.gz: 43a62057153fd9e33ed21bc6ce1a420b5fbeaad46e9b047bd1e039c9c7ab6ad2
4
+ data.tar.gz: 15759abc9542c0b7ddc6060e156e7eff74d78cceef5bb06c4bdfa562e029722b
5
5
  SHA512:
6
- metadata.gz: b1a224c8783e84a25aea02720ab06cb191c9a175c2416a9a1584e4a088845bc9b4d5e6a80eb73d06b7f4cabd933c770f386131b9cd52988626f200954770fa5b
7
- data.tar.gz: 0744e0552c490b4e334334a23044d19aeae2cea28106fe09528add0a91c80bd9c7f507acb7a3c017df5d375cbf1a7bf590f6cb405ba066b8e4cc13b99f19904d
6
+ metadata.gz: 6c1fc5c20a82e45a4fd6381fc56fd940dcd85cce2039e2e7f5159e0c939146d0176f1970481c29205bd7d7737022007d3d78cddc3fa93603a67221fa272d1a4e
7
+ data.tar.gz: 06a4f487a2cef2fd7b55bf5f650f6e13cec3528b6514f72e6dce69943c67d879f42c795d46c7aa442b2abfe789e4459f10437df94e955f9bfbe54968e9297e39
@@ -0,0 +1,75 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ - github-actions
8
+ pull_request:
9
+ branches:
10
+ - master
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ services:
16
+ postgres:
17
+ image: postgres:latest
18
+ env:
19
+ POSTGRES_USER: postgres
20
+ POSTGRES_PASSWORD: postgres
21
+ options: >-
22
+ --health-cmd pg_isready
23
+ --health-interval 10s
24
+ --health-timeout 5s
25
+ --health-retries 5
26
+ ports:
27
+ - 5432:5432
28
+ env:
29
+ CI: true
30
+ PGHOST: 127.0.0.1
31
+ PGUSER: postgres
32
+ PGPASS: postgres
33
+ strategy:
34
+ fail-fast: false
35
+ matrix:
36
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
37
+ active-record-version-env:
38
+ - ACTIVE_RECORD_VERSION="~> 5.2.0"
39
+ - ACTIVE_RECORD_VERSION="~> 6.0.0"
40
+ - ACTIVE_RECORD_VERSION="~> 6.1.0"
41
+ - ACTIVE_RECORD_VERSION="~> 7.0.0"
42
+ allow-failure: [false]
43
+ include:
44
+ - ruby-version: '3.1'
45
+ active-record-version-env: ACTIVE_RECORD_BRANCH="7-0-stable"
46
+ allow-failure: true
47
+ - ruby-version: '3.1'
48
+ active-record-version-env: ACTIVE_RECORD_BRANCH="6-1-stable"
49
+ allow-failure: true
50
+ exclude:
51
+ - ruby-version: '3.0'
52
+ active-record-version-env: ACTIVE_RECORD_VERSION="~> 5.2.0"
53
+ allow-failure: false
54
+ - ruby-version: '3.1'
55
+ active-record-version-env: ACTIVE_RECORD_VERSION="~> 5.2.0"
56
+ allow-failure: false
57
+ - ruby-version: '2.6'
58
+ active-record-version-env: ACTIVE_RECORD_VERSION="~> 7.0.0"
59
+ allow-failure: false
60
+ continue-on-error: ${{ matrix.allow-failure }}
61
+ steps:
62
+ - uses: actions/checkout@v2
63
+ - name: Set up Ruby
64
+ uses: ruby/setup-ruby@v1
65
+ with:
66
+ ruby-version: ${{ matrix.ruby-version }}
67
+ bundler-cache: true
68
+ - name: Set up test database
69
+ env:
70
+ PGPASSWORD: postgres
71
+ run: createdb pg_search_test
72
+ - name: Update bundle
73
+ run: ${{ matrix.active-record-version-env }} bundle update
74
+ - name: Run tests
75
+ run: ${{ matrix.active-record-version-env }} bundle exec rake
data/.rubocop.yml CHANGED
@@ -5,7 +5,7 @@ require:
5
5
  - rubocop-rspec
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.5
8
+ TargetRubyVersion: 2.6
9
9
  NewCops: enable
10
10
  Exclude:
11
11
  - bin/**/*
@@ -132,3 +132,6 @@ RSpec/MultipleExpectations:
132
132
 
133
133
  RSpec/ExampleLength:
134
134
  Max: 15
135
+
136
+ Rails/RakeEnvironment:
137
+ Enabled: false
data/.travis.yml CHANGED
@@ -3,40 +3,35 @@ bundler_args: --binstubs
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 2.7.2
7
- - 2.6.6
8
- - 2.5.8
9
- - jruby-9.2.13.0
6
+ - 3.0.1
7
+ - 2.7.3
8
+ - 2.6.7
10
9
 
11
10
  services:
12
11
  - postgresql
13
12
 
14
13
  env:
15
- global:
16
- - CC_TEST_REPORTER_ID=0a0e3e45118bc447e677d52c21d056a5471c4921d54f96ed7b2550d9fc5043ea
17
- matrix:
18
- - ACTIVE_RECORD_BRANCH="master"
14
+ jobs:
15
+ - ACTIVE_RECORD_BRANCH="main"
19
16
  - ACTIVE_RECORD_BRANCH="6-1-stable"
20
17
  - ACTIVE_RECORD_BRANCH="6-0-stable"
21
- - ACTIVE_RECORD_VERSION="~> 6.1.0.rc1"
18
+ - ACTIVE_RECORD_VERSION="~> 6.1.0"
22
19
  - ACTIVE_RECORD_VERSION="~> 6.0.0"
23
20
  - ACTIVE_RECORD_VERSION="~> 5.2.0"
24
21
 
25
- matrix:
22
+ jobs:
26
23
  allow_failures:
27
- - env: ACTIVE_RECORD_BRANCH="master"
24
+ - env: ACTIVE_RECORD_BRANCH="main"
28
25
  - env: ACTIVE_RECORD_BRANCH="6-0-stable"
29
26
  - env: ACTIVE_RECORD_BRANCH="6-1-stable"
30
- - env: ACTIVE_RECORD_VERSION="~> 6.1.0.rc1"
27
+ exclude:
28
+ - rvm: 3.0.1
29
+ env: ACTIVE_RECORD_VERSION="~> 5.2.0"
30
+ - rvm: 2.6.7
31
+ env: ACTIVE_RECORD_BRANCH="main"
31
32
 
32
33
  before_script:
33
34
  - psql --version
34
35
  - psql -c 'create database pg_search_test;' -U postgres >/dev/null
35
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
36
- - chmod +x ./cc-test-reporter
37
- - ./cc-test-reporter before-build
38
36
 
39
37
  script: bin/rake
40
-
41
- after_script:
42
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # pg_search changelog
2
2
 
3
+ ## 2.3.6
4
+
5
+ * Drop support for Ruby 2.5
6
+ * Support Ruby 3.1
7
+ * Support Active Record 7.0
8
+ * Don't require `:against` if `:tsvector_column` is specified (Travis Hunter)
9
+ * Optionally disable transaction when rebuilding documents (Travis Hunter)
10
+ * Preserve columns when chaining ::with_pg_search_highlight (jcsanti)
11
+
3
12
  ## 2.3.5
4
13
 
5
14
  * Add table of contents to README (Barry Woolgar)
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2020 Casebook, PBC <http://www.casebook.net>
1
+ Copyright (c) 2010-2021 Casebook, PBC <http://www.casebook.net>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,10 +1,7 @@
1
1
  # [pg_search](http://github.com/Casecommons/pg_search/)
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/pg_search.svg?style=flat)](https://rubygems.org/gems/pg_search)
4
- [![Build Status](https://secure.travis-ci.org/Casecommons/pg_search.svg?branch=master)](https://travis-ci.org/Casecommons/pg_search)
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/ae1a7c021e473e9b2486/maintainability)](https://codeclimate.com/github/Casecommons/pg_search/maintainability)
6
- [![Test Coverage](https://codeclimate.com/github/Casecommons/pg_search/badges/coverage.svg)](https://codeclimate.com/github/Casecommons/pg_search/coverage)
7
- [![Inline docs](http://inch-ci.org/github/Casecommons/pg_search.svg?branch=master&style=flat)](http://inch-ci.org/github/Casecommons/pg_search)
4
+ [![Build Status](https://github.com/Casecommons/pg_search/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Casecommons/pg_search/actions/workflows/ci.yml)
8
5
  [![Join the chat at https://gitter.im/Casecommons/pg_search](https://img.shields.io/badge/gitter-join%20chat-blue.svg)](https://gitter.im/Casecommons/pg_search?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
9
6
 
10
7
  ## DESCRIPTION
@@ -12,11 +9,11 @@
12
9
  PgSearch builds named scopes that take advantage of PostgreSQL's full text
13
10
  search.
14
11
 
15
- Read the blog post introducing PgSearch at https://content.pivotal.io/blog/pg-search-how-i-learned-to-stop-worrying-and-love-postgresql-full-text-search
12
+ Read the blog post introducing PgSearch at https://tanzu.vmware.com/content/blog/pg-search-how-i-learned-to-stop-worrying-and-love-postgresql-full-text-search
16
13
 
17
14
  ## REQUIREMENTS
18
15
 
19
- * Ruby 2.5+
16
+ * Ruby 2.6+
20
17
  * ActiveRecord 5.2+
21
18
  * PostgreSQL 9.2+
22
19
  * [PostgreSQL extensions](https://github.com/Casecommons/pg_search/wiki/Installing-PostgreSQL-Extensions) for certain features
@@ -319,7 +316,7 @@ To remove all of the documents for a given class, you can simply delete all of
319
316
  the PgSearch::Document records.
320
317
 
321
318
  ```ruby
322
- PgSearch::Document.delete_all(searchable_type: "Animal")
319
+ PgSearch::Document.delete_by(searchable_type: "Animal")
323
320
  ```
324
321
 
325
322
  To regenerate the documents for a given class, run:
@@ -338,6 +335,13 @@ like so:
338
335
  PgSearch::Multisearch.rebuild(Product, clean_up: false)
339
336
  ```
340
337
 
338
+ ```rebuild``` runs inside a single transaction. To run outside of a transaction,
339
+ you can pass ```transactional: false``` like so:
340
+
341
+ ```ruby
342
+ PgSearch::Multisearch.rebuild(Product, transactional: false)
343
+ ```
344
+
341
345
  Rebuild is also available as a Rake task, for convenience.
342
346
 
343
347
  $ rake pg_search:multisearch:rebuild[BlogPost]
@@ -383,7 +387,7 @@ class Movie < ActiveRecord::Base
383
387
  INSERT INTO pg_search_documents (searchable_type, searchable_id, content, created_at, updated_at)
384
388
  SELECT 'Movie' AS searchable_type,
385
389
  movies.id AS searchable_id,
386
- (movies.name || ' ' || directors.name) AS content,
390
+ CONCAT_WS(' ', movies.name, directors.name) AS content,
387
391
  now() AS created_at,
388
392
  now() AS updated_at
389
393
  FROM movies
@@ -393,6 +397,7 @@ class Movie < ActiveRecord::Base
393
397
  end
394
398
  end
395
399
  ```
400
+ **Note:** If using PostgreSQL before 9.1, replace the `CONCAT_WS()` function call with double-pipe concatenation, eg. `(movies.name || ' ' || directors.name)`. However, now be aware that if *any* of the joined values is NULL then the final `content` value will also be NULL, whereas `CONCAT_WS()` will selectively ignore NULL values.
396
401
 
397
402
  #### Disabling multi-search indexing temporarily
398
403
 
@@ -1196,5 +1201,5 @@ for discussing pg_search and other Casebook PBC open source projects.
1196
1201
 
1197
1202
  ## LICENSE
1198
1203
 
1199
- Copyright © 2010–2019 [Casebook PBC](http://www.casebook.net).
1204
+ Copyright © 2010–2021 [Casebook PBC](http://www.casebook.net).
1200
1205
  Licensed under the MIT license, see [LICENSE](/LICENSE) file.
data/Rakefile CHANGED
@@ -11,4 +11,10 @@ RuboCop::RakeTask.new do |t|
11
11
  t.options = %w[--display-cop-names]
12
12
  end
13
13
 
14
- task default: %w[spec rubocop]
14
+ desc "Check test coverage"
15
+ task :undercover do
16
+ system("git fetch --unshallow") if ENV["CI"]
17
+ exit(1) unless system("bin/undercover --compare origin/master")
18
+ end
19
+
20
+ task default: %w[spec rubocop undercover]
@@ -92,8 +92,11 @@ module PgSearch
92
92
  }.freeze
93
93
 
94
94
  def assert_valid_options(options)
95
- unless options[:against] || options[:associated_against]
96
- raise ArgumentError, "the search scope #{@name} must have :against or :associated_against in its options"
95
+ unless options[:against] || options[:associated_against] || using_tsvector_column?(options[:using])
96
+ raise(
97
+ ArgumentError,
98
+ "the search scope #{@name} must have :against, :associated_against, or :tsvector_column in its options"
99
+ )
97
100
  end
98
101
 
99
102
  options.assert_valid_keys(VALID_KEYS)
@@ -104,5 +107,12 @@ module PgSearch
104
107
  end
105
108
  end
106
109
  end
110
+
111
+ def using_tsvector_column?(options)
112
+ return unless options.is_a?(Hash)
113
+
114
+ options.dig(:dmetaphone, :tsvector_column).present? ||
115
+ options.dig(:tsearch, :tsvector_column).present?
116
+ end
107
117
  end
108
118
  end
@@ -10,7 +10,7 @@ module PgSearch
10
10
  %i[only sort_only]
11
11
  end
12
12
 
13
- delegate :connection, :quoted_table_name, to: :'@model'
13
+ delegate :connection, :quoted_table_name, to: :@model
14
14
 
15
15
  def initialize(query, options, all_columns, model, normalizer)
16
16
  @query = query
@@ -132,7 +132,7 @@ module PgSearch
132
132
  def tsquery
133
133
  return "''" if query.blank?
134
134
 
135
- query_terms = query.split(" ").compact
135
+ query_terms = query.split.compact
136
136
  tsquery_terms = query_terms.map { |term| tsquery_for_term(term) }
137
137
  tsquery_terms.join(options[:any_word] ? ' || ' : ' && ')
138
138
  end
@@ -5,7 +5,7 @@ require "pg_search/multisearch/rebuilder"
5
5
  module PgSearch
6
6
  module Multisearch
7
7
  class << self
8
- def rebuild(model, deprecated_clean_up = nil, clean_up: true)
8
+ def rebuild(model, deprecated_clean_up = nil, clean_up: true, transactional: true)
9
9
  unless deprecated_clean_up.nil?
10
10
  ActiveSupport::Deprecation.warn(
11
11
  "pg_search 3.0 will no longer accept a boolean second argument to PgSearchMultisearch.rebuild, " \
@@ -14,11 +14,19 @@ module PgSearch
14
14
  clean_up = deprecated_clean_up
15
15
  end
16
16
 
17
- model.transaction do
18
- PgSearch::Document.where(searchable_type: model.base_class.name).delete_all if clean_up
19
- Rebuilder.new(model).rebuild
17
+ if transactional
18
+ model.transaction { execute(model, clean_up) }
19
+ else
20
+ execute(model, clean_up)
20
21
  end
21
22
  end
23
+
24
+ private
25
+
26
+ def execute(model, clean_up)
27
+ PgSearch::Document.where(searchable_type: model.base_class.name).delete_all if clean_up
28
+ Rebuilder.new(model).rebuild
29
+ end
22
30
  end
23
31
 
24
32
  class ModelNotMultisearchable < StandardError
@@ -37,11 +37,8 @@ module PgSearch
37
37
 
38
38
  def with_pg_search_highlight
39
39
  scope = self
40
- scope.select(pg_search_highlight_field)
41
- end
42
-
43
- def pg_search_highlight_field
44
- "(#{highlight}) AS pg_search_highlight, #{table_name}.*"
40
+ scope = scope.select("#{table_name}.*") unless scope.select_values.any?
41
+ scope.select("(#{highlight}) AS pg_search_highlight")
45
42
  end
46
43
 
47
44
  def highlight
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgSearch
4
- VERSION = '2.3.5'
4
+ VERSION = '2.3.6'
5
5
  end
data/lib/pg_search.rb CHANGED
@@ -57,14 +57,14 @@ module PgSearch
57
57
  class PgSearchRankNotSelected < StandardError
58
58
  def message
59
59
  "You must chain .with_pg_search_rank after the pg_search_scope " \
60
- "to access the pg_search_rank attribute on returned records"
60
+ "to access the pg_search_rank attribute on returned records"
61
61
  end
62
62
  end
63
63
 
64
64
  class PgSearchHighlightNotSelected < StandardError
65
65
  def message
66
66
  "You must chain .with_pg_search_highlight after the pg_search_scope " \
67
- "to access the pg_search_highlight attribute on returned records"
67
+ "to access the pg_search_highlight attribute on returned records"
68
68
  end
69
69
  end
70
70
  end
data/pg_search.gemspec CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
13
13
  s.summary = "PgSearch builds Active Record named scopes that take advantage of PostgreSQL's full text search"
14
14
  s.description = "PgSearch builds Active Record named scopes that take advantage of PostgreSQL's full text search"
15
15
  s.licenses = ['MIT']
16
+ s.metadata["rubygems_mfa_required"] = "true"
16
17
 
17
18
  s.files = `git ls-files`.split("\n")
18
19
  s.test_files = `git ls-files -- spec/*`.split("\n")
@@ -30,8 +31,10 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
30
31
  s.add_development_dependency 'rubocop-rake'
31
32
  s.add_development_dependency 'rubocop-rspec'
32
33
  s.add_development_dependency 'simplecov'
34
+ s.add_development_dependency 'simplecov-lcov'
35
+ s.add_development_dependency 'undercover'
33
36
  s.add_development_dependency 'warning'
34
37
  s.add_development_dependency 'with_model'
35
38
 
36
- s.required_ruby_version = '>= 2.5'
39
+ s.required_ruby_version = '>= 2.6'
37
40
  end
@@ -140,6 +140,22 @@ describe "an Active Record model which includes PgSearch" do
140
140
  }.to raise_error(ArgumentError, /against/)
141
141
  end
142
142
  end
143
+
144
+ context "when a tsvector column is specified" do
145
+ it "does not raise an exception when invoked" do
146
+ ModelWithPgSearch.pg_search_scope :with_unknown_ignoring, {
147
+ using: {
148
+ tsearch: {
149
+ tsvector_column: "tsv"
150
+ }
151
+ }
152
+ }
153
+
154
+ expect {
155
+ ModelWithPgSearch.with_unknown_ignoring("foo")
156
+ }.not_to raise_error
157
+ end
158
+ end
143
159
  end
144
160
  end
145
161
  end
@@ -407,6 +423,15 @@ describe "an Active Record model which includes PgSearch" do
407
423
  expect(results).to eq([winner, loser])
408
424
  end
409
425
 
426
+ it 'preserves column selection when with_pg_search_rank is chained after a select()' do
427
+ loser = ModelWithPgSearch.create!(title: 'foo', content: 'bar')
428
+
429
+ results = ModelWithPgSearch.search_content('bar').select(:content).with_pg_search_rank
430
+
431
+ expect(results.length).to be 1
432
+ expect(results.first.as_json.keys).to contain_exactly('id', 'content', 'pg_search_rank')
433
+ end
434
+
410
435
  it 'allows pg_search_rank along with a join' do
411
436
  parent_1 = ParentModel.create!(id: 98)
412
437
  parent_2 = ParentModel.create!(id: 99)
@@ -614,7 +639,7 @@ describe "an Active Record model which includes PgSearch" do
614
639
  describe "highlighting" do
615
640
  before do
616
641
  ["Strip Down", "Down", "Down and Out", "Won't Let You Down"].each do |name|
617
- ModelWithPgSearch.create! content: name
642
+ ModelWithPgSearch.create! title: 'Just a title', content: name
618
643
  end
619
644
  end
620
645
 
@@ -635,6 +660,12 @@ describe "an Active Record model which includes PgSearch" do
635
660
 
636
661
  expect(result.pg_search_highlight).to eq("Won't <b>Let</b> You Down")
637
662
  end
663
+
664
+ it 'preserves column selection when with_pg_search_highlight is chained after a select()' do
665
+ result = ModelWithPgSearch.search_content("Let").select(:content).with_pg_search_highlight.first
666
+
667
+ expect(result.as_json.keys).to contain_exactly('id', 'content', 'pg_search_highlight')
668
+ end
638
669
  end
639
670
 
640
671
  context "with custom highlighting options" do
@@ -16,7 +16,7 @@ describe PgSearch::Features::Trigram do
16
16
  ]
17
17
  }
18
18
  let(:normalizer) { PgSearch::Normalizer.new(config) }
19
- let(:config) { OpenStruct.new(ignore: []) }
19
+ let(:config) { OpenStruct.new(ignore: []) } # rubocop:disable Style/OpenStructUse
20
20
 
21
21
  let(:coalesced_columns) do
22
22
  <<~SQL.squish
@@ -33,6 +33,15 @@ describe PgSearch::Multisearch do
33
33
  expect(model).to have_received(:transaction).once
34
34
  end
35
35
 
36
+ context "when transactional is false" do
37
+ it "does not operate inside a transaction" do
38
+ allow(model).to receive(:transaction)
39
+
40
+ described_class.rebuild(model, transactional: false)
41
+ expect(model).not_to have_received(:transaction)
42
+ end
43
+ end
44
+
36
45
  describe "cleaning up search documents for this model" do
37
46
  before do
38
47
  connection.execute <<~SQL.squish
@@ -2,9 +2,9 @@
2
2
 
3
3
  require "spec_helper"
4
4
 
5
- # For Active Record 5.x and 6.0, the association reflection's cache needs be cleared
5
+ # For Active Record 5.x, the association reflection's cache needs be cleared
6
6
  # because we're stubbing the related constants.
7
- if ActiveRecord::VERSION::MAJOR == 5 || (ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR == 0)
7
+ if ActiveRecord::VERSION::MAJOR == 5
8
8
  def clear_searchable_cache
9
9
  PgSearch::Document.reflect_on_association(:searchable).clear_association_scope_cache
10
10
  end
data/spec/spec_helper.rb CHANGED
@@ -4,8 +4,16 @@ require 'warning'
4
4
  # Ignore Ruby 2.7 warnings from Active Record
5
5
  Warning.ignore :keyword_separation
6
6
 
7
+ # https://github.com/grodowski/undercover#setting-up-required-lcov-reporting
7
8
  require 'simplecov'
8
- SimpleCov.start
9
+ require 'simplecov-lcov'
10
+ SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
11
+ SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
12
+ SimpleCov.start do
13
+ add_filter(%r{^/spec/})
14
+ enable_coverage(:branch)
15
+ end
16
+ require 'undercover'
9
17
 
10
18
  require "bundler/setup"
11
19
  require "pg_search"
@@ -10,10 +10,12 @@ else
10
10
  end
11
11
 
12
12
  begin
13
- ActiveRecord::Base.establish_connection(adapter: 'postgresql',
14
- database: 'pg_search_test',
15
- username: (ENV["TRAVIS"] ? "postgres" : ENV["USER"]),
16
- min_messages: 'warning')
13
+ connection_options = { adapter: 'postgresql', database: 'pg_search_test', min_messages: 'warning' }
14
+ if ENV["CI"]
15
+ connection_options[:username] = 'postgres'
16
+ connection_options[:password] = 'postgres'
17
+ end
18
+ ActiveRecord::Base.establish_connection(connection_options)
17
19
  connection = ActiveRecord::Base.connection
18
20
  connection.execute("SELECT 1")
19
21
  rescue ERROR_CLASS, ActiveRecord::NoDatabaseError => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.5
4
+ version: 2.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Hutchins
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-11-16 00:00:00.000000000 Z
12
+ date: 2022-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -165,6 +165,34 @@ dependencies:
165
165
  - - ">="
166
166
  - !ruby/object:Gem::Version
167
167
  version: '0'
168
+ - !ruby/object:Gem::Dependency
169
+ name: simplecov-lcov
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ type: :development
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ - !ruby/object:Gem::Dependency
183
+ name: undercover
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
168
196
  - !ruby/object:Gem::Dependency
169
197
  name: warning
170
198
  requirement: !ruby/object:Gem::Requirement
@@ -202,11 +230,11 @@ executables: []
202
230
  extensions: []
203
231
  extra_rdoc_files: []
204
232
  files:
205
- - ".autotest"
206
233
  - ".bundle/config"
207
234
  - ".codeclimate.yml"
208
235
  - ".editorconfig"
209
236
  - ".github/dependabot.yml"
237
+ - ".github/workflows/ci.yml"
210
238
  - ".gitignore"
211
239
  - ".jrubyrc"
212
240
  - ".rspec"
@@ -271,7 +299,8 @@ files:
271
299
  homepage: https://github.com/Casecommons/pg_search
272
300
  licenses:
273
301
  - MIT
274
- metadata: {}
302
+ metadata:
303
+ rubygems_mfa_required: 'true'
275
304
  post_install_message:
276
305
  rdoc_options: []
277
306
  require_paths:
@@ -280,14 +309,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
280
309
  requirements:
281
310
  - - ">="
282
311
  - !ruby/object:Gem::Version
283
- version: '2.5'
312
+ version: '2.6'
284
313
  required_rubygems_version: !ruby/object:Gem::Requirement
285
314
  requirements:
286
315
  - - ">="
287
316
  - !ruby/object:Gem::Version
288
317
  version: '0'
289
318
  requirements: []
290
- rubygems_version: 3.1.4
319
+ rubygems_version: 3.3.3
291
320
  signing_key:
292
321
  specification_version: 4
293
322
  summary: PgSearch builds Active Record named scopes that take advantage of PostgreSQL's
data/.autotest DELETED
@@ -1,5 +0,0 @@
1
- Autotest.add_hook :initialize do |at|
2
- at.add_mapping(%r%^lib/.*\.rb$%, true) { |filename, _|
3
- at.files_matching %r%^spec/.*_spec.rb$%
4
- }
5
- end