From fb695216cbf6e26e85ac81bf4cd9a9a175697eb0 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Mon, 29 Apr 2024 08:38:30 -0700 Subject: [PATCH] publish bounce as NPM module --- README.md | 30 ++++++++++++++--------------- config/{template.ini => bounce.ini} | 0 index.js | 6 +++--- test/index.js | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) rename config/{template.ini => bounce.ini} (100%) diff --git a/README.md b/README.md index 9f4306f..c5c953a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![NPM][npm-img]][npm-url] -# haraka-plugin-template +# haraka-plugin-bounce Clone me, to create a new Haraka plugin! @@ -24,11 +24,11 @@ export MY_GITHUB_ORG=haraka export MY_PLUGIN_NAME=haraka-plugin-SOMETHING ``` -Clone and rename the template repo: +Clone and rename the bounce repo: ```sh -git clone git@github.com:haraka/haraka-plugin-template.git -mv haraka-plugin-template $MY_PLUGIN_NAME +git clone git@github.com:haraka/haraka-plugin-bounce.git +mv haraka-plugin-bounce $MY_PLUGIN_NAME cd $MY_PLUGIN_NAME git remote rm origin git remote add origin "git@github.com:$MY_GITHUB_ORG/$MY_PLUGIN_NAME.git" @@ -38,7 +38,7 @@ 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. +Replaces all uses of the word `bounce` with your plugin's name. ./redress.sh [something] @@ -50,8 +50,8 @@ You'll then be prompted to update package.json and then force push this repo ont ```sh cd /path/to/local/haraka -npm install haraka-plugin-template -echo "template" >> config/plugins +npm install haraka-plugin-bounce +echo "bounce" >> config/plugins service haraka restart ``` @@ -60,17 +60,17 @@ service haraka restart 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 +cp node_modules/haraka-plugin-bounce/config/bounce.ini config/bounce.ini +$EDITOR config/bounce.ini ``` ## USAGE -[ci-img]: https://github.com/haraka/haraka-plugin-template/actions/workflows/ci.yml/badge.svg -[ci-url]: https://github.com/haraka/haraka-plugin-template/actions/workflows/ci.yml -[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 +[ci-img]: https://github.com/haraka/haraka-plugin-bounce/actions/workflows/ci.yml/badge.svg +[ci-url]: https://github.com/haraka/haraka-plugin-bounce/actions/workflows/ci.yml +[clim-img]: https://codeclimate.com/github/haraka/haraka-plugin-bounce/badges/gpa.svg +[clim-url]: https://codeclimate.com/github/haraka/haraka-plugin-bounce +[npm-img]: https://nodei.co/npm/haraka-plugin-bounce.png +[npm-url]: https://www.npmjs.com/package/haraka-plugin-bounce diff --git a/config/template.ini b/config/bounce.ini similarity index 100% rename from config/template.ini rename to config/bounce.ini diff --git a/index.js b/index.js index f09e7c0..495421e 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,15 @@ "use strict"; exports.register = function () { - this.load_template_ini(); + this.load_bounce_ini(); // register hooks here. More info at https://haraka.github.io/core/Plugins/ // this.register_hook('data_post', 'do_stuff_with_message') }; -exports.load_template_ini = function () { +exports.load_bounce_ini = function () { this.cfg = this.config.get( - "template.ini", + "bounce.ini", { booleans: [ "+enabled", // this.cfg.main.enabled=true diff --git a/test/index.js b/test/index.js index 5f65df3..e7afa5f 100644 --- a/test/index.js +++ b/test/index.js @@ -8,23 +8,23 @@ const fixtures = require("haraka-test-fixtures"); // assert: https://nodejs.org/api/assert.html beforeEach(function () { - this.plugin = new fixtures.plugin("template"); + this.plugin = new fixtures.plugin("bounce"); }); -describe("template", function () { +describe("bounce", function () { it("loads", function () { assert.ok(this.plugin); }); }); -describe("load_template_ini", function () { - it("loads template.ini from config/template.ini", function () { - this.plugin.load_template_ini(); +describe("load_bounce_ini", function () { + it("loads bounce.ini from config/bounce.ini", function () { + this.plugin.load_bounce_ini(); assert.ok(this.plugin.cfg); }); it("initializes enabled boolean", function () { - this.plugin.load_template_ini(); + this.plugin.load_bounce_ini(); assert.equal(this.plugin.cfg.main.enabled, true, this.plugin.cfg); }); });