outoftime-sunspot 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/History.txt +9 -6
  2. data/README.rdoc +45 -13
  3. data/Rakefile +5 -21
  4. data/VERSION.yml +4 -0
  5. data/bin/sunspot-solr +39 -0
  6. data/lib/sunspot/builder.rb +78 -0
  7. data/lib/sunspot/dsl/fields.rb +39 -0
  8. data/lib/sunspot/dsl/query.rb +32 -0
  9. data/lib/sunspot/dsl/scope.rb +35 -0
  10. data/lib/sunspot/dsl.rb +3 -0
  11. data/lib/sunspot/query.rb +9 -20
  12. data/lib/sunspot/search.rb +8 -25
  13. data/lib/sunspot.rb +2 -3
  14. data/solr/etc/jetty.xml +10 -4
  15. data/solr/solr/conf/{admin-extra.html → elevate.xml} +18 -13
  16. data/solr/solr/conf/solrconfig.xml +369 -67
  17. data/solr/webapps/solr.war +0 -0
  18. data/spec/api/build_search_spec.rb +195 -0
  19. data/spec/api/indexer_spec.rb +112 -0
  20. data/spec/api/search_retrieval_spec.rb +59 -0
  21. data/spec/api/session_spec.rb +44 -0
  22. data/spec/api/spec_helper.rb +1 -0
  23. data/spec/api/standard_search_builder_spec.rb +76 -0
  24. data/{test → spec}/custom_expectation.rb +0 -0
  25. data/{test/integration/test_field_types.rb → spec/integration/field_types_spec.rb} +9 -9
  26. data/{test/integration/test_keyword_search.rb → spec/integration/keyword_search_spec.rb} +5 -5
  27. data/spec/integration/spec_helper.rb +1 -0
  28. data/{test → spec}/integration/test_pagination.rb +5 -5
  29. data/{test → spec}/mocks/base_class.rb +0 -0
  30. data/{test → spec}/mocks/comment.rb +0 -0
  31. data/{test → spec}/mocks/mock_adapter.rb +0 -0
  32. data/{test → spec}/mocks/post.rb +0 -0
  33. data/{test/test_helper.rb → spec/spec_helper.rb} +6 -12
  34. data/tasks/gemspec.rake +18 -0
  35. data/tasks/rcov.rake +27 -5
  36. data/tasks/spec.rake +21 -0
  37. metadata +90 -125
  38. data/Manifest.txt +0 -104
  39. data/PostInstall.txt +0 -7
  40. data/config/hoe.rb +0 -74
  41. data/config/requirements.rb +0 -15
  42. data/lib/sunspot/conditions.rb +0 -50
  43. data/lib/sunspot/conditions_builder.rb +0 -37
  44. data/lib/sunspot/field_builder.rb +0 -37
  45. data/lib/sunspot/query_builder.rb +0 -30
  46. data/lib/sunspot/scope_builder.rb +0 -33
  47. data/lib/sunspot/version.rb +0 -10
  48. data/setup.rb +0 -1585
  49. data/solr/README.txt +0 -36
  50. data/solr/exampledocs/books.csv +0 -11
  51. data/solr/exampledocs/hd.xml +0 -46
  52. data/solr/exampledocs/ipod_other.xml +0 -50
  53. data/solr/exampledocs/ipod_video.xml +0 -35
  54. data/solr/exampledocs/mem.xml +0 -58
  55. data/solr/exampledocs/monitor.xml +0 -31
  56. data/solr/exampledocs/monitor2.xml +0 -30
  57. data/solr/exampledocs/mp500.xml +0 -39
  58. data/solr/exampledocs/post.jar +0 -0
  59. data/solr/exampledocs/post.sh +0 -28
  60. data/solr/exampledocs/sd500.xml +0 -33
  61. data/solr/exampledocs/solr.xml +0 -38
  62. data/solr/exampledocs/spellchecker.xml +0 -58
  63. data/solr/exampledocs/utf8-example.xml +0 -42
  64. data/solr/exampledocs/vidcard.xml +0 -52
  65. data/solr/solr/README.txt +0 -52
  66. data/solr/solr/bin/abc +0 -176
  67. data/solr/solr/bin/abo +0 -176
  68. data/solr/solr/bin/backup +0 -108
  69. data/solr/solr/bin/backupcleaner +0 -142
  70. data/solr/solr/bin/commit +0 -128
  71. data/solr/solr/bin/optimize +0 -129
  72. data/solr/solr/bin/readercycle +0 -129
  73. data/solr/solr/bin/rsyncd-disable +0 -77
  74. data/solr/solr/bin/rsyncd-enable +0 -76
  75. data/solr/solr/bin/rsyncd-start +0 -145
  76. data/solr/solr/bin/rsyncd-stop +0 -105
  77. data/solr/solr/bin/scripts-util +0 -83
  78. data/solr/solr/bin/snapcleaner +0 -148
  79. data/solr/solr/bin/snapinstaller +0 -168
  80. data/solr/solr/bin/snappuller +0 -248
  81. data/solr/solr/bin/snappuller-disable +0 -77
  82. data/solr/solr/bin/snappuller-enable +0 -77
  83. data/solr/solr/bin/snapshooter +0 -109
  84. data/solr/solr/conf/scripts.conf +0 -24
  85. data/tasks/deployment.rake +0 -34
  86. data/tasks/environment.rake +0 -7
  87. data/tasks/solr.rake +0 -12
  88. data/tasks/website.rake +0 -17
  89. data/test/api/test_build_search.rb +0 -216
  90. data/test/api/test_helper.rb +0 -4
  91. data/test/api/test_indexer.rb +0 -110
  92. data/test/api/test_retrieve_search.rb +0 -114
  93. data/test/api/test_session.rb +0 -46
  94. data/test/integration/test_helper.rb +0 -1
data/tasks/rcov.rake CHANGED
@@ -1,6 +1,28 @@
1
- require 'rcov/rcovtask'
2
- Rcov::RcovTask.new do |t|
3
- t.test_files = FileList['test/**/test_*.rb']
4
- t.rcov_opts << "--sort coverage"
5
- t.rcov_opts << "--only-uncovered"
1
+ require 'rake'
2
+ require 'spec/rake/spectask'
3
+
4
+ desc 'run specs with rcov'
5
+ Spec::Rake::SpecTask.new('rcov') do |t|
6
+ t.spec_files = FileList['spec/**/*_spec.rb']
7
+ t.rcov = true
8
+ t.rcov_dir = File.join('coverage', 'all')
9
+ t.rcov_opts.concat(['--exclude', 'spec', '--sort', 'coverage', '--only-uncovered'])
10
+ end
11
+
12
+ namespace :rcov do
13
+ desc 'run api specs with rcov'
14
+ Spec::Rake::SpecTask.new('api') do |t|
15
+ t.spec_files = FileList['spec/api/*_spec.rb']
16
+ t.rcov = true
17
+ t.rcov_dir = File.join('coverage', 'api')
18
+ t.rcov_opts.concat(['--exclude', 'spec', '--sort', 'coverage', '--only-uncovered'])
19
+ end
20
+
21
+ desc 'run integration specs with rcov'
22
+ Spec::Rake::SpecTask.new('integration') do |t|
23
+ t.spec_files = FileList['spec/integration/*_spec.rb']
24
+ t.rcov = true
25
+ t.rcov_dir = File.join('coverage', 'integration')
26
+ t.rcov_opts.concat(['--exclude', 'spec', '--sort', 'coverage', '--only-uncovered'])
27
+ end
6
28
  end
data/tasks/spec.rake ADDED
@@ -0,0 +1,21 @@
1
+ gem 'rspec', '~>1.1'
2
+
3
+ require 'spec'
4
+ require 'spec/rake/spectask'
5
+
6
+ desc 'run specs'
7
+ Spec::Rake::SpecTask.new('spec') do |t|
8
+ t.spec_files = FileList[File.join(File.dirname(__FILE__), '..', 'spec', '**', '*_spec.rb')]
9
+ end
10
+
11
+ namespace :spec do
12
+ desc 'run api specs (mock out Solr dependency)'
13
+ Spec::Rake::SpecTask.new('api') do |t|
14
+ t.spec_files = FileList[File.join(File.dirname(__FILE__), '..', 'spec', 'api', '*_spec.rb')]
15
+ end
16
+
17
+ desc 'run integration specs (be sure to run `bin/sunspot-solr start`)'
18
+ Spec::Rake::SpecTask.new('integration') do |t|
19
+ t.spec_files = FileList[File.join(File.dirname(__FILE__), '..', 'spec', 'integration', '*_spec.rb')]
20
+ end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outoftime-sunspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Brown
@@ -9,154 +9,128 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-12 00:00:00 -08:00
13
- default_executable:
12
+ date: 2009-02-14 00:00:00 -08:00
13
+ default_executable: sunspot-solr
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: newgem
16
+ name: solr-ruby
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
21
  - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 1.0.6
23
+ version: 0.0.6
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
- name: hoe
26
+ name: extlib
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
29
31
  - - ">="
30
32
  - !ruby/object:Gem::Version
31
- version: 1.8.0
33
+ version: 0.9.10
32
34
  version:
33
- description: ""
34
- email:
35
- - mat@patch.com
36
- executables: []
37
-
35
+ - !ruby/object:Gem::Dependency
36
+ name: rspec
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: "1.1"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: ruby-debug
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: "0.10"
54
+ version:
55
+ description: Library for expressive, powerful interaction with the Solr search engine
56
+ email: mat@patch.com
57
+ executables:
58
+ - sunspot-solr
38
59
  extensions: []
39
60
 
40
- extra_rdoc_files:
41
- - History.txt
42
- - Manifest.txt
43
- - PostInstall.txt
44
- - README.rdoc
45
- - solr/README.txt
46
- - solr/solr/README.txt
47
- - solr/solr/conf/protwords.txt
48
- - solr/solr/conf/stopwords.txt
49
- - solr/solr/conf/synonyms.txt
61
+ extra_rdoc_files: []
62
+
50
63
  files:
51
- - History.txt
52
- - Manifest.txt
53
- - PostInstall.txt
54
- - README.rdoc
55
64
  - Rakefile
56
- - config/hoe.rb
57
- - config/requirements.rb
58
- - lib/light_config.rb
59
- - lib/sunspot.rb
65
+ - README.rdoc
66
+ - History.txt
67
+ - VERSION.yml
68
+ - bin/sunspot-solr
69
+ - lib/sunspot
70
+ - lib/sunspot/session.rb
71
+ - lib/sunspot/type.rb
60
72
  - lib/sunspot/adapters.rb
61
- - lib/sunspot/conditions.rb
62
- - lib/sunspot/conditions_builder.rb
73
+ - lib/sunspot/restriction.rb
63
74
  - lib/sunspot/configuration.rb
75
+ - lib/sunspot/dsl.rb
76
+ - lib/sunspot/search.rb
77
+ - lib/sunspot/builder.rb
64
78
  - lib/sunspot/field.rb
65
- - lib/sunspot/field_builder.rb
66
79
  - lib/sunspot/indexer.rb
67
80
  - lib/sunspot/query.rb
68
- - lib/sunspot/query_builder.rb
69
- - lib/sunspot/restriction.rb
70
- - lib/sunspot/scope_builder.rb
71
- - lib/sunspot/search.rb
72
- - lib/sunspot/session.rb
73
- - lib/sunspot/type.rb
74
81
  - lib/sunspot/util.rb
