-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
128 lines (113 loc) · 5.59 KB
/
Rakefile
File metadata and controls
128 lines (113 loc) · 5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
########################################################################
###
### Tim Voet's Vim Setup
### Based on Eduardo Del Balso's Vim Setup
### Based on the work of Ben Bleything.
### Rakefile updated to support zip and gzip files
###
### Modified from: http://github.com/bleything/dotvim
###
### This is eventually going to be replaced by git submodule approach ( i think )
########################################################################
require 'pathname'
task :default do
puts "Hi! All this Rakefile can do right now is update the bundles:"
puts # blank line
puts " $ rake vim:update_bundles"
end
namespace :vim do
BUNDLES = {
# plugins
#:txtfmt => "http://www.vim.org/scripts/download_script.php?src_id=13856",
:bufexplorer => "git://github.com/corntrace/bufexplorer.git",
#:nerdcommenter => "git://github.com/scrooloose/nerdcommenter.git",
:nerdtree => "git://github.com/scrooloose/nerdtree.git",
:rails => "git://github.com/tpope/vim-rails.git",
#:surround => "git://github.com/tpope/vim-surround.git",
#:tabular => "git://github.com/godlygeek/tabular",
#:taglist => "http://www.vim.org/scripts/download_script.php?src_id=7701",
#:lusty_explorer => "git://github.com/sjbach/lusty.git",
#:ragtag => "git://github.com/tpope/vim-ragtag.git",
#:matchit => "http://www.vim.org/scripts/download_script.php?src_id=8196",
#:endwise => "http://www.vim.org/scripts/download_script.php?src_id=9299",
:git => "git://github.com/tpope/vim-git.git",
:fugitive => "git://github.com/tpope/vim-fugitive.git",
#:jekyll => "git://github.com/csexton/jekyll.vim.git",
#:rvm => "git://github.com/tpope/vim-rvm.git",
:unimpaired => "git://github.com/tpope/vim-unimpaired.git",
#:gpg => "git@gitorious.org:vim-gnupg/vim-gnupg.git",
#:powerline => "git://github.com/Lokaltog/vim-powerline.git",
:tmuxline => "git://github.com/edkolev/tmuxline.vim.git",
:lightline => "git://github.com/itchyny/lightline.vim.git",
#:gundo => "git://github.com/sjl/gundo.vim.git",
:bundler => "https://github.com/tpope/vim-bundler.git",
# syntax definitions
:syntax_markdown => "git://github.com/ujihisa/vim-markdown.git",
:syntax_textile => "git://github.com/timcharper/textile.vim.git",
# :syntax_cucumber => "git://github.com/tpope/vim-cucumber.git",
:syntax_git => "git://github.com/tpope/vim-git.git",
#:syntax_rdoc => "git://github.com/hallison/vim-rdoc.git",
# :syntax_slidedown => "git://github.com/bleything/vim-slidedown.git",
# :syntax_twiki => "http://www.vim.org/scripts/download_script.php?src_id=6460",
# Color Schemes
# :color_sampler => "http://www.vim.org/scripts/download_script.php?src_id=12179",
:blackboard => "git://github.com/nelstrom/vim-blackboard.git",
:solarized => "git://github.com/altercation/vim-colors-solarized.git",
#:dawn => "http://www.vim.org/scripts/download_script.php?src_id=4807",
:syntax_less => "git://github.com/groenewege/vim-less.git",
}
desc "update any bundles defined in the Rakefile"
task :update_bundles do
bundle_home = Pathname.new( ENV['HOME'] ) + '.vim' + 'bundle'
mkdir_p bundle_home
BUNDLES.sort_by {|k,v| k.to_s }.each do |bundle, location|
target_path = bundle_home + bundle.to_s
puts "*" * 72
puts "*** Instaling #{bundle} to #{target_path} from #{location}"
puts # blank line
rm_rf target_path
case location.match( /^(.*?):/ )[1]
when 'git'
sh "git clone #{location} #{target_path} > /dev/null"
rm_rf target_path + '.git'
when 'http'
mkdir_p target_path
sh "cd #{target_path} && curl -s '#{location}' > filedownload.tmp"
file_output = `file #{target_path}/filedownload.tmp`
if file_output.include? "Zip archive data"
puts "-- Identified file as :: ZIP ARCHIVE"
puts "*** deleting temporary download for #{bundle.to_s}"
sh "pwd"
sh "cd #{target_path}; unzip filedownload.tmp"
sh "rm #{target_path}/filedownload.tmp"
elsif file_output.include? "TAR archive"
puts "-- Identified file as :: TAR ARCHIVE"
puts "*** deleting temporary download for #{bundle.to_s}"
sh "rm #{target_path}/filedownload.tmp"
puts "*** redownload #{bundle.to_s} to #{target_path}"
sh "cd #{target_path} && curl -s '#{location}' | tar zx -"
elsif ( file_output.include? ("ASCII") ) && ( file_output.include?( "text" ) )
puts "-- Identified file as :: VIM FILE"
mkdir_p "#{target_path}/plugin"
puts "*** putting downloaded ASCII file to #{target_path}/plugin/#{bundle.to_s}.vim"
sh "mv #{target_path}/filedownload.tmp #{target_path}/plugin/#{bundle.to_s}.vim"
elsif ( file_output.include? ("gzip compressed data") )
puts "-- Identified file as :: GZIP ARCHIVE"
puts "*** deleting temporary download for #{bundle.to_s}"
sh "rm #{target_path}/filedownload.tmp"
puts "*** redownload #{bundle.to_s} to #{target_path}"
sh "cd #{target_path} && curl -s '#{location}' | tar zx -"
else
puts "ERROR: Unrecognized file type:: #{file_output}"
exit
end
end
docdir = target_path + 'doc'
if docdir.exist?
puts "doc dir exists; tagging"
sh "vim -u NONE -esX -c 'helptags #{docdir}' -c quit"
end
puts # blank line
end
end # task :bundles
end # namespace :update