searchcraft 0.4.1 → 0.4.2

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: f97a2c7a55d3ccc12f032416b977dd1628285f9e1b1f64b5fe690d57f5086acb
4
- data.tar.gz: 42f521f0a114fe21a88165632919d2c2a7fb74fd2dd35b6a7dd3fedba58daed2
3
+ metadata.gz: 913320513d07b3447532e62d060b3ebc118dce10531d2f1d62587bdccc5c8c33
4
+ data.tar.gz: f8b7d111101ece94baeffd41d5d4f42350f47a9b7db0d96e589ee2297e4ae196
5
5
  SHA512:
6
- metadata.gz: ada2ebc9f32ab873bde7c313465fd4711f8416bd25409b0eef66530bdf48e12b58e514a6e26197db5cf6e32fbd2bc9c4a3074bc662423f99e5c701daf6390283
7
- data.tar.gz: 41c3d14649b1ffb1e90428c81727758c03c91d1deae80f6e6b2c0f04bba68f57d28ce0da5eeb6234fadf5b7525e56a785ffc4de311af9aa35d0d3edf77b44c0f
6
+ metadata.gz: baab9337ba89647bd3cf7819570d0de0ae32a066c07d33587ac33c157f8bd3014c20516c6a3d5a2bc77ed37fb9e53fa73eabacef8fbf784b240cc5046da036a0
7
+ data.tar.gz: 4daaa7dcd5d3312740a83eb8f08efb6f86bc20179a0081e092207f7788673e9bb6ecc0b88ca47beeb33278406f96d4775653b24ccd4255282e9fd8eba16ba3b1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## Not Yet Released
2
+
3
+ ## [0.4.2] - 2023-11-06
4
+
5
+ - `SEARCHCRAFT_DEBUG=true` is the same as `SearchCraft.debug = true` and shows internal debugging of errors and activities
6
+ - `SearchCraft.config.disable_annotate = true` to disable automatic annotation of models (which is enabled by default if `annotate_model` gem discovered)
7
+
8
+ Fixes:
9
+
10
+ - `SearchCraft.dependencies_ready?` (used on launch) is fixed for normal/default case where `explicit_builder_class_names` not provided
11
+
1
12
  ## [0.4.1] - 2023-11-01
2
13
 
3
14
  - [`SearchCraft::TextSearch`](lib/searchcraft/text_search.rb) module added to `Builder` which provides `tsvector` helpers. See [`test_text_search.rb`](test/searchcraft/builder/test_text_search.rb) for examples.
@@ -2,6 +2,7 @@ module SearchCraft::Annotate
2
2
  # If using annotate gem, then automatically annotate models after rebuilding views
3
3
  # TODO: I'm suspicious this is not working for dependent Builders, e.g. demo_app's OnsaleSearchBuilder
4
4
  def annotate_models!
5
+ return if SearchCraft.config.disable_annotate
5
6
  return unless Rails.env.development?
6
7
  return unless Object.const_defined?(:Annotate)
7
8
 
@@ -16,7 +17,8 @@ module SearchCraft::Annotate
16
17
  exclude_helpers: true,
17
18
  hide_limit_column_types: "",
18
19
  hide_default_column_types: "",
19
- ignore_unknown_models: true
20
+ ignore_unknown_models: true,
21
+ show_indexes: true
20
22
  }
21
23
  capture_stdout do
22
24
  AnnotateModels.do_annotations(options)
@@ -1,7 +1,8 @@
1
1
  module SearchCraft
2
2
  class Configuration
3
3
  attr_accessor :disable_autorebuild
4
- attr_accessor :debug
4
+ attr_accessor :disable_annotate
5
+ attr_writer :debug
5
6
  attr_reader :explicit_builder_classes
6
7
  attr_accessor :explicit_builder_class_names
7
8
  attr_accessor :explicit_model_class_names
@@ -11,6 +12,10 @@ module SearchCraft
11
12
  !disable_autorebuild
12
13
  end
13
14
 
15
+ def debug
16
+ @debug || ENV["SEARCHCRAFT_DEBUG"] == "true"
17
+ end
18
+
14
19
  # If you need to explicitly list the builder + model classes you want to use,
15
20
  # then set this to a hash of builder class names => model class names.
16
21
  # {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SearchCraft
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
data/lib/searchcraft.rb CHANGED
@@ -20,8 +20,8 @@ module SearchCraft
20
20
  end
21
21
 
22
22
  def dependencies_ready?
23
- config.explicit_builder_class_names.all? do |builder_class_name|
24
- builder_class_name.constantize.new.dependencies_ready?
23
+ Builder.builders_to_rebuild.all? do |builder_class|
24
+ builder_class.new.dependencies_ready?
25
25
  end
26
26
  end
27
27
 
@@ -12,6 +12,10 @@ module SearchCraft
12
12
 
13
13
  def disable_autorebuild=: (bool) -> void
14
14
 
15
+ def disable_annotate: () -> bool
16
+
17
+ def disable_annotate=: (bool) -> void
18
+
15
19
  def explicit_builder_classes: () -> Hash[String, String]
16
20
 
17
21
  def explicit_builder_classes=: (Hash[String, String]) -> void
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchcraft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-31 00:00:00.000000000 Z
11
+ date: 2023-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord