lib/soywiki.rb in soywiki-0.5.7 vs lib/soywiki.rb in soywiki-0.5.8

- old
+ new

@@ -1,9 +1,9 @@ require 'string_ext' module Soywiki - VERSION = '0.5.7' + VERSION = '0.5.8' WIKI_WORD = /\b([a-z][\w_]+\.)?[A-Z][a-z]+[A-Z]\w*\b/ HYPERLINK = %r|\bhttps?://[^ >)\n\]]+| def self.run if %W( -v --version -h --help).include?(ARGV.first) @@ -22,9 +22,15 @@ END exit elsif ARGV.first == '--html' self.html_export exit + elsif ARGV.first == '--install-plugin' + require 'erb' + plugin_template = File.read(File.join(File.dirname(__FILE__), 'plugin.erb')) + vimscript_file = File.join(File.dirname(__FILE__), 'soywiki.vim') + plugin_body = ERB.new(plugin_template).result(binding) + File.open("#{ENV['HOME']}/.vim/plugin/soywiki_starter.vim", "w") {|f| f.write plugin_body} else vim = ENV['SOYWIKI_VIM'] || 'vim' vimscript = File.expand_path("../soywiki.vim", __FILE__) vim_command = "#{vim} -S #{vimscript}" exec vim_command