alchemy-pg_search 7.4.0 → 8.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e00888216dd93910987461a26a8638880587c9ada33cf2406216dea03e05554
4
- data.tar.gz: 8c96b6b2bafec9df42017106b016587d62c51b33d462c0674218b39d06168033
3
+ metadata.gz: 62c44d2e487f8296eb9f4739662d146f66b1777259c4aeaf650989166afa5ab4
4
+ data.tar.gz: 39b4b40b8ac6db6eb3c0c951c2d9a2fdb687138a57a70547d0e1e76ac322fac0
5
5
  SHA512:
6
- metadata.gz: 19e2ac77874ac9a99110419d813f907ee8895f83cfc91140bf3c4af9451e95a722e10e5a87a3379caa30e65bff2c3ba6314e0fe7f719aec5029bd231638de00d
7
- data.tar.gz: 7465ebc5e8b3080a3551e686ac31917da67bdd226ebe8e9aee49d15259b2eaa562f7d7ea6f97f387139e94cf28f48f91193af5afc0c0f1c2a7d2117c4c9dd1d6
6
+ metadata.gz: 7e68e94e0931c5bb4e6fa0f12eb77cc0222ffac071995b745daafdce847082b9f2c63e902a213c6046bf8a669c8dd7a272bb6d2d841aef5278f6b6bee356c182
7
+ data.tar.gz: 86246d85296783101bc52999e42e39a83955e2f0649e7499d7b5bf1e41aa72fca47ba1422dbcd2911c1d4c029032a05d7bd96521c4c6a061a5ca147429f6fa02
@@ -17,7 +17,7 @@ jobs:
17
17
  fail-fast: false
18
18
  matrix:
19
19
  ruby: ["3.2", "3.4"]
20
- alchemy_cms: ["7.4"]
20
+ alchemy_cms: ["8.0"]
21
21
  env:
22
22
  RAILS_ENV: test
23
23
  ALCHEMY_CMS_VERSION: ${{ matrix.alchemy_cms }}
@@ -6,6 +6,7 @@ on:
6
6
  types: [closed]
7
7
  branches:
8
8
  - main
9
+ - '*-stable'
9
10
 
10
11
  jobs:
11
12
  publish:
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ yarn.lock
15
15
 
16
16
  .idea
17
17
  .vscode
18
+ .claude/
data/CHANGELOG.md CHANGED
@@ -1,14 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## 7.4.0 (2026-03-17)
3
+ ## 8.0.0 (2026-03-17)
4
4
 
5
5
  ## What's Changed
6
- * Add reusable release workflows by @tvdeyen in https://github.com/AlchemyCMS/alchemy-pg_search/pull/64
7
- * Pass rubygems_api_key secret to release workflow by @tvdeyen in https://github.com/AlchemyCMS/alchemy-pg_search/pull/65
8
- * Update Alchemy to v7.4.x by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/68
6
+ * Add bin/setup script by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/70
7
+ * Upgrade Alchemy v8.0 by @sascha-karnatz in https://github.com/AlchemyCMS/alchemy-pg_search/pull/69
9
8
 
10
9
 
11
- **Full Changelog**: https://github.com/AlchemyCMS/alchemy-pg_search/compare/v6.1.0...v7.4.0
10
+ **Full Changelog**: https://github.com/AlchemyCMS/alchemy-pg_search/compare/v7.4.0...v8.0.0
12
11
 
13
12
  ## [v6.1.0](https://github.com/AlchemyCMS/alchemy-pg_search/tree/v6.1.0) (2024-12-13)
14
13
 
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  gem "rails", "~> 7.1.0"
6
- gem "alchemy_cms", "~> #{ENV.fetch("ALCHEMY_CMS_VERSION", "7.4")}.0"
6
+ gem "alchemy_cms", "~> #{ENV.fetch("ALCHEMY_CMS_VERSION", "8.0")}.0"
7
7
 
8
8
  gem "sassc-rails"
9
9
  gem "sassc", "~> 2.4.0"
data/README.md CHANGED
@@ -236,6 +236,16 @@ and reindex your database in your Rails console
236
236
  $ Alchemy::PgSearch.rebuild
