diff options
author | Scisco <alireza@developmentseed.org> | 2014-07-17 13:06:18 -0400 |
---|---|---|
committer | Scisco <alireza@developmentseed.org> | 2014-07-17 13:06:18 -0400 |
commit | 805ba85ff3008bfcb6e146eddfd1d3ba9c5fd21b (patch) | |
tree | d385870e544666925b834f17066cf6cde588688d | |
parent | c5b18e5b5786f03d5d395854cde0241bd27244e0 (diff) |
If the repo is private, ssh key is needed, if it's public a simple https request is enough
-rw-r--r-- | config.sample.json | 10 | ||||
-rwxr-xr-x | jekyll-hook.js | 9 |
2 files changed, 13 insertions, 6 deletions
diff --git a/config.sample.json b/config.sample.json index 1ad82cf..dee6f1b 100644 --- a/config.sample.json +++ b/config.sample.json @@ -1,18 +1,18 @@ { "gh_server": "github.com", "temp": "/home/ubuntu/jekyll-hook", + "public-repo": True, "scripts": { "build": "./scripts/build.sh", "publish": "./scripts/publish.sh" }, "email": { - "user": "", - "password": "", - "host": "", + "user": "", + "password": "", + "host": "", "ssl": true }, "accounts": [ "developmentseed", - "mapbox" ] -}
\ No newline at end of file +} diff --git a/jekyll-hook.js b/jekyll-hook.js index 42b505c..32359e2 100755 --- a/jekyll-hook.js +++ b/jekyll-hook.js @@ -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'); |