Skip to content

Instantly share code, notes, and snippets.

@borgand
Created May 26, 2010 14:17
Show Gist options
  • Save borgand/414542 to your computer and use it in GitHub Desktop.
Save borgand/414542 to your computer and use it in GitHub Desktop.
Zip-enabled version of update_bundles script
#!/usr/bin/env ruby
# Changelog:
# - added zip support
# - added support for cmd-line list of bundles to update
git_bundles = [
"http://github.com/astashov/vim-ruby-debugger.git",
#"http://github.com/msanders/snipmate.vim.git",
"http://github.com/scrooloose/nerdtree.git",
"http://github.com/timcharper/textile.vim.git",
"http://github.com/tpope/vim-cucumber.git",
"http://github.com/tpope/vim-fugitive.git",
"http://github.com/tpope/vim-git.git",
"http://github.com/tpope/vim-haml.git",
"http://github.com/tpope/vim-markdown.git",
"http://github.com/tpope/vim-rails.git",
"http://github.com/tpope/vim-repeat.git",
"http://github.com/tpope/vim-surround.git",
"http://github.com/tpope/vim-vividchalk.git",
"http://github.com/tsaleh/vim-align.git",
"http://github.com/tsaleh/vim-shoulda.git",
"http://github.com/tsaleh/vim-supertab.git",
"http://github.com/tsaleh/vim-tcomment.git",
"http://github.com/vim-ruby/vim-ruby.git",
#"http://github.com/vim-bundles/fuzzyfinder.git",
"https://github.com/clones/vim-fuzzyfinder.git",
"http://github.com/borgand/ir_black.git",
"https://github.com/mattn/gist-vim.git",
"http://github.com/Shougo/neocomplcache/tree/master",
]
vim_org_scripts = [
["IndexedSearch", "7062", "plugin"],
["jquery", "12107", "syntax"],
#["bufexplorer", "12904", "zip"],
["minibufexpl", "3640", "plugin"],
["taglist", "7701", "zip"],
["vcscommand", "12743", "zip"],
["l9", "13948", "zip"]
]
require 'fileutils'
require 'open-uri'
bundles_dir = File.join(File.dirname(__FILE__), "bundles")
FileUtils.cd(bundles_dir)
# If ARGV is not empty, work only on listed bundles
def should_update(b)
return ARGV.empty? || (ARGV.include?(b))
end
puts "Trashing #{ARGV.empty? ? 'everything' : ARGV.join(',')} (lookout!)"
Dir["*"].each {|d| FileUtils.rm_rf d if should_update d}
git_bundles.each do |url|
dir = url.split('/').last.sub(/\.git$/, '')
next unless should_update dir
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|
next unless should_update name
puts " Downloading #{name}"
local_file = File.join(name, script_type, "#{name}.#{script_type == 'zip' ? 'zip' : '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
end
if script_type == 'zip'
%x(unzip -d #{name} #{local_file})
end
end
@borgand
Copy link
Author

borgand commented May 26, 2010

Original version by Tammer Saleh: http://tammersaleh.com/posts/the-modern-vim-config-with-pathogen

Added support for vim.org's zipped scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment