fuzzily 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 173f23b097720f4ab64080adba9dd9d1aa4f9de9
4
+ data.tar.gz: 5312ce068351b2db5f5acaecd3a040cf6a3bddbc
5
+ SHA512:
6
+ metadata.gz: 030d7aed45fcc823b8f56e60f24e01570125d4ec41dc3be72cbacbffd915d7d6f4ef129a29525ebafcc93267766f4e6652db94740851e93aa4ad9c80abc4f826
7
+ data.tar.gz: 41c23a925ea4bec80ea1fb77087f6add430145e98d49590a36eb0162e5eb26902dcbaeb4eb39be551da51c7db7ea3cf355eec8acf3c5c5f297badb97a2fe898c
@@ -2,11 +2,15 @@ rvm:
2
2
  - "1.8.7"
3
3
  - "1.9.2"
4
4
  - "1.9.3"
5
+ - "2.0.0"
5
6
  gemfile:
6
7
  - gemfiles/rails23.gemfile
7
8
  - gemfiles/rails30.gemfile
8
9
  - gemfiles/rails31.gemfile
9
10
  - gemfiles/rails32.gemfile
10
11
  - gemfiles/rails32_pg.gemfile
12
+ - gemfiles/rails32_mysql.gemfile
11
13
  before_script:
12
14
  - psql -c 'create database fuzzily_test;' -U postgres
15
+ - mysql -e 'create database fuzzily_test;'
16
+ env: TRAVIS=TRUE
data/Appraisals CHANGED
@@ -17,3 +17,7 @@ end
17
17
  appraise "rails32-pg" do
18
18
  gem "activerecord", "~> 3.2.0"
19
19
  end
20
+
21
+ appraise "rails32-mysql" do
22
+ gem "activerecord", "~> 3.2.0"
23
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fuzzily (0.2.2)
4
+ fuzzily (0.2.3)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
@@ -24,9 +24,17 @@ GEM
24
24
  arel (3.0.2)
25
25
  builder (3.0.4)
26
26
  coderay (1.0.9)
27
+ colorize (0.5.8)
28
+ coveralls (0.6.7)
29
+ colorize
30
+ multi_json (~> 1.3)
31
+ rest-client
32
+ simplecov (>= 0.7)
33
+ thor
27
34
  diff-lcs (1.2.4)
28
35
  i18n (0.6.1)
29
36
  method_source (0.8.1)
37
+ mime-types (1.23)
30
38
  multi_json (1.7.2)
31
39
  mysql2 (0.3.11)
32
40
  pg (0.15.1)
@@ -37,6 +45,8 @@ GEM
37
45
  pry-nav (0.2.3)
38
46
  pry (~> 0.9.10)
39
47
  rake (10.0.4)
48
+ rest-client (1.6.7)
49
+ mime-types (>= 1.16)
40
50
  rspec (2.13.0)
41
51
  rspec-core (~> 2.13.0)
42
52
  rspec-expectations (~> 2.13.0)
@@ -45,8 +55,13 @@ GEM
45
55
  rspec-expectations (2.13.0)
46
56
  diff-lcs (>= 1.1.3, < 2.0)
47
57
  rspec-mocks (2.13.1)
58
+ simplecov (0.7.1)
59
+ multi_json (~> 1.0)
60
+ simplecov-html (~> 0.7.1)
61
+ simplecov-html (0.7.1)
48
62
  slop (3.4.4)
49
63
  sqlite3 (1.3.7)
64
+ thor (0.18.1)
50
65
  tzinfo (0.3.37)
51
66
 
52
67
  PLATFORMS
@@ -54,6 +69,7 @@ PLATFORMS
54
69
 
55
70
  DEPENDENCIES
56
71
  appraisal
72
+ coveralls
57
73
  fuzzily!
58
74
  mysql2
59
75
  pg
data/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![Build Status](https://travis-ci.org/mezis/fuzzily.png?branch=master)](https://travis-ci.org/mezis/fuzzily)
5
5
  [![Dependency Status](https://gemnasium.com/mezis/fuzzily.png)](https://gemnasium.com/mezis/fuzzily)
6
6
  [![Code Climate](https://codeclimate.com/github/mezis/fuzzily.png)](https://codeclimate.com/github/mezis/fuzzily)
7
+ [![Coverage Status](https://coveralls.io/repos/mezis/fuzzily/badge.png?branch=coveralls)](https://coveralls.io/r/mezis/fuzzily?branch=coveralls)
7
8
 
8
9
  > Show me photos of **Marakech** !
9
10
  >
@@ -14,7 +15,7 @@ Blurrily finds misspelled, prefix, or partial needles in a haystack of
14
15
  strings. It's a fast, [trigram](http://en.wikipedia.org/wiki/N-gram)-based, database-backed [fuzzy](http://en.wikipedia.org/wiki/Approximate_string_matching) string search/match engine for Rails.
15
16
  Loosely inspired from an [old blog post](http://unirec.blogspot.co.uk/2007/12/live-fuzzy-search-using-n-grams-in.html).
16
17
 
17
- Works with ActiveRecord 2.3, 3.0, 3.1, 3.2 on various Rubies.
18
+ Tested with ActiveRecord (2.3, 3.0, 3.1, 3.2) on various Rubies (1.8.7, 1.9.2, 1.9.3, 2.0.0) and the most common adapters (SQLite3, MySQL, and PostgreSQL).
18
19
 
19
20
  If your dateset is big, if you need yet more speed, or do not use ActiveRecord,
20
21
  check out [blurrily](http://github.com/mezis/blurrily), another gem (backed with a C extension)
@@ -125,4 +126,7 @@ MIT licence. Quite permissive if you ask me.
125
126
  2. Create your feature branch (`git checkout -b my-new-feature`)
126
127
  3. Commit your changes (`git commit -am 'Add some feature'`)
127
128
  4. Push to the branch (`git push origin my-new-feature`)
128
- 5. Create new Pull Request
129
+ 5. Create a new Pull Request
130
+
131
+
132
+ Thanks to @bclennox and @fdegiuli for helping fix compatibility issues.
@@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_development_dependency 'sqlite3'
23
23
  gem.add_development_dependency 'pg'
24
24
  gem.add_development_dependency 'mysql2'
25
+ gem.add_development_dependency 'coveralls'
25
26
 
26
27
  gem.files = `git ls-files`.split($/)
27
28
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.2)
4
+ fuzzily (0.2.3)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
@@ -10,31 +10,47 @@ GEM
10
10
  activerecord (2.3.17)
11
11
  activesupport (= 2.3.17)
12
12
  activesupport (2.3.17)
13
- appraisal (0.5.1)
13
+ appraisal (0.5.2)
14
14
  bundler
15
15
  rake
16
16
  coderay (1.0.9)
17
- diff-lcs (1.1.3)
17
+ colorize (0.5.8)
18
+ coveralls (0.6.7)
19
+ colorize
20
+ multi_json (~> 1.3)
21
+ rest-client
22
+ simplecov (>= 0.7)
23
+ thor
24
+ diff-lcs (1.2.4)
18
25
  method_source (0.8.1)
26
+ mime-types (1.23)
27
+ multi_json (1.7.2)
19
28
  mysql2 (0.3.11)
20
- pg (0.14.1)
21
- pry (0.9.12)
29
+ pg (0.15.1)
30
+ pry (0.9.12.1)
22
31
  coderay (~> 1.0.5)
23
32
  method_source (~> 0.8)
24
33
  slop (~> 3.4)
25
34
  pry-nav (0.2.3)
26
35
  pry (~> 0.9.10)
27
- rake (10.0.3)
28
- rspec (2.12.0)
29
- rspec-core (~> 2.12.0)
30
- rspec-expectations (~> 2.12.0)
31
- rspec-mocks (~> 2.12.0)
32
- rspec-core (2.12.2)
33
- rspec-expectations (2.12.1)
34
- diff-lcs (~> 1.1.3)
35
- rspec-mocks (2.12.2)
36
- slop (3.4.3)
36
+ rake (10.0.4)
37
+ rest-client (1.6.7)
38
+ mime-types (>= 1.16)
39
+ rspec (2.13.0)
40
+ rspec-core (~> 2.13.0)
41
+ rspec-expectations (~> 2.13.0)
42
+ rspec-mocks (~> 2.13.0)
43
+ rspec-core (2.13.1)
44
+ rspec-expectations (2.13.0)
45
+ diff-lcs (>= 1.1.3, < 2.0)
46
+ rspec-mocks (2.13.1)
47
+ simplecov (0.7.1)
48
+ multi_json (~> 1.0)
49
+ simplecov-html (~> 0.7.1)
50
+ simplecov-html (0.7.1)
51
+ slop (3.4.4)
37
52
  sqlite3 (1.3.7)
53
+ thor (0.18.1)
38
54
 
39
55
  PLATFORMS
40
56
  ruby
@@ -42,6 +58,7 @@ PLATFORMS
42
58
  DEPENDENCIES
43
59
  activerecord (~> 2.3.0)
44
60
  appraisal
61
+ coveralls
45
62
  fuzzily!
46
63
  mysql2
47
64
  pg
@@ -17,35 +17,51 @@ GEM
17
17
  arel (~> 2.0.10)
18
18
  tzinfo (~> 0.3.23)
19
19
  activesupport (3.0.20)
20
- appraisal (0.5.1)
20
+ appraisal (0.5.2)
21
21
  bundler
22
22
  rake
23
23
  arel (2.0.10)
24
24
  builder (2.1.2)
25
25
  coderay (1.0.9)
26
- diff-lcs (1.1.3)
26
+ colorize (0.5.8)
27
+ coveralls (0.6.7)
28
+ colorize
29
+ multi_json (~> 1.3)
30
+ rest-client
31
+ simplecov (>= 0.7)
32
+ thor
33
+ diff-lcs (1.2.4)
27
34
  i18n (0.5.0)
28
35
  method_source (0.8.1)
36
+ mime-types (1.23)
37
+ multi_json (1.7.2)
29
38
  mysql2 (0.3.11)
30
39
  pg (0.15.1)
31
- pry (0.9.12)
40
+ pry (0.9.12.1)
32
41
  coderay (~> 1.0.5)
33
42
  method_source (~> 0.8)
34
43
  slop (~> 3.4)
35
44
  pry-nav (0.2.3)
36
45
  pry (~> 0.9.10)
37
- rake (10.0.3)
38
- rspec (2.12.0)
39
- rspec-core (~> 2.12.0)
40
- rspec-expectations (~> 2.12.0)
41
- rspec-mocks (~> 2.12.0)
42
- rspec-core (2.12.2)
43
- rspec-expectations (2.12.1)
44
- diff-lcs (~> 1.1.3)
45
- rspec-mocks (2.12.2)
46
- slop (3.4.3)
46
+ rake (10.0.4)
47
+ rest-client (1.6.7)
48
+ mime-types (>= 1.16)
49
+ rspec (2.13.0)
50
+ rspec-core (~> 2.13.0)
51
+ rspec-expectations (~> 2.13.0)
52
+ rspec-mocks (~> 2.13.0)
53
+ rspec-core (2.13.1)
54
+ rspec-expectations (2.13.0)
55
+ diff-lcs (>= 1.1.3, < 2.0)
56
+ rspec-mocks (2.13.1)
57
+ simplecov (0.7.1)
58
+ multi_json (~> 1.0)
59
+ simplecov-html (~> 0.7.1)
60
+ simplecov-html (0.7.1)
61
+ slop (3.4.4)
47
62
  sqlite3 (1.3.7)
48
- tzinfo (0.3.35)
63
+ thor (0.18.1)
64
+ tzinfo (0.3.37)
49
65
 
50
66
  PLATFORMS
51
67
  ruby
@@ -53,6 +69,7 @@ PLATFORMS
53
69
  DEPENDENCIES
54
70
  activerecord (~> 3.0.0)
55
71
  appraisal
72
+ coveralls
56
73
  fuzzily!
57
74
  mysql2
58
75
  pg
@@ -18,36 +18,51 @@ GEM
18
18
  tzinfo (~> 0.3.29)
19
19
  activesupport (3.1.11)
20
20
  multi_json (~> 1.0)
21
- appraisal (0.5.1)
21
+ appraisal (0.5.2)
22
22
  bundler
23
23
  rake
24
24
  arel (2.2.3)
25
25
  builder (3.0.4)
26
26
  coderay (1.0.9)
27
- diff-lcs (1.1.3)
28
- i18n (0.6.1)
27
+ colorize (0.5.8)
28
+ coveralls (0.6.7)
29
+ colorize
30
+ multi_json (~> 1.3)
31
+ rest-client
32
+ simplecov (>= 0.7)
33
+ thor
34
+ diff-lcs (1.2.4)
35
+ i18n (0.6.4)
29
36
  method_source (0.8.1)
30
- multi_json (1.6.1)
37
+ mime-types (1.23)
38
+ multi_json (1.7.2)
31
39
  mysql2 (0.3.11)
32
40
  pg (0.15.1)
33
- pry (0.9.12)
41
+ pry (0.9.12.1)
34
42
  coderay (~> 1.0.5)
35
43
  method_source (~> 0.8)
36
44
  slop (~> 3.4)
37
45
  pry-nav (0.2.3)
38
46
  pry (~> 0.9.10)
39
- rake (10.0.3)
40
- rspec (2.12.0)
41
- rspec-core (~> 2.12.0)
42
- rspec-expectations (~> 2.12.0)
43
- rspec-mocks (~> 2.12.0)
44
- rspec-core (2.12.2)
45
- rspec-expectations (2.12.1)
46
- diff-lcs (~> 1.1.3)
47
- rspec-mocks (2.12.2)
48
- slop (3.4.3)
47
+ rake (10.0.4)
48
+ rest-client (1.6.7)
49
+ mime-types (>= 1.16)
50
+ rspec (2.13.0)
51
+ rspec-core (~> 2.13.0)
52
+ rspec-expectations (~> 2.13.0)
53
+ rspec-mocks (~> 2.13.0)
54
+ rspec-core (2.13.1)
55
+ rspec-expectations (2.13.0)
56
+ diff-lcs (>= 1.1.3, < 2.0)
57
+ rspec-mocks (2.13.1)
58
+ simplecov (0.7.1)
59
+ multi_json (~> 1.0)
60
+ simplecov-html (~> 0.7.1)
61
+ simplecov-html (0.7.1)
62
+ slop (3.4.4)
49
63
  sqlite3 (1.3.7)
50
- tzinfo (0.3.35)
64
+ thor (0.18.1)
65
+ tzinfo (0.3.37)
51
66
 
52
67
  PLATFORMS
53
68
  ruby
@@ -55,6 +70,7 @@ PLATFORMS
55
70
  DEPENDENCIES
56
71
  activerecord (~> 3.1.0)
57
72
  appraisal
73
+ coveralls
58
74
  fuzzily!
59
75
  mysql2
60
76
  pg
@@ -1,53 +1,68 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.2)
4
+ fuzzily (0.2.3)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.12)
11
- activesupport (= 3.2.12)
10
+ activemodel (3.2.13)
11
+ activesupport (= 3.2.13)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.12)
14
- activemodel (= 3.2.12)
15
- activesupport (= 3.2.12)
13
+ activerecord (3.2.13)
14
+ activemodel (= 3.2.13)
15
+ activesupport (= 3.2.13)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.12)
19
- i18n (~> 0.6)
18
+ activesupport (3.2.13)
19
+ i18n (= 0.6.1)
20
20
  multi_json (~> 1.0)
21
- appraisal (0.5.1)
21
+ appraisal (0.5.2)
22
22
  bundler
23
23
  rake
24
24
  arel (3.0.2)
25
25
  builder (3.0.4)
26
26
  coderay (1.0.9)
27
- diff-lcs (1.1.3)
27
+ colorize (0.5.8)
28
+ coveralls (0.6.7)
29
+ colorize
30
+ multi_json (~> 1.3)
31
+ rest-client
32
+ simplecov (>= 0.7)
33
+ thor
34
+ diff-lcs (1.2.4)
28
35
  i18n (0.6.1)
29
36
  method_source (0.8.1)
30
- multi_json (1.6.1)
37
+ mime-types (1.23)
38
+ multi_json (1.7.2)
31
39
  mysql2 (0.3.11)
32
40
  pg (0.15.1)
33
- pry (0.9.12)
41
+ pry (0.9.12.1)
34
42
  coderay (~> 1.0.5)
35
43
  method_source (~> 0.8)
36
44
  slop (~> 3.4)
37
45
  pry-nav (0.2.3)
38
46
  pry (~> 0.9.10)
39
- rake (10.0.3)
40
- rspec (2.12.0)
41
- rspec-core (~> 2.12.0)
42
- rspec-expectations (~> 2.12.0)
43
- rspec-mocks (~> 2.12.0)
44
- rspec-core (2.12.2)
45
- rspec-expectations (2.12.1)
46
- diff-lcs (~> 1.1.3)
47
- rspec-mocks (2.12.2)
48
- slop (3.4.3)
47
+ rake (10.0.4)
48
+ rest-client (1.6.7)
49
+ mime-types (>= 1.16)
50
+ rspec (2.13.0)
51
+ rspec-core (~> 2.13.0)
52
+ rspec-expectations (~> 2.13.0)
53
+ rspec-mocks (~> 2.13.0)
54
+ rspec-core (2.13.1)
55
+ rspec-expectations (2.13.0)
56
+ diff-lcs (>= 1.1.3, < 2.0)
57
+ rspec-mocks (2.13.1)
58
+ simplecov (0.7.1)
59
+ multi_json (~> 1.0)
60
+ simplecov-html (~> 0.7.1)
61
+ simplecov-html (0.7.1)
62
+ slop (3.4.4)
49
63
  sqlite3 (1.3.7)
50
- tzinfo (0.3.35)
64
+ thor (0.18.1)
65
+ tzinfo (0.3.37)
51
66
 
52
67
  PLATFORMS
53
68
  ruby
@@ -55,6 +70,7 @@ PLATFORMS
55
70
  DEPENDENCIES
56
71
  activerecord (~> 3.2.0)
57
72
  appraisal
73
+ coveralls
58
74
  fuzzily!
59
75
  mysql2
60
76
  pg
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 3.2.0"
6
+
7
+ gemspec :path=>"../"
8
+
9
+ ENV['FUZZILY_ADAPTER'] = 'mysql'
10
+ ENV['FUZZILY_DB_USER'] = ENV['TRAVIS'] ? 'travis' : 'root'
@@ -0,0 +1,81 @@
1
+ PATH
2
+ remote: /Users/mezis/Dropbox/Development/fuzzily
3
+ specs:
4
+ fuzzily (0.2.3)
5
+ activerecord (>= 2.3.17)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (3.2.13)
11
+ activesupport (= 3.2.13)
12
+ builder (~> 3.0.0)
13
+ activerecord (3.2.13)
14
+ activemodel (= 3.2.13)
15
+ activesupport (= 3.2.13)
16
+ arel (~> 3.0.2)
17
+ tzinfo (~> 0.3.29)
18
+ activesupport (3.2.13)
19
+ i18n (= 0.6.1)
20
+ multi_json (~> 1.0)
21
+ appraisal (0.5.2)
22
+ bundler
23
+ rake
24
+ arel (3.0.2)
25
+ builder (3.0.4)
26
+ coderay (1.0.9)
27
+ colorize (0.5.8)
28
+ coveralls (0.6.7)
29
+ colorize
30
+ multi_json (~> 1.3)
31
+ rest-client
32
+ simplecov (>= 0.7)
33
+ thor
34
+ diff-lcs (1.2.4)
35
+ i18n (0.6.1)
36
+ method_source (0.8.1)
37
+ mime-types (1.23)
38
+ multi_json (1.7.2)
39
+ mysql2 (0.3.11)
40
+ pg (0.15.1)
41
+ pry (0.9.12.1)
42
+ coderay (~> 1.0.5)
43
+ method_source (~> 0.8)
44
+ slop (~> 3.4)
45
+ pry-nav (0.2.3)
46
+ pry (~> 0.9.10)
47
+ rake (10.0.4)
48
+ rest-client (1.6.7)
49
+ mime-types (>= 1.16)
50
+ rspec (2.13.0)
51
+ rspec-core (~> 2.13.0)
52
+ rspec-expectations (~> 2.13.0)
53
+ rspec-mocks (~> 2.13.0)
54
+ rspec-core (2.13.1)
55
+ rspec-expectations (2.13.0)
56
+ diff-lcs (>= 1.1.3, < 2.0)
57
+ rspec-mocks (2.13.1)
58
+ simplecov (0.7.1)
59
+ multi_json (~> 1.0)
60
+ simplecov-html (~> 0.7.1)
61
+ simplecov-html (0.7.1)
62
+ slop (3.4.4)
63
+ sqlite3 (1.3.7)
64
+ thor (0.18.1)
65
+ tzinfo (0.3.37)
66
+
67
+ PLATFORMS
68
+ ruby
69
+
70
+ DEPENDENCIES
71
+ activerecord (~> 3.2.0)
72
+ appraisal
73
+ coveralls
74
+ fuzzily!
75
+ mysql2
76
+ pg
77
+ pry
78
+ pry-nav
79
+ rake
80
+ rspec
81
+ sqlite3
@@ -6,4 +6,5 @@ gem "activerecord", "~> 3.2.0"
6
6
 
7
7
  gemspec :path=>"../"
8
8
 
9
- ENV['FUZZILY_USE_PG'] = 'YES'
9
+ ENV['FUZZILY_ADAPTER'] = 'postgresql'
10
+ ENV['FUZZILY_DB_USER'] = ENV['TRAVIS'] ? 'postgres' : ENV['USER']
@@ -1,42 +1,52 @@
1
1
  PATH
2
2
  remote: /Users/mezis/Dropbox/Development/fuzzily
3
3
  specs:
4
- fuzzily (0.2.2)
4
+ fuzzily (0.2.3)
5
5
  activerecord (>= 2.3.17)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (3.2.12)
11
- activesupport (= 3.2.12)
10
+ activemodel (3.2.13)
11
+ activesupport (= 3.2.13)
12
12
  builder (~> 3.0.0)
13
- activerecord (3.2.12)
14
- activemodel (= 3.2.12)
15
- activesupport (= 3.2.12)
13
+ activerecord (3.2.13)
14
+ activemodel (= 3.2.13)
15
+ activesupport (= 3.2.13)
16
16
  arel (~> 3.0.2)
17
17
  tzinfo (~> 0.3.29)
18
- activesupport (3.2.12)
19
- i18n (~> 0.6)
18
+ activesupport (3.2.13)
19
+ i18n (= 0.6.1)
20
20
  multi_json (~> 1.0)
21
- appraisal (0.5.1)
21
+ appraisal (0.5.2)
22
22
  bundler
23
23
  rake
24
24
  arel (3.0.2)
25
25
  builder (3.0.4)
26
26
  coderay (1.0.9)
27
- diff-lcs (1.2.2)
28
- i18n (0.6.4)
27
+ colorize (0.5.8)
28
+ coveralls (0.6.7)
29
+ colorize
30
+ multi_json (~> 1.3)
31
+ rest-client
32
+ simplecov (>= 0.7)
33
+ thor
34
+ diff-lcs (1.2.4)
35
+ i18n (0.6.1)
29
36
  method_source (0.8.1)
37
+ mime-types (1.23)
30
38
  multi_json (1.7.2)
31
39
  mysql2 (0.3.11)
32
40
  pg (0.15.1)
33
- pry (0.9.12)
41
+ pry (0.9.12.1)
34
42
  coderay (~> 1.0.5)
35
43
  method_source (~> 0.8)
36
44
  slop (~> 3.4)
37
45
  pry-nav (0.2.3)
38
46
  pry (~> 0.9.10)
39
47
  rake (10.0.4)
48
+ rest-client (1.6.7)
49
+ mime-types (>= 1.16)
40
50
  rspec (2.13.0)
41
51
  rspec-core (~> 2.13.0)
42
52
  rspec-expectations (~> 2.13.0)
@@ -44,9 +54,14 @@ GEM
44
54
  rspec-core (2.13.1)
45
55
  rspec-expectations (2.13.0)
46
56
  diff-lcs (>= 1.1.3, < 2.0)
47
- rspec-mocks (2.13.0)
57
+ rspec-mocks (2.13.1)
58
+ simplecov (0.7.1)
59
+ multi_json (~> 1.0)
60
+ simplecov-html (~> 0.7.1)
61
+ simplecov-html (0.7.1)
48
62
  slop (3.4.4)
49
63
  sqlite3 (1.3.7)
64
+ thor (0.18.1)
50
65
  tzinfo (0.3.37)
51
66
 
52
67
  PLATFORMS
@@ -55,6 +70,7 @@ PLATFORMS
55
70
  DEPENDENCIES
56
71
  activerecord (~> 3.2.0)
57
72
  appraisal
73
+ coveralls
58
74
  fuzzily!
59
75
  mysql2
60
76
  pg
@@ -16,10 +16,14 @@ module Fuzzily
16
16
  def make_field_fuzzily_searchable(field, options={})
17
17
  class_variable_defined?(:"@@fuzzily_searchable_#{field}") and return
18
18
 
19
- trigram_class_name = options.fetch(:class_name, 'Trigram')
20
- trigram_association = "trigrams_for_#{field}".to_sym
19
+ trigram_class_name = options.fetch(:class_name, 'Trigram')
20
+ trigram_association = "trigrams_for_#{field}".to_sym
21
21
  update_trigrams_method = "update_fuzzy_#{field}!".to_sym
22
22
 
23
+ supports_bulk_inserts =
24
+ connection.class.name !~ /sqlite/i ||
25
+ connection.send(:sqlite_version) >= '3.7.11'
26
+
23
27
  has_many trigram_association,
24
28
  :class_name => trigram_class_name,
25
29
  :as => :owner,
@@ -55,14 +59,30 @@ module Fuzzily
55
59
  end
56
60
  end
57
61
 
62
+ # take care of quoting
63
+ c = trigram_class.connection
64
+ insert_sql = %Q{
65
+ INSERT INTO %s (%s, %s, %s, %s, %s)
66
+ VALUES
67
+ } % [
68
+ c.quote_table_name(trigram_class.table_name),
69
+ c.quote_column_name('owner_type'),
70
+ c.quote_column_name('owner_id'),
71
+ c.quote_column_name('fuzzy_field'),
72
+ c.quote_column_name('score'),
73
+ c.quote_column_name('trigram')
74
+ ]
75
+
58
76
  trigram_class.transaction do
59
77
  batch.each { |record| record.send(trigram_association).delete_all }
60
- trigram_class.connection.insert(%Q{
61
- INSERT INTO `#{trigram_class.table_name}`
62
- (`owner_type`, `owner_id`, `fuzzy_field`, `score`, `trigram`)
63
- VALUES
64
- #{inserts.join(", ")}
65
- })
78
+
79
+ if supports_bulk_inserts
80
+ trigram_class.connection.insert(insert_sql + inserts.join(", "))
81
+ else
82
+ inserts.each do |insert|
83
+ trigram_class.connection.insert(insert_sql + insert)
84
+ end
85
+ end
66
86
  end
67
87
  end
68
88
  end
@@ -82,6 +102,5 @@ module Fuzzily
82
102
  class_variable_set(:"@@fuzzily_searchable_#{field}", true)
83
103
  self
84
104
  end
85
-
86
105
  end
87
106
  end
@@ -1,3 +1,3 @@
1
1
  module Fuzzily
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -71,6 +71,17 @@ describe Fuzzily::Searchable do
71
71
  end
72
72
  end
73
73
 
74
+ describe '.bulk_update_fuzzy_<field>' do
75
+ before { subject.fuzzily_searchable :name }
76
+
77
+ it 'creates all trigrams' do
78
+ subject.create(:name => 'Paris')
79
+ Trigram.delete_all
80
+ subject.bulk_update_fuzzy_name
81
+ Trigram.all.should_not be_empty
82
+ end
83
+ end
84
+
74
85
  context '(integrationg test)' do
75
86
  describe '#find_by_fuzzy_<field>' do
76
87
  it 'returns records' do
@@ -1,8 +1,41 @@
1
1
  require 'fuzzily'
2
2
  require 'pathname'
3
3
  require 'yaml'
4
+ require 'coveralls'
4
5
 
5
- Database = Pathname.new 'test.sqlite3'
6
+ Coveralls.wear!
7
+
8
+ DATABASE = Pathname.new 'test.sqlite3'
9
+
10
+ # def get_adapter
11
+ # ENV.fetch('FUZZILY_ADAPTER', 'sqlite3')
12
+ # end
13
+
14
+ # Database connection hashes
15
+ def get_connection_hash
16
+ case ENV.fetch('FUZZILY_ADAPTER', 'sqlite3')
17
+ when 'postgresql'
18
+ {
19
+ :adapter => 'postgresql',
20
+ :database => 'fuzzily_test',
21
+ :host => 'localhost',
22
+ :min_messages => 'warning',
23
+ :username => ENV['FUZZILY_DB_USER']
24
+ }
25
+ when 'mysql'
26
+ {
27
+ :adapter => 'mysql2',
28
+ :database => 'fuzzily_test',
29
+ :host => 'localhost',
30
+ :user => ENV['FUZZILY_DB_USER']
31
+ }
32
+ when 'sqlite3'
33
+ {
34
+ :adapter => 'sqlite3',
35
+ :database => DATABASE.to_s
36
+ }
37
+ end
38
+ end
6
39
 
7
40
  # A test model we'll need as a source of trigrams
8
41
  class Stuff < ActiveRecord::Base ; end
@@ -22,24 +55,11 @@ end
22
55
 
23
56
  RSpec.configure do |config|
24
57
  config.before(:each) do
25
- # Setup test database
26
-
27
- if ENV['FUZZILY_USE_PG']
28
- ActiveRecord::Base.establish_connection(
29
- :adapter => 'postgresql',
30
- :database => 'fuzzily_test',
31
- :host => 'localhost',
32
- :username => 'postgres'
33
- )
58
+ # Connect to & cleanup test database
59
+ ActiveRecord::Base.establish_connection(get_connection_hash)
34
60
 
35
- ActiveRecord::Base.connection.execute 'DROP TABLE IF EXISTS trigrams;'
36
- ActiveRecord::Base.connection.execute 'DROP TABLE IF EXISTS stuffs;'
37
- ActiveRecord::Base.connection.execute 'DROP TABLE IF EXISTS foobars;'
38
- else
39
- ActiveRecord::Base.establish_connection(
40
- :adapter => 'sqlite3',
41
- :database => Database.to_s
42
- )
61
+ %w(trigrams stuffs foobars).each do |table_name|
62
+ ActiveRecord::Base.connection.execute "DROP TABLE IF EXISTS #{table_name};"
43
63
  end
44
64
 
45
65
  def prepare_trigrams_table
@@ -57,8 +77,6 @@ RSpec.configure do |config|
57
77
  end
58
78
 
59
79
  config.after(:each) do
60
- unless ENV['FUZZILY_USE_PG']
61
- Database.delete if Database.exist?
62
- end
80
+ DATABASE.delete if DATABASE.exist?
63
81
  end
64
82
  end
metadata CHANGED
@@ -1,158 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuzzily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
5
- prerelease:
4
+ version: 0.2.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Julien Letessier
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-03 00:00:00.000000000 Z
11
+ date: 2013-07-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 2.3.17
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 2.3.17
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: appraisal
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: pry
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: pry-nav
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: sqlite3
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: pg
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: mysql2
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - '>='
148
130
  - !ruby/object:Gem::Version
149
131
  version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: coveralls
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
156
151
  - !ruby/object:Gem::Version
157
152
  version: '0'
158
153
  description: Fast fuzzy string matching for rails
@@ -181,6 +176,8 @@ files:
181
176
  - gemfiles/rails31.gemfile.lock
182
177
  - gemfiles/rails32.gemfile
183
178
  - gemfiles/rails32.gemfile.lock
179
+ - gemfiles/rails32_mysql.gemfile
180
+ - gemfiles/rails32_mysql.gemfile.lock
184
181
  - gemfiles/rails32_pg.gemfile
185
182
  - gemfiles/rails32_pg.gemfile.lock
186
183
  - lib/fuzzily.rb
@@ -197,33 +194,26 @@ files:
197
194
  - spec/spec_helper.rb
198
195
  homepage: ''
199
196
  licenses: []
197
+ metadata: {}
200
198
  post_install_message:
201
199
  rdoc_options: []
202
200
  require_paths:
203
201
  - lib
204
202
  required_ruby_version: !ruby/object:Gem::Requirement
205
- none: false
206
203
  requirements:
207
- - - ! '>='
204
+ - - '>='
208
205
  - !ruby/object:Gem::Version
209
206
  version: '0'
210
- segments:
211
- - 0
212
- hash: 2078821306338560416
213
207
  required_rubygems_version: !ruby/object:Gem::Requirement
214
- none: false
215
208
  requirements:
216
- - - ! '>='
209
+ - - '>='
217
210
  - !ruby/object:Gem::Version
218
211
  version: '0'
219
- segments:
220
- - 0
221
- hash: 2078821306338560416
222
212
  requirements: []
223
213
  rubyforge_project:
224
- rubygems_version: 1.8.23
214
+ rubygems_version: 2.0.3
225
215
  signing_key:
226
- specification_version: 3
216
+ specification_version: 4
227
217
  summary: A fast, trigram-based, database-backed fuzzy string search/match engine for
228
218
  Rails.
229
219
  test_files: