mirror of
https://github.com/preservim/nerdcommenter.git
synced 2024-11-24 01:29:27 +08:00
use rakefile from nerdtree
This commit is contained in:
parent
4d933f01d6
commit
a1b4c3b94a
80
Rakefile
80
Rakefile
|
@ -1,18 +1,76 @@
|
||||||
desc "Copy the vim/doc files into ~/.vim"
|
# written by travis jeffery <travisjeffery@gmail.com>
|
||||||
task :deploy_local do
|
# contributions by scrooloose <github:scrooloose>
|
||||||
run "cp plugin/NERD_commenter.vim ~/.vim/plugin"
|
|
||||||
run "cp doc/NERD_commenter.txt ~/.vim/doc"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
require 'rake'
|
||||||
|
require 'find'
|
||||||
|
require 'pathname'
|
||||||
|
|
||||||
desc "Create a zip archive for release to vim.org"
|
IGNORE = [/\.gitignore$/, /Rakefile$/]
|
||||||
|
|
||||||
|
files = `git ls-files`.split("\n")
|
||||||
|
files.reject! { |f| IGNORE.any? { |re| f.match(re) } }
|
||||||
|
|
||||||
|
desc 'Zip up the project files'
|
||||||
task :zip do
|
task :zip do
|
||||||
abort "NERD_commenter.zip already exists, aborting" if File.exist?("NERD_commenter.zip")
|
zip_name = File.basename(File.dirname(__FILE__))
|
||||||
run "zip NERD_commenter.zip plugin/NERD_commenter.vim doc/NERD_commenter.txt"
|
zip_name.gsub!(/ /, '_')
|
||||||
|
zip_name = "#{zip_name}.zip"
|
||||||
|
|
||||||
|
if File.exist?(zip_name)
|
||||||
|
abort("Zip file #{zip_name} already exists. Remove it first.")
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "Creating zip file: #{zip_name}"
|
||||||
|
system("zip #{zip_name} #{files.join(" ")}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(cmd)
|
desc 'Install plugin and documentation'
|
||||||
puts "Executing: #{cmd}"
|
task :install do
|
||||||
system cmd
|
vimfiles = if ENV['VIMFILES']
|
||||||
|
ENV['VIMFILES']
|
||||||
|
elsif RUBY_PLATFORM =~ /(win|w)32$/
|
||||||
|
File.expand_path("~/vimfiles")
|
||||||
|
else
|
||||||
|
File.expand_path("~/.vim")
|
||||||
|
end
|
||||||
|
files.each do |file|
|
||||||
|
target_file = File.join(vimfiles, file)
|
||||||
|
FileUtils.mkdir_p File.dirname(target_file)
|
||||||
|
FileUtils.cp file, target_file
|
||||||
|
|
||||||
|
puts "Installed #{file} to #{target_file}"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'Pulls from origin'
|
||||||
|
task :pull do
|
||||||
|
puts "Updating local repo..."
|
||||||
|
system("cd " << Dir.new(File.dirname(__FILE__)).path << " && git pull")
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Calls pull task and then install task'
|
||||||
|
task :update => ['pull', 'install'] do
|
||||||
|
puts "Update of vim script complete."
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Uninstall plugin and documentation'
|
||||||
|
task :uninstall do
|
||||||
|
vimfiles = if ENV['VIMFILES']
|
||||||
|
ENV['VIMFILES']
|
||||||
|
elsif RUBY_PLATFORM =~ /(win|w)32$/
|
||||||
|
File.expand_path("~/vimfiles")
|
||||||
|
else
|
||||||
|
File.expand_path("~/.vim")
|
||||||
|
end
|
||||||
|
files.each do |file|
|
||||||
|
target_file = File.join(vimfiles, file)
|
||||||
|
FileUtils.rm target_file
|
||||||
|
|
||||||
|
puts "Uninstalled #{target_file}"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
task :default => ['update']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user