webhook-templates
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -31,2 +31,15 @@ var Dust, dustBase, nth, _; | ||
}, | ||
gitshortmessage: function(chunk, context, bodies, params) { | ||
var lines; | ||
if (_.isString(params.message)) { | ||
lines = params.message.split(/\n/); | ||
if (lines.length > 1) { | ||
return chunk.write(lines[0] + " [...]"); | ||
} else { | ||
return chunk.write(lines[0]); | ||
} | ||
} else { | ||
return chunk; | ||
} | ||
}, | ||
first: function(chunk, context, bodies, params) { | ||
@@ -33,0 +46,0 @@ return nth(chunk, context, bodies, params, 0); |
@@ -1,2 +0,2 @@ | ||
// Generated Fri, 18 May 2012 17:10:02 GMT | ||
// Generated Mon, 21 May 2012 13:03:53 GMT | ||
Template = require('./template'); | ||
@@ -16,4 +16,4 @@ dust = Template.Dust | ||
templateNames.push("github"); | ||
templateDetails["github"] = {"name":"GitHub","author":"Benjie Gillam http://www.benjiegillam.com/","format":"JSON","jsonfield":"payload","ips":["207.97.227.253","50.57.128.197","108.171.174.178"],"url":"http://help.github.com/post-receive-hooks/"}; | ||
templateStrings["github"] = "{!WebhookTemplate{\n \"name\" : \"GitHub\"\n, \"author\" : \"Benjie Gillam http://www.benjiegillam.com/\"\n, \"format\" : \"JSON\"\n, \"jsonfield\" : \"payload\"\n, \"ips\" : [\"207.97.227.253\", \"50.57.128.197\", \"108.171.174.178\"]\n, \"url\" : \"http://help.github.com/post-receive-hooks/\"\n}!}\n{#last array=commits}{author.name}{/first}{~s}\npushed to branch `{#gitbranch ref=ref/}`{~s}\nof [{repository.owner.name}/{repository.name}]({repository.url}){?commits}:{/commits}\n{#reverse array=commits}\n {~n}{~s}{~s}- {message} ([`{#gitshorthash hash=id/}`]({url}))\n{/reverse}\n"; | ||
(function(){dust.register("github",body_0);function body_0(chk,ctx){return chk.section(ctx.get("last"),ctx,{"block":body_1},{"array":ctx.get("commits")}).write(" pushed to branch `").section(ctx.get("gitbranch"),ctx,{},{"ref":ctx.get("ref")}).write("` of [").reference(ctx.getPath(false,["repository","owner","name"]),ctx,"h").write("/").reference(ctx.getPath(false,["repository","name"]),ctx,"h").write("](").reference(ctx.getPath(false,["repository","url"]),ctx,"h").write(")").exists(ctx.get("commits"),ctx,{"block":body_2},null).section(ctx.get("reverse"),ctx,{"block":body_3},{"array":ctx.get("commits")});}function body_1(chk,ctx){return chk.reference(ctx.getPath(false,["author","name"]),ctx,"h");}function body_2(chk,ctx){return chk.write(":");}function body_3(chk,ctx){return chk.write("\n - ").reference(ctx.get("message"),ctx,"h").write(" ([`").section(ctx.get("gitshorthash"),ctx,{},{"hash":ctx.get("id")}).write("`](").reference(ctx.get("url"),ctx,"h").write("))");}return body_0;})(); | ||
templateDetails["github"] = {"name":"GitHub","author":"Benjie Gillam (http://www.benjiegillam.com/)","format":"JSON","jsonfield":"payload","url":"http://help.github.com/post-receive-hooks/"}; | ||
templateStrings["github"] = "{!WebhookTemplate{\n \"name\" : \"GitHub\"\n, \"author\" : \"Benjie Gillam (http://www.benjiegillam.com/)\"\n, \"format\" : \"JSON\"\n, \"jsonfield\" : \"payload\"\n, \"url\" : \"http://help.github.com/post-receive-hooks/\"\n}!}\n{#last array=commits}{author.name}{/first}{~s}\npushed to branch `{#gitbranch ref=ref/}`{~s}\nof{~s}\n{?repository.url}\n [{repository.owner.name}/{repository.name}]({repository.url})\n{:else}\n {repository.name}\n{/repository.url}\n{?commits}\n :\n {#reverse array=commits}\n {~n}{~s}{~s}- {#gitshortmessage message=message/}{~s}\n {?url}\n ([`{#gitshorthash hash=id/}`]({url}))\n {:else}\n (`{#gitshorthash hash=id/}`)\n {/url}\n {/reverse}\n{/commits}\n"; | ||
(function(){dust.register("github",body_0);function body_0(chk,ctx){return chk.section(ctx.get("last"),ctx,{"block":body_1},{"array":ctx.get("commits")}).write(" pushed to branch `").section(ctx.get("gitbranch"),ctx,{},{"ref":ctx.get("ref")}).write("` of ").exists(ctx.getPath(false,["repository","url"]),ctx,{"else":body_2,"block":body_3},null).exists(ctx.get("commits"),ctx,{"block":body_4},null);}function body_1(chk,ctx){return chk.reference(ctx.getPath(false,["author","name"]),ctx,"h");}function body_2(chk,ctx){return chk.reference(ctx.getPath(false,["repository","name"]),ctx,"h");}function body_3(chk,ctx){return chk.write("[").reference(ctx.getPath(false,["repository","owner","name"]),ctx,"h").write("/").reference(ctx.getPath(false,["repository","name"]),ctx,"h").write("](").reference(ctx.getPath(false,["repository","url"]),ctx,"h").write(")");}function body_4(chk,ctx){return chk.write(":").section(ctx.get("reverse"),ctx,{"block":body_5},{"array":ctx.get("commits")});}function body_5(chk,ctx){return chk.write("\n - ").section(ctx.get("gitshortmessage"),ctx,{},{"message":ctx.get("message")}).write(" ").exists(ctx.get("url"),ctx,{"else":body_6,"block":body_7},null);}function body_6(chk,ctx){return chk.write("(`").section(ctx.get("gitshorthash"),ctx,{},{"hash":ctx.get("id")}).write("`)");}function body_7(chk,ctx){return chk.write("([`").section(ctx.get("gitshorthash"),ctx,{},{"hash":ctx.get("id")}).write("`](").reference(ctx.get("url"),ctx,"h").write("))");}return body_0;})(); |
{ | ||
"name": "webhook-templates", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Dust.js templates for webhook payloads", | ||
@@ -5,0 +5,0 @@ "keywords": ["pim", "webhook", "templates", "dust", "dustjs"], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5661
78