Add a very rough and dirty search mechanism that uses Git’s grep.

This commit is contained in:
Tobias Adam
2010-08-22 23:17:54 +02:00
parent 48b143c6ed
commit 4905ce99da
4 changed files with 60 additions and 1 deletions
+7
View File
@@ -128,6 +128,13 @@ module Precious
end
end
get '/search' do
@q = params[:q]
@search_command = "cd #{$path} && git grep -c '#{@q}' master"
@results = `#{@search_command}`
mustache :search
end
get '/*' do
show_page_or_file(params[:splat].first)
end