Code Monkey home page Code Monkey logo

mkproject's Introduction

mkproject

A utility for creating skeleton project directories.

Usage

$ mkproject TYPE NAME

Where TYPE is a project template, and NAME is the name of your project. Projects will be made in ~/Dev by default, but this can be overriden with the MKPROJECT_ROOT environmental variable. If you wanted to store your projects in ~/code, simply add export MKPROJECT_ROOT=~/code to your bash profile:

$ echo "export MKPROJECT_ROOT=~/code" >> ~/.bash_profile

mkprojectrc

mkprojectrc lives at ~/.mkproject/mkprojectrc and is an ini-style configuration file.

defaults

The defaults section allows you to provide your defaults for project variables.

[defaults]
author_name=Joe Bloggs
[email protected]
github_user=joebloggs

Project Templates

Project templates consist of two parts, a directory structure to be copied and an optional settings file. mkproject will check ~/.mkproject and then /etc/mkproject for a directory called TYPE.

Templates/Variables

Project template files may contain variables in the form ${var}, which will be replaced on file creation. The only variable available by default is name, which contains the project name. Additional variables must be registered in the settings file.

Settings

If supplied, the settings file must be named projectname_settings.py in the same directory as the project skeleton. There are 5 possible settings:

variables

All variables aside name must be registered with a varspec in the format (var_name, default_value, description):

variables = (
    ('author_name', '', "Author's name"),
    ('author_email', '', "Author's email"),
    ('github_user', '', "Github username"),
)

path

path specifies where the directory structure will be copied to, and defaults to %(name)s. You may want to change this if, for example, you wanted to create a new virtualenv and copy the skeleton directory into a subdirectory of that environment.

path = 'src/%(name)s'

pre_commands

A tuple of commands to be executed before the project is created. Commands must be provided as a string, and standard python string formatting may be used for any variables. Commands are executed from $MKPROJECT_ROOT.

pre_commands = (
    'mkdir %(name)',
    'virtualenv --no-site-packages ./%(name)',
)

post_commands

A tuple of commands to be executed after the project is created. Commands are executed from $MKPROJECT_ROOT/%(path)s.

post_commands = (
    'git init',
    'git remote add origin [email protected]/%(github_user)s/%(name)s.git',
)

mkproject's People

Contributors

wrboyce avatar skorokithakis avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.