soulmate 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,17 +10,19 @@ end
10
10
  require 'rake'
11
11
 
12
12
  require 'jeweler'
13
+ require './lib/soulmate/version.rb'
13
14
  Jeweler::Tasks.new do |gem|
14
15
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "soulmate"
16
- gem.homepage = "http://github.com/seatgeek/soulmate"
17
- gem.license = "MIT"
18
- gem.summary = %Q{Redis-backed service for fast autocompleting - extracted from SeatGeek}
19
- gem.description = %Q{Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finished your sentences.}
20
- gem.email = "eric@seatgeek.com"
21
- gem.authors = ["Eric Waller"]
22
- # Include your dependencies below. Runtime dependencies are required when using your gem,
23
- # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
16
+ gem.name = "soulmate"
17
+ gem.version = Soulmate::Version::STRING
18
+ gem.homepage = "http://github.com/seatgeek/soulmate"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Redis-backed service for fast autocompleting - extracted from SeatGeek}
21
+ gem.description = %Q{Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finishes your sentences.}
22
+ gem.email = "eric@seatgeek.com"
23
+ gem.homepage = "http://github.com/seatgeek/soulmate"
24
+ gem.authors = ["Eric Waller"]
25
+ # The versions specified here are pretty arbitrary right now...
24
26
  gem.add_runtime_dependency 'redis', '>= 2.0'
25
27
  gem.add_runtime_dependency 'vegas', '>= 0.1.0'
26
28
  gem.add_runtime_dependency 'sinatra', '>= 1.0'
@@ -11,17 +11,19 @@ module Soulmate
11
11
  end
12
12
 
13
13
  get '/' do
14
- '{ "soulmate": 0.1.0, "status": "ok" }'
14
+ JSON.pretty_generate({ :soulmate => Soulmate::Version::STRING, :status => "ok" })
15
15
  end
16
16
 
17
17
  get '/search' do
18
+ raise Sinatra::NotFound unless (params[:term] and params[:types] and params[:types].is_a?(Array))
19
+
18
20
  limit = (params[:limit] || 5).to_i
19
21
  types = params[:types].map { |t| normalize(t) }
20
22
  term = params[:term]
21
23
 
22
24
  results = {}
23
25
  types.each do |type|
24
- matcher = Soulmate::Matcher.new(type)
26
+ matcher = Matcher.new(type)
25
27
  results[type] = matcher.matches_for_term(term, :limit => limit)
26
28
  end
27
29
 
@@ -32,7 +34,8 @@ module Soulmate
32
34
  end
33
35
 
34
36
  not_found do
35
- '{ "error": "not found" }'
37
+ content_type 'application/json', :charset => 'utf-8'
38
+ JSON.pretty_generate({ :error => "not found" })
36
39
  end
37
40
 
38
41
  end
@@ -0,0 +1,9 @@
1
+ module Soulmate
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 2
6
+
7
+ STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
+ end
9
+ end
data/lib/soulmate.rb CHANGED
@@ -2,6 +2,7 @@ require 'uri'
2
2
  require 'json'
3
3
  require 'redis'
4
4
 
5
+ require 'soulmate/version'
5
6
  require 'soulmate/helpers'
6
7
  require 'soulmate/base'
7
8
  require 'soulmate/matcher'
data/soulmate.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{soulmate}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eric Waller"]
12
12
  s.date = %q{2011-02-14}
13
- s.description = %q{Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finished your sentences.}
13
+ s.description = %q{Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finishes your sentences.}
14
14
  s.email = %q{eric@seatgeek.com}
15
15
  s.executables = ["soulmate", "soulmate-web"]
16
16
  s.extra_rdoc_files = [
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
24
24
  "LICENSE.txt",
25
25
  "README.rdoc",
26
26
  "Rakefile",
27
- "VERSION",
28
27
  "bin/soulmate",
29
28
  "bin/soulmate-web",
30
29
  "lib/soulmate.rb",
@@ -33,6 +32,7 @@ Gem::Specification.new do |s|
33
32
  "lib/soulmate/loader.rb",
34
33
  "lib/soulmate/matcher.rb",
35
34
  "lib/soulmate/server.rb",
35
+ "lib/soulmate/version.rb",
36
36
  "soulmate.gemspec",
37
37
  "test/helper.rb",
38
38
  "test/test_soulmate.rb"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Eric Waller
@@ -131,7 +131,7 @@ dependencies:
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: *id008
134
- description: Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finished your sentences.
134
+ description: Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finishes your sentences.
135
135
  email: eric@seatgeek.com
136
136
  executables:
137
137
  - soulmate
@@ -148,7 +148,6 @@ files:
148
148
  - LICENSE.txt
149
149
  - README.rdoc
150
150
  - Rakefile
151
- - VERSION
152
151
  - bin/soulmate
153
152
  - bin/soulmate-web
154
153
  - lib/soulmate.rb
@@ -157,6 +156,7 @@ files:
157
156
  - lib/soulmate/loader.rb
158
157
  - lib/soulmate/matcher.rb
159
158
  - lib/soulmate/server.rb
159
+ - lib/soulmate/version.rb
160
160
  - soulmate.gemspec
161
161
  - test/helper.rb
162
162
  - test/test_soulmate.rb
@@ -174,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
174
  requirements:
175
175
  - - ">="
176
176
  - !ruby/object:Gem::Version
177
- hash: -33650355
177
+ hash: -955125361
178
178
  segments:
179
179
  - 0
180
180
  version: "0"
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.0.1