75
- - lib/sunspot/version.rb
76
- - log/test_solr.log
77
- - setup.rb
78
- - solr/README.txt
79
- - solr/etc/jetty.xml
82
+ - lib/sunspot/dsl
83
+ - lib/sunspot/dsl/fields.rb
84
+ - lib/sunspot/dsl/scope.rb
85
+ - lib/sunspot/dsl/query.rb
86
+ - lib/sunspot.rb
87
+ - lib/light_config.rb
88
+ - spec/spec_helper.rb
89
+ - spec/custom_expectation.rb
90
+ - spec/integration
91
+ - spec/integration/spec_helper.rb
92
+ - spec/integration/keyword_search_spec.rb
93
+ - spec/integration/field_types_spec.rb
94
+ - spec/integration/test_pagination.rb
95
+ - spec/mocks
96
+ - spec/mocks/base_class.rb
97
+ - spec/mocks/mock_adapter.rb
98
+ - spec/mocks/post.rb
99
+ - spec/mocks/comment.rb
100
+ - spec/api
101
+ - spec/api/search_retrieval_spec.rb
102
+ - spec/api/spec_helper.rb
103
+ - spec/api/session_spec.rb
104
+ - spec/api/build_search_spec.rb
105
+ - spec/api/standard_search_builder_spec.rb
106
+ - spec/api/indexer_spec.rb
107
+ - tasks/gemspec.rake
108
+ - tasks/rcov.rake
109
+ - tasks/spec.rake
80
110
  - solr/etc/webdefault.xml
81
- - solr/exampledocs/books.csv
82
- - solr/exampledocs/hd.xml
83
- - solr/exampledocs/ipod_other.xml
84
- - solr/exampledocs/ipod_video.xml
85
- - solr/exampledocs/mem.xml
86
- - solr/exampledocs/monitor.xml
87
- - solr/exampledocs/monitor2.xml
88
- - solr/exampledocs/mp500.xml
89
- - solr/exampledocs/post.jar
90
- - solr/exampledocs/post.sh
91
- - solr/exampledocs/sd500.xml
92
- - solr/exampledocs/solr.xml
93
- - solr/exampledocs/spellchecker.xml
94
- - solr/exampledocs/utf8-example.xml
95
- - solr/exampledocs/vidcard.xml
96
- - solr/lib/jetty-6.1.3.jar
111
+ - solr/etc/jetty.xml
97
112
  - solr/lib/jetty-util-6.1.3.jar
113
+ - solr/lib/servlet-api-2.5-6.1.3.jar
114
+ - solr/lib/jetty-6.1.3.jar
115
+ - solr/lib/jsp-2.1
116
+ - solr/lib/jsp-2.1/jsp-2.1.jar
98
117
  - solr/lib/jsp-2.1/ant-1.6.5.jar
99
118
  - solr/lib/jsp-2.1/core-3.1.1.jar
100
- - solr/lib/jsp-2.1/jsp-2.1.jar
101
119
  - solr/lib/jsp-2.1/jsp-api-2.1.jar
102
- - solr/lib/servlet-api-2.5-6.1.3.jar
103
- - solr/logs
104
- - solr/solr/README.txt
105
- - solr/solr/bin/abc
106
- - solr/solr/bin/abo
107
- - solr/solr/bin/backup
108
- - solr/solr/bin/backupcleaner
109
- - solr/solr/bin/commit
110
- - solr/solr/bin/optimize
111
- - solr/solr/bin/readercycle
112
- - solr/solr/bin/rsyncd-disable
113
- - solr/solr/bin/rsyncd-enable
114
- - solr/solr/bin/rsyncd-start
115
- - solr/solr/bin/rsyncd-stop
116
- - solr/solr/bin/scripts-util
117
- - solr/solr/bin/snapcleaner
118
- - solr/solr/bin/snapinstaller
119
- - solr/solr/bin/snappuller
120
- - solr/solr/bin/snappuller-disable
121
- - solr/solr/bin/snappuller-enable
122
- - solr/solr/bin/snapshooter
123
- - solr/solr/conf/admin-extra.html
120
+ - solr/webapps/solr.war
121
+ - solr/solr/conf/elevate.xml
124
122
  - solr/solr/conf/protwords.txt
125
- - solr/solr/conf/schema.xml
126
- - solr/solr/conf/scripts.conf
123
+ - solr/solr/conf/synonyms.txt
127
124
  - solr/solr/conf/solrconfig.xml
125
+ - solr/solr/conf/schema.xml
128
126
  - solr/solr/conf/stopwords.txt
129
- - solr/solr/conf/synonyms.txt
130
- - solr/solr/conf/xslt
131
- - solr/solr/data/spell
132
127
  - solr/start.jar
133
- - solr/webapps/solr.war
134
- - tasks/deployment.rake
135
- - tasks/environment.rake
136
- - tasks/rcov.rake
137
- - tasks/solr.rake
138
- - tasks/website.rake
139
- - test/api/test_build_search.rb
140
- - test/api/test_helper.rb
141
- - test/api/test_indexer.rb
142
- - test/api/test_retrieve_search.rb
143
- - test/api/test_session.rb
144
- - test/custom_expectation.rb
145
- - test/integration/test_field_types.rb
146
- - test/integration/test_helper.rb
147
- - test/integration/test_keyword_search.rb
148
- - test/integration/test_pagination.rb
149
- - test/mocks/base_class.rb
150
- - test/mocks/comment.rb
151
- - test/mocks/mock_adapter.rb
152
- - test/mocks/post.rb
153
- - test/test_helper.rb
154
128
  has_rdoc: true
155
129
  homepage: http://github.com/outoftime/sunspot
156
- post_install_message: PostInstall.txt
130
+ post_install_message:
157
131
  rdoc_options:
158
- - --main
159
- - README.rdoc
132
+ - --inline-source
133
+ - --charset=UTF-8
160
134
  require_paths:
161
135
  - lib
162
136
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -173,19 +147,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
147
  version:
174
148
  requirements: []
175
149
 
176
- rubyforge_project: sunspot
150
+ rubyforge_project:
177
151
  rubygems_version: 1.2.0
178
152
  signing_key:
179
153
  specification_version: 2
