pyramid_scheme 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -34,6 +34,7 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
34
34
  spec.libs << 'lib' << 'spec'
35
35
  spec.pattern = 'spec/**/*_spec.rb'
36
36
  spec.rcov = true
37
+ spec.rcov_opts = ['-x gems,', '-x rake']
37
38
  end
38
39
 
39
40
  task :spec => :check_dependencies
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -7,10 +7,10 @@ module PyramidScheme
7
7
  def initialize(options = {})
8
8
  @index_provider = PyramidScheme::IndexProvider::FileSystem.new
9
9
  @configuration = PyramidScheme::Configuration.new
10
- @indexer_class = configuration[:indexer_class] || PyramidScheme::ThinkingSphinxIndexer
10
+ @indexer_class = configuration[:indexer_class] || PyramidScheme::Indexer::ThinkingSphinx
11
11
  end
12
12
 
13
- # @returns [PyramidScheme::Indexer] an instance of the specified indexer_class from initialization
13
+ # @returns [PyramidScheme::Indexer::Base] an instance of the specified indexer_class from initialization
14
14
  def indexer
15
15
  @indexer ||= @indexer_class.new
16
16
  end
@@ -18,6 +18,7 @@ module PyramidScheme
18
18
  # run the index
19
19
  def index
20
20
  create_lock_file
21
+ indexer.configure
21
22
  indexer.index
22
23
  destroy_lock_file
23
24
  index_provider.process_index
@@ -0,0 +1,21 @@
1
+ module PyramidScheme
2
+ module Indexer
3
+ #defines an interface for indexers
4
+ class Base
5
+ attr_reader :index_task_name, :configure_task_name
6
+
7
+ def initialize
8
+ @index_task_name = self.class.index_task_name
9
+ @configure_task_name = self.class.configure_task_name
10
+ end
11
+
12
+ def configure
13
+ Rake::Task[@configure_task_name].invoke
14
+ end
15
+
16
+ def index
17
+ Rake::Task[@index_task_name].invoke
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ module PyramidScheme
2
+ module Indexer
3
+ class ThinkingSphinx < PyramidScheme::Indexer::Base
4
+ def self.index_task_name
5
+ 'ts:in'
6
+ end
7
+
8
+ def self.configure_task_name
9
+ 'ts:config'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module PyramidScheme
2
+ module Indexer
3
+ class Ultrasphinx < PyramidScheme::Indexer::Base
4
+ def self.index_task_name
5
+ 'ultrasphinx:index'
6
+ end
7
+
8
+ def self.configure_task_name
9
+ 'ultrasphinx:configure'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -4,9 +4,10 @@ require 'configatron'
4
4
 
5
5
  require 'pyramid_scheme/required_configuration_not_found'
6
6
 
7
- require 'pyramid_scheme/indexer'
8
- require 'pyramid_scheme/thinking_sphinx_indexer'
9
- require 'pyramid_scheme/ultrasphinx_indexer'
7
+ require 'pyramid_scheme/indexer/base'
8
+ require 'pyramid_scheme/indexer/thinking_sphinx'
9
+ require 'pyramid_scheme/indexer/ultrasphinx'
10
+
10
11
 
11
12
  require 'pyramid_scheme/index_lock_file'
12
13
  require 'pyramid_scheme/configuration'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pyramid_scheme}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Pickett"]
12
- s.date = %q{2010-02-08}
12
+ s.date = %q{2010-02-15}
13
13
  s.description = %q{Sphinx index propagtion (currently via the filesystem)}
14
14
  s.email = %q{dpickett@enlightsolutions.com}
