Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My current ruby script to update vim bundles... can't remember whose blog I got the starter from at this point.
#!/usr/bin/env ruby
git_bundles = [
"https://github.com/kien/ctrlp.vim",
"git://github.com/tpope/vim-fugitive.git",
# "git://github.com/tpope/vim-rails.git",
# "git://github.com/tpope/vim-abolish.git",
# "https://github.com/rizzatti/dash.vim.git",
"https://github.com/wavded/vim-stylus.git",
"git://github.com/slim-template/vim-slim.git",
# "https://github.com/rhysd/vim-crystal.git",
"https://github.com/mileszs/ack.vim.git",
# "git://github.com/tpope/vim-cucumber.git",
# "https://github.com/vim-scripts/AnsiEsc.vim.git",
"https://github.com/fatih/vim-go.git",
# "https://github.com/astashov/vim-ruby-debugger.git",
"https://github.com/wakatime/vim-wakatime.git",
# "https://github.com/pthrasher/conqueterm-vim.git",
# "https://github.com/skwp/vim-ruby-conque.git",
"https://github.com/mattn/gist-vim",
"https://github.com/gregsexton/gitv",
"https://github.com/tomasr/molokai",
"https://github.com/elixir-lang/vim-elixir.git",
"https://github.com/juvenn/mustache.vim",
"https://github.com/jceb/vim-orgmode.git",
# "https://github.com/marcus/rsense.git",
# "https://github.com/vim-scripts/taglist.vim",
"https://github.com/tpope/vim-bundler",
"https://github.com/kchmck/vim-coffee-script",
"https://github.com/altercation/vim-colors-solarized",
"git://github.com/sickill/vim-pasta.git",
"git://github.com/effkay/argonaut.vim.git",
# BORKDED "https://github.com/tpope/vim-rake",
# DEFER "https://github.com/benmills/vimux",
"https://github.com/tpope/vim-pathogen.git",
"git://github.com/ervandew/supertab.git",
# DEFER "git://github.com/godlygeek/tabular.git",
# "git://github.com/hallison/vim-rdoc.git",
# "git://github.com/msanders/snipmate.vim.git",
"git://github.com/pangloss/vim-javascript.git",
"git://github.com/scrooloose/nerdtree.git",
"git://github.com/timcharper/textile.vim.git",
"git://github.com/tpope/vim-git.git",
"git://github.com/tpope/vim-haml.git",
"git://github.com/tpope/vim-markdown.git",
"git://github.com/tpope/vim-repeat.git",
"git://github.com/tpope/vim-surround.git",
"git://github.com/tpope/vim-vividchalk.git",
# BROKEN ? "git://github.com/tsaleh/taskpaper.vim.git",
# BROKEN ? "git://github.com/tsaleh/vim-matchit.git",
"git://github.com/tsaleh/vim-shoulda.git",
# "git://github.com/tsaleh/vim-tcomment.git",
# "git://github.com/tsaleh/vim-tmux.git",
"git://github.com/vim-ruby/vim-ruby.git",
# "git://github.com/vim-scripts/Gist.vim.git",
# "https://github.com/vim-scripts/paredit.vim.git",
"git://github.com/vim-scripts/Colour-Sampler-Pack.git",
"https://github.com/stephenmckinney/vim-solarized-powerline.git",
"https://github.com/Lokaltog/powerline",
"https://github.com/Lokaltog/powerline-fonts",
]
vim_org_scripts = [
["IndexedSearch", "7062", "plugin"],
["jquery", "12107", "syntax"],
["ctags", "2529", "plugin"]
# ["XMLFolding", "1438", "plugin"]
]
other_vim_scripts = [
# ["http://www.complang.org/ragel/ragel.vim", "syntax"],
["https://github.com/vim-scripts/applescript.vim.git", "syntax"],
["https://github.com/vim-scripts/groovy.vim.git", "syntax"]
]
require 'fileutils'
require 'open-uri'
bundles_dir = File.join(File.dirname(__FILE__), "bundle")
FileUtils.cd(bundles_dir)
puts "trashing everything (lookout!)"
Dir["*"].each {|d| FileUtils.rm_rf d }
git_bundles.each do |url|
dir = url.split('/').last.sub(/\.git$/, '')
puts "unpacking #{url} into #{dir}"
`git clone #{url} #{dir}`
FileUtils.rm_rf(File.join(dir, ".git"))
end
vim_org_scripts.each do |name, script_id, script_type|
puts "downloading #{name}"
local_file = File.join(name, script_type, "#{name}.vim")
FileUtils.mkdir_p(File.dirname(local_file))
File.open(local_file, "w") do |file|
file << open("http://www.vim.org/scripts/download_script.php?src_id=#{script_id}").read.sub("\x0d","")
end
end
other_vim_scripts.each do |location, script_type|
file_name = File.basename(location)
puts "downloading #{file_name}"
local_file = File.join(file_name.split('.').first, script_type, file_name)
FileUtils.mkdir_p(File.dirname(local_file))
File.open(local_file, "w") do |file|
file << open(location).read
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment