1. Blake Sweeney
  2. prj

Overview

HTTPS SSH

Prj

Prj is a simple tool to build projects based upon templates. It's written in Chicken Scheme and is basically an excuse for me to play with macros, plus I wanted a dry project builder that supports multiple languages in a relatively simple way.

Design

A project is composed of several components. By default only dependencies, commands, directories and files are used, each is explained below.

Templates

Commands

System commands which are simply executed, errors will be output and the whole process will fail. Declared with (commands "cmd1" "cmd2").

Dependencies

Project templates to execute when building this template. For example, I have a git template that I use both with my ruby projects and my chicken projects. Declared with (depends-on prj1 prj2).

Directories

As you may expect. Declared with (directories d1 d2).

Files

Template files which will be appended to the existing file. Declared like (files (file-name template-file)) or (files file-name). If no template file is given then an empty file will be created. The template files will be taken from the same locations as the project templates.

Examples

  • ruby

    (depends-on code)
    (directories lib spec)
    (files
      (.rspec files/rspec)
      (.gitignore files/ruby-gitignore)
      (spec/spec_helper.rb files/spec_helper.rb))
    
  • code

    (depends git-flow readme)
    
  • git-flow

    (depends-on git)
    (commands "git flow init -d")
    
  • git

    (commands "git init")
    (files
      (.gitignore files/gitignore))
    

Requirements

Usage

The prj executable require a ~/.prj with a templates directory storing all templates and a definitions directory storing all project definitions.

To generate a new directory some-dir using the projects ruby and gem:

  $ prj some-dir ruby gem

When this project is built it will perform the actions for each component in the order you define the components in the template file. So if you try to put a file in a directory you haven't created yet you will get an error.

If you are in a specific directory and want to update it with some projects do:

  $ prj -u gem

Extending

This should be very extendible. Project components can be easily added. Look at project-definition.scm to see what a project definition looks like. To use a different definition when building simply do:

  $ prj -d new-definition.scm some-dir new-project-type

You can also place a definition in to ~/.prj/definition directory and it will always be loaded.

Limitations

  • Can't detect circular dependencies.

Author

Blake Sweeney blakes.85@gmail.com