2 Dirs = %w[ after autoload doc plugin ruby snippets syntax ftdetect ftplugin colors indent ]
6 VIM::Dirs.each do |dir|
10 def vim_plugin_task(name, repo=nil)
11 cwd = File.expand_path("../", __FILE__)
12 dir = File.expand_path("tmp/#{name}")
19 sh "git clone #{repo} #{dir}"
21 elsif repo =~ /download_script/
22 if filename = `curl --silent --head #{repo} | grep attachment`[/filename=(.+)/,1]
24 sh "curl #{repo} > tmp/#{filename}"
26 raise ArgumentError, 'unable to determine script type'
29 elsif repo =~ /(tar|gz|vba|zip)$/
30 filename = File.basename(repo)
31 sh "curl #{repo} > tmp/#{filename}"
34 raise ArgumentError, 'unrecognized source url for plugin'
39 sh "unzip -o tmp/#{filename} -d #{dir}"
42 dirname = File.basename(filename, '.tar.gz')
44 sh "tar zxvf tmp/#{filename}"
45 sh "mv #{dirname} #{dir}"
49 sh "gunzip -f tmp/#{filename}"
50 filename = File.basename(filename, '.gz')
53 # TODO: move this into the install task
55 lines = File.readlines("tmp/#{filename}")
56 current = lines.shift until current =~ /finish$/ # find finish line
58 while current = lines.shift
59 # first line is the filename (possibly followed by garbage)
60 # some vimballs use win32 style path separators
61 path = current[/^(.+?)(\t\[{3}\d)?$/, 1].gsub '\\', '/'
63 # then the size of the payload in lines
65 num_lines = current[/^(\d+)$/, 1].to_i
68 data = lines.slice!(0, num_lines).join
72 mkdir_p File.dirname(path)
73 File.open(path, 'w'){ |f| f.write(data) }
87 task :install => [:pull] + subdirs do
89 if File.exists?("Rakefile") and `rake -T` =~ /^rake install/
91 elsif File.exists?("install.sh")
94 subdirs.each do |subdir|
95 if File.exists?(subdir)
96 sh "cp -RfL #{subdir}/* #{cwd}/#{subdir}/"
102 yield if block_given?
105 task :install => subdirs do
106 yield if block_given?
111 desc "Install #{name} plugin"
115 puts "*#{"Installing #{name}".center(38)}*"
118 Rake::Task["#{name}:install"].invoke
120 task :default => name
123 def skip_vim_plugin(name)
124 Rake::Task[:default].prerequisites.delete(name)
127 vim_plugin_task "ack.vim", "git://github.com/mileszs/ack.vim.git"
128 vim_plugin_task "color-sampler", "git://github.com/vim-scripts/Color-Sampler-Pack.git"
129 vim_plugin_task "conque", "http://conque.googlecode.com/files/conque_1.1.tar.gz"
130 vim_plugin_task "fugitive", "git://github.com/tpope/vim-fugitive.git"
131 vim_plugin_task "git", "git://github.com/tpope/vim-git.git"
132 vim_plugin_task "haml", "git://github.com/tpope/vim-haml.git"
133 vim_plugin_task "indent_object", "git://github.com/michaeljsmith/vim-indent-object.git"
134 vim_plugin_task "javascript", "git://github.com/pangloss/vim-javascript.git"
135 vim_plugin_task "nerdtree", "git://github.com/wycats/nerdtree.git"
136 vim_plugin_task "nerdcommenter", "git://github.com/ddollar/nerdcommenter.git"
137 vim_plugin_task "surround", "git://github.com/tpope/vim-surround.git"
138 vim_plugin_task "taglist", "git://github.com/vim-scripts/taglist.vim.git"
139 vim_plugin_task "vividchalk", "git://github.com/tpope/vim-vividchalk.git"
140 vim_plugin_task "solarized", "git://github.com/altercation/vim-colors-solarized.git"
141 vim_plugin_task "supertab", "git://github.com/ervandew/supertab.git"
142 vim_plugin_task "cucumber", "git://github.com/tpope/vim-cucumber.git"
143 vim_plugin_task "textile", "git://github.com/timcharper/textile.vim.git"
144 vim_plugin_task "rails", "git://github.com/tpope/vim-rails.git"
145 vim_plugin_task "rspec", "git://github.com/taq/vim-rspec.git"
146 vim_plugin_task "zoomwin", "git://github.com/vim-scripts/ZoomWin.git"
147 vim_plugin_task "snipmate", "git://github.com/msanders/snipmate.vim.git"
148 vim_plugin_task "markdown", "git://github.com/tpope/vim-markdown.git"
149 vim_plugin_task "align", "git://github.com/tsaleh/vim-align.git"
150 vim_plugin_task "unimpaired", "git://github.com/tpope/vim-unimpaired.git"
151 vim_plugin_task "searchfold", "git://github.com/vim-scripts/searchfold.vim.git"
152 vim_plugin_task "endwise", "git://github.com/tpope/vim-endwise.git"
153 vim_plugin_task "irblack", "git://github.com/wgibbs/vim-irblack.git"
154 vim_plugin_task "vim-coffee-script","git://github.com/kchmck/vim-coffee-script.git"
155 vim_plugin_task "syntastic", "git://github.com/scrooloose/syntastic.git"
156 vim_plugin_task "puppet", "git://github.com/ajf/puppet-vim.git"
157 vim_plugin_task "scala", "git://github.com/bdd/vim-scala.git"
158 vim_plugin_task "gist-vim", "git://github.com/mattn/gist-vim.git"
160 #vim_plugin_task "hammer", "git://github.com/robgleeson/hammer.vim.git" do
161 # sh "gem install github-markup redcarpet"
164 vim_plugin_task "janus_themes" do
165 # custom version of railscasts theme
166 File.open(File.expand_path("../colors/railscasts+.vim", __FILE__), "w") do |file|
167 file.puts <<-VIM.gsub(/^ +/, "").gsub("<SP>", " ")
168 runtime colors/railscasts.vim
169 let g:colors_name = "railscasts+"
171 set fillchars=vert:\\<SP>
172 set fillchars=stl:\\<SP>
173 set fillchars=stlnc:\\<SP>
174 hi StatusLine guibg=#cccccc guifg=#000000
175 hi VertSplit guibg=#dddddd
179 # custom version of jellybeans theme
180 File.open(File.expand_path("../colors/jellybeans+.vim", __FILE__), "w") do |file|
181 file.puts <<-VIM.gsub(/^ /, "")
182 runtime colors/jellybeans.vim
183 let g:colors_name = "jellybeans+"
185 hi VertSplit guibg=#888888
186 hi StatusLine guibg=#cccccc guifg=#000000
187 hi StatusLineNC guibg=#888888 guifg=#000000
192 vim_plugin_task "molokai" do
193 sh "curl https://raw.github.com/mrtazz/molokai.vim/master/colors/molokai.vim > colors/molokai.vim"
195 vim_plugin_task "mustache" do
196 sh "curl https://raw.github.com/defunkt/mustache/master/contrib/mustache.vim > syntax/mustache.vim"
197 File.open(File.expand_path('../ftdetect/mustache.vim', __FILE__), 'w') do |file|
198 file << "au BufNewFile,BufRead *.mustache setf mustache"
201 vim_plugin_task "arduino","git://github.com/vim-scripts/Arduino-syntax-file.git" do
202 File.open(File.expand_path('../ftdetect/arduino.vim', __FILE__), 'w') do |file|
203 file << "au BufNewFile,BufRead *.pde setf arduino"
206 vim_plugin_task "vwilight" do
207 sh "curl https://raw.github.com/gist/796172/724c7ca237a7f6b8d857c4ac2991cfe5ffb18087 > colors/vwilight.vim"
210 if File.exists?(janus = File.expand_path("~/.janus.rake"))
211 puts "Loading your custom rake file"
215 desc "Update the documentation"
217 puts "Updating VIM Documentation..."
218 system "vim -e -s <<-EOF\n:helptags ~/.vim/doc\n:quit\nEOF"
221 desc "link vimrc to ~/.vimrc"
223 %w[ vimrc gvimrc ].each do |file|
224 dest = File.expand_path("~/.#{file}")
225 unless File.exist?(dest)
226 ln_s(File.expand_path("../#{file}", __FILE__), dest)
232 system "git clean -dfx"
235 desc "Pull the latest"
245 desc "Clear out all build artifacts and rebuild the latest Janus"
246 task :upgrade => [:clean, :pull, :default]