Skip to content

Instantly share code, notes, and snippets.

@borgand
Created May 26, 2010 14:17
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • 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