shanna-dm-sphinx-adapter 0.4

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.
@@ -0,0 +1,75 @@
1
+ require 'test/unit'
2
+ require 'dm-sphinx-adapter'
3
+
4
+ class TestConfig < Test::Unit::TestCase
5
+ def setup
6
+ base = Pathname(__FILE__).dirname.expand_path
7
+ @config = base / 'files' / 'sphinx.conf'
8
+ @log = base / 'var' / 'sphinx.log'
9
+ end
10
+
11
+ def test_initialize
12
+ assert_nothing_raised{ config }
13
+ assert_nothing_raised{ config({}) }
14
+ assert_nothing_raised{ config(:config => nil) }
15
+ assert_nothing_raised{ config(:config => 'blah') }
16
+ assert_nothing_raised{ config(:config => @log) }
17
+ end
18
+
19
+ def test_initalize_defaults
20
+ assert c = config({})
21
+ assert_equal '0.0.0.0', c.address
22
+ assert_equal 3312, c.port
23
+ assert_equal 'searchd.log', c.log
24
+ assert_raise(RuntimeError){ c.pid_file }
25
+ assert_nil c.config
26
+ end
27
+
28
+ def test_initalize_options_hash
29
+ assert c = config(
30
+ :host => 'options',
31
+ :port => 1234,
32
+ :log => 'log.log',
33
+ :pid_file => 'pid.pid'
34
+ )
35
+
36
+ assert_equal 'options', c.address
37
+ assert_equal 1234, c.port
38
+ assert_equal 'log.log', c.log
39
+ assert_equal 'pid.pid', c.pid_file
40
+ assert_nil c.config
41
+ end
42
+
43
+ def test_initialize_options_string
44
+ assert c = config("sphinx://options:1234")
45
+ assert_equal 'options', c.address
46
+ assert_equal 1234, c.port
47
+ assert_equal 'searchd.log', c.log
48
+ assert_raise(RuntimeError){ c.pid_file }
49
+ assert_nil c.config
50
+ end
51
+
52
+ def test_initialize_config
53
+ assert c = config(:config => @config)
54
+ assert_equal 'localhost', c.address
55
+ assert_equal '3312', c.port
56
+ assert_equal 'test/var/sphinx.log', c.log
57
+ assert_equal 'test/var/sphinx.pid', c.pid_file
58
+ assert_equal @config, c.config
59
+ end
60
+
61
+ def test_initialize_database_hash
62
+ assert c = config(:database => @config)
63
+ assert_equal @config, c.config
64
+ end
65
+
66
+ def test_initialize_database_string
67
+ assert c = config("sphinx://localhost/test/files/sphinx.conf")
68
+ assert_equal @config, c.config
69
+ end
70
+
71
+ protected
72
+ def config(options = {:config => @config})
73
+ DataMapper::Adapters::Sphinx::Config.new(options)
74
+ end
75
+ end # TestConfig
@@ -0,0 +1,29 @@
1
+ require 'test/unit'
2
+ require 'dm-sphinx-adapter'
3
+
4
+ class TestConfigParser < Test::Unit::TestCase
5
+ def setup
6
+ base = Pathname(__FILE__).dirname.expand_path
7
+ @config = base / 'files' / 'sphinx.conf'
8
+ @log = base / 'var' / 'sphinx.log'
9
+ end
10
+
11
+ def test_parse
12
+ assert_nothing_raised{ parse }
13
+ assert_raise(Errno::ENOENT){ parse('blah') }
14
+ assert_raise(RuntimeError){ parse(@log) }
15
+ end
16
+
17
+ def test_searchd
18
+ assert_kind_of Hash, searchd = parse
19
+ assert_equal 'localhost', searchd['address']
20
+ assert_equal '3312', searchd['port']
21
+ assert_equal 'test/var/sphinx.pid', searchd['pid_file']
22
+ assert_equal 'test/var/sphinx.log', searchd['log']
23
+ end
24
+
25
+ protected
26
+ def parse(config = @config)
27
+ DataMapper::Adapters::Sphinx::ConfigParser.parse(config)
28
+ end
29
+ end # TestConfigParser
@@ -0,0 +1,8 @@
1
+ require 'dm-sphinx-adapter'
2
+
3
+ class TestTypeAttribute < Test::Unit::TestCase
4
+ def test_initialize
5
+ # TODO:
6
+ assert true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'dm-sphinx-adapter'
2
+
3
+ class TestTypeIndex < Test::Unit::TestCase
4
+ def test_initialize
5
+ # TODO:
6
+ assert true
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shanna-dm-sphinx-adapter
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.4"
5
+ platform: ruby
6
+ authors:
7
+ - Shane Hanna
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-24 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: dm-core
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 0.9.7
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: riddle
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: "0.9"
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: hoe
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.8.2
41
+ version:
42
+ description: A DataMapper Sphinx adapter.
43
+ email:
44
+ - shane.hanna@gmail.com
45
+ executables: []
46
+
47
+ extensions: []
48
+
49
+ extra_rdoc_files:
50
+ - History.txt
51
+ - LICENCE.txt
52
+ - Manifest.txt
53
+ - README.txt
54
+ files:
55
+ - History.txt
56
+ - LICENCE.txt
57
+ - Manifest.txt
58
+ - README.txt
59
+ - Rakefile
60
+ - dm-sphinx-adapter.gemspec
61
+ - lib/dm-sphinx-adapter.rb
62
+ - lib/dm-sphinx-adapter/adapter.rb
63
+ - lib/dm-sphinx-adapter/attribute.rb
64
+ - lib/dm-sphinx-adapter/client.rb
65
+ - lib/dm-sphinx-adapter/config.rb
66
+ - lib/dm-sphinx-adapter/config_parser.rb
67
+ - lib/dm-sphinx-adapter/index.rb
68
+ - lib/dm-sphinx-adapter/resource.rb
69
+ - test/files/dm_sphinx_adapter_test.sql
70
+ - test/files/resource_explicit.rb
71
+ - test/files/resource_resource.rb
72
+ - test/files/resource_searchable.rb
73
+ - test/files/resource_storage_name.rb
74
+ - test/files/resource_vanilla.rb
75
+ - test/files/sphinx.conf
76
+ - test/test_adapter.rb
77
+ - test/test_adapter_explicit.rb
78
+ - test/test_adapter_resource.rb
79
+ - test/test_adapter_searchable.rb
80
+ - test/test_adapter_vanilla.rb
81
+ - test/test_client.rb
82
+ - test/test_config.rb
83
+ - test/test_config_parser.rb
84
+ - test/test_type_attribute.rb
85
+ - test/test_type_index.rb
86
+ has_rdoc: true
87
+ homepage: http://rubyforge.org/projects/dm-sphinx/
88
+ post_install_message:
89
+ rdoc_options:
90
+ - --main
91
+ - README.txt
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: "0"
99
+ version:
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: "0"
105
+ version:
106
+ requirements: []
107
+
108
+ rubyforge_project: dm-sphinx-adapter
109
+ rubygems_version: 1.2.0
110
+ signing_key:
111
+ specification_version: 2
112
+ summary: A DataMapper Sphinx adapter.
113
+ test_files:
114
+ - test/test_adapter.rb
115
+ - test/test_adapter_explicit.rb
116
+ - test/test_adapter_resource.rb
117
+ - test/test_adapter_searchable.rb
118
+ - test/test_adapter_vanilla.rb
119
+ - test/test_client.rb
120
+ - test/test_config.rb
121
+ - test/test_config_parser.rb
122
+ - test/test_type_attribute.rb
123
+ - test/test_type_index.rb