Skip to content

Instantly share code, notes, and snippets.

@thinca
Created January 16, 2011 15:27
Show Gist options
  • Save thinca/781879 to your computer and use it in GitHub Desktop.
Save thinca/781879 to your computer and use it in GitHub Desktop.
require 'yaml'
CONFIG = 'script.yaml'
yaml = YAML.load(File.read(CONFIG))
COMMAND = yaml['command']
# Normalize
yaml['scripts'].map do |s|
s['dir'] = s['name'] unless s['dir']
end
def install(script)
if File.directory?(script['dir'])
puts "#{script['name']} is already installed."
else
puts "Installing #{script['name']} ..."
sh COMMAND[script['type']]['install'] % [script['location'], script['dir']]
end
end
def update(script)
dir = script['dir']
if File.directory?(dir)
puts "Updating #{script['name']} ..."
cd(dir, :verbose => false) do
sh COMMAND[script['type']]['update']
end
else
install(script)
end
end
def set_version(script)
dir = script['dir']
cd(dir, :verbose => false) do
sh COMMAND[script['type']]['version'] % script['version'] if script['version']
end
end
task :default => 'update'
desc 'Update all scripts.'
task 'update' do
yaml['scripts'].each {|s| update(s) rescue nil}
end
task 'install' do
yaml['scripts'].each {|s| install(s) rescue nil}
end
yaml['scripts'].each do |s|
task s['dir'] do
update(s)
end
end
if yaml['basedir']
mkdir_p(yaml['basedir'], :verbose => false)
cd(yaml['basedir'], :verbose => false)
end
basedir: bundle
scripts:
- name: helpja
dir: helpja/doc
type: subversion
location: http://cvs.kaoriya.net/svn/vimdoc/trunk/ja
- name: autofmt
type: subversion
location: http://vim-soko.googlecode.com/svn/trunk/autofmt
- name: clojure
type: mercurial
location: http://bitbucket.org/kotarak/vimclojure/
# - name: fuzzyfinder
# type: mercurial
# location: http://bitbucket.org/ns9tks/vim-fuzzyfinder/
- name: projecteuler.vim
dir: projecteuler
type: git
location: https://github.com/mfumi/ProjectEuler.vim.git
- name: onlinejudge.vim
dir: onlinejudge
type: git
location: https://github.com/eagletmt/onlinejudge-vim.git
- name: speeddating.vim
dir: speeddating
type: git
location: https://github.com/tpope/vim-speeddating.git
- name: calendar.vim
dir: calendar
type: git
location: https://github.com/mattn/calendar-vim.git
- name: gist.vim
dir: gist
type: git
location: https://github.com/mattn/gist-vim.git
- name: webapi.vim
dir: webapi
type: git
location: https://github.com/mattn/webapi-vim.git
- name: lingr.vim
dir: lingr
type: git
location: https://github.com/tsukkee/lingr-vim.git
- name: unite-help.vim
dir: unite-help
type: git
location: https://github.com/tsukkee/unite-help.git
- name: unite-tags.vim
dir: unite-tags
type: git
location: https://github.com/tsukkee/unite-tags.git
- name: unite-qflist.vim
dir: unite-qflist
type: git
location: https://github.com/soh335/unite-qflist.git
- name: unite-colorscheme.vim
dir: unite-colorscheme
type: git
location: https://github.com/ujihisa/unite-colorscheme.git
- name: unite-outline.vim
dir: unite-outline
type: git
location: https://github.com/h1mesuke/unite-outline.git
- name: unite-font.vim
dir: unite-font
type: git
location: https://github.com/ujihisa/unite-font.git
- name: shadow.vim
dir: shadow
type: git
location: https://github.com/ujihisa/shadow.vim.git
- name: alignta.vim
dir: alignta
type: git
location: https://github.com/h1mesuke/vim-alignta.git
- name: gundo.vim
dir: gundo
type: git
location: https://github.com/sjl/gundo.vim.git
- name: conque.vim
dir: conque
type: subversion
location: http://conque.googlecode.com/svn/trunk
# tyru's plugins.
- name: skk.vim
dir: skk
type: git
location: https://github.com/tyru/skk.vim.git
- name: eskk.vim
dir: eskk
type: git
location: https://github.com/tyru/eskk.vim.git
- name: skkdict.vim
dir: skkdict
type: git
location: https://github.com/tyru/skkdict.vim.git
- name: current-func-info.vim
dir: cfi
type: git
location: https://github.com/tyru/current-func-info.vim.git
- name: caw.vim
dir: caw
type: git
location: https://github.com/tyru/caw.vim.git
- name: open-browser.vim
dir: open-browser
type: git
location: https://github.com/tyru/open-browser.vim.git
- name: restart.vim
dir: restart
type: git
location: https://github.com/tyru/restart.vim.git
- name: emap.vim
dir: emap
type: git
location: https://github.com/tyru/emap.vim.git
- name: simpletap.vim
dir: simpletap
type: git
location: https://github.com/tyru/simpletap.vim.git
- name: cul.vim
dir: cul
type: git
location: https://github.com/tyru/cul.vim.git
- name: savemap.vim
dir: savemap
type: git
location: https://github.com/tyru/savemap.vim.git
- name: urilib.vim
dir: urilib
type: git
location: https://github.com/tyru/urilib.vim.git
- name: vice.vim
dir: vice
type: git
location: https://github.com/tyru/vice.vim.git
# thinca's plugins.
- name: thinca-ku-source
type: git
location: https://github.com/thinca/vim-ku_source.git
- name: thinca-textobj-plugins
type: git
location: https://github.com/thinca/vim-textobj-plugins.git
- name: template.vim
dir: template
type: git
location: https://github.com/thinca/vim-template.git
- name: prettyprint.vim
dir: prettyprint
type: git
location: https://github.com/thinca/vim-prettyprint.git
- name: fontzoom.vim
dir: fontzoom
type: git
location: https://github.com/thinca/vim-fontzoom.git
- name: qfreplace.vim
dir: qfreplace
type: git
location: https://github.com/thinca/vim-qfreplace.git
- name: visualstar.vim
dir: visualstar
type: git
location: https://github.com/thinca/vim-visualstar.git
- name: poslist.vim
dir: poslist
type: git
location: https://github.com/thinca/vim-poslist.git
- name: scouter.vim
dir: scouter
type: git
location: https://github.com/thinca/vim-scouter.git
- name: localrc.vim
dir: localrc
type: git
location: https://github.com/thinca/vim-localrc.git
- name: ref.vim
dir: ref
type: git
location: https://github.com/thinca/vim-ref.git
- name: quickrun.vim
dir: quickrun
type: git
location: https://github.com/thinca/vim-quickrun.git
- name: unite-history.vim
dir: unite-history
type: git
location: https://github.com/thinca/vim-unite-history.git
- name: github.vim
dir: github
type: git
location: https://github.com/thinca/vim-github.git
- name: vcs.vim
dir: vcs
type: git
location: https://github.com/thinca/vim-vcs.git
- name: markdown_fold.vim
dir: ft-markdown_fold
type: git
location: https://github.com/thinca/vim-ft-markdown_fold.git
- name: diff_fold.vim
dir: ft-diff_fold
type: git
location: https://github.com/thinca/vim-ft-diff_fold.git
- name: rst_header.vim
dir: ft-rst_header
type: git
location: https://github.com/thinca/vim-ft-rst_header.git
- name: svn_diff.vim
dir: ft-svn_diff
type: git
location: https://github.com/thinca/vim-ft-svn_diff.git
- name: openbuf.vim
dir: openbuf
type: git
location: https://github.com/thinca/vim-openbuf.git
# Shougo's plugins.
- name: neocomplcache.vim
dir: neocomplcache
type: git
location: https://github.com/Shougo/neocomplcache.git
- name: vimshell.vim
dir: vimshell
type: git
location: https://github.com/Shougo/vimshell.git
- name: vimproc
type: git
location: https://github.com/Shougo/vimproc.git
- name: vimfiler.vim
dir: vimfiler
type: git
location: https://github.com/Shougo/vimfiler.git
- name: unite.vim
dir: unite
type: git
location: https://github.com/Shougo/unite.vim.git
- name: echodoc.vim
dir: echodoc
type: git
location: https://github.com/Shougo/echodoc.git
- name: vinarise.vim
dir: vinarise
type: git
location: https://github.com/Shougo/vinarise.git
# kana's plugins.
- name: arpeggio
type: git
location: https://github.com/kana/vim-arpeggio.git
- name: surround
type: git
location: https://github.com/kana/vim-surround.git
- name: narrow
type: git
location: https://github.com/kana/vim-narrow.git
- name: fakeclip
type: git
location: https://github.com/kana/vim-fakeclip.git
# Own hack exists.
# - name: submode
# type: git
# location: https://github.com/kana/vim-submode.git
# Irregular directory structure.
# - name: smartword
# type: git
# location: https://github.com/kana/vim-smartword.git
- name: smartchr
type: git
location: https://github.com/kana/vim-smartchr.git
# - name: ku
# type: git
# location: https://github.com/kana/vim-ku.git
- name: metarw
type: git
location: https://github.com/kana/vim-metarw.git
- name: metarw-git
type: git
location: https://github.com/kana/vim-metarw-git.git
- name: textobj-user
type: git
location: https://github.com/kana/vim-textobj-user.git
- name: textobj-datetime
type: git
location: https://github.com/kana/vim-textobj-datetime.git
- name: textobj-fold
type: git
location: https://github.com/kana/vim-textobj-fold.git
- name: textobj-jabraces
type: git
location: https://github.com/kana/vim-textobj-jabraces.git
- name: textobj-lastpat
type: git
location: https://github.com/kana/vim-textobj-lastpat.git
- name: textobj-diff
type: git
location: https://github.com/kana/vim-textobj-diff.git
- name: textobj-indent
type: git
location: https://github.com/kana/vim-textobj-indent.git
- name: textobj-entire
type: git
location: https://github.com/kana/vim-textobj-entire.git
- name: textobj-function
type: git
location: https://github.com/kana/vim-textobj-function.git
- name: textobj-syntax
type: git
location: https://github.com/kana/vim-textobj-syntax.git
- name: operator-user
type: git
location: https://github.com/kana/vim-operator-user.git
- name: operator-replace
type: git
location: https://github.com/kana/vim-operator-replace.git
command:
subversion:
install: svn checkout %s %s
update: svn update
version: svn update -r %s
git:
install: git clone %s %s
update: git pull
version: git checkout %s
mercurial:
install: hg clone %s %s
update: hg pull --update
version: hg update %s
bazaar:
install: bzr branch %s %s
update: bzr pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment