riddle 2.2.2 → 2.3.0

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
- SHA1:
3
- metadata.gz: 16cce08cdd0afffbd0189f3ebdafce83928257d2
4
- data.tar.gz: 145e3cb7642fde0dd66411ae800b4db94bc2765a
2
+ SHA256:
3
+ metadata.gz: 34d2ffd1aafa3678203285a425bb6bd893ac8b8e218f6affec4dd0a89136cebe
4
+ data.tar.gz: 7690d50b67c6d2d7d9b46168c52cfc588f7daa7eb2cafdcacd01f667e8c8e39f
5
5
  SHA512:
6
- metadata.gz: 5a82eccd82b01e0161d5101f337e59ade78bb1c088f9dbe88c13f13f1fff60e05665c44ec576f2f2b795ba2c5ecde3d4470aea6c314fc1be77896b7cbb4205b1
7
- data.tar.gz: 1d3266ef9b83e5f7e71b16fa15cf47910aa82b5d3b8b36c1de678a9a76ecae22070e4d0a6d1ce9479b5a61ea5ea6105f47bb136fd3f955b5b897b28b67b87ebb
6
+ metadata.gz: 6503e33c3bccdf966e76b2e6da2fabb53b8a4dca7b74ebe52315f303eefaf35fd700fb0dba58f0f675c3fdb90ef4d8d6149c57239d80787cc6cf4ff194407f12
7
+ data.tar.gz: 45c61b1009289b5d3b4343e718dc3804030dadfd87e9f877fce56503a46397e419c6c0519c1346f9f5961acdc18709bd6b1f8755137128bb9fd2eb9e12974fff
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.8
4
- - 2.3.5
5
- - 2.4.2
3
+ - 2.2.9
4
+ - 2.3.6
5
+ - 2.4.3
6
+ - 2.5.0
6
7
  - jruby-9.1.14.0
7
8
  env:
8
9
  global:
@@ -14,9 +15,9 @@ env:
14
15
  - SPHINX_VERSION=2.2.6
15
16
  before_script:
16
17
  - killall searchd; echo ''
17
- - if (ruby -e "exit RUBY_VERSION.to_f >= 2.4"); then export RUBYOPT="--enable-frozen-string-literal";
18
- fi; echo $RUBYOPT
19
18
  - "./bin/loadsphinx $SPHINX_VERSION"
19
+ before_install:
20
+ - gem update --system
20
21
  after_script:
21
22
  - killall searchd; echo ''
22
23
  sudo: false
data/HISTORY CHANGED
@@ -1,3 +1,8 @@
1
+ 2.3.0 - January 14th 2018
2
+ - Add controller method for merging indices.
3
+ - Add support for sockets in searchd configuration.
4
+ - Fix handling of command errors when executed via backticks (verbose).
5
+
1
6
  2.2.2 - December 2nd 2017
2
7
  - Fix frozen string concatenation for searchd/indexer commands.
3
8
 
@@ -14,7 +14,7 @@ Riddle is available as a gem, so you can install it directly:
14
14
 
15
15
  Or include it in a Gemfile:
16
16
 
17
- gem 'riddle', '~> 2.2.2'
17
+ gem 'riddle', '~> 2.3.0'
18
18
 
19
19
  ## Usage
20
20
 
@@ -23,7 +23,13 @@ module Riddle
23
23
  @listen << "9306:mysql41" if @mysql41.is_a?(TrueClass)
24
24
  @listen << "#{@mysql41}:mysql41" if @mysql41.is_a?(NUMBER)
25
25
 
26
- @listen = @listen.collect { |line| "#{@address}:#{line}" } if @address
26
+ if @listen.empty? && @address
27
+ @listen << @address
28
+ else
29
+ @listen = @listen.collect { |line| "#{@address}:#{line}" } if @address
30
+ end
31
+
32
+ @listen += Array(@socket) if @socket
27
33
  end
28
34
 
29
35
  def settings
@@ -27,7 +27,7 @@ module Riddle
27
27
  end
28
28
 
29
29
  attr_accessor *self.settings
30
- attr_accessor :mysql41
30
+ attr_accessor :mysql41, :socket
31
31
 
32
32
  def render
33
33
  raise ConfigurationError unless valid?
@@ -4,6 +4,8 @@ module Riddle
4
4
  NoConfigurationFileError = Class.new StandardError
5
5
 
6
6
  class Controller
7
+ DEFAULT_MERGE_OPTIONS = {:filters => {}}.freeze
8
+
7
9
  attr_accessor :path, :bin_path, :searchd_binary_name, :indexer_binary_name
8
10
 
9
11
  def initialize(configuration, path)
@@ -31,6 +33,20 @@ module Riddle
31
33
  Riddle::ExecuteCommand.call command, options[:verbose]
32
34
  end
33
35
 
36
+ def merge(destination, source, options = {})
37
+ options = DEFAULT_MERGE_OPTIONS.merge options
38
+
39
+ command = "#{indexer} --config \"#{@path}\"".dup
40
+ command << " --merge #{destination} #{source}"
41
+ options[:filters].each do |attribute, value|
42
+ value = value..value unless value.is_a?(Range)
43
+ command << " --merge-dst-range #{attribute} #{value.min} #{value.max}"
44
+ end
45
+ command << " --rotate" if running?
46
+
47
+ Riddle::ExecuteCommand.call command, options[:verbose]
48
+ end
49
+
34
50
  def start(options = {})
35
51
  return if running?
36
52
  check_for_configuration_file
@@ -30,7 +30,11 @@ class Riddle::ExecuteCommand
30
30
  attr_reader :command, :verbose
31
31
 
32
32
  def result_from_backticks
33
- output = `#{command}`
33
+ begin
34
+ output = `#{command}`
35
+ rescue SystemCallError => error
36
+ output = error.message
37
+ end
34
38
 
35
39
  Riddle::CommandResult.new command, $?.exitstatus, output
36
40
  end
@@ -5,7 +5,7 @@ $:.push File.expand_path('../lib', __FILE__)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'riddle'
8
- s.version = '2.2.2'
8
+ s.version = '2.3.0'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ['Pat Allan']
11
11
  s.email = ['pat@freelancing-gods.com']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-02 00:00:00.000000000 Z
11
+ date: 2018-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project: riddle
131
- rubygems_version: 2.6.13
131
+ rubygems_version: 2.7.3
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: An API for Sphinx, written in and for Ruby.