15
15
  s.extra_rdoc_files = [
@@ -29,7 +29,9 @@ Gem::Specification.new do |s|
29
29
  "lib/pyramid_scheme/index_lock_file.rb",
30
30
  "lib/pyramid_scheme/index_provider/file_system.rb",
31
31
  "lib/pyramid_scheme/index_server.rb",
32
- "lib/pyramid_scheme/indexer.rb",
32
+ "lib/pyramid_scheme/indexer/base.rb",
33
+ "lib/pyramid_scheme/indexer/thinking_sphinx.rb",
34
+ "lib/pyramid_scheme/indexer/ultrasphinx.rb",
33
35
  "lib/pyramid_scheme/required_configuration_not_found.rb",
34
36
  "lib/pyramid_scheme/tasks.rb",
35
37
  "lib/pyramid_scheme/tasks/rake_tasks.rake",
@@ -41,8 +43,8 @@ Gem::Specification.new do |s|
41
43
  "spec/pyramid_scheme/index_provider/file_system_spec.rb",
42
44
  "spec/pyramid_scheme/index_provider_configuration_spec.rb",
43
45
  "spec/pyramid_scheme/index_server_spec.rb",
44
- "spec/pyramid_scheme/thinking_sphinx_indexer_spec.rb",
45
- "spec/pyramid_scheme/ultrasphinx_indexer_spec.rb",
46
+ "spec/pyramid_scheme/indexer/thinking_sphinx_spec.rb",
47
+ "spec/pyramid_scheme/indexer/ultrasphinx_spec.rb",
46
48
  "spec/spec.opts",
47
49
  "spec/spec_helper.rb",
48
50
  "tasks/pyramid_scheme.rake"
@@ -57,8 +59,8 @@ Gem::Specification.new do |s|
57
59
  "spec/pyramid_scheme/index_provider/file_system_spec.rb",
58
60
  "spec/pyramid_scheme/index_provider_configuration_spec.rb",
59
61
  "spec/pyramid_scheme/index_server_spec.rb",
60
- "spec/pyramid_scheme/thinking_sphinx_indexer_spec.rb",
61
- "spec/pyramid_scheme/ultrasphinx_indexer_spec.rb",
62
+ "spec/pyramid_scheme/indexer/thinking_sphinx_spec.rb",
63
+ "spec/pyramid_scheme/indexer/ultrasphinx_spec.rb",
62
64
  "spec/pyramid_scheme.rb",
63
65
  "spec/spec_helper.rb"
64
66
  ]
@@ -5,6 +5,7 @@ describe PyramidScheme::IndexServer do
5
5
 
6
6
  before(:each) do
7
7
  @server = PyramidScheme::IndexServer.new
8
+ @server.indexer.stub(:configure)
8
9
  @server.indexer.stub(:index)
9
10
  FileUtils.mkdir_p(PyramidScheme.configuration[:server_destination_path])
10
11
  FileUtils.mkdir_p(PyramidScheme.configuration[:client_source_path])
@@ -15,17 +16,21 @@ describe PyramidScheme::IndexServer do
15
16
  end
16
17
 
17
18
  it 'should default to a thinking sphinx indexer' do
18
- @server.indexer.should be_kind_of(PyramidScheme::ThinkingSphinxIndexer)
19
+ @server.indexer.should be_kind_of(PyramidScheme::Indexer::ThinkingSphinx)
19
20
  end
20
21
 
21
22
  it 'should allow me to specify an ultrasphinx indexer' do
22
23
  PyramidScheme.configure do |config|
23
- config.indexer_class = PyramidScheme::UltrasphinxIndexer
24
+ config.indexer_class = PyramidScheme::Indexer::Ultrasphinx
24
25
  end
25
26
  @server = PyramidScheme::IndexServer.new
26
- @server.indexer.should be_kind_of(PyramidScheme::UltrasphinxIndexer)
27
+ @server.indexer.should be_kind_of(PyramidScheme::Indexer::Ultrasphinx)
27
28
  end
28
29
 
30
+ it 'should configure via the indexer' do
31
+ @server.indexer.expects(:configure).once
32
+ @server.index
33
+ end
29
34
  it 'should index via the indexer' do
30
35
  @server.indexer.expects(:index).once
31
36
  @server.index
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe PyramidScheme::Indexer::ThinkingSphinx do
4
+ before(:each) do
5
+ @indexer = PyramidScheme::Indexer::ThinkingSphinx.new
6
+ end
7
+
8
+ it 'should have the index rake task of ts:in' do
9
+ @indexer.class.index_task_name.should eql('ts:in')
10
+ end
11
+
12
+ it 'should have the configure rake task of ts:config' do
13
+ @indexer.class.configure_task_name.should eql('ts:config')
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe PyramidScheme::Indexer::Ultrasphinx do
4
+ before(:each) do
5
+ @indexer = PyramidScheme::Indexer::Ultrasphinx.new
6
+ end
7
+
8
+ it 'should have the indexer task of ultrasphinx:index' do
9
+ @indexer.class.index_task_name.should eql('ultrasphinx:index')
10
+ end
11
+
12
+ it 'should have the configure task of ultrasphinx:configure' do
13
+ @indexer.class.configure_task_name.should eql('ultrasphinx:configure')
14
+ end
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pyramid_scheme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Pickett
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-08 00:00:00 -05:00
12
+ date: 2010-02-15 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -94,7 +94,9 @@ files:
94
94
  - lib/pyramid_scheme/index_lock_file.rb
95
95
  - lib/pyramid_scheme/index_provider/file_system.rb
96
96
  - lib/pyramid_scheme/index_server.rb
97
- - lib/pyramid_scheme/indexer.rb
97
+ - lib/pyramid_scheme/indexer/base.rb
98
+ - lib/pyramid_scheme/indexer/thinking_sphinx.rb
99
+ - lib/pyramid_scheme/indexer/ultrasphinx.rb
98
100
  - lib/pyramid_scheme/required_configuration_not_found.rb
99
101
  - lib/pyramid_scheme/tasks.rb
100
102
  - lib/pyramid_scheme/tasks/rake_tasks.rake
@@ -106,8 +108,8 @@ files:
106
108
  - spec/pyramid_scheme/index_provider/file_system_spec.rb
107
109
  - spec/pyramid_scheme/index_provider_configuration_spec.rb
108
110
  - spec/pyramid_scheme/index_server_spec.rb
109
- - spec/pyramid_scheme/thinking_sphinx_indexer_spec.rb
110
- - spec/pyramid_scheme/ultrasphinx_indexer_spec.rb
111
+ - spec/pyramid_scheme/indexer/thinking_sphinx_spec.rb
112
+ - spec/pyramid_scheme/indexer/ultrasphinx_spec.rb
111
113
  - spec/spec.opts
112
114
  - spec/spec_helper.rb
113
115
  - tasks/pyramid_scheme.rake
@@ -144,7 +146,7 @@ test_files:
144
146
  - spec/pyramid_scheme/index_provider/file_system_spec.rb
145
147
  - spec/pyramid_scheme/index_provider_configuration_spec.rb
146
148
  - spec/pyramid_scheme/index_server_spec.rb
147
- - spec/pyramid_scheme/thinking_sphinx_indexer_spec.rb
148
- - spec/pyramid_scheme/ultrasphinx_indexer_spec.rb
149
+ - spec/pyramid_scheme/indexer/thinking_sphinx_spec.rb
150
+ - spec/pyramid_scheme/indexer/ultrasphinx_spec.rb
149
151
  - spec/pyramid_scheme.rb
150
152
  - spec/spec_helper.rb
@@ -1,14 +0,0 @@
1
- module PyramidScheme
2
- #defines an interface for indexers
3
- class Indexer
4
- attr_reader :rake_task_name
5
-
6
- def initialize(rake_task_name = nil)
7
- @rake_task_name = rake_task_name || self.class.default_task_name
8
- end
9
-
10
- def index
11
- Rake::Task[@rake_task_name].invoke
12
- end
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe PyramidScheme::ThinkingSphinxIndexer do
4
- before(:each) do
5
- @indexer = PyramidScheme::ThinkingSphinxIndexer.new
6
- end
7
-
8
- it 'should have the default rake task of ts:in' do
9
- @indexer.class.default_task_name.should eql('ts:in')
10
- end
11
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe PyramidScheme::UltrasphinxIndexer do
4
- before(:each) do
5
- @indexer = PyramidScheme::UltrasphinxIndexer.new
6
- end
7
-
8
- it 'should have the default rake task of ultrasphinx:index' do
9
- @indexer.class.default_task_name.should eql('ultrasphinx:index')
10
- end
11
-
12
- it 'should default to the default rake task' do
13
- @indexer.rake_task_name.should eql(@indexer.class.default_task_name)
14
- end
15
- end