lunar 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +53 -0
  6. data/VERSION +1 -0
  7. data/examples/ohm.rb +23 -0
  8. data/lib/lunar.rb +12 -0
  9. data/lib/lunar/doc.rb +13 -0
  10. data/lib/lunar/index.rb +70 -0
  11. data/lib/lunar/scoring.rb +11 -0
  12. data/test/helper.rb +13 -0
  13. data/test/test_lunar.rb +4 -0
  14. data/test/test_lunar_document.rb +20 -0
  15. data/test/test_lunar_index.rb +174 -0
  16. data/test/test_lunar_scoring.rb +26 -0
  17. data/vendor/nest/nest.rb +7 -0
  18. data/vendor/redis/.gitignore +9 -0
  19. data/vendor/redis/LICENSE +20 -0
  20. data/vendor/redis/README.markdown +120 -0
  21. data/vendor/redis/Rakefile +75 -0
  22. data/vendor/redis/benchmarking/logging.rb +62 -0
  23. data/vendor/redis/benchmarking/pipeline.rb +44 -0
  24. data/vendor/redis/benchmarking/speed.rb +21 -0
  25. data/vendor/redis/benchmarking/suite.rb +24 -0
  26. data/vendor/redis/benchmarking/worker.rb +71 -0
  27. data/vendor/redis/bin/distredis +33 -0
  28. data/vendor/redis/examples/basic.rb +15 -0
  29. data/vendor/redis/examples/dist_redis.rb +43 -0
  30. data/vendor/redis/examples/incr-decr.rb +17 -0
  31. data/vendor/redis/examples/list.rb +26 -0
  32. data/vendor/redis/examples/pubsub.rb +25 -0
  33. data/vendor/redis/examples/sets.rb +36 -0
  34. data/vendor/redis/lib/edis.rb +3 -0
  35. data/vendor/redis/lib/redis.rb +496 -0
  36. data/vendor/redis/lib/redis/client.rb +265 -0
  37. data/vendor/redis/lib/redis/dist_redis.rb +118 -0
  38. data/vendor/redis/lib/redis/distributed.rb +460 -0
  39. data/vendor/redis/lib/redis/hash_ring.rb +131 -0
  40. data/vendor/redis/lib/redis/pipeline.rb +13 -0
  41. data/vendor/redis/lib/redis/raketasks.rb +1 -0
  42. data/vendor/redis/lib/redis/subscribe.rb +79 -0
  43. data/vendor/redis/profile.rb +22 -0
  44. data/vendor/redis/tasks/redis.tasks.rb +140 -0
  45. data/vendor/redis/test/db/.gitignore +1 -0
  46. data/vendor/redis/test/distributed_test.rb +1131 -0
  47. data/vendor/redis/test/redis_test.rb +1134 -0
  48. data/vendor/redis/test/test.conf +8 -0
  49. data/vendor/redis/test/test_helper.rb +113 -0
  50. metadata +127 -0
