1.0.0-beta.3 • Published 9 years ago

erebus v1.0.0-beta.3

Weekly downloads
4
License
ISC
Repository
github
Last release
9 years ago

Erebus

Erebus is a data generation tool that:

  1. is based on schema files, so changing the structure of the data is easy
  2. is seeded, so it will always generate the same data as long as the seed remains constant*
  3. can generate extremely interconnected data to better simulate real situations
  4. can use different "flavors" of data, so you can pull names from Lord of the Rings, for example.

* note: changing the schemas will also (naturally) change the data generated.

How to use

This is kind of a weird thing to document. I'll do my best below, but you'll probably get a better feel for it by reading the tutorial.

npm install -g erebus

It takes several options, all of which can instead be put into an erebus.json file, if you prefer. Or whatever filename you pass with --config.

schemaDir (short: -i, default: ./schemas)

The directory where your schema files reside.

outputDir (short: -o, default: ./data)

The directory where the generated data will be written.

flavor (short: -f)

The dataset(s) from which to pull values when generating. You can declare multiple sources, for example

$ erebus -f asoiaf -f lotr

fallback (short: -F)

Make flavor selection fallback rather than merge (the default). Using the above example,

$ erebus -F -f asoiaf -f lotr

Erebus will first try to find a value in the asoiaf dataset, and only if that dataset lacks a generator for the requested value will it look at lotr.

verbose (short: -v)

Increase the verbosity. Only errors/warnings by default, -v includes some info, and -vv will spit out entirely too much.

seed (short: -s)

The seed to use when generating data. Can be a number or a string.

Schema format

Schema files should be objects, even if the data to generate is an array. The actual schema is a property of the object.

  • __generated__ - indicates that this file is one Erebus ought to parse. Otherwise it will be treated as a static datafile.
  • type - "Array" if this should generate an array of data, otherwise leave it out
  • count - [min, max] range of entries to generate
  • relatedData - an object, where each key is an alias to use, and each value is another object. The other object has:
    • use - the name of the schema to which this alias refers
    • count - another [min, max] type thing
    • backRef - key/value pairs for references to put into the use-schema-generated data. The value is the current objects own properties.
  • schema - the actual schema. The keys are the real keys that will be used in the output, the values can be. If a value begins with "$", then it will look up that value in the datasets. If a value begins with "@", then it is a cross-reference, and it will look it up per relatedData (above).

Check the example schemas in the repo.

Why "Erebus"?

Something chaos something random generation blah blah whatever. No real reason.