generated from haraka/haraka-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix: sed for readme (#1) - Move config/template.ini to config/$1.ini (#2) - Move template.ini to $1.ini - beef up eslint config for codeclimate benefit - add mocha to eslint env (for codeclimate) - npm install before test run - also rename config file - add github issue & pr templates - replace .eslintrc.json with .eslintrc.yaml - remove rules added to haraka-eslint - Update to node 10 in .travis.yml (#8) - use GitHub workflows for CI (#15) - README: update badge URLs - add 'versions' to package.json
- Loading branch information
0 parents
commit 473b409
Showing
17 changed files
with
466 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
engines: | ||
eslint: | ||
enabled: true | ||
channel: "eslint-6" | ||
config: | ||
config: ".eslintrc.yaml" | ||
|
||
ratings: | ||
paths: | ||
- "**.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
env: | ||
node: true | ||
es6: true | ||
mocha: true | ||
|
||
plugins: | ||
- haraka | ||
|
||
extends: | ||
- eslint:recommended | ||
- plugin:haraka/recommended | ||
|
||
rules: | ||
indent: [2, 2, {"SwitchCase": 1}] | ||
|
||
root: true | ||
|
||
globals: | ||
OK: true | ||
CONT: true | ||
DENY: true | ||
DENYSOFT: true | ||
DENYDISCONNECT: true | ||
DENYSOFTDISCONNECT: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
### system info | ||
|
||
Please report your OS, Node version, and Haraka version by running this shell script on your Haraka server and replacing this section with the output. | ||
|
||
echo "Haraka | $(haraka -v)"; echo " --- | :--- "; echo "Node | $(node -v)"; echo "OS | $(uname -a)"; echo "openssl | $(openssl version)" | ||
|
||
### Expected behavior | ||
|
||
### Observed behavior | ||
|
||
### Steps to reproduce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Fixes # | ||
|
||
Changes proposed in this pull request: | ||
- | ||
- | ||
|
||
Checklist: | ||
- [ ] docs updated | ||
- [ ] tests updated | ||
- [ ] Changes.md updated | ||
- [ ] package.json.version bumped | ||
- [ ] published to NPM (will be done by @core) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Plugin Tests - Windows | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
|
||
ci-test-win: | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ windows-latest ] | ||
node-version: [10.x, 12.x, 14.x] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
name: Checkout Plugin | ||
with: | ||
fetch-depth: 1 | ||
|
||
- uses: actions/setup-node@v1 | ||
name: Use Node.js ${{ matrix.node-version }} | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: npm install and test | ||
run: | | ||
npm install | ||
npm run test | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Plugin Tests | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
|
||
ci-test: | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
node-version: [10.x, 12.x, 14.x] | ||
fail-fast: false | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
name: Checkout Plugin | ||
with: | ||
fetch-depth: 1 | ||
|
||
- uses: actions/setup-node@v1 | ||
name: Use Node.js ${{ matrix.node-version }} | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: npm install | ||
run: npm install | ||
|
||
- name: Run test suite | ||
run: npm run test | ||
|
||
env: | ||
CI: true | ||
|
||
# services: | ||
# redis: | ||
# image: redis | ||
# ports: | ||
# - 6379/tcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
on: [ pull_request ] | ||
|
||
name: Test Coverage | ||
|
||
jobs: | ||
|
||
coverage: | ||
name: Codecov | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@master | ||
name: Checkout Plugin | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Use Node.js 10 | ||
uses: actions/setup-node@master | ||
with: | ||
node-version: 10.x | ||
|
||
- name: install, run | ||
run: | | ||
npm install | ||
npm install --no-save nyc codecov | ||
npm run cover | ||
- name: Coveralls | ||
uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.github_token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Lint | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
|
||
lint: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [ 12.x ] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
name: Checkout Plugin | ||
with: | ||
fetch-depth: 1 | ||
|
||
- uses: actions/setup-node@v1 | ||
name: Use Node.js ${{ matrix.node-version }} | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: npm install | ||
run: npm install | ||
|
||
- name: Lint using eslint | ||
run: npm run lint | ||
|
||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# 1.0.0 - 201_-__-__ | ||
|
||
- initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Haraka | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[![Unix Build Status][ci-img]][ci-url] | ||
[![Windows Build Status][ci-win-img]][ci-win-url] | ||
[![Code Climate][clim-img]][clim-url] | ||
[![NPM][npm-img]][npm-url] | ||
|
||
# haraka-plugin-template | ||
|
||
Clone me, to create a new plugin! | ||
|
||
# Template Instructions | ||
|
||
These instructions will not self-destruct after use. Use and destroy. | ||
|
||
See also, [How to Write a Plugin](https://github.com/haraka/Haraka/wiki/Write-a-Plugin) and [Plugins.md](https://github.com/haraka/Haraka/blob/master/docs/Plugins.md) for additional plugin writing information. | ||
|
||
## Create a new repo for your plugin | ||
|
||
Haraka plugins are named like `haraka-plugin-something`. All the namespace after `haraka-plugin-` is yours for the taking. Please check the [Plugins](https://github.com/haraka/Haraka/blob/master/Plugins.md) page and a Google search to see what plugins already exist. | ||
|
||
Once you've settled on a name, create the GitHub repo. On the repo's main page, click the _Clone or download_ button and copy the URL. Then paste that URL into a local ENV variable with a command like this: | ||
|
||
```sh | ||
export MY_GITHUB_ORG=haraka | ||
export MY_PLUGIN_NAME=haraka-plugin-SOMETHING | ||
``` | ||
|
||
Clone and rename the template repo: | ||
|
||
```sh | ||
git clone [email protected]:haraka/haraka-plugin-template.git | ||
mv haraka-plugin-template $MY_PLUGIN_NAME | ||
cd $MY_PLUGIN_NAME | ||
git remote rm origin | ||
git remote add origin "[email protected]:$MY_GITHUB_ORG/$MY_PLUGIN_NAME.git" | ||
``` | ||
|
||
Now you'll have a local git repo to begin authoring your plugin | ||
|
||
## rename boilerplate | ||
|
||
Replaces all uses of the word `template` with your plugin's name. | ||
|
||
./redress.sh [something] | ||
|
||
You'll then be prompted to update package.json and then force push this repo onto the GitHub repo you've created earlier. | ||
|
||
|
||
# Add your content here | ||
|
||
## INSTALL | ||
|
||
```sh | ||
cd /path/to/local/haraka | ||
npm install haraka-plugin-template | ||
echo "template" >> config/plugins | ||
service haraka restart | ||
``` | ||
|
||
### Configuration | ||
|
||
If the default configuration is not sufficient, copy the config file from the distribution into your haraka config dir and then modify it: | ||
|
||
```sh | ||
cp node_modules/haraka-plugin-template/config/template.ini config/template.ini | ||
$EDITOR config/template.ini | ||
``` | ||
|
||
## USAGE | ||
|
||
|
||
<!-- leave these buried at the bottom of the document --> | ||
[ci-img]: https://github.com/haraka/haraka-plugin-template/workflows/Plugin%20Tests/badge.svg | ||
[ci-url]: https://github.com/haraka/haraka-plugin-template/actions?query=workflow%3A%22Plugin+Tests%22 | ||
[ci-win-img]: https://github.com/haraka/haraka-plugin-template/workflows/Plugin%20Tests%20-%20Windows/badge.svg | ||
[ci-win-url]: https://github.com/haraka/haraka-plugin-template/actions?query=workflow%3A%22Plugin+Tests+-+Windows%22 | ||
[clim-img]: https://codeclimate.com/github/haraka/haraka-plugin-template/badges/gpa.svg | ||
[clim-url]: https://codeclimate.com/github/haraka/haraka-plugin-template | ||
[npm-img]: https://nodei.co/npm/haraka-plugin-template.png | ||
[npm-url]: https://www.npmjs.com/package/haraka-plugin-template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
[main] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict' | ||
|
||
exports.register = function () { | ||
this.load_template_ini() | ||
} | ||
|
||
exports.load_template_ini = function () { | ||
const plugin = this | ||
|
||
plugin.cfg = plugin.config.get('template.ini', { | ||
booleans: [ | ||
'+enabled', // plugin.cfg.main.enabled=true | ||
'-disabled', // plugin.cfg.main.disabled=false | ||
'+feature_section.yes' // plugin.cfg.feature_section.yes=true | ||
] | ||
}, | ||
function () { | ||
plugin.load_example_ini() | ||
}) | ||
} |
Oops, something went wrong.