dusen 0.4.6 → 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,7 +3,6 @@ pkg
3
3
  *.gem
4
4
  .idea
5
5
  app_root/log/*
6
- Gemfile.lock
7
6
  spec/shared/app_root/db/*.db
8
7
  spec/shared/app_root/config/database.yml
9
8
 
data/README.md CHANGED
@@ -37,7 +37,7 @@ Under the hood the search will be performed using [LIKE queries](http://dev.mysq
37
37
  Our example will be a simple address book:
38
38
 
39
39
  class Contact < ActiveRecord::Base
40
- validates_presence_of :name, :street, :city, :name
40
+ validates_presence_of :name, :street, :city, :email
41
41
  end
42
42
 
43
43
 
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ namespace :all do
45
45
  desc "Bundle all spec apps"
46
46
  task :bundle do
47
47
  for_each_directory_of('spec/**/Gemfile') do |directory|
48
- system("cd #{directory} && rm -f Gemfile.lock && bundle install")
48
+ system("cd #{directory} Gemfile.lock && bundle install")
49
49
  end
50
50
  end
51
51
 
data/dusen.gemspec CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_dependency('rails')
19
+ s.add_dependency('activerecord')
20
+ s.add_dependency('edge_rider', '>=0.2.3')
20
21
 
21
22
  end
@@ -27,7 +27,7 @@ module Dusen
27
27
 
28
28
  def self.synchronize_model(model)
29
29
  invalid_index_records = for_model(model).invalid
30
- source_ids = Util.collect_column(invalid_index_records, :source_id)
30
+ source_ids = invalid_index_records.collect_column(:source_id)
31
31
  pending_source_ids = Set.new(source_ids)
32
32
  source_records = Util.append_scope_conditions(model, :id => source_ids)
33
33
  source_records.find_in_batches do |batch|
@@ -57,7 +57,7 @@ module Dusen
57
57
  Dusen::Util.boolean_fulltext_query(phrases)
58
58
  ]
59
59
  matching_texts = Dusen::Util.append_scope_conditions(for_model(model), conditions)
60
- Dusen::Util.collect_column(matching_texts, :source_id)
60
+ matching_texts.collect_column(:source_id)
61
61
  end
62
62
 
63
63
  end
data/lib/dusen/util.rb CHANGED
@@ -81,42 +81,6 @@ module Dusen
81
81
  print "\033[0m"
82
82
  end
83
83
 
84
- #def scope_to_sql(scope)
85
- # query = if scope.respond_to?(:to_sql)
86
- # scope.to_sql
87
- # else
88
- # scope.construct_finder_sql({})
89
- # end
90
- #end
91
-
92
- def scope_to_sql(options = {})
93
- if Rails.version < '3'
94
- scope.construct_finder_sql(options)
95
- else
96
- scope.scoped(options).to_sql
97
- end
98
- end
99
-
100
- def collect_column(scope, column_name, find_options = {})
101
- distinct = find_options.delete(:distinct)
102
- qualified_column_name = "`#{scope.table_name}`.`#{column_name}`"
103
- select = distinct ? "DISTINCT #{qualified_column_name}" : qualified_column_name
104
- query = if Rails.version.to_i < 3
105
- scope.construct_finder_sql(find_options.merge(:select => select))
106
- else
107
- scope.scoped(find_options.merge(:select => select)).to_sql
108
- end
109
- raw_values = scope.connection.select_values(query)
110
- column = scope.columns_hash[column_name.to_s] or raise "Could not retrieve column information: #{column_name}"
111
- raw_values.collect { |value| column.type_cast(value) }
112
- end
113
-
114
- #def collect_ids(scope)
115
- # scope = select_scope_fields(scope, "`#{scope.table_name}`.`id`")
116
- # query = scope_to_sql(scope)
117
- # ::ActiveRecord::Base.connection.select_values(query).collect(&:to_i)
118
- #end
119
-
120
84
  def normalize_word_boundaries(text)
121
85
  unwanted_mysql_boundary = /[\.;\-]/
122
86
  text.gsub(unwanted_mysql_boundary, '')
data/lib/dusen/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Dusen
4
- VERSION = '0.4.6'
4
+ VERSION = '0.4.8'
5
5
  end
data/lib/dusen.rb CHANGED
@@ -9,6 +9,7 @@ require 'dusen/query'
9
9
  require 'dusen/syntax'
10
10
 
11
11
  if defined?(ActiveRecord)
12
+ require 'edge_rider'
12
13
  require 'dusen/active_record/base_ext'
13
14
  require 'dusen/active_record/search_text'
14
15
  end
@@ -0,0 +1,66 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ dusen (0.4.7)
5
+ activerecord
6
+ edge_rider (>= 0.2.3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (2.3.18)
12
+ actionpack (= 2.3.18)
13
+ actionpack (2.3.18)
14
+ activesupport (= 2.3.18)
15
+ rack (~> 1.1.0)
16
+ activerecord (2.3.18)
17
+ activesupport (= 2.3.18)
18
+ activeresource (2.3.18)
19
+ activesupport (= 2.3.18)
20
+ activesupport (2.3.18)
21
+ andand (1.3.3)
22
+ columnize (0.3.6)
23
+ database_cleaner (1.0.1)
24
+ edge_rider (0.2.3)
25
+ activerecord
26
+ hoe (2.8.0)
27
+ rake (>= 0.8.7)
28
+ linecache (0.46)
29
+ rbx-require-relative (> 0.0.4)
30
+ mysql2 (0.2.18)
31
+ rack (1.1.6)
32
+ rails (2.3.18)
33
+ actionmailer (= 2.3.18)
34
+ actionpack (= 2.3.18)
35
+ activerecord (= 2.3.18)
36
+ activeresource (= 2.3.18)
37
+ activesupport (= 2.3.18)
38
+ rake (>= 0.8.3)
39
+ rake (10.0.4)
40
+ rbx-require-relative (0.0.9)
41
+ rspec (1.3.2)
42
+ rspec-rails (1.3.4)
43
+ rack (>= 1.0.0)
44
+ rspec (~> 1.3.1)
45
+ ruby-debug (0.10.4)
46
+ columnize (>= 0.1)
47
+ ruby-debug-base (~> 0.10.4.0)
48
+ ruby-debug-base (0.10.4)
49
+ linecache (>= 0.3)
50
+ test-unit (1.2.3)
51
+ hoe (>= 1.5.1)
52
+
53
+ PLATFORMS
54
+ ruby
55
+
56
+ DEPENDENCIES
57
+ andand
58
+ database_cleaner
59
+ dusen!
60
+ hoe (= 2.8.0)
61
+ mysql2 (~> 0.2.0)
62
+ rails (~> 2.3)
63
+ rspec (~> 1.3)
64
+ rspec-rails (~> 1.3)
65
+ ruby-debug
66
+ test-unit (~> 1.2)
@@ -0,0 +1,120 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ dusen (0.4.7)
5
+ activerecord
6
+ edge_rider (>= 0.2.3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ abstract (1.0.0)
12
+ actionmailer (3.0.20)
13
+ actionpack (= 3.0.20)
14
+ mail (~> 2.2.19)
15
+ actionpack (3.0.20)
16
+ activemodel (= 3.0.20)
17
+ activesupport (= 3.0.20)
18
+ builder (~> 2.1.2)
19
+ erubis (~> 2.6.6)
20
+ i18n (~> 0.5.0)
21
+ rack (~> 1.2.5)
22
+ rack-mount (~> 0.6.14)
23
+ rack-test (~> 0.5.7)
24
+ tzinfo (~> 0.3.23)
25
+ activemodel (3.0.20)
26
+ activesupport (= 3.0.20)
27
+ builder (~> 2.1.2)
28
+ i18n (~> 0.5.0)
29
+ activerecord (3.0.20)
30
+ activemodel (= 3.0.20)
31
+ activesupport (= 3.0.20)
32
+ arel (~> 2.0.10)
33
+ tzinfo (~> 0.3.23)
34
+ activeresource (3.0.20)
35
+ activemodel (= 3.0.20)
36
+ activesupport (= 3.0.20)
37
+ activesupport (3.0.20)
38
+ andand (1.3.3)
39
+ arel (2.0.10)
40
+ builder (2.1.2)
41
+ columnize (0.3.6)
42
+ database_cleaner (1.0.1)
43
+ diff-lcs (1.2.4)
44
+ edge_rider (0.2.3)
45
+ activerecord
46
+ erubis (2.6.6)
47
+ abstract (>= 1.0.0)
48
+ i18n (0.5.0)
49
+ json (1.8.0)
50
+ linecache (0.46)
51
+ rbx-require-relative (> 0.0.4)
52
+ mail (2.2.20)
53
+ activesupport (>= 2.3.6)
54
+ i18n (>= 0.4.0)
55
+ mime-types (~> 1.16)
56
+ treetop (~> 1.4.8)
57
+ mime-types (1.23)
58
+ mysql2 (0.2.18)
59
+ polyglot (0.3.3)
60
+ rack (1.2.8)
61
+ rack-mount (0.6.14)
62
+ rack (>= 1.0.0)
63
+ rack-test (0.5.7)
64
+ rack (>= 1.0)
65
+ rails (3.0.20)
66
+ actionmailer (= 3.0.20)
67
+ actionpack (= 3.0.20)
68
+ activerecord (= 3.0.20)
69
+ activeresource (= 3.0.20)
70
+ activesupport (= 3.0.20)
71
+ bundler (~> 1.0)
72
+ railties (= 3.0.20)
73
+ railties (3.0.20)
74
+ actionpack (= 3.0.20)
75
+ activesupport (= 3.0.20)
76
+ rake (>= 0.8.7)
77
+ rdoc (~> 3.4)
78
+ thor (~> 0.14.4)
79
+ rake (10.0.4)
80
+ rbx-require-relative (0.0.9)
81
+ rdoc (3.12.2)
82
+ json (~> 1.4)
83
+ rspec (2.13.0)
84
+ rspec-core (~> 2.13.0)
85
+ rspec-expectations (~> 2.13.0)
86
+ rspec-mocks (~> 2.13.0)
87
+ rspec-core (2.13.1)
88
+ rspec-expectations (2.13.0)
89
+ diff-lcs (>= 1.1.3, < 2.0)
90
+ rspec-mocks (2.13.1)
91
+ rspec-rails (2.13.1)
92
+ actionpack (>= 3.0)
93
+ activesupport (>= 3.0)
94
+ railties (>= 3.0)
95
+ rspec-core (~> 2.13.0)
96
+ rspec-expectations (~> 2.13.0)
97
+ rspec-mocks (~> 2.13.0)
98
+ ruby-debug (0.10.4)
99
+ columnize (>= 0.1)
100
+ ruby-debug-base (~> 0.10.4.0)
101
+ ruby-debug-base (0.10.4)
102
+ linecache (>= 0.3)
103
+ thor (0.14.6)
104
+ treetop (1.4.12)
105
+ polyglot
106
+ polyglot (>= 0.3.1)
107
+ tzinfo (0.3.37)
108
+
109
+ PLATFORMS
110
+ ruby
111
+
112
+ DEPENDENCIES
113
+ andand
114
+ database_cleaner
115
+ dusen!
116
+ mysql2 (~> 0.2.0)
117
+ rails (~> 3.0.17)
118
+ rspec
119
+ rspec-rails
120
+ ruby-debug
@@ -0,0 +1,135 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ dusen (0.4.7)
5
+ activerecord
6
+ edge_rider (>= 0.2.3)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (3.2.13)
12
+ actionpack (= 3.2.13)
13
+ mail (~> 2.5.3)
14
+ actionpack (3.2.13)
15
+ activemodel (= 3.2.13)
16
+ activesupport (= 3.2.13)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ journey (~> 1.0.4)
20
+ rack (~> 1.4.5)
21
+ rack-cache (~> 1.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.2.1)
24
+ activemodel (3.2.13)
25
+ activesupport (= 3.2.13)
26
+ builder (~> 3.0.0)
27
+ activerecord (3.2.13)
28
+ activemodel (= 3.2.13)
29
+ activesupport (= 3.2.13)
30
+ arel (~> 3.0.2)
31
+ tzinfo (~> 0.3.29)
32
+ activeresource (3.2.13)
33
+ activemodel (= 3.2.13)
34
+ activesupport (= 3.2.13)
35
+ activesupport (3.2.13)
36
+ i18n (= 0.6.1)
37
+ multi_json (~> 1.0)
38
+ andand (1.3.3)
39
+ arel (3.0.2)
40
+ builder (3.0.4)
41
+ columnize (0.3.6)
42
+ database_cleaner (1.0.1)
43
+ diff-lcs (1.2.4)
44
+ edge_rider (0.2.3)
45
+ activerecord
46
+ erubis (2.7.0)
47
+ hike (1.2.2)
48
+ i18n (0.6.1)
49
+ journey (1.0.4)
50
+ json (1.8.0)
51
+ linecache (0.46)
52
+ rbx-require-relative (> 0.0.4)
53
+ mail (2.5.4)
54
+ mime-types (~> 1.16)
55
+ treetop (~> 1.4.8)
56
+ mime-types (1.23)
57
+ multi_json (1.7.3)
58
+ mysql2 (0.3.11)
59
+ polyglot (0.3.3)
60
+ rack (1.4.5)
61
+ rack-cache (1.2)
62
+ rack (>= 0.4)
63
+ rack-ssl (1.3.3)
64
+ rack
65
+ rack-test (0.6.2)
66
+ rack (>= 1.0)
67
+ rails (3.2.13)
68
+ actionmailer (= 3.2.13)
69
+ actionpack (= 3.2.13)
70
+ activerecord (= 3.2.13)
71
+ activeresource (= 3.2.13)
72
+ activesupport (= 3.2.13)
73
+ bundler (~> 1.0)
74
+ railties (= 3.2.13)
75
+ railties (3.2.13)
76
+ actionpack (= 3.2.13)
77
+ activesupport (= 3.2.13)
78
+ rack-ssl (~> 1.3.2)
79
+ rake (>= 0.8.7)
80
+ rdoc (~> 3.4)
81
+ thor (>= 0.14.6, < 2.0)
82
+ rake (10.0.4)
83
+ rbx-require-relative (0.0.9)
84
+ rdoc (3.12.2)
85
+ json (~> 1.4)
86
+ rspec (2.13.0)
87
+ rspec-core (~> 2.13.0)
88
+ rspec-expectations (~> 2.13.0)
89
+ rspec-mocks (~> 2.13.0)
90
+ rspec-core (2.13.1)
91
+ rspec-expectations (2.13.0)
92
+ diff-lcs (>= 1.1.3, < 2.0)
93
+ rspec-mocks (2.13.1)
94
+ rspec-rails (2.13.1)
95
+ actionpack (>= 3.0)
96
+ activesupport (>= 3.0)
97
+ railties (>= 3.0)
98
+ rspec-core (~> 2.13.0)
99
+ rspec-expectations (~> 2.13.0)
100
+ rspec-mocks (~> 2.13.0)
101
+ rspec_candy (0.2.9)
102
+ rspec
103
+ sneaky-save
104
+ ruby-debug (0.10.4)
105
+ columnize (>= 0.1)
106
+ ruby-debug-base (~> 0.10.4.0)
107
+ ruby-debug-base (0.10.4)
108
+ linecache (>= 0.3)
109
+ sneaky-save (0.0.4)
110
+ activerecord (>= 3.2.0)
111
+ sprockets (2.2.2)
112
+ hike (~> 1.2)
113
+ multi_json (~> 1.0)
114
+ rack (~> 1.0)
115
+ tilt (~> 1.1, != 1.3.0)
116
+ thor (0.18.1)
117
+ tilt (1.4.1)
118
+ treetop (1.4.12)
119
+ polyglot
120
+ polyglot (>= 0.3.1)
121
+ tzinfo (0.3.37)
122
+
123
+ PLATFORMS
124
+ ruby
125
+
126
+ DEPENDENCIES
127
+ andand
128
+ database_cleaner
129
+ dusen!
130
+ mysql2
131
+ rails (~> 3.2.0)
132
+ rspec
133
+ rspec-rails
134
+ rspec_candy
135
+ ruby-debug
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dusen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 6
10
- version: 0.4.6
9
+ - 8
10
+ version: 0.4.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-07-26 00:00:00 +02:00
18
+ date: 2013-09-17 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: rails
22
+ name: activerecord
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
@@ -32,6 +32,22 @@ dependencies:
32
32
  version: "0"
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: edge_rider
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 17
44
+ segments:
45
+ - 0
46
+ - 2
47
+ - 3
48
+ version: 0.2.3
49
+ type: :runtime
50
+ version_requirements: *id002
35
51
  description: Comprehensive full text search for ActiveRecord and MySQL
36
52
  email: henning.koch@makandra.de
37
53
  executables: []
@@ -69,6 +85,7 @@ files:
69
85
  - lib/dusen/util.rb
70
86
  - lib/dusen/version.rb
71
87
  - spec/rails-2.3/Gemfile
88
+ - spec/rails-2.3/Gemfile.lock
72
89
  - spec/rails-2.3/Rakefile
73
90
  - spec/rails-2.3/app_root/config/boot.rb
74
91
  - spec/rails-2.3/app_root/config/environment.rb
@@ -82,6 +99,7 @@ files:
82
99
  - spec/rails-2.3/spec/spec_helper.rb
83
100
  - spec/rails-3.0/.rspec
84
101
  - spec/rails-3.0/Gemfile
102
+ - spec/rails-3.0/Gemfile.lock
85
103
  - spec/rails-3.0/Rakefile
86
104
  - spec/rails-3.0/app_root/.gitignore
87
105
  - spec/rails-3.0/app_root/config/application.rb
@@ -101,6 +119,7 @@ files:
101
119
  - spec/rails-3.0/spec/spec_helper.rb
102
120
  - spec/rails-3.2/.rspec
103
121
  - spec/rails-3.2/Gemfile
122
+ - spec/rails-3.2/Gemfile.lock
104
123
  - spec/rails-3.2/Rakefile
105
124
  - spec/rails-3.2/app_root/.gitignore
106
125
  - spec/rails-3.2/app_root/config/application.rb