Skip to content

Commit

Permalink
publish bounce as NPM module
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Apr 29, 2024
1 parent 5992f23 commit fb69521
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[![NPM][npm-img]][npm-url]

# haraka-plugin-template
# haraka-plugin-bounce

Clone me, to create a new Haraka plugin!

Expand All @@ -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"
Expand All @@ -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]

Expand All @@ -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
```

Expand All @@ -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

<!-- leave these buried at the bottom of the document -->

[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
File renamed without changes.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down

0 comments on commit fb69521

Please sign in to comment.