237
237
  ```
238
238
 
239
+ ## Local Development
240
+
241
+ Run the setup script to install dependencies and prepare the dummy app:
242
+
243
+ ```shell
244
+ $ bin/setup
245
+ ```
246
+
247
+ This installs gems, runs the Alchemy and PgSearch installers, and clears temporary files.
248
+
239
249
  ## Contributing
240
250
 
241
251
  1. Fork it
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "alchemy_cms", [">= 7.4", "< 8"]
21
+ spec.add_runtime_dependency "alchemy_cms", [">= 8.0.7", "< 9"]
22
22
  spec.add_runtime_dependency "pg_search", ["~> 2.1"]
23
23
  spec.add_runtime_dependency "pg"
24
24
 
@@ -4,7 +4,7 @@ module Alchemy::Search::ElementExtension
4
4
  end
5
5
 
6
6
  def searchable
7
- definition.key?(:searchable) ? definition[:searchable] : true
7
+ definition.searchable
8
8
  end
9
9
 
10
10
  def searchable?
@@ -5,7 +5,7 @@ module Alchemy::Search::IngredientExtension
5
5
 
6
6
  def searchable?
7
7
  Alchemy.searchable_ingredients.has_key?(type.to_sym) &&
8
- (definition.key?(:searchable) ? definition[:searchable] : true) &&
8
+ definition.searchable &&
9
9
  !!element&.searchable?
10
10
  end
11
11
  end
@@ -2,8 +2,7 @@
2
2
  #
3
3
  module Alchemy::Search::PageExtension
4
4
  def searchable?
5
- (definition.key?(:searchable) ? definition[:searchable] : true) &&
6
- searchable && public? && !layoutpage?
5
+ definition.searchable && searchable && public? && !layoutpage?
7
6
  end
8
7
 
9
8
  def searchable_content
@@ -21,17 +21,17 @@ module Alchemy
21
21
 
22
22
  def self.search_result_page
23
23
  @search_result_page ||= begin
24
- page_layouts = PageLayout.all.select do |page_layout|
25
- page_layout.key?(:searchresults) && page_layout[:searchresults].to_s.casecmp(true.to_s).zero?
24
+ page_definitions = ::Alchemy::PageDefinition.all.select do |page_definition|
25
+ page_definition.searchresults
26
26
  end
27
27
 
28
- if page_layouts.nil?
28
+ if page_definitions.nil?
29
29
  raise "No searchresults page layout found. Please add page layout with `searchresults: true` into your `page_layouts.yml` file."
30
30
  end
31
31
 
32
32
  page = Page.published.find_by(
33
- page_layout: page_layouts.first["name"],
34
- language_id: Language.current.id,
33
+ page_layout: page_definitions.first.name,
34
+ language_id: ::Alchemy::Current.language.id,
35
35
  )
36
36
  if page.nil?
37
37
  logger.warn "\n++++++\nNo published search result page found. Please create one or publish your search result page.\n++++++\n"
data/bin/setup ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+ require "fileutils"
3
+
4
+ # path to dummy application root.
5
+ APP_ROOT = File.expand_path("../spec/dummy", __dir__)
6
+
7
+ # path to alchemy gem
8
+ GEM_ROOT = File.expand_path("../", __dir__)
9
+
10
+ def system!(*args)
11
+ system(*args) || abort("\n== Command #{args} failed ==")
12
+ end
13
+
14
+ FileUtils.chdir GEM_ROOT do
15
+ system! "gem install bundler --conservative"
16
+ system("bundle check") || system!("bundle install")
17
+ end
18
+
19
+ FileUtils.chdir APP_ROOT do
20
+ puts "\n== Remove migration files for dummy app =="
21
+ Dir.glob("db/migrate/*.rb")
22
+ .reject { |f| f.include?("create_users") || f.include?("pg_search_documents") }
23
+ .each { |f| FileUtils.rm(f) }
24
+
25
+ puts "\n== Create database for dummy app =="
26
+ system!("bin/rails db:drop")
27
+ system!("bin/rails db:create")
28
+
29
+ puts "\n== Installing Alchemy CMS into dummy app =="
30
+ system!("bin/rails g alchemy:install --skip --skip-demo-files --auto-accept")
31
+
32
+ puts "\n== Installing Alchemy PGSearch into dummy app =="
33
+ system!("bin/rails g alchemy:pg_search:install")
34
+
35
+ puts "\n== Removing old logs and tempfiles =="
36
+ system! "bin/rails log:clear tmp:clear"
37
+
38
+ puts "\n== Removing old logs and tempfiles =="
39
+ system! "RAILS_ENV=test bin/rails db:schema:load"
40
+ end
41
+
42
+ puts "\n== Alchemy PgSearch is ready 🎉 =="
@@ -14,7 +14,7 @@ module Alchemy
14
14
  # In development environment, this runs on every code reload, so avoid multiple reindexing jobs
15
15
  unless Alchemy.publish_targets.map(&:name).include? 'Alchemy::PgSearch::IndexPageJob'
16
16
  # reindex the page after it was published
17
- Alchemy.publish_targets << Alchemy::PgSearch::IndexPageJob
17
+ Alchemy.config.publish_targets << "Alchemy::PgSearch::IndexPageJob"
18
18
  end
19
19
  # enable searchable flag in page form
20
20
  Alchemy.enable_searchable = true
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module PgSearch
3
- VERSION = "7.4.0"
3
+ VERSION = "8.0.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-pg_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.4.0
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -15,20 +15,20 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '7.4'
18
+ version: 8.0.7
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
- version: '8'
21
+ version: '9'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '7.4'
28
+ version: 8.0.7
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
- version: '8'
31
+ version: '9'
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: pg_search
34
34
  requirement: !ruby/object:Gem::Requirement
@@ -130,6 +130,7 @@ files:
130
130
  - app/views/alchemy/search/_results.html.erb
131
131
  - bin/rails
132
132
  - bin/rspec
133
+ - bin/setup
133
134
  - config/locales/alchemy.search.de.yml
134
135
  - config/locales/alchemy.search.en.yml
135
136
  - db/migrate/20220826125413_add_page_id_column_to_pg_search_documents.rb