-
Notifications
You must be signed in to change notification settings - Fork 4
Add the ability for mailmason to generate and upload/update templates.
#3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
derekrushforth
merged 32 commits into
ActiveCampaign:master
from
randytarampi:template-api-support
Jan 13, 2018
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
9dffdfa
configuration for tests
hybernaut abb4d27
more test config cleanup
hybernaut 86c4d29
basic grunt task implemented
hybernaut e8ae024
read template files from filesystem
hybernaut 4057b64
remove debug
hybernaut d988011
TODO for validating htmlBody/htmlFile etc.
hybernaut aac24c8
pretty good support for creating a server
hybernaut 0873473
make create server task idempotent
hybernaut bcef316
refactor postmark-servers task using more idiomatic grunt usage
hybernaut 71ccf91
duplicate test requires only one additional iteration, not two
hybernaut d3331ca
collect serverToken from secrets.json
hybernaut a48658c
read template config from templates.json
hybernaut a650a90
clean up example template files
hybernaut d87365d
simplify configuration
hybernaut bb51efc
use more canonical htmlBody and textBody
hybernaut 3967d29
read templates.json in the postmark-templates task
hybernaut 82fb13c
checkpoint: making progress toward saving templateID output
hybernaut a0a6f6d
output template info (including IDs) in templates.json format
hybernaut 8fb62e5
update existing templates if templateID is present
hybernaut a518367
if update fails with bad Id, then revert to create
hybernaut 6131196
move postmark-servers task to separate PR
hybernaut ac17e37
remove references to postmark-servers (for another PR)
hybernaut f3a7f7e
one last comment
hybernaut 4a0b60c
node.js style callback
hybernaut aa3194b
simplify configuration following suggestions from @derekrushforth
hybernaut 90ec805
log "created" vs "updated"
hybernaut 315fd19
sample Gruntfile reads templates.json or defaults to inline config
hybernaut 19fc6c4
Add the ability for `mailmason` to generate and upload/update templates.
randytarampi 253a587
Further decouple `grunt-postmark` from `mailmason`.
randytarampi ee632f2
Add `postmark-templates-parse` and `postmark-templates-from-file`.
randytarampi b7e7a42
Add some documentation around `postmark-templates`.
randytarampi 2cfb716
Bump version to `0.0.8`.
randytarampi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| node_modules | ||
| .idea | ||
| secrets.json | ||
| config.json | ||
| secrets.json |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -3,35 +3,76 @@ | |
| * https://github.com/wildbit/grunt-postmark.git | ||
| */ | ||
|
|
||
| module.exports = function(grunt) { | ||
| module.exports = function (grunt) { | ||
| var secret = grunt.file.readJSON('secrets.json'); | ||
| var config = grunt.file.readJSON('config.json'); | ||
|
|
||
| grunt.initConfig({ | ||
| secrets: grunt.file.readJSON('secrets.json'), | ||
| secret: secret, | ||
| config: config, | ||
|
|
||
| /* Postmark | ||
| ------------------------------------------------- */ | ||
| ------------------------------------------------- */ | ||
| postmark: { | ||
| options: { | ||
| serverToken: '<%= secrets.serverToken %>' | ||
| serverToken: "<%= secret.postmark.server_token %>" | ||
| }, | ||
| email: { | ||
| from: '[email protected]', | ||
| to: '[email protected]', | ||
| subject: 'Yo', | ||
| src: ['test/email.html'] | ||
| from: "<%= config.postmark.from %>", | ||
| to: "<%= config.postmark.to %>", | ||
| subject: "<%= config.postmark.subject %>", | ||
| src: ["test/email.html"] | ||
| }, | ||
| bulk: { | ||
| from: '[email protected]', | ||
| to: '[email protected]', | ||
| subject: 'Hey', | ||
| src: ['test/*.html'] | ||
| from: "<%= config.postmark.from %>", | ||
| to: "<%= config.postmark.to %>", | ||
| subject: "<%= config.postmark.subject %>", | ||
| src: ["test/*.html"] | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| "postmark-templates-upload": { | ||
| options: { | ||
| ephemeralUploadResultsProperty: "<%= config.templates && config.templates.ephemeralUploadResultsProperty %>", | ||
| serverToken: "<%= secret.postmark.server_token %>" | ||
| }, | ||
| test_email: { | ||
| name: "testing-postmark-templates-js1-" + new Date().valueOf(), | ||
| subject: "Testing grunt-postmark-templates", | ||
| htmlSrc: "test/email.html", | ||
| textSrc: "test/email.txt" | ||
| }, | ||
| test_email_again: { | ||
| name: "testing-postmark-templates-js2-" + new Date().valueOf(), | ||
| subject: "Testing grunt-postmark-templates (again)", | ||
| htmlSrc: "test/email.html", | ||
| textSrc: "test/email.txt" | ||
| }, | ||
| test_email_inline_body: { | ||
| name: "testing-postmark-templates-js3-" + new Date().valueOf(), | ||
| subject: "Testing grunt-postmark-templates (inline body)", | ||
| htmlBody: "<html><body><h1>Another email test</h1></body></html>", | ||
| textBody: "Hello from grunt-postmark-templates\n" | ||
| } | ||
| }, | ||
|
|
||
| "postmark-templates-output": { | ||
| options: { | ||
| cleanOutput: "<%= config.templates && config.templates.cleanOutput %>", | ||
| outputFile: "<%= config.templates && config.templates.outputFile || config.templates && config.templates.file %>", | ||
| ephemeralUploadResultsProperty: "<%= config.templates && config.templates.ephemeralUploadResultsProperty %>" | ||
| } | ||
| }, | ||
|
|
||
| "postmark-templates-parse": { | ||
| options: { | ||
| inputFile: "<%= config.templates && config.templates.inputFile || config.templates && config.templates.file %>" | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| grunt.loadTasks('tasks'); | ||
| grunt.loadTasks("tasks"); | ||
|
|
||
| grunt.registerTask('default', ['postmark']); | ||
| grunt.registerTask("default", ["postmark", "postmark-templates"]); | ||
|
|
||
| }; | ||
This file contains hidden or 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
This file contains hidden or 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,16 @@ | ||
| // 1. Copy this file to "config.json" for your own version that won't be | ||
| // tracked in source control. | ||
| // | ||
| // 2. Delete these comments from the configuration so Grunt doesn't get confused | ||
| { | ||
| "postmark": { | ||
| "from": "[email protected]", | ||
| "to": "[email protected]", | ||
| "subject": "Test Email" | ||
| }, | ||
| "templates": { | ||
| "ephemeralUploadResultsProperty": "postmark-templates-upload-results", | ||
| "cleanOutput": true, | ||
| "file": "templates.json" | ||
| } | ||
| } |
This file contains hidden or 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,9 @@ | ||
| // 1. Copy this file to "secrets.json" for your own version that won't be | ||
| // tracked in source control. | ||
| // | ||
| // 2. Delete these comments from the configuration so Grunt doesn't get confused | ||
| { | ||
| "postmark": { | ||
| "server_token": "YOUR_POSTMARK_SERVER_TOKEN_HERE" | ||
| } | ||
| } |
This file contains hidden or 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 @@ | ||
| { | ||
| "test_email": { | ||
| "name": "testing-postmark-templates-js1", | ||
| "subject": "Testing grunt-postmark-templates", | ||
| "htmlSrc": "test/email.html", | ||
| "textSrc": "test/email.txt" | ||
| }, | ||
| "test_email_again": { | ||
| "name": "testing-postmark-templates-js2", | ||
| "subject": "Testing grunt-postmark-templates (again)", | ||
| "htmlSrc": "test/email.html", | ||
| "textSrc": "test/email.txt" | ||
| }, | ||
| "test_email_inline_body": { | ||
| "name": "testing-postmark-templates-js3", | ||
| "subject": "Testing grunt-postmark-templates (inline body)", | ||
| "htmlBody": "<html><body><h1>Another email test</h1></body></html>", | ||
| "textBody": "Hello from grunt-postmark-templates\n" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several details in this wiki entry that aren't relevant to grunt-postmark so this might confuse people who aren't using MailMason.
We should replace this with setup instructions specific to grunt-postmark. I can create the wiki page and link it once we've merged this PR.