pyramid_scheme 0.1.6 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/Rakefile +11 -1
- data/VERSION +1 -1
- data/lib/pyramid_scheme.rb +9 -3
- data/lib/pyramid_scheme/configuration.rb +5 -1
- data/lib/pyramid_scheme/index_client.rb +2 -1
- data/lib/pyramid_scheme/index_provider/base.rb +87 -0
- data/lib/pyramid_scheme/index_provider/file_system.rb +23 -63
- data/lib/pyramid_scheme/index_provider/s3.rb +68 -0
- data/lib/pyramid_scheme/index_server.rb +4 -4
- data/lib/pyramid_scheme/lock/base.rb +17 -0
- data/lib/pyramid_scheme/lock/file.rb +28 -0
- data/lib/pyramid_scheme/lock/s3.rb +30 -0
- data/spec/integrations/s3.example.yml +5 -0
- data/spec/integrations/s3_spec.rb +90 -0
- data/spec/pyramid_scheme/index_provider/file_system_spec.rb +8 -4
- data/spec/spec_helper.rb +8 -0
- metadata +78 -31
- data/lib/pyramid_scheme/index_lock_file.rb +0 -25
- data/pyramid_scheme.gemspec +0 -96
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -13,6 +13,7 @@ begin
|
|
13
13
|
gem.authors = ["Dan Pickett"]
|
14
14
|
gem.add_dependency "rake", ">= 0.8.7"
|
15
15
|
gem.add_dependency "configatron"
|
16
|
+
gem.add_dependency "aws-s3", ">= 0.5.1"
|
16
17
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
17
18
|
gem.add_development_dependency "yard", ">= 0"
|
18
19
|
gem.add_development_dependency "mocha", "0.9.8"
|
@@ -27,7 +28,16 @@ end
|
|
27
28
|
require 'spec/rake/spectask'
|
28
29
|
Spec::Rake::SpecTask.new(:spec) do |spec|
|
29
30
|
spec.libs << 'lib' << 'spec'
|
30
|
-
spec.spec_files = FileList['spec
|
31
|
+
spec.spec_files = FileList['spec/pyramid_scheme/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
namespace :spec do
|
35
|
+
|
36
|
+
Spec::Rake::SpecTask.new(:integrations) do |spec|
|
37
|
+
spec.libs << 'lib' << 'spec'
|
38
|
+
spec.spec_files = FileList['spec/integrations/*_spec.rb']
|
39
|
+
|
40
|
+
end
|
31
41
|
end
|
32
42
|
|
33
43
|
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/pyramid_scheme.rb
CHANGED
@@ -1,17 +1,23 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
+
|
3
4
|
require 'configatron'
|
5
|
+
require 'aws/s3'
|
4
6
|
|
5
7
|
require 'pyramid_scheme/required_configuration_not_found'
|
6
8
|
|
7
9
|
require 'pyramid_scheme/indexer/base'
|
8
10
|
require 'pyramid_scheme/indexer/thinking_sphinx'
|
9
11
|
require 'pyramid_scheme/indexer/ultrasphinx'
|
10
|
-
|
11
|
-
|
12
|
-
require 'pyramid_scheme/index_lock_file'
|
13
12
|
require 'pyramid_scheme/configuration'
|
13
|
+
|
14
|
+
require 'pyramid_scheme/index_provider/base'
|
14
15
|
require 'pyramid_scheme/index_provider/file_system'
|
16
|
+
require 'pyramid_scheme/index_provider/s3'
|
17
|
+
|
18
|
+
require 'pyramid_scheme/lock/base'
|
19
|
+
require 'pyramid_scheme/lock/file'
|
20
|
+
require 'pyramid_scheme/lock/s3'
|
15
21
|
|
16
22
|
require 'pyramid_scheme/index_server'
|
17
23
|
|
@@ -26,7 +26,11 @@ module PyramidScheme
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.defaults
|
29
|
-
{
|
29
|
+
{
|
30
|
+
:lock_file_name => 'pyramid_scheme_index_in_progress.txt',
|
31
|
+
:index_provider_class => PyramidScheme::IndexProvider::FileSystem,
|
32
|
+
:indexer_class => PyramidScheme::Indexer::ThinkingSphinx
|
33
|
+
}
|
30
34
|
end
|
31
35
|
|
32
36
|
def [](key)
|
@@ -2,7 +2,8 @@ module PyramidScheme
|
|
2
2
|
class IndexClient
|
3
3
|
attr_reader :index_provider
|
4
4
|
def initialize(options = {})
|
5
|
-
@
|
5
|
+
@configuration = PyramidScheme::Configuration.new(options)
|
6
|
+
@index_provider = @configuration[:index_provider_class].new
|
6
7
|
end
|
7
8
|
|
8
9
|
def retrieve_index
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module PyramidScheme
|
2
|
+
module IndexProvider
|
3
|
+
class Base
|
4
|
+
class << self
|
5
|
+
def maximum_copy_attempts
|
6
|
+
5
|
7
|
+
end
|
8
|
+
|
9
|
+
def required_options
|
10
|
+
[]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :configuration, :copy_attempts
|
15
|
+
|
16
|
+
def initialize(options = {})
|
17
|
+
@configuration = PyramidScheme::Configuration.new(options)
|
18
|
+
ensure_required_options_are_present
|
19
|
+
@copy_attempts = 0
|
20
|
+
end
|
21
|
+
|
22
|
+
def index_in_progress?
|
23
|
+
raise_override
|
24
|
+
end
|
25
|
+
|
26
|
+
def process_index
|
27
|
+
raise_override
|
28
|
+
end
|
29
|
+
|
30
|
+
def provide_client_with_index
|
31
|
+
raise_override
|
32
|
+
end
|
33
|
+
|
34
|
+
def lock
|
35
|
+
raise_override
|
36
|
+
end
|
37
|
+
|
38
|
+
def retrieve_index
|
39
|
+
client_copy
|
40
|
+
end
|
41
|
+
|
42
|
+
def index_in_progress?
|
43
|
+
lock.exists?
|
44
|
+
end
|
45
|
+
|
46
|
+
protected
|
47
|
+
def ensure_required_options_are_present
|
48
|
+
self.class.required_options.each do |opt|
|
49
|
+
if @configuration[opt].nil?
|
50
|
+
raise PyramidScheme::RequiredConfigurationNotFound,
|
51
|
+
"the #{opt} setting was not found"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def attempt_to_copy
|
57
|
+
@copy_attempts += 1
|
58
|
+
if index_in_progress?
|
59
|
+
Kernel.sleep(5)
|
60
|
+
retrieve_index
|
61
|
+
else
|
62
|
+
provide_client_with_index
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def client_copy
|
67
|
+
if !exceeded_maximum_copy_attempts?
|
68
|
+
attempt_to_copy
|
69
|
+
else
|
70
|
+
raise "copying sphinx indexes failed after maximum number of attempts"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
def exceeded_maximum_copy_attempts?
|
76
|
+
copy_attempts > self.class.maximum_copy_attempts
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
private
|
81
|
+
def raise_override
|
82
|
+
raise "you must override this function"
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -1,70 +1,26 @@
|
|
1
1
|
module PyramidScheme
|
2
2
|
module IndexProvider
|
3
|
-
class FileSystem
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def initialize(options = {})
|
15
|
-
@configuration = PyramidScheme::Configuration.new(options)
|
16
|
-
ensure_required_options_are_present
|
17
|
-
@copy_attempts = 0
|
18
|
-
end
|
19
|
-
|
20
|
-
def index_in_progress?
|
21
|
-
PyramidScheme::IndexLockFile.exists?
|
3
|
+
class FileSystem < IndexProvider::Base
|
4
|
+
class << self
|
5
|
+
def required_options
|
6
|
+
[
|
7
|
+
:server_source_path,
|
8
|
+
:server_destination_path,
|
9
|
+
:client_source_path,
|
10
|
+
:client_destination_path
|
11
|
+
]
|
12
|
+
end
|
22
13
|
end
|
23
14
|
|
24
15
|
def process_index
|
25
16
|
server_copy
|
26
17
|
end
|
27
|
-
|
28
|
-
def
|
29
|
-
|
18
|
+
|
19
|
+
def lock
|
20
|
+
@lock ||= PyramidScheme::Lock::File.new
|
30
21
|
end
|
31
|
-
|
32
|
-
|
33
|
-
def server_copy
|
34
|
-
Configuration::INDEX_FILE_EXTENSIONS.each do |ext|
|
35
|
-
Dir[File.join(self.configuration[:server_source_path], "*#{ext}")].each do |f|
|
36
|
-
FileUtils.cp_r(f, "#{self.configuration[:server_destination_path]}")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def client_copy
|
42
|
-
if !exceeded_maximum_copy_attempts?
|
43
|
-
attempt_to_copy
|
44
|
-
else
|
45
|
-
raise "copying sphinx indexes failed after maximum number of attempts"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def ensure_required_options_are_present
|
50
|
-
REQUIRED_OPTIONS.each do |opt|
|
51
|
-
if configuration[opt].nil?
|
52
|
-
raise PyramidScheme::RequiredConfigurationNotFound, "the #{opt} setting was not found"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def attempt_to_copy
|
58
|
-
@copy_attempts += 1
|
59
|
-
if index_in_progress?
|
60
|
-
Kernel.sleep(5)
|
61
|
-
client_copy
|
62
|
-
else
|
63
|
-
copy_client_files
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def copy_client_files
|
22
|
+
|
23
|
+
def provide_client_with_index
|
68
24
|
Configuration::INDEX_FILE_EXTENSIONS.each do |ext|
|
69
25
|
Dir[File.join(self.configuration[:client_source_path], "*#{ext}")].each do |f|
|
70
26
|
new_filename = File.basename(f.gsub(/\./, ".new."))
|
@@ -72,12 +28,16 @@ module PyramidScheme
|
|
72
28
|
"#{self.configuration[:client_destination_path]}/#{new_filename}")
|
73
29
|
end
|
74
30
|
end
|
75
|
-
|
76
31
|
end
|
77
32
|
|
78
|
-
|
79
|
-
|
80
|
-
|
33
|
+
private
|
34
|
+
def server_copy
|
35
|
+
Configuration::INDEX_FILE_EXTENSIONS.each do |ext|
|
36
|
+
Dir[File.join(self.configuration[:server_source_path], "*#{ext}")].each do |f|
|
37
|
+
FileUtils.cp_r(f, "#{self.configuration[:server_destination_path]}")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
81
41
|
end
|
82
42
|
end
|
83
43
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module PyramidScheme
|
2
|
+
module IndexProvider
|
3
|
+
class S3 < PyramidScheme::IndexProvider::Base
|
4
|
+
class << self
|
5
|
+
def required_options
|
6
|
+
[
|
7
|
+
:access_key,
|
8
|
+
:secret_access_key,
|
9
|
+
:bucket,
|
10
|
+
:prefix,
|
11
|
+
:server_source_path,
|
12
|
+
:client_destination_path
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
def establish_connection!
|
17
|
+
@connection ||= AWS::S3::Base.establish_connection!(
|
18
|
+
:access_key_id => PyramidScheme.configuration[:access_key],
|
19
|
+
:secret_access_key => PyramidScheme.configuration[:secret_access_key]
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(options = {})
|
26
|
+
super
|
27
|
+
self.class.establish_connection!
|
28
|
+
end
|
29
|
+
|
30
|
+
def process_index
|
31
|
+
server_copy
|
32
|
+
end
|
33
|
+
|
34
|
+
def provide_client_with_index
|
35
|
+
Configuration::INDEX_FILE_EXTENSIONS.each do |ext|
|
36
|
+
AWS::S3::Bucket.objects(@configuration[:bucket],
|
37
|
+
:prefix => @configuration[:prefix]).each do |obj|
|
38
|
+
|
39
|
+
new_filename = File.basename(obj.key.gsub(@configuration[:prefix], '').gsub(/\./, ".new."))
|
40
|
+
destined_path = File.join(@configuration[:client_destination_path], new_filename)
|
41
|
+
File.open(destined_path, 'w') do |file|
|
42
|
+
AWS::S3::S3Object.stream(obj.key, @configuration[:bucket]) do |chunk|
|
43
|
+
file.write chunk
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def lock
|
51
|
+
@lock ||= PyramidScheme::Lock::S3.new
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
def server_copy
|
56
|
+
Configuration::INDEX_FILE_EXTENSIONS.each do |ext|
|
57
|
+
Dir[File.join(@configuration[:server_source_path], "*#{ext}")].each do |f|
|
58
|
+
AWS::S3::S3Object.store("#{@configuration[:prefix]}/#{File.basename(f)}",
|
59
|
+
File.open(f),
|
60
|
+
@configuration[:bucket]
|
61
|
+
)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -5,9 +5,9 @@ module PyramidScheme
|
|
5
5
|
# initializes a new index server
|
6
6
|
# @param options [Hash] takes an optional :indexer_class (defaults to PyramidScheme::ThinkingSphinxIndexer
|
7
7
|
def initialize(options = {})
|
8
|
-
@index_provider = PyramidScheme::IndexProvider::FileSystem.new
|
9
8
|
@configuration = PyramidScheme::Configuration.new
|
10
|
-
@
|
9
|
+
@index_provider = @configuration[:index_provider_class].new
|
10
|
+
@indexer_class = @configuration[:indexer_class]
|
11
11
|
end
|
12
12
|
|
13
13
|
# @returns [PyramidScheme::Indexer::Base] an instance of the specified indexer_class from initialization
|
@@ -26,11 +26,11 @@ module PyramidScheme
|
|
26
26
|
|
27
27
|
private
|
28
28
|
def create_lock_file
|
29
|
-
|
29
|
+
@index_provider.lock.create
|
30
30
|
end
|
31
31
|
|
32
32
|
def destroy_lock_file
|
33
|
-
|
33
|
+
@index_provider.lock.destroy
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module PyramidScheme
|
2
|
+
module Lock
|
3
|
+
class File < PyramidScheme::Lock::Base
|
4
|
+
def exists?
|
5
|
+
::File.exists?(client_path)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create
|
9
|
+
FileUtils.touch(server_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def destroy
|
13
|
+
FileUtils.rm_f(server_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def server_path
|
18
|
+
::File.join(PyramidScheme.configuration[:server_destination_path],
|
19
|
+
PyramidScheme.configuration[:lock_file_name])
|
20
|
+
end
|
21
|
+
|
22
|
+
def client_path
|
23
|
+
::File.join(PyramidScheme.configuration[:client_source_path],
|
24
|
+
PyramidScheme.configuration[:lock_file_name])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module PyramidScheme
|
2
|
+
module Lock
|
3
|
+
class S3 < PyramidScheme::Lock::Base
|
4
|
+
def initialize
|
5
|
+
PyramidScheme::IndexProvider::S3.establish_connection!
|
6
|
+
end
|
7
|
+
|
8
|
+
def exists?
|
9
|
+
AWS::S3::S3Object.exists?(key_name, bucket)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
AWS::S3::S3Object.store(key_name, "", bucket)
|
14
|
+
end
|
15
|
+
|
16
|
+
def destroy
|
17
|
+
AWS::S3::S3Object.delete(key_name, bucket)
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
def bucket
|
22
|
+
PyramidScheme.configuration[:bucket]
|
23
|
+
end
|
24
|
+
|
25
|
+
def key_name
|
26
|
+
"#{PyramidScheme.configuration[:prefix]}/#{PyramidScheme.configuration[:lock_file_name]}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "S3 index provider" do
|
4
|
+
before(:each) do
|
5
|
+
load_configuration_from_yaml
|
6
|
+
@provider = PyramidScheme::IndexProvider::S3.new
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "lock files" do
|
10
|
+
it 'should create a key in the s3 bucket and prefix' do
|
11
|
+
PyramidScheme::Lock::S3.new.create
|
12
|
+
PyramidScheme::Lock::S3.new.exists?.should be_true
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should remove a key in the s3 bucket and prefix' do
|
16
|
+
PyramidScheme::Lock::S3.new.destroy
|
17
|
+
PyramidScheme::Lock::S3.new.exists?.should be_false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "populating index files" do
|
22
|
+
before(:each) do
|
23
|
+
|
24
|
+
end
|
25
|
+
it 'should copy all the relevant index files to s3 on processing' do
|
26
|
+
FileUtils.mkdir_p(PyramidScheme.configuration[:server_source_path])
|
27
|
+
FileUtils.mkdir_p(PyramidScheme.configuration[:server_destination_path])
|
28
|
+
@filenames = [
|
29
|
+
'.spi',
|
30
|
+
'.spd',
|
31
|
+
'.spa',
|
32
|
+
'.sph',
|
33
|
+
'.spm',
|
34
|
+
'.spp',
|
35
|
+
'.spk'
|
36
|
+
].collect{|s| "some_index#{s}" }
|
37
|
+
|
38
|
+
@filenames.each do |f|
|
39
|
+
FileUtils.touch(File.join(PyramidScheme.configuration[:server_source_path], f))
|
40
|
+
File.exists?(File.join(PyramidScheme.configuration[:server_source_path], f)).should be_true
|
41
|
+
end
|
42
|
+
|
43
|
+
@provider.process_index
|
44
|
+
|
45
|
+
@filenames.each do |f|
|
46
|
+
AWS::S3::S3Object.exists?("#{PyramidScheme.configuration[:prefix]}/#{@filename}",
|
47
|
+
PyramidScheme.configuration[:bucket])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "providing index files" do
|
53
|
+
it 'should download all the relevant index files to s3 on providing' do
|
54
|
+
FileUtils.mkdir_p(PyramidScheme.configuration[:client_destination_path])
|
55
|
+
@provider.retrieve_index
|
56
|
+
|
57
|
+
[
|
58
|
+
'.spi',
|
59
|
+
'.spd',
|
60
|
+
'.spa',
|
61
|
+
'.sph',
|
62
|
+
'.spm',
|
63
|
+
'.spp',
|
64
|
+
'.spk'
|
65
|
+
].collect{|s| "some_index#{s}" }.each do |f|
|
66
|
+
File.exists?(File.join(PyramidScheme.configuration[:client_destination_path],
|
67
|
+
f.gsub(/\./, '.new.'))).should be_true
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def load_configuration_from_yaml
|
74
|
+
FakeFS.deactivate!
|
75
|
+
yml_config = YAML.load_file(File.join(File.dirname(__FILE__), 's3.yml'))
|
76
|
+
|
77
|
+
PyramidScheme.configure do |config|
|
78
|
+
config.index_provider_class = PyramidScheme::IndexProvider::S3
|
79
|
+
config.access_key = yml_config["access_key"]
|
80
|
+
config.secret_access_key = yml_config["secret_access_key"]
|
81
|
+
config.bucket = yml_config["bucket"]
|
82
|
+
config.prefix = yml_config["prefix"]
|
83
|
+
config.server_source_path = "/some/server/source"
|
84
|
+
config.client_destination_path = "/some/client/destination"
|
85
|
+
end
|
86
|
+
|
87
|
+
FakeFS.activate!
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
@@ -95,18 +95,22 @@ describe "copying from the filesytem" do
|
|
95
95
|
].collect{|s| "some_index#{s}" }
|
96
96
|
|
97
97
|
@filenames.each do |f|
|
98
|
-
FileUtils.touch(File.join(PyramidScheme.configuration[:client_source_path], f))
|
99
|
-
File.exists?(File.join(PyramidScheme.configuration[:client_source_path], f)).should be_true
|
98
|
+
FileUtils.touch(::File.join(PyramidScheme.configuration[:client_source_path], f))
|
99
|
+
::File.exists?(::File.join(PyramidScheme.configuration[:client_source_path], f)).should be_true
|
100
100
|
end
|
101
101
|
|
102
102
|
@provider.retrieve_index
|
103
103
|
|
104
104
|
@filenames.each do |f|
|
105
|
-
new_filename = File.basename(f).gsub(/\./, ".new.")
|
106
|
-
File.exists?(File.join(PyramidScheme.configuration[:client_destination_path],
|
105
|
+
new_filename = ::File.basename(f).gsub(/\./, ".new.")
|
106
|
+
::File.exists?(::File.join(PyramidScheme.configuration[:client_destination_path],
|
107
107
|
new_filename)).should be_true
|
108
108
|
end
|
109
109
|
|
110
110
|
end
|
111
|
+
|
112
|
+
it 'should have a lock file' do
|
113
|
+
@provider.lock.should be_kind_of(PyramidScheme::Lock::File)
|
114
|
+
end
|
111
115
|
end
|
112
116
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pyramid_scheme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Dan Pickett
|
@@ -9,69 +14,103 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-03-08 00:00:00 -05:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rake
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 8
|
30
|
+
- 7
|
23
31
|
version: 0.8.7
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: configatron
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ">="
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
33
43
|
version: "0"
|
34
|
-
|
44
|
+
type: :runtime
|
45
|
+
version_requirements: *id002
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: aws-s3
|
48
|
+
prerelease: false
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
segments:
|
54
|
+
- 0
|
55
|
+
- 5
|
56
|
+
- 1
|
57
|
+
version: 0.5.1
|
58
|
+
type: :runtime
|
59
|
+
version_requirements: *id003
|
35
60
|
- !ruby/object:Gem::Dependency
|
36
61
|
name: rspec
|
37
|
-
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
40
64
|
requirements:
|
41
65
|
- - ">="
|
42
66
|
- !ruby/object:Gem::Version
|
67
|
+
segments:
|
68
|
+
- 1
|
69
|
+
- 2
|
70
|
+
- 9
|
43
71
|
version: 1.2.9
|
44
|
-
|
72
|
+
type: :development
|
73
|
+
version_requirements: *id004
|
45
74
|
- !ruby/object:Gem::Dependency
|
46
75
|
name: yard
|
47
|
-
|
48
|
-
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
76
|
+
prerelease: false
|
77
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
50
78
|
requirements:
|
51
79
|
- - ">="
|
52
80
|
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
53
83
|
version: "0"
|
54
|
-
|
84
|
+
type: :development
|
85
|
+
version_requirements: *id005
|
55
86
|
- !ruby/object:Gem::Dependency
|
56
87
|
name: mocha
|
57
|
-
|
58
|
-
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
prerelease: false
|
89
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
60
90
|
requirements:
|
61
91
|
- - "="
|
62
92
|
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
- 9
|
96
|
+
- 8
|
63
97
|
version: 0.9.8
|
64
|
-
|
98
|
+
type: :development
|
99
|
+
version_requirements: *id006
|
65
100
|
- !ruby/object:Gem::Dependency
|
66
101
|
name: fakefs
|
67
|
-
|
68
|
-
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
prerelease: false
|
103
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
70
104
|
requirements:
|
71
105
|
- - "="
|
72
106
|
- !ruby/object:Gem::Version
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
- 2
|
110
|
+
- 1
|
73
111
|
version: 0.2.1
|
74
|
-
|
112
|
+
type: :development
|
113
|
+
version_requirements: *id007
|
75
114
|
description: Sphinx index propagtion (currently via the filesystem)
|
76
115
|
email: dpickett@enlightsolutions.com
|
77
116
|
executables: []
|
@@ -91,18 +130,23 @@ files:
|
|
91
130
|
- lib/pyramid_scheme.rb
|
92
131
|
- lib/pyramid_scheme/configuration.rb
|
93
132
|
- lib/pyramid_scheme/index_client.rb
|
94
|
-
- lib/pyramid_scheme/
|
133
|
+
- lib/pyramid_scheme/index_provider/base.rb
|
95
134
|
- lib/pyramid_scheme/index_provider/file_system.rb
|
135
|
+
- lib/pyramid_scheme/index_provider/s3.rb
|
96
136
|
- lib/pyramid_scheme/index_server.rb
|
97
137
|
- lib/pyramid_scheme/indexer/base.rb
|
98
138
|
- lib/pyramid_scheme/indexer/thinking_sphinx.rb
|
99
139
|
- lib/pyramid_scheme/indexer/ultrasphinx.rb
|
140
|
+
- lib/pyramid_scheme/lock/base.rb
|
141
|
+
- lib/pyramid_scheme/lock/file.rb
|
142
|
+
- lib/pyramid_scheme/lock/s3.rb
|
100
143
|
- lib/pyramid_scheme/required_configuration_not_found.rb
|
101
144
|
- lib/pyramid_scheme/tasks.rb
|
102
145
|
- lib/pyramid_scheme/tasks/rake_tasks.rake
|
103
146
|
- lib/pyramid_scheme/thinking_sphinx_indexer.rb
|
104
147
|
- lib/pyramid_scheme/ultrasphinx_indexer.rb
|
105
|
-
-
|
148
|
+
- spec/integrations/s3.example.yml
|
149
|
+
- spec/integrations/s3_spec.rb
|
106
150
|
- spec/pyramid_scheme.rb
|
107
151
|
- spec/pyramid_scheme/index_client_spec.rb
|
108
152
|
- spec/pyramid_scheme/index_provider/file_system_spec.rb
|
@@ -126,22 +170,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
170
|
requirements:
|
127
171
|
- - ">="
|
128
172
|
- !ruby/object:Gem::Version
|
173
|
+
segments:
|
174
|
+
- 0
|
129
175
|
version: "0"
|
130
|
-
version:
|
131
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
177
|
requirements:
|
133
178
|
- - ">="
|
134
179
|
- !ruby/object:Gem::Version
|
180
|
+
segments:
|
181
|
+
- 0
|
135
182
|
version: "0"
|
136
|
-
version:
|
137
183
|
requirements: []
|
138
184
|
|
139
185
|
rubyforge_project:
|
140
|
-
rubygems_version: 1.3.
|
186
|
+
rubygems_version: 1.3.6
|
141
187
|
signing_key:
|
142
188
|
specification_version: 3
|
143
189
|
summary: Sphinx index propagation
|
144
190
|
test_files:
|
191
|
+
- spec/integrations/s3_spec.rb
|
145
192
|
- spec/pyramid_scheme/index_client_spec.rb
|
146
193
|
- spec/pyramid_scheme/index_provider/file_system_spec.rb
|
147
194
|
- spec/pyramid_scheme/index_provider_configuration_spec.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module PyramidScheme
|
2
|
-
class IndexLockFile
|
3
|
-
def self.server_path
|
4
|
-
File.join(PyramidScheme.configuration[:server_destination_path],
|
5
|
-
PyramidScheme.configuration[:lock_file_name])
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.client_path
|
9
|
-
File.join(PyramidScheme.configuration[:client_source_path],
|
10
|
-
PyramidScheme.configuration[:lock_file_name])
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.exists?
|
14
|
-
File.exists?(client_path)
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.create
|
18
|
-
FileUtils.touch(server_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.destroy
|
22
|
-
FileUtils.rm_f(server_path)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/pyramid_scheme.gemspec
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{pyramid_scheme}
|
8
|
-
s.version = "0.1.6"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Dan Pickett"]
|
12
|
-
s.date = %q{2010-02-17}
|
13
|
-
s.description = %q{Sphinx index propagtion (currently via the filesystem)}
|
14
|
-
s.email = %q{dpickett@enlightsolutions.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"lib/pyramid_scheme.rb",
|
27
|
-
"lib/pyramid_scheme/configuration.rb",
|
28
|
-
"lib/pyramid_scheme/index_client.rb",
|
29
|
-
"lib/pyramid_scheme/index_lock_file.rb",
|
30
|
-
"lib/pyramid_scheme/index_provider/file_system.rb",
|
31
|
-
"lib/pyramid_scheme/index_server.rb",
|
32
|
-
"lib/pyramid_scheme/indexer/base.rb",
|
33
|
-
"lib/pyramid_scheme/indexer/thinking_sphinx.rb",
|
34
|
-
"lib/pyramid_scheme/indexer/ultrasphinx.rb",
|
35
|
-
"lib/pyramid_scheme/required_configuration_not_found.rb",
|
36
|
-
"lib/pyramid_scheme/tasks.rb",
|
37
|
-
"lib/pyramid_scheme/tasks/rake_tasks.rake",
|
38
|
-
"lib/pyramid_scheme/thinking_sphinx_indexer.rb",
|
39
|
-
"lib/pyramid_scheme/ultrasphinx_indexer.rb",
|
40
|
-
"pyramid_scheme.gemspec",
|
41
|
-
"spec/pyramid_scheme.rb",
|
42
|
-
"spec/pyramid_scheme/index_client_spec.rb",
|
43
|
-
"spec/pyramid_scheme/index_provider/file_system_spec.rb",
|
44
|
-
"spec/pyramid_scheme/index_provider_configuration_spec.rb",
|
45
|
-
"spec/pyramid_scheme/index_server_spec.rb",
|
46
|
-
"spec/pyramid_scheme/indexer/thinking_sphinx_spec.rb",
|
47
|
-
"spec/pyramid_scheme/indexer/ultrasphinx_spec.rb",
|
48
|
-
"spec/spec.opts",
|
49
|
-
"spec/spec_helper.rb",
|
50
|
-
"tasks/pyramid_scheme.rake"
|
51
|
-
]
|
52
|
-
s.homepage = %q{http://github.com/dpickett/pyramid_scheme}
|
53
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
54
|
-
s.require_paths = ["lib"]
|
55
|
-
s.rubygems_version = %q{1.3.5}
|
56
|
-
s.summary = %q{Sphinx index propagation}
|
57
|
-
s.test_files = [
|
58
|
-
"spec/pyramid_scheme/index_client_spec.rb",
|
59
|
-
"spec/pyramid_scheme/index_provider/file_system_spec.rb",
|
60
|
-
"spec/pyramid_scheme/index_provider_configuration_spec.rb",
|
61
|
-
"spec/pyramid_scheme/index_server_spec.rb",
|
62
|
-
"spec/pyramid_scheme/indexer/thinking_sphinx_spec.rb",
|
63
|
-
"spec/pyramid_scheme/indexer/ultrasphinx_spec.rb",
|
64
|
-
"spec/pyramid_scheme.rb",
|
65
|
-
"spec/spec_helper.rb"
|
66
|
-
]
|
67
|
-
|
68
|
-
if s.respond_to? :specification_version then
|
69
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
70
|
-
s.specification_version = 3
|
71
|
-
|
72
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
73
|
-
s.add_runtime_dependency(%q<rake>, [">= 0.8.7"])
|
74
|
-
s.add_runtime_dependency(%q<configatron>, [">= 0"])
|
75
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
76
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
77
|
-
s.add_development_dependency(%q<mocha>, ["= 0.9.8"])
|
78
|
-
s.add_development_dependency(%q<fakefs>, ["= 0.2.1"])
|
79
|
-
else
|
80
|
-
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
81
|
-
s.add_dependency(%q<configatron>, [">= 0"])
|
82
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
83
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
84
|
-
s.add_dependency(%q<mocha>, ["= 0.9.8"])
|
85
|
-
s.add_dependency(%q<fakefs>, ["= 0.2.1"])
|
86
|
-
end
|
87
|
-
else
|
88
|
-
s.add_dependency(%q<rake>, [">= 0.8.7"])
|
89
|
-
s.add_dependency(%q<configatron>, [">= 0"])
|
90
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
91
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
92
|
-
s.add_dependency(%q<mocha>, ["= 0.9.8"])
|
93
|
-
s.add_dependency(%q<fakefs>, ["= 0.2.1"])
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|