├── .github
└── FUNDING.yml
├── docs
├── foundry-release.png
└── getting-started.sh
├── test
├── test-files
│ ├── foundry-release-echo
│ │ ├── package.json
│ │ ├── foundry-release-echo.cmd
│ │ └── foundry-release-echo
│ ├── foundry-release-unknown
│ │ └── package.json
│ ├── foundry-release-resume-continue
│ │ ├── package.json
│ │ ├── foundry-release-echo.cmd
│ │ └── foundry-release-echo
│ ├── foundry-release-resume-failure
│ │ ├── package.json
│ │ ├── foundry-release-echo.cmd
│ │ └── foundry-release-echo
│ ├── foundry-release-bad-spec-version
│ │ ├── package.json
│ │ ├── foundry-release-bad-spec-version.cmd
│ │ └── foundry-release-bad-spec-version
│ ├── foundryrc-project
│ │ └── .foundryrc
│ ├── package.json-project
│ │ └── package.json
│ └── foundry-resume.json
├── utils
│ └── child-process.js
├── cli.js
├── lib.js
└── cli-resume.js
├── .gitignore
├── .eslintrc.js
├── bin
├── foundry
└── completion
│ └── foundry
├── appveyor.yml
├── .travis.yml
├── UNLICENSE
├── Vagrantfile
├── package.json
├── CHANGELOG.md
├── lib
├── foundry.js
└── release.js
└── README.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: https://twolfson.com/support-me
2 |
--------------------------------------------------------------------------------
/docs/foundry-release.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/twolfson/foundry/HEAD/docs/foundry-release.png
--------------------------------------------------------------------------------
/test/test-files/foundry-release-echo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "foundry": {
3 | "releaseCommands": [
4 | "foundry-release-echo"
5 | ]
6 | }
7 | }
--------------------------------------------------------------------------------
/test/test-files/foundry-release-unknown/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "foundry": {
3 | "releaseCommands": [
4 | "foundry-release-unknown"
5 | ]
6 | }
7 | }
--------------------------------------------------------------------------------
/test/test-files/foundry-release-resume-continue/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "foundry": {
3 | "releaseCommands": [
4 | "foundry-release-echo"
5 | ]
6 | }
7 | }
--------------------------------------------------------------------------------
/test/test-files/foundry-release-resume-failure/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "foundry": {
3 | "releaseCommands": [
4 | "foundry-release-echo"
5 | ]
6 | }
7 | }
--------------------------------------------------------------------------------
/test/test-files/foundry-release-bad-spec-version/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "foundry": {
3 | "releaseCommands": [
4 | "foundry-release-bad-spec-version"
5 | ]
6 | }
7 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .vagrant/
3 | docs/foundry-example/
4 | test/test-files/foundry-release-resume-failure/foundry-resume.json
5 | test/test-files/foundry-release-resume-continue/foundry-resume.json
6 |
--------------------------------------------------------------------------------
/test/test-files/foundry-release-echo/foundry-release-echo.cmd:
--------------------------------------------------------------------------------
1 | @IF EXIST "%~dp0\node.exe" (
2 | "%~dp0\node.exe" "%~dp0\foundry-release-echo" %*
3 | ) ELSE (
4 | @SETLOCAL
5 | @SET PATHEXT=%PATHEXT:;.JS;=;%
6 | node "%~dp0\foundry-release-echo" %*
7 | )
8 |
--------------------------------------------------------------------------------
/test/test-files/foundry-release-resume-failure/foundry-release-echo.cmd:
--------------------------------------------------------------------------------
1 | @IF EXIST "%~dp0\node.exe" (
2 | "%~dp0\node.exe" "%~dp0\foundry-release-echo" %*
3 | ) ELSE (
4 | @SETLOCAL
5 | @SET PATHEXT=%PATHEXT:;.JS;=;%
6 | node "%~dp0\foundry-release-echo" %*
7 | )
8 |
--------------------------------------------------------------------------------
/test/test-files/foundry-release-resume-continue/foundry-release-echo.cmd:
--------------------------------------------------------------------------------
1 | @IF EXIST "%~dp0\node.exe" (
2 | "%~dp0\node.exe" "%~dp0\foundry-release-echo" %*
3 | ) ELSE (
4 | @SETLOCAL
5 | @SET PATHEXT=%PATHEXT:;.JS;=;%
6 | node "%~dp0\foundry-release-echo" %*
7 | )
8 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | // Inherit from our package
3 | extends: 'eslint-config-twolfson',
4 |
5 | // Configure our environment
6 | // http://eslint.org/docs/user-guide/configuring#specifying-environments
7 | env: {
8 | node: true,
9 | mocha: true
10 | }
11 | };
12 |
--------------------------------------------------------------------------------
/test/test-files/foundry-release-bad-spec-version/foundry-release-bad-spec-version.cmd:
--------------------------------------------------------------------------------
1 | @IF EXIST "%~dp0\node.exe" (
2 | "%~dp0\node.exe" "%~dp0\foundry-release-bad-spec-version" %*
3 | ) ELSE (
4 | @SETLOCAL
5 | @SET PATHEXT=%PATHEXT:;.JS;=;%
6 | node "%~dp0\foundry-release-bad-spec-version" %*
7 | )
8 |
--------------------------------------------------------------------------------
/test/test-files/foundryrc-project/.foundryrc:
--------------------------------------------------------------------------------
1 | {
2 | "releaseCommands": [
3 | "foundry-release-string",
4 | {
5 | "type": "customCommand",
6 | "updateFiles": "echo hello",
7 | "commit": "echo world"
8 | },
9 | {
10 | "type": "releaseCommand",
11 | "command": "foundry-release-object"
12 | }
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/bin/foundry:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | // Create a new program
4 | var Foundry = require('../');
5 | var program = new Foundry();
6 | program.version(require('../package').version);
7 |
8 | // Parse the arguments
9 | program.parse(process.argv);
10 |
11 | // If there weren't enough arguments, display help
12 | if (process.argv.length <= 2) {
13 | program.outputHelp();
14 | }
15 |
--------------------------------------------------------------------------------
/test/test-files/package.json-project/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "foundry": {
3 | "releaseCommands": [
4 | "foundry-release-string",
5 | {
6 | "type": "customCommand",
7 | "updateFiles": "echo hello",
8 | "commit": "echo world"
9 | },
10 | {
11 | "type": "releaseCommand",
12 | "command": "foundry-release-object"
13 | }
14 | ]
15 | }
16 | }
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: "{build}"
2 |
3 | environment:
4 | matrix:
5 | # DEV: Disabled `node@0.10` on Windows because it's extremely finnicky with `stdout` and processes closing
6 | # - nodejs_version: "0.10"
7 | - nodejs_version: "0.12"
8 | - nodejs_version: "4.1"
9 |
10 | matrix:
11 | fast_finish: true
12 |
13 | install:
14 | - ps: Install-Product node $env:nodejs_version
15 | - node --version
16 | - npm --version
17 | - npm install
18 |
19 | test_script:
20 | - npm run test-windows-ci
21 |
22 | build: off
23 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "16"
4 | - "14"
5 | - "12"
6 |
7 | before_install:
8 | # Upgrade npm to avoid semver issues
9 | - curl --location http://rawgit.com/twolfson/fix-travis-ci/master/lib/install.sh | bash -s
10 |
11 | before_script:
12 | # Configure `git` user
13 | - git config --global user.email "foundry-test@mailinator.com"
14 | - git config --global user.name "Foundry Test"
15 |
16 | notifications:
17 | email:
18 | recipients:
19 | - todd@twolfson.com
20 | on_success: change
21 | on_failure: change
22 |
--------------------------------------------------------------------------------
/test/test-files/foundry-resume.json:
--------------------------------------------------------------------------------
1 | {
2 | "FOUNDRY_VERSION": "1.0.0",
3 | "FOUNDRY_MESSAGE": "Release 1.0.0",
4 | "steps": [
5 | {
6 | "step": "foundry-release-echo update-files \"$FOUNDRY_VERSION\" \"$FOUNDRY_MESSAGE\"",
7 | "completed": true
8 | },
9 | {
10 | "step": "foundry-release-echo commit \"$FOUNDRY_VERSION\" \"$FOUNDRY_MESSAGE\"",
11 | "completed": true
12 | },
13 | {
14 | "step": "foundry-release-echo register \"$FOUNDRY_VERSION\" \"$FOUNDRY_MESSAGE\"",
15 | "completed": false
16 | },
17 | {
18 | "step": "foundry-release-echo publish \"$FOUNDRY_VERSION\" \"$FOUNDRY_MESSAGE\"",
19 | "completed": false
20 | }
21 | ]
22 | }
--------------------------------------------------------------------------------
/test/test-files/foundry-release-bad-spec-version/foundry-release-bad-spec-version:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | // Load in our dependencies
3 | var program = require('commander-completion');
4 |
5 | // Define our spec version
6 | program.option('--spec-version', 'Output the spec-version for foundry');
7 | program.on('spec-version', function outputSpecVersion () {
8 | process.stdout.write('1.2.0\n');
9 | // Forcefully end stdout
10 | // DEV: This is required for `node@0.10` on Windows (otherwise, it's too slow and we can exit before the flush)
11 | // DEV: We have a try/catch because this is illegal in `node>=0.12`
12 | // Another option is the `exit` package but this is simpler since we are a CLI
13 | // https://github.com/twolfson/foundry-release-base/blob/1.0.2/lib/foundry-release-base.js#L27-L31
14 | try { process.stdout.end(); } catch (err) {}
15 | process.exit(0);
16 | });
17 |
18 | // Parse CLI arguments
19 | program.parse(process.argv);
20 |
--------------------------------------------------------------------------------
/test/test-files/foundry-release-resume-failure/foundry-release-echo:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | // Load in our dependencies
3 | var FoundryReleaseBase = require('foundry-release-base');
4 |
5 | // Define our library
6 | var myReleaseCommand = new FoundryReleaseBase({
7 | updateFiles: function (params, cb) {
8 | console.log('Step run (echo): update-files ' + params.version + ' ' + params.message);
9 | process.nextTick(cb);
10 | },
11 | commit: function (params, cb) {
12 | console.log('Step run (echo): commit ' + params.version + ' ' + params.message);
13 | process.nextTick(cb);
14 | },
15 | register: function (params, cb) {
16 | throw new Error('(echo) Something went wrong =(');
17 | },
18 | publish: function (params, cb) {
19 | console.log('Step run (echo): publish ' + params.version + ' ' + params.message);
20 | process.nextTick(cb);
21 | }
22 | });
23 |
24 | // Parse CLI arguments
25 | myReleaseCommand.parse(process.argv);
26 |
--------------------------------------------------------------------------------
/test/test-files/foundry-release-echo/foundry-release-echo:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | // Load in our dependencies
3 | var FoundryReleaseBase = require('foundry-release-base');
4 |
5 | // Define our library
6 | var myReleaseCommand = new FoundryReleaseBase({
7 | updateFiles: function (params, cb) {
8 | console.log('Step run (echo): update-files ' + params.version + ' ' + params.message);
9 | process.nextTick(cb);
10 | },
11 | commit: function (params, cb) {
12 | console.log('Step run (echo): commit ' + params.version + ' ' + params.message);
13 | process.nextTick(cb);
14 | },
15 | register: function (params, cb) {
16 | console.log('Step run (echo): register ' + params.version + ' ' + params.message);
17 | process.nextTick(cb);
18 | },
19 | publish: function (params, cb) {
20 | console.log('Step run (echo): publish ' + params.version + ' ' + params.message);
21 | process.nextTick(cb);
22 | }
23 | });
24 |
25 | // Parse CLI arguments
26 | myReleaseCommand.parse(process.argv);
27 |
--------------------------------------------------------------------------------
/test/test-files/foundry-release-resume-continue/foundry-release-echo:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | // Load in our dependencies
3 | var FoundryReleaseBase = require('foundry-release-base');
4 |
5 | // Define our library
6 | var myReleaseCommand = new FoundryReleaseBase({
7 | updateFiles: function (params, cb) {
8 | console.log('Step run (echo): update-files ' + params.version + ' ' + params.message);
9 | process.nextTick(cb);
10 | },
11 | commit: function (params, cb) {
12 | console.log('Step run (echo): commit ' + params.version + ' ' + params.message);
13 | process.nextTick(cb);
14 | },
15 | register: function (params, cb) {
16 | console.log('Step run (echo): register ' + params.version + ' ' + params.message);
17 | process.nextTick(cb);
18 | },
19 | publish: function (params, cb) {
20 | console.log('Step run (echo): publish ' + params.version + ' ' + params.message);
21 | process.nextTick(cb);
22 | }
23 | });
24 |
25 | // Parse CLI arguments
26 | myReleaseCommand.parse(process.argv);
27 |
--------------------------------------------------------------------------------
/UNLICENSE:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
25 |
--------------------------------------------------------------------------------
/test/utils/child-process.js:
--------------------------------------------------------------------------------
1 | // Load in dependencies
2 | var path = require('path');
3 | var bufferedSpawn = require('buffered-spawn');
4 |
5 | // Define our utilities
6 | exports.addToPath = function (dir) {
7 | before(function addToPathFn() {
8 | // Save the current PATH for later
9 | this._pathStack = this.pathStack || [];
10 | this._pathStack.push(process.env.PATH);
11 |
12 | // Prepend the new directory to the PATH so it's hit first
13 | process.env.PATH = dir + path.delimiter + process.env.PATH;
14 | });
15 | after(function restorePath() {
16 | // Pop the most recent PATH and restore it
17 | var lastPath = this._pathStack.pop();
18 | process.env.PATH = lastPath;
19 | });
20 | };
21 |
22 | exports.spawn = function (command, args, options) {
23 | before(function spawnFn(done) {
24 | // Run our command
25 | var that = this;
26 | bufferedSpawn(command, args, options, function handleBufferedSpawn(err, stdout, stderr) {
27 | // Save our results
28 | that.err = err;
29 | that.stdout = stdout;
30 | that.stderr = stderr;
31 |
32 | // Callback with no errors
33 | done();
34 | });
35 | });
36 |
37 | after(function cleanup() {
38 | // Clean up our results
39 | delete this.err;
40 | delete this.stdout;
41 | delete this.stderr;
42 | });
43 | };
44 |
--------------------------------------------------------------------------------
/Vagrantfile:
--------------------------------------------------------------------------------
1 | # -*- mode: ruby -*-
2 | # vi: set ft=ruby :
3 |
4 | Vagrant.configure("2") do |config|
5 | config.vm.box = "precise64"
6 | config.vm.box_url = "http://files.vagrantup.com/precise64.box"
7 |
8 | # Update apt-get once
9 | $update_apt_get = <