Skip to content

Commit

Permalink
+ Cedar Stack
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Jun 15, 2011
1 parent 17b2d07 commit 4d7e427
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 20,547 deletions.
9 changes: 2 additions & 7 deletions .gitignore
@@ -1,7 +1,2 @@
.sass-cache log/*.log
server/log/*.log data/Marshal.*
server/log/search.log
server/tmp/pids/unicorn.pid
server/log/unicorn.stderr.log
server/log/unicorn.stdout.log
data/gems.csv
2 changes: 2 additions & 0 deletions Procfile
@@ -0,0 +1,2 @@
web: cd server; bundle exec rake start
server: cd client; bundle exec unicorn -p 80
7 changes: 1 addition & 6 deletions client/app.rb
Expand Up @@ -10,12 +10,7 @@


# Sets up two query instances. # Sets up two query instances.
# #
if ENV['RACK_ENV'] == 'production' GemSearch = Picky::Client.new :host => 'localhost', :port => 8080, :path => '/gems'
puts "Running Gemsearch on production"
GemSearch = Picky::Client.new :host => 'gemsearch-server.heroku.com', :port => 80, :path => '/gems'
else
GemSearch = Picky::Client.new :host => 'localhost', :port => 8080, :path => '/gems'
end


set :static, true set :static, true
set :public, File.dirname(__FILE__) set :public, File.dirname(__FILE__)
Expand Down
16 changes: 8 additions & 8 deletions client/gem.rb
Expand Up @@ -9,31 +9,31 @@
# * dependencies # * dependencies
# #
class AGem class AGem

@@gems_mapping = {} @@gems_mapping = {}

# Load the books on startup. # Load the books on startup.
# #
file_name = File.expand_path 'data/gems.csv', File.dirname(__FILE__) file_name = File.expand_path '../data/gems.csv', File.dirname(__FILE__)
CSV.open(file_name, 'r:utf-8').each do |row| CSV.open(file_name, 'r:utf-8').each do |row|
@@gems_mapping[row.shift.to_i] = row @@gems_mapping[row.shift.to_i] = row
end end

# Find uses a lookup table. # Find uses a lookup table.
# #
def self.find ids, _ = {} def self.find ids, _ = {}
ids.map { |id| new(id, *@@gems_mapping[id]) } ids.map { |id| new(id, *@@gems_mapping[id]) }
end end

attr_reader :id attr_reader :id

def initialize id, name, versions, authors, dependencies, summary def initialize id, name, versions, authors, dependencies, summary
@id, @name, @versions = id, name, versions @id, @name, @versions = id, name, versions
@authors = authors.split(/\|/).join(', ') @authors = authors.split(/\|/).join(', ')
@dependencies = dependencies.split(/\|/).join(', ') @dependencies = dependencies.split(/\|/).join(', ')
@summary = summary @summary = summary
end end

# "Rendering" ;) # "Rendering" ;)
# #
# Note: This is just an example. Please do not render in the model. # Note: This is just an example. Please do not render in the model.
Expand All @@ -44,5 +44,5 @@ def to_s
summary = "<p class='summary'>#{@summary}</p>" summary = "<p class='summary'>#{@summary}</p>"
"<li class='gem'><p><a href='http://rubygems.org/gems/#{@name}'>#{@name}</a><p>#{summary}<p></p>#{dependencies}#{authors}</li>" "<li class='gem'><p><a href='http://rubygems.org/gems/#{@name}'>#{@name}</a><p>#{summary}<p></p>#{dependencies}#{authors}</li>"
end end

end end
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions script/update
@@ -0,0 +1,4 @@
script/get_data
script/preprocess_data
cd server; rake index
cd server; PICKY_ENV=production rake index
2 changes: 1 addition & 1 deletion server/app/application.rb
Expand Up @@ -27,7 +27,7 @@ class PickySearch < Application
# See http://github.com/floere/picky/wiki/Sources-Configuration#sources # See http://github.com/floere/picky/wiki/Sources-Configuration#sources
# #
gems = Index::Memory.new :gems do gems = Index::Memory.new :gems do
source Sources::CSV.new(:name, :versions, :author, :dependencies, :summary, file: 'data/gems.csv') source Sources::CSV.new(:name, :versions, :author, :dependencies, :summary, file: '../data/gems.csv')


category :name, category :name,
similarity: Similarity::DoubleMetaphone.new(2), similarity: Similarity::DoubleMetaphone.new(2),
Expand Down
Binary file removed server/data/Marshal.4.8.Z
Binary file not shown.
20,519 changes: 0 additions & 20,519 deletions server/data/gems.csv

This file was deleted.

1 change: 0 additions & 1 deletion server/script/copy_to_client

This file was deleted.

5 changes: 0 additions & 5 deletions server/script/update

This file was deleted.

0 comments on commit 4d7e427

Please sign in to comment.