180
- summary: library for expressive, powerful interaction with the Solr search engine
181
- test_files:
182
- - test/api/test_build_search.rb
183
- - test/api/test_helper.rb
184
- - test/api/test_indexer.rb
185
- - test/api/test_retrieve_search.rb
186
- - test/api/test_session.rb
187
- - test/integration/test_field_types.rb
188
- - test/integration/test_helper.rb
189
- - test/integration/test_keyword_search.rb
190
- - test/integration/test_pagination.rb
191
- - test/test_helper.rb
154
+ summary: Library for expressive, powerful interaction with the Solr search engine
155
+ test_files: []
156
+
data/Manifest.txt DELETED
@@ -1,104 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- PostInstall.txt
4
- README.rdoc
5
- Rakefile
6
- config/hoe.rb
7
- config/requirements.rb
8
- lib/light_config.rb
9
- lib/sunspot.rb
10
- lib/sunspot/adapters.rb
11
- lib/sunspot/conditions.rb
12
- lib/sunspot/conditions_builder.rb
13
- lib/sunspot/configuration.rb
14
- lib/sunspot/field.rb
15
- lib/sunspot/field_builder.rb
16
- lib/sunspot/indexer.rb
17
- lib/sunspot/query.rb
18
- lib/sunspot/query_builder.rb
19
- lib/sunspot/restriction.rb
20
- lib/sunspot/scope_builder.rb
21
- lib/sunspot/search.rb
22
- lib/sunspot/session.rb
23
- lib/sunspot/type.rb
24
- lib/sunspot/util.rb
25
- lib/sunspot/version.rb
26
- log/test_solr.log
27
- setup.rb
28
- solr/README.txt
29
- solr/etc/jetty.xml
30
- solr/etc/webdefault.xml
31
- solr/exampledocs/books.csv
32
- solr/exampledocs/hd.xml
33
- solr/exampledocs/ipod_other.xml
34
- solr/exampledocs/ipod_video.xml
35
- solr/exampledocs/mem.xml
36
- solr/exampledocs/monitor.xml
37
- solr/exampledocs/monitor2.xml
38
- solr/exampledocs/mp500.xml
39
- solr/exampledocs/post.jar
40
- solr/exampledocs/post.sh
41
- solr/exampledocs/sd500.xml
42
- solr/exampledocs/solr.xml
43
- solr/exampledocs/spellchecker.xml
44
- solr/exampledocs/utf8-example.xml
45
- solr/exampledocs/vidcard.xml
46
- solr/lib/jetty-6.1.3.jar
47
- solr/lib/jetty-util-6.1.3.jar
48
- solr/lib/jsp-2.1/ant-1.6.5.jar
49
- solr/lib/jsp-2.1/core-3.1.1.jar
50
- solr/lib/jsp-2.1/jsp-2.1.jar
51
- solr/lib/jsp-2.1/jsp-api-2.1.jar
52
- solr/lib/servlet-api-2.5-6.1.3.jar
53
- solr/logs
54
- solr/solr/README.txt
55
- solr/solr/bin/abc
56
- solr/solr/bin/abo
57
- solr/solr/bin/backup
58
- solr/solr/bin/backupcleaner
59
- solr/solr/bin/commit
60
- solr/solr/bin/optimize
61
- solr/solr/bin/readercycle
62
- solr/solr/bin/rsyncd-disable
63
- solr/solr/bin/rsyncd-enable
64
- solr/solr/bin/rsyncd-start
65
- solr/solr/bin/rsyncd-stop
66
- solr/solr/bin/scripts-util
67
- solr/solr/bin/snapcleaner
68
- solr/solr/bin/snapinstaller
69
- solr/solr/bin/snappuller
70
- solr/solr/bin/snappuller-disable
71
- solr/solr/bin/snappuller-enable
72
- solr/solr/bin/snapshooter
73
- solr/solr/conf/admin-extra.html
74
- solr/solr/conf/protwords.txt
75
- solr/solr/conf/schema.xml
76
- solr/solr/conf/scripts.conf
77
- solr/solr/conf/solrconfig.xml
78
- solr/solr/conf/stopwords.txt
79
- solr/solr/conf/synonyms.txt
80
- solr/solr/conf/xslt
81
- solr/solr/conf/xslt
82
- solr/solr/data/spell
83
- solr/start.jar
84
- solr/webapps/solr.war
85
- tasks/deployment.rake
86
- tasks/environment.rake
87
- tasks/rcov.rake
88
- tasks/solr.rake
89
- tasks/website.rake
90
- test/api/test_build_search.rb
91
- test/api/test_helper.rb
92
- test/api/test_indexer.rb
93
- test/api/test_retrieve_search.rb
94
- test/api/test_session.rb
95
- test/custom_expectation.rb
96
- test/integration/test_field_types.rb
97
- test/integration/test_helper.rb
98
- test/integration/test_keyword_search.rb
99
- test/integration/test_pagination.rb
100
- test/mocks/base_class.rb
101
- test/mocks/comment.rb
102
- test/mocks/mock_adapter.rb
103
- test/mocks/post.rb
104
- test/test_helper.rb
data/PostInstall.txt DELETED
@@ -1,7 +0,0 @@
1
-
2
- For more information on sunspot, see http://sunspot.rubyforge.org
3
-
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
6
-
7
-
data/config/hoe.rb DELETED
@@ -1,74 +0,0 @@
1
- require 'sunspot/version'
2
-
3
- AUTHOR = 'Mat Brown' # can also be an array of Authors
4
- EMAIL = "mat@patch.com"
5
- DESCRIPTION = "Awesome Solr interaction for Ruby"
6
- GEM_NAME = 'sunspot' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = 'sunspot' # The unix name for your project
8
- HOMEPATH = "http://github.com/outoftime/sunspot"
9
- DOWNLOAD_PATH = "http://github.com/outoftime/sunspot"
10
- EXTRA_DEPENDENCIES = [
11
- ['solr-ruby', '= 0.0.6',
12
- 'extlib', '>= 0.9.7']
13
- ] # An array of rubygem dependencies [name, version]
14
-
15
- @config_file = "~/.rubyforge/user-config.yml"
16
- @config = nil
17
- RUBYFORGE_USERNAME = "unknown"
18
- def rubyforge_username
19
- unless @config
20
- begin
21
- @config = YAML.load(File.read(File.expand_path(@config_file)))
22
- rescue
23
- puts <<-EOS
24
- ERROR: No rubyforge config file found: #{@config_file}
25
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
26
- - See http://newgem.rubyforge.org/rubyforge.html for more details
27
- EOS
28
- exit
29
- end
30
- end
31
- RUBYFORGE_USERNAME.replace @config["username"]
32
- end
33
-
34
-
35
- REV = nil
36
- # UNCOMMENT IF REQUIRED:
37
- # REV = YAML.load(`svn info`)['Revision']
38
- VERS = Sunspot::VERSION::STRING + (REV ? ".#{REV}" : "")
39
- RDOC_OPTS = ['--quiet', '--title', 'sunspot documentation',
40
- "--opname", "index.html",
41
- "--line-numbers",
42
- "--main", "README.rdoc",
43
- "--inline-source"]
44
-
45
- class Hoe
46
- def extra_deps
47
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
48
- @extra_deps
49
- end
50
- end
51
-
52
- # Generate all the Rake tasks
53
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
54
- $hoe = Hoe.new(GEM_NAME, VERS) do |p|
55
- p.developer(AUTHOR, EMAIL)
56
- p.description = DESCRIPTION
57
- p.summary = DESCRIPTION
58
- p.url = HOMEPATH
59
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
60
- p.test_globs = ["spec/**/*_spec.rb"]
61
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
62
-
63
- # == Optional
64
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
65
- #p.extra_deps = EXTRA_DEPENDENCIES
66
-
67
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
68
- end
69
-
70
- CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
71
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
72
- $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
73
- $hoe.rsync_args = '-av --delete --ignore-errors'
74
- $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -1,15 +0,0 @@
1
- require 'fileutils'
2
- include FileUtils
3
-
4
- require 'rubygems'
5
- %w[rake hoe newgem rubigen].each do |req_gem|
6
- begin
7
- require req_gem
8
- rescue LoadError
9
- puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
- puts "Installation: gem install #{req_gem} -y"
11
- exit
12
- end
13
- end
14
-
15
- $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
@@ -1,50 +0,0 @@
1
- module Sunspot
2
- class Conditions
3
- def initialize(query, conditions_hash)
4
- @query = query
5
- @conditions_hash = conditions_hash.inject({}) do |hash, pair|
6
- field_name, value = pair
7
- hash[field_name.to_s] = value
8
- hash
9
- end
10
- end
11
-
12
- def interpret(field_name, condition_type)
13
- operators_hash[field_name.to_s] = Sunspot::Restriction.const_get condition_type.to_s.camel_case
14
- end
15
-
16
- def default(field_name, value)
17
- conditions_hash[field_name.to_s] ||= value
18
- end
19
-
20
- def restrictions
21
- conditions_hash.map { |field_name, value| condition_for(field_name, value) }.compact
22
- end
23
-
24
- protected
25
- attr_reader :conditions_hash
26
-
27
- def condition_for(field_name, value)
28
- operator = operator_for(field_name) || default_operator_for(value)
29
- begin
30
- @query.build_condition field_name, operator, value
31
- rescue ArgumentError
32
- nil # fail silently if field isn't configured
33
- end
34
- end
35
-
36
- def default_operator_for(value)
37
- if value.is_a?(Array) then Sunspot::Restriction::AnyOf
38
- else Sunspot::Restriction::EqualTo
39
- end
40
- end
41
-
42
- def operator_for(field_name)
43
- operators_hash[field_name.to_s]
44
- end
45
-
46
- def operators_hash
47
- @operators_hash ||= {}
48
- end
49
- end
50
- end
@@ -1,37 +0,0 @@
1
- module Sunspot
2
- class Conditions
3
- def initialize(query, conditions_hash)
4
- @query, @conditions_hash = query, conditions_hash
5
- end
6
-
7
- def interpret(field_name, condition_type)
8
- operators_hash[field_name.to_s] = Sunspot::Restriction.const_get condition_type.to_s.camel_case
9
- end
10
-
11
- def conditions
12
- conditions_hash.map { |field_name, value| condition_for(field_name, value) }
13
- end
14
-
15
- protected
16
- attr_reader :conditions_hash
17
-
18
- def condition_for(field_name, value)
19
- operator = operator_for(field_name) || default_operator_for(value)
20
- @query.build_condition field_name, operator, value
21
- end
22
-
23
- def default_operator_for(value)
24
- if value.is_a?(Array) then Sunspot::Restriction::AnyOf
25
- else Sunspot::Restriction::EqualTo
26
- end
27
- end
28
-
29
- def operator_for(field_name)
30
- operators_hash[field_name.to_s]
31
- end
32
-
33
- def operators_hash
34
- @operators_hash ||= {}
35
- end
36
- end
37
- end
@@ -1,37 +0,0 @@
1
- module Sunspot
2
- class FieldBuilder
3
- def initialize(clazz)
4
- @clazz = clazz
5
- end
6
-
7
- def text(*names, &block)
8
- for name in names
9
- ::Sunspot::Field.register_text clazz, build_field(name, ::Sunspot::Type::TextType, &block)
10
- end
11
- end
12
-
13
- def method_missing(method, *args, &block)
14
- begin
15
- type = ::Sunspot::Type.const_get "#{method.to_s.camel_case}Type"
16
- rescue(NameError)
17
- super(method.to_sym, *args, &block) and return
18
- end
19
- name = args.shift
20
- ::Sunspot::Field.register clazz, build_field(name, type, *args, &block)
21
- end
22
-
23
- protected
24
- attr_reader :clazz
25
-
26
- private
27
-
28
- def build_field(name, type, *args, &block)
29
- options = args.shift if args.first.is_a?(Hash)
30
- unless block
31
- ::Sunspot::Field::AttributeField.new(name, type, options || {})
32
- else
33
- ::Sunspot::Field::VirtualField.new(name, type, options || {}, &block)
34
- end
35
- end
36
- end
37
- end
@@ -1,30 +0,0 @@
1
- module Sunspot
2
- class QueryBuilder
3
- def initialize(query)
4
- @query = query
5
- end
6
-
7
- def keywords(keywords)
8
- @query.keywords = keywords
9
- end
10
-
11
- def with
12
- @conditions_builder ||= ::Sunspot::ScopeBuilder.new(@query)
13
- end
14
-
15
- def conditions
16
- @query.conditions
17
- end
18
-
19
- def paginate(options = {})
20
- page = options.delete(:page) || raise(ArgumentError, "paginate requires a :page argument")
21
- per_page = options.delete(:per_page)
22
- raise ArgumentError, "unknown argument #{options.keys.first.inspect} passed to paginate" unless options.empty?
23
- @query.paginate(page, per_page)
24
- end
25
-
26
- def order_by(field_name, direction = nil)
27
- @query.order_by(field_name, direction)
28
- end
29
- end
30
- end