/update_bundles
Ruby | 88 lines | 68 code | 12 blank | 8 comment | 4 complexity | e75d288bd07b1a6ccc3df682c24678bc MD5 | raw file
- #!/usr/bin/env ruby
- hg_bundles = [
- "https://bitbucket.org/ns9tks/vim-fuzzyfinder/",
- "https://bitbucket.org/ns9tks/vim-l9/",
- "https://bitbucket.org/sjl/gundo.vim",
- ]
- git_bundles = [
- #"git://github.com/astashov/vim-ruby-debugger.git",
- "git://github.com/msanders/snipmate.vim.git",
- "git://github.com/scrooloose/nerdtree.git",
- "https://github.com/scrooloose/nerdcommenter.git",
- #"git://github.com/timcharper/textile.vim.git",
- "git://github.com/tpope/vim-cucumber.git",
- "git://github.com/tpope/vim-fugitive.git",
- "git://github.com/tpope/vim-git.git",
- "https://github.com/mattn/gist-vim.git",
- "git://github.com/tpope/vim-markdown.git",
- "git://github.com/tpope/vim-rails.git",
- "git://github.com/tpope/vim-repeat.git",
- "git://github.com/tpope/vim-surround.git",
- "git://github.com/vim-ruby/vim-ruby.git",
- "git://repo.or.cz/vcscommand",
- "https://github.com/vim-scripts/dbext.vim.git",
- "https://github.com/mileszs/ack.vim.git",
- "https://github.com/vim-scripts/mru.vim.git",
- "https://github.com/ervandew/supertab.git",
- #"https://github.com/toritori0318/vim-redmine.git",
- #"https://github.com/mattn/webapi-vim.git",
- "https://github.com/shinzui/vim-idleFingers.git",
- "https://github.com/itspriddle/vim-jquery.git",
- "https://github.com/henrik/vim-indexed-search.git",
- #"https://github.com/vim-scripts/pythoncomplete.git",
- "https://github.com/skammer/vim-css-color.git",
- "https://github.com/vim-scripts/taglist.vim.git",
- #"https://github.com/fholgado/minibufexpl.vim.git",
- "https://github.com/scrooloose/syntastic.git",
- "https://github.com/sukima/xmledit.git",
- "https://github.com/othree/html5.vim.git",
- ]
- vim_org_scripts = [
- ["molokai", "9750", "colors"],
- ]
- require 'fileutils'
- require 'open-uri'
- bundles_dir = File.join(File.dirname(__FILE__), "bundle")
- 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}
- hg_bundles.each do |url|
- dir = url.split('/').last
- puts " Unpacking #{url} into #{dir}"
- `hg clone #{url} #{dir}`
- FileUtils.rm_rf(File.join(dir, ".hg"))
- end
- 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|
- 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