Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Norton committed Jan 21, 2015
0 parents commit 37f49ed
Show file tree
Hide file tree
Showing 76 changed files with 25,255 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gaan
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pkg
bin
hound.sublime-workspace
data
.vagrant
pub/index.html
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2014, Etsy, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Hound

Hound is an extremely fast source code search engine. The core is based on this article (and code) from Russ Cox:
[Regular Expression Matching with a Trigram Index](http://swtch.com/~rsc/regexp/regexp4.html). Hound itself is a static
[React](http://facebook.github.io/react/) frontend that talks to a [Go](http://golang.org/) backend. The backend keeps an up-to-date index for each
repository and and answers searches through a minimal API.

## Why Another Code Search Tool?

We've used many similar tools in the past, and most of them are either too slow, too hard to configure, or require too much software to be installed.
Which brings us to...

## Requirements

### Hard Requirements
* Go 1.3+

### Optional, Recommended Software
* Rake (for building the binaries, not strictly required)
* nodejs (for the command line react-tools)

Yup, that's it. You can proxy requests to the Go service through Apache/nginx/etc., but that's not required.

## Hacking on Hound

### Building

```
rake
```

This will build `./bin/houndd` which is the server binary and `./bin/hound` which is the command line client.

### Running in development

```
./bin/houndd
```

This will start up the combined server and indexer. The first time you start the server, it will take a bit of time to initialize your `data` directory with the repository data.
You can access the web frontend at http://localhost:6080/

### Running in production

```
./bin/houndd --prod --addr=address:port
```

The will start up the combined server/indexer and build all static assets in production mode. The default addr is ":6080", and thus the `--addr` flag can be used to have the server listen on a different port.

## Get in Touch

IRC: #codeascraft on freenode

Created at [Etsy](https://www.etsy.com) by:

* [Kelly Norton](https://github.com/kellegous)
* [Jonathan Klein](https://github.com/jklein)
36 changes: 36 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'fileutils'

GOPATH=File.open('.gaan').map do |x|
File.absolute_path(File.join(File.dirname(__FILE__), x.strip))
end.join(':')

ENV.update({
'GOPATH' => GOPATH
})

file 'bin/hound' => FileList['src/hound/**/*', 'src/ansi/**/*'] do
host = ENV['HOST'] || 'localhost:6080'
args = ['go', 'build', '-o', 'bin/hound', '-ldflags', "-X main.defaultHost #{host}"] + FileList['src/hound/cmds/hound/*.go']
sh *args
end

file 'bin/houndd' => FileList['src/hound/**/*'] do
sh 'go', 'build', '-o', 'bin/houndd', 'src/hound/cmds/houndd/main.go'
end

task :default => [
'bin/houndd',
'bin/hound',
]

task :clean do
FileUtils::rm_rf('bin')
end

task :test do
pkgs = FileList['src/**/*_test.go'].map do |x|
File.dirname(x[4,x.length])
end.uniq
args = ['go', 'test'].concat(pkgs)
sh *args
end
11 changes: 11 additions & 0 deletions config-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"dbpath" : "data",
"repos" : {
"SomeRepo" : {
"url" : "https://www.github.com/YourOrganization/RepoOne.git"
},
"AnotherRepo" : {
"url" : "https://www.github.com/YourOrganization/RepoTwo.git"
}
}
}
16 changes: 16 additions & 0 deletions hound.sublime-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"folders":
[
{
"follow_symlinks": true,
"path": ".",
"folder_exclude_patterns": ["data"]
}
],
"settings":
{
"tab_size": 2,
"convert_tabspaces_on_save": true,
"translate_tabs_to_spaces": true
}
}
Loading

0 comments on commit 37f49ed

Please sign in to comment.