pvcbuild / pvc

PVC -- Scaffold, Build, Publish -- Composable, extensible builds in .NET created by @stirno
http://pvcbuild.com
MIT License
117 stars 11 forks source link

Init scripts #16

Closed stirno closed 10 years ago

stirno commented 10 years ago

Functionality to scaffold pieces of an application via pvc init templateName command.

Must Haves

First planned template is a pvc plugin project.

stirno commented 10 years ago

Version one of this is complete.. (if you don't see it working, run cuninst pvc then cinst pvc)

JSON config files/templates are hosted at https://github.com/pvcbuild/pvc-init-templates

Each file can provide the git repo to clone, the variables to replace (config section) and the questions to ask the user (prompts).

Sample file (https://github.com/pvcbuild/pvc-init-templates/blob/master/plugin.json):

{
    "templateRepo": "https://github.com/pvcbuild/pvc-init-plugin.git",
    "replacementExtensions": [".cs", ".csproj", ".nuspec", ".sln", "LICENSE"],
    "config": {
        "pluginName": null,
        "license": null
    },
    "prompts": {
        "Plugin Name: ": {
            "field": "pluginName"
        },
        "License: ": {
            "field": "license",
            "options": [
                ["MIT"],
                ["Apache 2", "Apache2"],
                ["BSD"],
                ["None (will add later)", null]
            ],
            "choose": "LICENSE"
        }
    }
}

This can be used by running pvc init plugin.

stirno commented 10 years ago

Also includes a 'choose' function which allows a choice to be made at config time, that will select a file for inclusion and remove the rest.

In this case its used for the license. There are 3 licenses in the template. They will be removed and renamed to LICENSE.