PageRenderTime 59ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/update_bundles

https://bitbucket.org/eunix/vimfiles
Ruby | 88 lines | 68 code | 12 blank | 8 comment | 4 complexity | e75d288bd07b1a6ccc3df682c24678bc MD5 | raw file
  1. #!/usr/bin/env ruby
  2. hg_bundles = [
  3. "https://bitbucket.org/ns9tks/vim-fuzzyfinder/",
  4. "https://bitbucket.org/ns9tks/vim-l9/",
  5. "https://bitbucket.org/sjl/gundo.vim",
  6. ]
  7. git_bundles = [
  8. #"git://github.com/astashov/vim-ruby-debugger.git",
  9. "git://github.com/msanders/snipmate.vim.git",
  10. "git://github.com/scrooloose/nerdtree.git",
  11. "https://github.com/scrooloose/nerdcommenter.git",
  12. #"git://github.com/timcharper/textile.vim.git",
  13. "git://github.com/tpope/vim-cucumber.git",
  14. "git://github.com/tpope/vim-fugitive.git",
  15. "git://github.com/tpope/vim-git.git",
  16. "https://github.com/mattn/gist-vim.git",
  17. "git://github.com/tpope/vim-markdown.git",
  18. "git://github.com/tpope/vim-rails.git",
  19. "git://github.com/tpope/vim-repeat.git",
  20. "git://github.com/tpope/vim-surround.git",
  21. "git://github.com/vim-ruby/vim-ruby.git",
  22. "git://repo.or.cz/vcscommand",
  23. "https://github.com/vim-scripts/dbext.vim.git",
  24. "https://github.com/mileszs/ack.vim.git",
  25. "https://github.com/vim-scripts/mru.vim.git",
  26. "https://github.com/ervandew/supertab.git",
  27. #"https://github.com/toritori0318/vim-redmine.git",
  28. #"https://github.com/mattn/webapi-vim.git",
  29. "https://github.com/shinzui/vim-idleFingers.git",
  30. "https://github.com/itspriddle/vim-jquery.git",
  31. "https://github.com/henrik/vim-indexed-search.git",
  32. #"https://github.com/vim-scripts/pythoncomplete.git",
  33. "https://github.com/skammer/vim-css-color.git",
  34. "https://github.com/vim-scripts/taglist.vim.git",
  35. #"https://github.com/fholgado/minibufexpl.vim.git",
  36. "https://github.com/scrooloose/syntastic.git",
  37. "https://github.com/sukima/xmledit.git",
  38. "https://github.com/othree/html5.vim.git",
  39. ]
  40. vim_org_scripts = [
  41. ["molokai", "9750", "colors"],
  42. ]
  43. require 'fileutils'
  44. require 'open-uri'
  45. bundles_dir = File.join(File.dirname(__FILE__), "bundle")
  46. FileUtils.cd(bundles_dir)
  47. # If ARGV is not empty, work only on listed bundles
  48. def should_update(b)
  49. return ARGV.empty? || (ARGV.include?(b))
  50. end
  51. puts "Trashing #{ARGV.empty? ? 'everything' : ARGV.join(',')} (lookout!)"
  52. Dir["*"].each {|d| FileUtils.rm_rf d if should_update d}
  53. hg_bundles.each do |url|
  54. dir = url.split('/').last
  55. puts " Unpacking #{url} into #{dir}"
  56. `hg clone #{url} #{dir}`
  57. FileUtils.rm_rf(File.join(dir, ".hg"))
  58. end
  59. git_bundles.each do |url|
  60. dir = url.split('/').last.sub(/\.git$/, '')
  61. puts " Unpacking #{url} into #{dir}"
  62. `git clone #{url} #{dir}`
  63. FileUtils.rm_rf(File.join(dir, ".git"))
  64. end
  65. vim_org_scripts.each do |name, script_id, script_type|
  66. next unless should_update name
  67. puts " Downloading #{name}"
  68. local_file = File.join(name, script_type, "#{name}.#{script_type == 'zip' ? 'zip' : 'vim'}")
  69. FileUtils.mkdir_p(File.dirname(local_file))
  70. File.open(local_file, "w") do |file|
  71. file << open("http://www.vim.org/scripts/download_script.php?src_id=#{script_id}").read
  72. end
  73. if script_type == 'zip'
  74. %x(unzip -d #{name} #{local_file})
  75. end
  76. end