summaryrefslogtreecommitdiff
path: root/jekyll-hook.js
diff options
context:
space:
mode:
authorAJ <scisco@users.noreply.github.com>2014-07-17 15:57:26 -0400
committerAJ <scisco@users.noreply.github.com>2014-07-17 15:57:26 -0400
commit086585c95574596765f9ce15bef0ff539b2cd6e5 (patch)
treee7584d93b1e1680231f0f98810fa990b0f7d47e3 /jekyll-hook.js
parentea87493f9a91a0d853ea6dd5f6e4a25cb9d536db (diff)
parent54d4b6cc127a786506cbf4b0abc0ee8e8cc55c56 (diff)
Merge pull request #16 from developmentseed/improvements
Making jekyll-hook compatible with Ubuntu 14.0
Diffstat (limited to 'jekyll-hook.js')
-rwxr-xr-xjekyll-hook.js29
1 files changed, 19 insertions, 10 deletions
diff --git a/jekyll-hook.js b/jekyll-hook.js
index 5154fd6..a5d61fa 100755
--- a/jekyll-hook.js
+++ b/jekyll-hook.js
@@ -20,7 +20,7 @@ app.post('/hooks/jekyll/:branch', function(req, res) {
// Queue request handler
tasks.defer(function(req, res, cb) {
- var data = JSON.parse(req.body.payload);
+ var data = req.body;
var branch = req.params.branch;
var params = [];
@@ -47,7 +47,14 @@ app.post('/hooks/jekyll/:branch', function(req, res) {
/* repo */ params.push(data.repo);
/* branch */ params.push(data.branch);
/* owner */ params.push(data.owner);
- /* giturl */ params.push('git@' + config.gh_server + ':' + data.owner + '/' + data.repo + '.git');
+
+ /* giturl */
+ if (config.public_repo) {
+ params.push('https://' + config.gh_server + '/' + data.owner + '/' + data.repo + '.git');
+ } else {
+ params.push('git@' + config.gh_server + ':' + data.owner + '/' + data.repo + '.git');
+ }
+
/* source */ params.push(config.temp + '/' + data.owner + '/' + data.repo + '/' + data.branch + '/' + 'code');
/* build */ params.push(config.temp + '/' + data.owner + '/' + data.repo + '/' + data.branch + '/' + 'site');
@@ -105,13 +112,15 @@ function run(file, params, cb) {
}
function send(body, subject, data) {
- if (config.email && data.pusher.email) {
- var message = {
- text: body,
- from: config.email.user,
- to: data.pusher.email,
- subject: subject
- };
- mailer.send(message, function(err) { if (err) console.warn(err); });
+ if (config.email.isActivated) {
+ if (config.email && data.pusher.email) {
+ var message = {
+ text: body,
+ from: config.email.user,
+ to: data.pusher.email,
+ subject: subject
+ };
+ mailer.send(message, function(err) { if (err) console.warn(err); });
+ }
}
}