@@ -0,0 +1,8 @@
1
+ dir ./test/db
2
+ pidfile ./redis.pid
3
+ port 6379
4
+ timeout 300
5
+ loglevel debug
6
+ logfile stdout
7
+ databases 16
8
+ daemonize yes
@@ -0,0 +1,113 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
+
3
+ $VERBOSE = true
4
+
5
+ require "test/unit"
6
+ require "logger"
7
+ require "stringio"
8
+ require "redis"
9
+ require "stringio"
10
+
11
+ begin
12
+ require "ruby-debug"
13
+ rescue LoadError
14
+ end
15
+
16
+ def capture_stderr
17
+ stderr = $stderr
18
+ $stderr = StringIO.new
19
+
20
+ yield
21
+
22
+ $stderr = stderr
23
+ end
24
+
25
+ def ensure_redis_running(r)
26
+ begin
27
+ @r.ping
28
+ rescue Errno::ECONNREFUSED
29
+ puts <<-EOS
30
+
31
+ Cannot connect to Redis.
32
+
33
+ Make sure Redis is running on localhost, port 6379.
34
+ This testing suite connects to the database 15.
35
+
36
+ To start the server:
37
+ rake start
38
+
39
+ To stop the server:
40
+ rake stop
41
+
42
+ EOS
43
+ exit 1
44
+ end
45
+ end
46
+
47
+ # Test::Unit loads a default test if the suite is empty, whose purpose is to
48
+ # fail. Since having empty contexts is a common practice, we decided to
49
+ # overwrite TestSuite#empty? in order to allow them. Having a failure when no
50
+ # tests have been defined seems counter-intuitive.
51
+ class Test::Unit::TestSuite
52
+ def empty?
53
+ false
54
+ end
55
+ end
56
+
57
+ # Contest adds +teardown+, +test+ and +context+ as class methods, and the
58
+ # instance methods +setup+ and +teardown+ now iterate on the corresponding
59
+ # blocks. Note that all setup and teardown blocks must be defined with the
60
+ # block syntax. Adding setup or teardown instance methods defeats the purpose
61
+ # of this library.
62
+ class Test::Unit::TestCase
63
+ def self.setup(&block)
64
+ define_method :setup do
65
+ super(&block)
66
+ instance_eval(&block)
67
+ end
68
+ end
69
+
70
+ def self.teardown(&block)
71
+ define_method :teardown do
72
+ instance_eval(&block)
73
+ super(&block)
74
+ end
75
+ end
76
+
77
+ def self.context(*name, &block)
78
+ subclass = Class.new(self)
79
+ remove_tests(subclass)
80
+ subclass.class_eval(&block) if block_given?
81
+ const_set(context_name(name.join(" ")), subclass)
82
+ end
83
+
84
+ def self.test(name, &block)
85
+ block ||= lambda { print "P" }
86
+ define_method(test_name(name), &block)
87
+ end
88
+
89
+ class << self
90
+ alias_method :should, :test
91
+ alias_method :describe, :context
92
+ end
93
+
94
+ private
95
+
96
+ def self.context_name(name)
97
+ "Test#{sanitize_name(name).gsub(/(^| )(\w)/) { $2.upcase }}".to_sym
98
+ end
99
+
100
+ def self.test_name(name)
101
+ "test_#{sanitize_name(name).gsub(/\s+/,'_')}".to_sym
102
+ end
103
+
104
+ def self.sanitize_name(name)
105
+ name.gsub(/\W+/, ' ').strip
106
+ end
107
+
108
+ def self.remove_tests(subclass)
109
+ subclass.public_instance_methods.grep(/^test_/).each do |meth|
110
+ subclass.send(:undef_method, meth.to_sym)
111
+ end
112
+ end
113
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lunar
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Cyril David
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-05-01 00:00:00 +08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: contest
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ description: uses sorted sets and sets, sorting by score
33
+ email: cyx.ucron@gmail.com
34
+ executables: []
35
+
36
+ extensions: []
37
+
38
+ extra_rdoc_files:
39
+ - LICENSE
40
+ - README.rdoc
41
+ files:
42
+ - .document
43
+ - .gitignore
44
+ - LICENSE
45
+ - README.rdoc
46
+ - Rakefile
47
+ - VERSION
48
+ - examples/ohm.rb
49
+ - lib/lunar.rb
50
+ - lib/lunar/doc.rb
51
+ - lib/lunar/index.rb
52
+ - lib/lunar/scoring.rb
53
+ - test/helper.rb
54
+ - test/test_lunar.rb
55
+ - test/test_lunar_document.rb
56
+ - test/test_lunar_index.rb
57
+ - test/test_lunar_scoring.rb
58
+ - vendor/nest/nest.rb
59
+ - vendor/redis/.gitignore
60
+ - vendor/redis/LICENSE
61
+ - vendor/redis/README.markdown
62
+ - vendor/redis/Rakefile
63
+ - vendor/redis/benchmarking/logging.rb
64
+ - vendor/redis/benchmarking/pipeline.rb
65
+ - vendor/redis/benchmarking/speed.rb
66
+ - vendor/redis/benchmarking/suite.rb
67
+ - vendor/redis/benchmarking/worker.rb
68
+ - vendor/redis/bin/distredis
69
+ - vendor/redis/examples/basic.rb
70
+ - vendor/redis/examples/dist_redis.rb
71
+ - vendor/redis/examples/incr-decr.rb
72
+ - vendor/redis/examples/list.rb
73
+ - vendor/redis/examples/pubsub.rb
74
+ - vendor/redis/examples/sets.rb
75
+ - vendor/redis/lib/edis.rb
76
+ - vendor/redis/lib/redis.rb
77
+ - vendor/redis/lib/redis/client.rb
78
+ - vendor/redis/lib/redis/dist_redis.rb
79
+ - vendor/redis/lib/redis/distributed.rb
80
+ - vendor/redis/lib/redis/hash_ring.rb
81
+ - vendor/redis/lib/redis/pipeline.rb
82
+ - vendor/redis/lib/redis/raketasks.rb
83
+ - vendor/redis/lib/redis/subscribe.rb
84
+ - vendor/redis/profile.rb
85
+ - vendor/redis/tasks/redis.tasks.rb
86
+ - vendor/redis/test/db/.gitignore
87
+ - vendor/redis/test/distributed_test.rb
88
+ - vendor/redis/test/redis_test.rb
89
+ - vendor/redis/test/test.conf
90
+ - vendor/redis/test/test_helper.rb
91
+ has_rdoc: true
92
+ homepage: http://github.com/cyx/lunar
93
+ licenses: []
94
+
95
+ post_install_message:
96
+ rdoc_options:
97
+ - --charset=UTF-8
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ segments:
112
+ - 0
113
+ version: "0"
114
+ requirements: []
115
+
116
+ rubyforge_project:
117
+ rubygems_version: 1.3.6
118
+ signing_key:
119
+ specification_version: 3
120
+ summary: a minimalistic full text search implementation in redis
121
+ test_files:
122
+ - test/helper.rb
123
+ - test/test_lunar.rb
124
+ - test/test_lunar_document.rb
125
+ - test/test_lunar_index.rb
126
+ - test/test_lunar_scoring.rb
127
+ - examples/ohm.rb