dusen 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Rakefile +48 -0
- data/lib/dusen/parser.rb +1 -2
- data/lib/dusen/syntax.rb +1 -0
- data/lib/dusen/version.rb +1 -1
- data/spec/rails-3.0/Gemfile.lock +1 -1
- data/spec/rails-3.2/Gemfile.lock +1 -1
- data/spec/shared/spec/dusen/active_record/base_ext_spec.rb +6 -1
- data/spec/shared/spec/dusen/parser_spec.rb +7 -0
- metadata +45 -70
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OWVjNGViYjQ5OGJlOWNjNzM5ZmMzMzBjZTYxODEyN2VjMWRiZTZlYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTQ2ODMzOTg0ZmZhYjg4NjYyMjMyOWNlZDVmZmYxOWU5ZThjYTE5Ng==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NmJjMzI3NDUzMjY1MzgwNDZjMzMxZDcwZmNkNWY5NWUyOWQyMWRkOTg1NTEy
|
10
|
+
ZTljNjlhYmZlZWI2MDQyMGM1MmEzZTBlZTcyNzRmOTVlZDQxMDA0MDI1ZWEz
|
11
|
+
ODAzMTAyYzgwMjI1Nzc0YThkMTVmMzE5YmI5NTRjYjg2NjYxMDI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTZjYTYzMDYxNDEzMDM4M2RlM2MyY2NmYTcxOWMzYjczYjY5ZjY3YmFkOTBj
|
14
|
+
ZjYxMWJiOTY4OTE0OWI4ZjMxMzMzMjc0MTY4NWM5NzMwZDk0NzBkMmEwM2Vl
|
15
|
+
NzA3ZmQyMTIxODVhNmJlMDk0ZWQ3ZTY3NDVjMDRiNDNkMTEzNjc=
|
data/Rakefile
CHANGED
@@ -49,6 +49,22 @@ namespace :all do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
desc 'Install gems and run tests on several Ruby versions'
|
53
|
+
task :rubies do
|
54
|
+
success = case
|
55
|
+
when system('which rvm')
|
56
|
+
run_for_all_rubies :rvm
|
57
|
+
when system('which rbenv') && `rbenv commands`.split("\n").include?('alias')
|
58
|
+
# rbenv currently works only with the alias plugin, as we do not want to
|
59
|
+
# specify Ruby versions down to their patch levels.
|
60
|
+
run_for_all_rubies :rbenv
|
61
|
+
else
|
62
|
+
fail 'Currently only RVM and rbenv (with alias plugin) are supported. Open Rakefile and add your Ruby version manager!'
|
63
|
+
end
|
64
|
+
|
65
|
+
fail "Tests failed" unless success
|
66
|
+
end
|
67
|
+
|
52
68
|
end
|
53
69
|
|
54
70
|
def for_each_directory_of(path, &block)
|
@@ -58,3 +74,35 @@ def for_each_directory_of(path, &block)
|
|
58
74
|
block.call(directory)
|
59
75
|
end
|
60
76
|
end
|
77
|
+
|
78
|
+
def run_for_all_rubies(version_manager)
|
79
|
+
%w[
|
80
|
+
1.8.7
|
81
|
+
1.9.3
|
82
|
+
2.1.2
|
83
|
+
].all? do |ruby_version|
|
84
|
+
announce "Running bundle and specs for Ruby #{ruby_version}", 2
|
85
|
+
|
86
|
+
execute = case version_manager
|
87
|
+
when :rvm
|
88
|
+
"rvm #{ruby_version} do"
|
89
|
+
when :rbenv
|
90
|
+
ENV['RBENV_VERSION'] = ruby_version
|
91
|
+
'rbenv exec'
|
92
|
+
end
|
93
|
+
|
94
|
+
current_version = `#{execute} ruby -v`.match(/^ruby (\d\.\d\.\d)/)[1]
|
95
|
+
if current_version == ruby_version
|
96
|
+
puts "Currently active Ruby is #{current_version}"
|
97
|
+
system "#{execute} rake all:bundle all:spec"
|
98
|
+
else
|
99
|
+
fail "Failed to set Ruby #{ruby_version} (#{current_version} active!)"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def announce(text, level = 1)
|
105
|
+
space = "\n" * level
|
106
|
+
message = "# #{text}"
|
107
|
+
puts "\e[4;34m#{space + message}\e[0m" # blue underline
|
108
|
+
end
|
data/lib/dusen/parser.rb
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
module Dusen
|
4
4
|
class Parser
|
5
5
|
|
6
|
-
|
7
|
-
TEXT_QUERY = /(?:(\-)?"([^"]+)"|(\-)?([#{WESTERNISH_WORD_CHARACTER}]+))/
|
6
|
+
TEXT_QUERY = /(?:(\-)?"([^"]+)"|(\-)?([\S]+))/
|
8
7
|
FIELD_QUERY = /(\-)?(\w+)\:#{TEXT_QUERY}/
|
9
8
|
|
10
9
|
def self.parse(query_string)
|
data/lib/dusen/syntax.rb
CHANGED
data/lib/dusen/version.rb
CHANGED
data/spec/rails-3.0/Gemfile.lock
CHANGED
data/spec/rails-3.2/Gemfile.lock
CHANGED
@@ -66,7 +66,7 @@ shared_examples_for 'model with search syntax' do
|
|
66
66
|
subject.search('E.ONNNEN').to_a.should == [match]
|
67
67
|
end
|
68
68
|
|
69
|
-
it 'should find words where one letter is separated from other letters by a
|
69
|
+
it 'should find words where one letter is separated from other letters by a semicolon' do
|
70
70
|
match = subject.create!(:name => 'E;ONNNEN')
|
71
71
|
subject.search('E;ONNNEN')
|
72
72
|
subject.search('E;ONNNEN').to_a.should == [match]
|
@@ -78,6 +78,11 @@ shared_examples_for 'model with search syntax' do
|
|
78
78
|
subject.search('Baden-Baden').to_a.should == [match]
|
79
79
|
end
|
80
80
|
|
81
|
+
it 'should handle umlauts and special characters' do
|
82
|
+
match = subject.create!(:city => 'púlvérìsätëûr')
|
83
|
+
subject.search('púlvérìsätëûr').to_a.should == [match]
|
84
|
+
end
|
85
|
+
|
81
86
|
context 'with excludes' do
|
82
87
|
|
83
88
|
it 'should exclude words with prefix - (minus)' do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Dusen::Parser do
|
@@ -14,6 +16,11 @@ describe Dusen::Parser do
|
|
14
16
|
query.collect(&:value).should == ['Baden-Baden']
|
15
17
|
end
|
16
18
|
|
19
|
+
it 'should parse umlauts and accents' do
|
20
|
+
query = Dusen::Parser.parse('field:åöÙÔøüéíÁ "ÄüÊçñÆ ððÿáÒÉ" pulvérisateur pędzić')
|
21
|
+
query.collect(&:value).should == ['åöÙÔøüéíÁ', 'ÄüÊçñÆ ððÿáÒÉ', 'pulvérisateur', 'pędzić']
|
22
|
+
end
|
23
|
+
|
17
24
|
end
|
18
25
|
|
19
26
|
end
|
metadata
CHANGED
@@ -1,63 +1,49 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dusen
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 5
|
9
|
-
- 2
|
10
|
-
version: 0.5.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.3
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Henning Koch
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: activerecord
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 7
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
version: "3.0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
34
20
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: edge_rider
|
38
21
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: edge_rider
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
49
33
|
version: 0.2.5
|
50
34
|
type: :runtime
|
51
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.5
|
52
41
|
description: Comprehensive full text search for ActiveRecord and MySQL
|
53
42
|
email: henning.koch@makandra.de
|
54
43
|
executables: []
|
55
|
-
|
56
44
|
extensions: []
|
57
|
-
|
58
45
|
extra_rdoc_files: []
|
59
|
-
|
60
|
-
files:
|
46
|
+
files:
|
61
47
|
- .gitignore
|
62
48
|
- .ruby-version
|
63
49
|
- .travis.yml
|
@@ -138,39 +124,28 @@ files:
|
|
138
124
|
- spec/shared/spec/dusen/parser_spec.rb
|
139
125
|
- spec/shared/spec/dusen/query_spec.rb
|
140
126
|
- spec/shared/spec/dusen/util_spec.rb
|
141
|
-
has_rdoc: true
|
142
127
|
homepage: https://github.com/makandra/dusen
|
143
|
-
licenses:
|
128
|
+
licenses:
|
144
129
|
- MIT
|
130
|
+
metadata: {}
|
145
131
|
post_install_message:
|
146
132
|
rdoc_options: []
|
147
|
-
|
148
|
-
require_paths:
|
133
|
+
require_paths:
|
149
134
|
- lib
|
150
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
none: false
|
161
|
-
requirements:
|
162
|
-
- - ">="
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
hash: 3
|
165
|
-
segments:
|
166
|
-
- 0
|
167
|
-
version: "0"
|
135
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ! '>='
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
168
145
|
requirements: []
|
169
|
-
|
170
146
|
rubyforge_project:
|
171
|
-
rubygems_version:
|
147
|
+
rubygems_version: 2.2.2
|
172
148
|
signing_key:
|
173
|
-
specification_version:
|
149
|
+
specification_version: 4
|
174
150
|
summary: Comprehensive full text search for ActiveRecord and MySQL
|
175
151
|
test_files: []
|
176
|
-
|