Enable Your Project's Metadata
Indexer provides projects with a universal metadata format.
Indexer defines a canonical project metadata specification which is both
detailed and strict. The strictness of the specification makes the format simple
enough for developers to use without an intermediate API. Although Indexer also
provides a convenience API for working with the specification and its data more
loosely when suitable to the usecase. Indexer also specifies a standard
location for canonized metadata to be kept, in a
Indexer provides a tool to import metadata from external sources. Indexer can handle a variety of metadata source formats, including YAML, HTML Microformats and Ruby DSL scripts.
- YAML-based format for universal accessibility.
- Platform and programming language agnostic.
- Canonical specification provides idempotent access.
- Convenient Ruby API available.
- Supports custom metadata fields.
Indexer is a Ruby application, so as long as you have Ruby installed, it is easy to install Indexer via RubyGems.
$ gem install indexer
Indexer is capable of generating a canonical
.index file from a variety of
sources. Being so flexible, exactly how a developer decides to store a project's
metadata is a largely a matter of taste. But in general there are four overall
- Specify the metadata in one or more static files, typically a single YAML file.
- Specify the metadata using microformats in a project's README file.
- Construct the metadata via a Ruby DSL, customizing the generation in any way.
The first approach is a great option in the it is the easiest. One can quickly
put together a YAML document covering a project's metadata. Since Indexer is
very flexible in it's parsing of the YAML, it really is a quick and user-friendly
way to go. Typically this file will be called
Index.yml, but there is no name
requirement. In fact, Indexer will also let you split the metadata up over
multiple files, and can even go as far as using a file store, which is
a directory of files, one for each field.
The second choice is, in many respects, the nicest because it does not require any additional files be added to a project and it helps to ensure a good README file. On the downside, it may require some HTML be hand-coded into the README. If your README's markup format has a sexy syntax for microformats, this approach rocks. Otherwise, another approach is probably the better choice.
The last approach provides maximum flexibility. Using the Ruby DSL one can literally
script the metadata, which means it can come from anywhere at all. For example,
you might want to pull the project's version from the
file, i.e. Bundler style. The DSL is as intuitive and as flexible as using plain
YAML, so it's nearly as easy to take this approach. By convention this file is
Index.rb, but it too can be any file path one prefers.
On the Indexer wiki you can find detailed tutorials on a variety of setups, along with their pros and cons and various tip and tricks.
As an example of getting started, lets say we want to customize our index
metadata via a YAML file, but we want to keep the version information is
VERSION file. That's a common layout so Indexer is designed
to handle it out of the box. First create the
$ echo '0.1.0' > VERSION
Next we need our YAML file. Indexer makes out life easier by offering us some
template generation for common approaches. In this case we use the
command option, specifying that we want an
$ index --generate Index.yml
Now we can edit the
Index.yaml file to suite our project.
$ vim Index.yml
Once we have the source files setup, its easy to build the canonical
file using the
index command. We simply issue the
index command with
-u/--using command option:
$ index --using VERSION Index.yml
Indexer will utilize both sources and create the
Over time project metadata tends to evolve and change. To keep the canonical
.index file up to date simply call the
index command without any options.
By default the
.index file will not be updated if it has a modification time
newer than its source files. If need be, use the
-f/--force option to
That's the quick "one two" of getting started with Indexer. For more information, see the Wiki, API documentation, QED specifications and the Manpages.
Indexer is copyrighted open-source software.
© 2012 Rubyworks
It can be modified and redistributed in accordance with the terms of the BSD-2-Clause license.