Skip to content

Commit

Permalink
exchange now has cson extension
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Mar 14, 2015
1 parent f449b46 commit 5f10871
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
22 changes: 12 additions & 10 deletions docpad.coffee
Expand Up @@ -5,6 +5,7 @@ CSON = require('cson')
moment = require('moment')
strUtil = require('underscore.string')
extendr = require('extendr')
semver = require('semver')
#validator = require('validator')

# Prepare
Expand Down Expand Up @@ -445,18 +446,19 @@ docpadConfig =
# http://docpad.org/exchange.json?version=6.32.0
server.get '/exchange.json', (req,res) ->
# Determine branch based on docpad version
version = (req.query.version or '').split('.')
branch =
if version[0] is '5'
if version[1] is '3'
'docpad-5.3.x'
else
'docpad-5.x'
else
'docpad-6.x'
version = (req.query.version or '')
if semver.satisfies(version, '5.3')
branch = 'docpad-5.3.x'
extension = 'json'
else if semver.satisfies(version, '5')
branch = 'docpad-5.x'
extension = 'json'
else
branch = 'docpad-6.x'
extension = 'cson'

# Redirect
res.redirect(codeRedirectPermanent, "https://raw.githubusercontent.com/bevry/docpad-extras/#{branch}/exchange.json")
res.redirect(codeRedirectPermanent, "https://raw.githubusercontent.com/bevry/docpad-extras/#{branch}/exchange.#{extension}")

# Latest
server.get '/latest.json', (req,res) ->
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -42,6 +42,7 @@
"getcontributors": "~1.3.0",
"moment": "^2.9.0",
"request": "^2.51.0",
"semver": "^4.3.1",
"underscore.string": "^3.0.3"
},
"devDependencies": {
Expand Down

0 comments on commit 5f10871

Please sign in to comment.