-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCakefile
84 lines (71 loc) · 2.61 KB
/
Cakefile
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
fs = require "fs"
sytemSpawn = require('child_process').spawn
bundles = [
"https://github.com/kchmck/vim-coffee-script.git",
"https://github.com/tpope/vim-markdown.git",
"https://github.com/Lokaltog/vim-powerline.git",
"https://github.com/tpope/vim-fugitive.git",
"https://github.com/scrooloose/nerdtree.git",
"https://github.com/ervandew/supertab.git",
"https://github.com/kien/ctrlp.vim.git",
"https://github.com/vim-scripts/mediawiki.vim.git",
"https://github.com/gabemc/powershell-vim.git",
"https://github.com/tpope/vim-rails.git",
"https://github.com/skammer/vim-css-color.git",
# "https://github.com/digitaltoad/vim-jade",
# "https://github.com/groenewege/vim-less",
# "https://github.com/walm/jshint.vim",
# For snipmate
"https://github.com/garbas/vim-snipmate.git",
"https://github.com/tomtom/tlib_vim.git",
"https://github.com/MarcWeber/vim-addon-mw-utils.git",
# "https://github.com/honza/snipmate-snippets.git",
# Color schemes
"https://github.com/vim-scripts/darkspectrum.git",
"https://github.com/vim-scripts/fnaqevan",
"https://github.com/nanotech/jellybeans.vim",
"https://github.com/tomasr/molokai.git",
"https://github.com/noahfrederick/Hemisu.git",
"https://github.com/jpo/vim-railscasts-theme.git",
"https://github.com/sjl/badwolf.git"
]
console.green = (text) ->
green = `'\033[32m'`
reset = `'\033[0m'`
console.log (green + text + reset)
option "-n", "--name [NAME]", "Foldername of the bundle to update"
task 'update', 'Updates vim bundles', (options) ->
todo = bundles.concat()
next = ->
return unless todo.length
url = todo.shift()
name = getFoldername url
if options.name isnt undefined and options.name isnt name
console.log "Skipping #{name}"
return next()
clone = (name, url) ->
fs.exists name, (exists) ->
if exists
git = spawn 'git', [ 'fetch', 'origin' ], { cwd: name }
git.on 'exit', ->
git = spawn 'git', [ 'reset', '--hard', 'origin/master' ], { cwd: name }
git.on 'exit', ->
next()
else
git = spawn 'git', [ 'clone', url ]
git.on 'exit', ->
next()
console.green name
clone name, url
next()
# Curry the system spawn
spawn = (cmd, args, options) ->
options = options or {}
options.customFds = [0,1,2]
return sytemSpawn cmd, args, options
gitClone = (url) ->
spawn "git", [ 'clone', url ]
getFoldername = (url) ->
urlparts = url.split '/'
last = urlparts[urlparts.length - 1]
return last.replace /.git$/, ""