Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JCThePants committed Apr 30, 2020
0 parents commit 5722c05
Show file tree
Hide file tree
Showing 29 changed files with 3,334 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build & Test Package
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
linux-node10:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: npm config set "@mintpond:registry" https://npm.pkg.github.com/mintpond
- run: npm config set //npm.pkg.github.com/:_authToken ${{secrets.NPM_INSTALL_TOKEN}}
- run: npm install
- run: npm test

linux-node12:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm config set "@mintpond:registry" https://npm.pkg.github.com
- run: npm config set //npm.pkg.github.com/:_authToken ${{secrets.NPM_INSTALL_TOKEN}}
- run: npm install
- run: npm test

windows-node10:
runs-on: windows-2016
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: npm config set "@mintpond:registry" https://npm.pkg.github.com
- run: npm config set //npm.pkg.github.com/:_authToken ${{secrets.NPM_INSTALL_TOKEN}}
- run: npm install
- run: npm test

windows-node12:
runs-on: windows-2016
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm config set "@mintpond:registry" https://npm.pkg.github.com
- run: npm config set //npm.pkg.github.com/:_authToken ${{secrets.NPM_INSTALL_TOKEN}}
- run: npm install
- run: npm test
16 changes: 16 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish Package
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: npm config set "@mintpond:registry" https://npm.pkg.github.com/mintpond
- run: npm config set //npm.pkg.github.com/:_authToken ${{secrets.GITHUB_TOKEN}}
- run: npm install
- run: npm publish
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
.idea/
.forever/
.vscode/
*.iml
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 JCThePants, contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
mint-commands
=============

This module contains CLI command line interface building utilities for NodeJS used by [MintPond Mining Pool](https://mintpond.com).

## Install ##
__Install as Dependency in NodeJS Project__
```bash
# Install from Github NPM repository

npm config set @mintpond:registry https://npm.pkg.github.com/mintpond
npm config set //npm.pkg.github.com/:_authToken <PERSONAL_ACCESS_TOKEN>

npm install @mintpond/mint-commands@1.0.0 --save
```
[Creating a personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line)

__Install & Test__
```bash
# Install nodejs v10
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs -y

# Download mint-commands
git clone https://github.com/MintPond/mint-commands

# build & test
cd mint-commands
npm install
npm test
```
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

module.exports = {
CliServer: require('./libs/class.CliServer'),
Command: require('./libs/class.Command'),
CommandDispatcher: require('./libs/class.CommandDispatcher'),
CommandError: require('./libs/class.CommandError'),
Commands: require('./libs/class.Commands'),
argParser: require('./libs/service.argParser'),
cli: require('./libs/service.cli'),
cmdParser: require('./libs/service.cmdParser')
};
50 changes: 50 additions & 0 deletions libs/class.Category.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
'use strict';

const
precon = require('@mintpond/mint-precon'),
pu = require('@mintpond/mint-utils').prototypes,
Command = require('./class.Command');


/**
* A command definition to use where an actual command is not defined (i.e. categories).
*/
class Category extends Command {

/**
* Constructor.
*
* @param args
* @param args.path {string}
* @param [args.description] {string}
*/
constructor(args) {
precon.string(args.path, 'path');
precon.opt_string(args.description, 'description');

super(args);
}


/* Override */
execute(argMap, callback) {
throw new Error('Cannot execute a category.');
}

/* Override */
toJSON() {
const _ = this;
return {
path: _.path,
description: _.description
};
}


static [Symbol.hasInstance](obj) {
return pu.isInstanceOfByName(obj, 'Category') &&
obj instanceof Command;
}
}

module.exports = Category;
Loading

0 comments on commit 5722c05

Please sign in to comment.