Project

zeiger

0.0
No release in over 3 years
Low commit activity in last 3 years
Maintain an in-memory text index of files in current directory tree, allow querying via unix socket in current directory
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0
 Project Readme

Zeiger

Zeiger is the German word for "pointer", "indicator", "index", "locator". This gem is built in the "index" sense. To install,

gem install zeiger

In a terminal, run

zeiger server

Zeiger will open a unix-socket under /tmp and listen for search and file-list requests. Run this in a terminal:

cd myproject
zeiger search "muppets"

(Replace "myproject" with something meaningful!)

Zeiger will index the current directory if it is not already indexed, then search for lines containing "muppets". Output is in the same format as grep (so you can hook it up with your emacs for quick project browsing).

Zeiger will rescan files in the current directory every ten seconds so the index is mostly up-to-date.

Usage

zeiger server runs the server and opens a unix filesystem socket called /tmp/zeiger-index

zeiger search "foo" writes the query to the socket and displays the result

zeiger files "xed" asks for the list of filenames corresponding to the argument ("xed"). With no argument, return all filenames. Files are sorted by length of filename. This sounds odd, but works nicely with 'completing-read in emacs: you will find the file you want in fewer keystrokes.

By default, Zeiger searches only in these subdirectories : %w{ app bin config lib spec test }, and excludes filenames matching these patterns: %w{ .gz$ .png$ .jpg$ .pdf$ }.

To override, create a file called .zeiger.yml in your project root with the following format:

search:
  - bin
  - lib
  - config.rb
ignore:
  - .gz$
  - .png$
  - .gif$
  - .zip$
  - .jpg$
  - .ico$
  - .xcf$
  - .mpg$

You should change the contents to suit your indexing needs. The search key is a list of regexps, zeiger will index only those files whose name matches at least one of these regexps. The ignore key is likewise a list of regexps, zeiger will not index any file whose name matches any of these regexps. The ignore rule supercedes the search rule.

When you invoke zeiger search ... or zeiger files ..., zeiger will consider whether an index already exists for the current directory. If not, and the current directory is a project root, it will create an index for the current directory. If there is no index, and the current directory is not a project root, it moves up one directory and tries again.

Zeiger considers a project root any directory containing any one of the following: %w{ .zeiger.yml .git .hg Makefile Rakefile Gemfile build.xml } (see ROOT_FILES constant in index.rb)

TODO

Use Listen gem instead of manual filesystem scan

Contributing

  1. Fork it ( https://github.com/conanite/zeiger/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request