minidusen 0.8.1 → 0.8.2

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
  SHA1:
3
- metadata.gz: 53ae4e4778bb465b76e102597bcde71ea9a0db5a
4
- data.tar.gz: f2edf0821b4675e6be42805345e1cff779a42e43
3
+ metadata.gz: 22721ff1a24bd3c0c1bcf0df5e3917f0c9b0ca35
4
+ data.tar.gz: 3781308c4bd9c6614e14750f0c676ac06a749cb8
5
5
  SHA512:
6
- metadata.gz: dd3747985637690f5ee1f6504518c7e4a79a32c31ed9d5e99c54e0354c38b6e672b517ac518a0042308dbee49b08740c0b2517fecc32142ca61b8f6bf457c734
7
- data.tar.gz: 72a9c8759ba4379793959ebd83dcd694076a146e81a4d0d95ff7635e3f0a6cff789381040f68b3b20267ea0dd7457ca709b0f334ebcf5c4c6173de6594dba42a
6
+ metadata.gz: ae988bf28bbe784d4665ff22fcd70d5d7965786355a36f900b38aab3ea61500d8ee9f856e1d4c383ca7fdbeb07632bfc2c49f00df0d1c25fdead7bc466718224
7
+ data.tar.gz: 6512014a63c286dcba862579e7a931e31d2bd261dcf1b5f960acec9ccc677294f3b4c140f0fb0ca6a38f3ee0cf17e311848a975f4cc5a59a67d2a52829eb296c
data/.travis.yml CHANGED
@@ -26,6 +26,11 @@ notifications:
26
26
  email:
27
27
  - fail@makandra.de
28
28
 
29
+ install:
30
+ # Replace default Travis CI bundler script with a version that doesn't
31
+ # explode when lockfile doesn't match recently bumped version
32
+ - bundle install --no-deployment --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
33
+
29
34
  matrix:
30
35
  exclude:
31
36
  - rvm: 2.1.8
@@ -1,7 +1,9 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- minidusen (0.8.0)
4
+ edge_rider (0.3.1)
5
+ activerecord
6
+ minidusen (0.8.1)
5
7
  activerecord (>= 3.2)
6
8
  activesupport (>= 3.2)
7
9
  edge_rider (>= 0.2.5)
@@ -27,8 +29,6 @@ GEM
27
29
  byebug (9.0.5)
28
30
  database_cleaner (1.5.3)
29
31
  diff-lcs (1.2.5)
30
- edge_rider (0.3.1)
31
- activerecord
32
32
  gemika (0.3.2)
33
33
  i18n (0.7.0)
34
34
  json (1.8.3)
@@ -4,7 +4,7 @@ module Minidusen
4
4
  class CannotParse < StandardError; end
5
5
 
6
6
  TEXT_QUERY = /(?:(\-)?"([^"]+)"|(\-)?([\S]+))/
7
- FIELD_QUERY = /(\-)?(\w+)\:#{TEXT_QUERY}/
7
+ FIELD_QUERY = /(?:\s|^|(\-))(\w+)\:#{TEXT_QUERY}/
8
8
 
9
9
  class << self
10
10
 
@@ -1,3 +1,3 @@
1
1
  module Minidusen
2
- VERSION = '0.8.1'
2
+ VERSION = '0.8.2'
3
3
  end
@@ -5,19 +5,28 @@ describe Minidusen::Parser do
5
5
  describe 'when called with a String' do
6
6
 
7
7
  it 'parses the given string into tokens' do
8
- query = Minidusen::Parser.parse('fieldname:fieldvalue word "a phrase"')
9
- query.size.should == 3
8
+ query = Minidusen::Parser.parse('fieldname:fieldvalue word "a phrase" "deploy:rollback" -"db:seed"')
9
+ query.size.should == 5
10
10
  query[0].field.should == 'fieldname'
11
11
  query[0].value.should == 'fieldvalue'
12
+ query[0].exclude.should == false
12
13
  query[1].field.should == 'text'
13
14
  query[1].value.should == 'word'
15
+ query[1].exclude.should == false
14
16
  query[2].field.should == 'text'
15
17
  query[2].value.should == 'a phrase'
18
+ query[2].exclude.should == false
19
+ query[3].field.should == 'text'
20
+ query[3].value.should == 'deploy:rollback'
21
+ query[3].exclude.should == false
22
+ query[4].field.should == 'text'
23
+ query[4].value.should == 'db:seed'
24
+ query[4].exclude.should == true
16
25
  end
17
26
 
18
27
  it 'should parse field tokens first, because they usually give maximum filtering at little cost' do
19
- query = Minidusen::Parser.parse('word1 field1:field1-value word2 field2:field2-value')
20
- query.collect(&:value).should == ['field1-value', 'field2-value', 'word1', 'word2']
28
+ query = Minidusen::Parser.parse('word1 field1:field1-value word2 field2:field2-value "search:word"')
29
+ query.collect(&:value).should == ['field1-value', 'field2-value', 'word1', 'word2', 'search:word']
21
30
  end
22
31
 
23
32
  it 'should not consider the dash to be a word boundary' do
@@ -30,6 +39,30 @@ describe Minidusen::Parser do
30
39
  query.collect(&:value).should == ['åöÙÔøüéíÁ', 'ÄüÊçñÆ ððÿáÒÉ', 'pulvérisateur', 'pędzić']
31
40
  end
32
41
 
42
+ it 'should allow to search for a phrase containing a colon' do
43
+ query = Minidusen::Parser.parse('"deploy:rollback"')
44
+ query.size.should == 1
45
+ query[0].field.should == 'text'
46
+ query[0].value.should == 'deploy:rollback'
47
+ query[0].exclude.should == false
48
+ end
49
+
50
+ it 'should parse a field token which is at the beginning of the search string' do
51
+ query = Minidusen::Parser.parse('filetype:pdf word')
52
+ query.size.should == 2
53
+ query[0].field.should == 'filetype'
54
+ query[0].value.should == 'pdf'
55
+ query[0].exclude.should == false
56
+ end
57
+
58
+ it 'should parse an excluded field token which is at the beginning of the search string' do
59
+ query = Minidusen::Parser.parse('-filetype:docx word')
60
+ query.size.should == 2
61
+ query[0].field.should == 'filetype'
62
+ query[0].value.should == 'docx'
63
+ query[0].exclude.should == true
64
+ end
65
+
33
66
  end
34
67
 
35
68
  describe 'when called with a Query' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minidusen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-06 00:00:00.000000000 Z
11
+ date: 2018-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport