forked from kitspace/kitspace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getBoards.coffee
executable file
·29 lines (27 loc) · 1.04 KB
/
getBoards.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env coffee
fs = require('fs')
cp = require('child_process')
utils = require('./utils')
versions = JSON.parse(fs.readFileSync('versions.json'))
for {repo, hash} in versions
folder = utils.repoToFolder(repo)
fs.exists folder, ((folder, repo, hash, exists) ->
if exists
cmd = "cd #{folder} && git checkout #{hash}
|| git fetch --unshallow && git checkout #{hash}
|| git pull origin master && git checkout #{hash}"
console.log(cmd)
cp.exec cmd, (err, out)->
if err?
console.error(err)
process.exit(err.code)
else
cmd = "git clone --depth=1 #{repo} #{folder}
&& cd #{folder} && git checkout #{hash}
|| git fetch --unshallow && git checkout #{hash}"
console.log(cmd)
cp.exec cmd, (err, out)->
if err?
console.error(err)
process.exit(err.code)
).bind(undefined, folder, repo, hash)