=> git.r.bdr.sh
=> summary
=> tree
=> log
=> refs
=> view raw
1 module VIM 2 Dirs = %w[ after autoload doc plugin ruby snippets syntax ftdetect ftplugin colors indent ] 3 end 4 5 directory "tmp" 6 VIM::Dirs.each do |dir| 7 directory(dir) 8 end 9 10 def vim_plugin_task(name, repo=nil) 11 cwd = File.expand_path("../", __FILE__) 12 dir = File.expand_path("tmp/#{name}") 13 subdirs = VIM::Dirs 14 15 namespace(name) do 16 if repo 17 file dir => "tmp" do 18 if repo =~ /git$/ 19 sh "git clone #{repo} #{dir}" 20 21 elsif repo =~ /download_script/ 22 if filename = `curl --silent --head #{repo} | grep attachment`[/filename=(.+)/,1] 23 filename.strip! 24 sh "curl #{repo} > tmp/#{filename}" 25 else 26 raise ArgumentError, 'unable to determine script type' 27 end 28 29 elsif repo =~ /(tar|gz|vba|zip)$/ 30 filename = File.basename(repo) 31 sh "curl #{repo} > tmp/#{filename}" 32 33 else 34 raise ArgumentError, 'unrecognized source url for plugin' 35 end 36 37 case filename 38 when /zip$/ 39 sh "unzip -o tmp/#{filename} -d #{dir}" 40 41 when /tar\.gz$/ 42 dirname = File.basename(filename, '.tar.gz') 43 44 sh "tar zxvf tmp/#{filename}" 45 sh "mv #{dirname} #{dir}" 46 47 when /vba(\.gz)?$/ 48 if filename =~ /gz$/ 49 sh "gunzip -f tmp/#{filename}" 50 filename = File.basename(filename, '.gz') 51 end 52 53 # TODO: move this into the install task 54 mkdir_p dir 55 lines = File.readlines("tmp/#{filename}") 56 current = lines.shift until current =~ /finish$/ # find finish line 57 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 '\\', '/' 62 63 # then the size of the payload in lines 64 current = lines.shift 65 num_lines = current[/^(\d+)$/, 1].to_i 66 67 # the data itself 68 data = lines.slice!(0, num_lines).join 69 70 # install the data 71 Dir.chdir dir do 72 mkdir_p File.dirname(path) 73 File.open(path, 'w'){ |f| f.write(data) } 74 end 75 end 76 end 77 end 78 79 task :pull => dir do 80 if repo =~ /git$/ 81 Dir.chdir dir do 82 sh "git pull" 83 end 84 end 85 end 86 87 task :install => [:pull] + subdirs do 88 Dir.chdir dir do 89 if File.exists?("Rakefile") and `rake -T` =~ /^rake install/ 90 sh "rake install" 91 elsif File.exists?("install.sh") 92 sh "sh install.sh" 93 else 94 subdirs.each do |subdir| 95 if File.exists?(subdir) 96 sh "cp -RfL #{subdir}/* #{cwd}/#{subdir}/" 97 end 98 end 99 end 100 end 101 102 yield if block_given? 103 end 104 else 105 task :install => subdirs do 106 yield if block_given? 107 end 108 end 109 end 110 111 desc "Install #{name} plugin" 112 task name do 113 puts 114 puts "*" * 40 115 puts "*#{"Installing #{name}".center(38)}*" 116 puts "*" * 40 117 puts 118 Rake::Task["#{name}:install"].invoke 119 end 120 task :default => name 121 end 122 123 def skip_vim_plugin(name) 124 Rake::Task[:default].prerequisites.delete(name) 125 end 126 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" 159 160 #vim_plugin_task "hammer", "git://github.com/robgleeson/hammer.vim.git" do 161 # sh "gem install github-markup redcarpet" 162 #end 163 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("", " ") 168 runtime colors/railscasts.vim 169 let g:colors_name = "railscasts+" 170 171 set fillchars=vert:\\ 172 set fillchars=stl:\\ 173 set fillchars=stlnc:\\ 174 hi StatusLine guibg=#cccccc guifg=#000000 175 hi VertSplit guibg=#dddddd 176 VIM 177 end 178 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+" 184 185 hi VertSplit guibg=#888888 186 hi StatusLine guibg=#cccccc guifg=#000000 187 hi StatusLineNC guibg=#888888 guifg=#000000 188 VIM 189 end 190 end 191 192 vim_plugin_task "molokai" do 193 sh "curl https://raw.github.com/mrtazz/molokai.vim/master/colors/molokai.vim > colors/molokai.vim" 194 end 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" 199 end 200 end 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" 204 end 205 end 206 vim_plugin_task "vwilight" do 207 sh "curl https://raw.github.com/gist/796172/724c7ca237a7f6b8d857c4ac2991cfe5ffb18087 > colors/vwilight.vim" 208 end 209 210 if File.exists?(janus = File.expand_path("~/.janus.rake")) 211 puts "Loading your custom rake file" 212 import(janus) 213 end 214 215 desc "Update the documentation" 216 task :update_docs do 217 puts "Updating VIM Documentation..." 218 system "vim -e -s <<-EOF\n:helptags ~/.vim/doc\n:quit\nEOF" 219 end 220 221 desc "link vimrc to ~/.vimrc" 222 task :link_vimrc do 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) 227 end 228 end 229 end 230 231 task :clean do 232 system "git clean -dfx" 233 end 234 235 desc "Pull the latest" 236 task :pull do 237 system "git pull" 238 end 239 240 task :default => [ 241 :update_docs, 242 :link_vimrc 243 ] 244 245 desc "Clear out all build artifacts and rebuild the latest Janus" 246 task :upgrade => [:clean, :pull, :default] 247
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).