Permalink
Browse files

Remove Gem installation infrastructure

This project hasn't been distributed as a gem in the better part of a decade
and the resulting user complaints have registered as little more than a murmur.

Relevant FAQ content will be moved to the wiki.

Fixes #198.
1 parent d1f7471 commit 686546d623c93b76a22da1cad3a97ea1a813e53a @dkearns dkearns committed Feb 12, 2014
Showing with 6 additions and 756 deletions.
  1. +0 −251 FAQ
  2. +1 −2 INSTALL.markdown
  3. +5 −6 README
  4. +0 −42 Rakefile
  5. +0 −455 bin/vim-ruby-install.rb
View
251 FAQ
@@ -1,251 +0,0 @@
-*vim-ruby.txt* *vim-ruby* *vim-ruby-faq*
-
- VIM/RUBY CONFIGURATION FILES
-
- The vim-ruby Project FAQ
-
- https://github.com/vim-ruby/vim-ruby
-
-The vim-ruby project maintains Ruby-related configuration files for Vim. This
-FAQ contains all you need to know about it.
-
-*** TOC ***
-
-==============================================================================
-
-*vim-ruby-faq-X* What is the vim-ruby project?
-
-It maintains all the configuration files that help Vim edit Ruby code. By
-installing these files, Vim will properly highlight and indent Ruby files, and
-will be able to run them and go directly to the location of any errors.
-Rakefiles, ERB files, and unit tests are also identified and supported.
-
-If you make use of this project, make sure you read the installation and
-configuration instructions in this FAQ.
-
-
-*vim-ruby-faq-X* Doesn't Vim include these files?
-
-Yes it does. You should only want to download and install this project if it
-has changed since you last installed your version of Vim. Read the "News"
-section of the |vim-ruby-homepage| to see when the most recent release was
-made.
-
-
-*vim-ruby-faq-X* How do you get it?
-
-The easiest way is to run: >
-
- gem install vim-ruby
-
-(This really only downloads it. See installation instructions
-|vim-ruby-install| below.)
-
-If you don't have RubyGems, download a tarball from: >
-
- https://github.com/vim-ruby/vim-ruby/downloads
-
-Again, see installation instructions below.
-
-
-*vim-ruby-faq-X* How do you install it? *vim-ruby-install*
-
-If you obtained the vim-ruby files via RubyGems, run: >
-
- vim-ruby-install.rb
-
-If you downloaded a tarball, unpack it, change to the created directory, and
-run: >
-
- ruby bin/vim-ruby-install.rb
-
-Whichever way you run it, the effect is the same. The installer will:
- - Search for a Vim config directory to put its files and ask you to confirm.
- - Copy the configuration files to the appropriate places underneath the
- directory you selected.
-
-Here is an example installation transcript:
-
- Possible Vim installation directories: ~
- 1) D:/Gavin/vimfiles ~
- 2) E:/Vim/vimfiles ~
- ~
- Please select one (or anything else to specify another directory): 2 ~
- autoload/rubycomplete.vim -> E:/Vim/vimfiles/autoload/rubycomplete.vim ~
- compiler/eruby.vim -> E:/Vim/vimfiles/compiler/eruby.vim ~
- compiler/ruby.vim -> E:/Vim/vimfiles/compiler/ruby.vim ~
- compiler/rubyunit.vim -> E:/Vim/vimfiles/compiler/rubyunit.vim ~
- ftdetect/ruby.vim -> E:/Vim/vimfiles/ftdetect/ruby.vim ~
- ftplugin/eruby.vim -> E:/Vim/vimfiles/ftplugin/eruby.vim ~
- ftplugin/ruby.vim -> E:/Vim/vimfiles/ftplugin/ruby.vim ~
- indent/eruby.vim -> E:/Vim/vimfiles/indent/eruby.vim ~
- indent/ruby.vim -> E:/Vim/vimfiles/indent/ruby.vim ~
- syntax/eruby.vim -> E:/Vim/vimfiles/syntax/eruby.vim ~
- syntax/ruby.vim -> E:/Vim/vimfiles/syntax/ruby.vim ~
-
-Existing files are overwritten. This is safe, because it's a slow-maturing
-project, so new files are better than old ones. However, if you had edited the
-files, you will have lost your changes. Better make your changes in, for
-instance:
-
- ~/.vim/after/ftplugin/ruby.vim ~
-
-This file will be loaded _after_ the regular config files are loaded, so your
-customisations will definitely take effect.
-
-
-*vim-ruby-faq-X* What Vim config do I need? *vim-ruby-config*
-
-Without the following lines in your .vimrc, _vimrc, or other startup file, the
-files in the vim-ruby project will be largely useless. >
-
- set nocompatible " We're running Vim, not Vi!
- syntax on " Enable syntax highlighting
- filetype on " Enable filetype detection
- filetype indent on " Enable filetype-specific indenting
- filetype plugin on " Enable filetype-specific plugins
- compiler ruby " Enable compiler support for ruby
-
-See |.vimrc| for more information about this important Vim configuration file.
-
-See |matchit-install| for instructions on installing "matchit", which will
-allow you to use |%| to bounce between Ruby keywords (class, def, while, ...)
-and their respective "end" keywords.
-
-
-*vim-ruby-faq-X* How do I know that everything's working?
-
-If you've run the installer and added the configuration |vim-ruby-config|
-above, everything should be fine when you restart Vim. To test this:
- - Edit a Ruby file with Vim (make sure it has a .rb extension).
- - The code should be syntax highlighted.
- - Type in some code. When you start a new line, it should be automatically
- indented to the correct spot.
- - Add or remove some space from the beginning of a line of code and hit ==.
- That line should be reindented.
- - Put the cursor on a "class" or "def" keyword and hit %. The cursor should
- now be on the matching "end" keyword.
- - TODO: what else?
-
-
-*vim-ruby-faq-X* How do I use it?
-
-TODO: write.
-
-
-*vim-ruby-faq-X* How do I customise it? *vim-ruby-customize*
-
-The most important customisation for editing Ruby code is the amount of space to
-indent. The following is a typical setup. Look up the various options to read
-about them. >
-
- set expandtab
- set tabstop=2 shiftwidth=2 softtabstop=2
- set autoindent
-
-TODO: is autoindent necessary? What other options should go here? What about
-Ruby comments?
-FIXME: Autoindent is good. maybe mention |i_CTRL_D| and |i_CTRL_T| for
-moving lines about in this context?
-COMMENT: I never use ^D and ^T in insert mode, though I always knew what they
-do. Might try them!
-
-
-*vim-ruby-faq-X* I want feature X. Will you include it?
-
-The idea of the vim-ruby project is to maintain configuration files that are
-actually distributed with Vim. Therefore all functionality should be helpful to
-all Vim/Ruby users. So the project does not deal with people's individual
-tastes.
-
-That said, we are considering creating a separate configuration file for less
-universal features, whose features users can pick and choose. So don't hesitate
-to send us your suggestions.
-
-
-*vim-ruby-faq-X* What are some other cool Ruby-related Vim tricks I can use?
-
-An example is the following (put it in ~/.vimrc/ftplugin/ruby_extra.vim or
-similar): [similar? |$VIMRUNTIME| or what?] >
-
- if !exists( "*EndToken" )
- function EndToken()
- let current_line = getline( '.' )
- let braces_at_end = '{\s*\(|\(,\|\s\|\w\)*|\s*\)\?$'
- if match( current_line, braces_at_end ) >= 0
- return '}'
- else
- return 'end'
- endif
- endfunction
- endif
-
- imap <S-CR> <ESC>:execute 'normal o' . EndToken()<CR>O
-
-This will help you create ruby blocks of code, by inserting "}" or "end" as
-appropriate. Try creating these lines of code and hitting SHIFT-ENTER:
-
- array.map { |elem| ~
-
- def fibonacci(n) ~
-
-For other suggestions, search the web or look at: >
-
- https://github.com/vim-ruby/vim-ruby/wiki/VimRubySupport
-
-
-*vim-ruby-faq-X* How can I report a bug? *vim-ruby-bug-reporting*
-
-Bug reports are most welcome. In order of preference:
- - submit a bug at https://github.com/vim-ruby/vim-ruby/issues
- - send an email to the mailing list (see below)
- - email the maintainer (email address appears in each configuration file)
-
-
- *vim-ruby-list*
-*vim-ruby-faq-X* Does the project have a mailing list?
-
-Yes: vim-ruby-devel@rubyforge.org. Only subscribers can post. To join, visit:
->
- http://rubyforge.org/mailman/listinfo/vim-ruby-devel
-
-The list is mirrored at: >
-
- http://news.gmane.org/gmane.comp.editors.vim.vim%2druby.devel
-
-
-*vim-ruby-faq-X* Why is this project separate from Vim?
-
-We can't use Vim's CVS to keep track of these files, so we organise it ourselves
-and give Bram the latest files in time for each release of Vim. By keeping the
-Ruby stuff together, we can release it all at once and people can update it
-independently of Vim.
-
-
-*vim-ruby-faq-X* I have another question...
-
-The mailing list or the file maintainer is a good place to ask. Or perhaps
-comp.lang.ruby, but please make sure you've read the FAQ thoroughly before
-asking there.
-
-
-*vim-ruby-faq-X* Can you repeat all the web pages listed in this FAQ?
-
-Homepage *vim-ruby-homepage* : >
- https://github.com/vim-ruby/vim-ruby/
-
-Bug tracker: >
- https://github.com/vim-ruby/vim-ruby/issues
-
-Relevant Wiki page: >
- https://github.com/vim-ruby/vim-ruby/wiki
-
-Mailing list archives: >
- http://news.gmane.org/gmane.comp.editors.vim.vim%2druby.devel
- http://rubyforge.org/pipermail/vim-ruby-devel/
-
-Mailing list join: >
- http://rubyforge.org/mailman/listinfo/vim-ruby-devel
-
-
-vim: ft=help tw=78 noet :
View
3 INSTALL.markdown
@@ -32,5 +32,4 @@ Manually
--------
[Download](https://github.com/vim-ruby/vim-ruby/archives/master) and
-extract an archive, and run `bin/vim-ruby-install.rb` to copy the
-relevant files to `~/.vim`.
+extract the relevant files to `~/.vim` (or `$HOME/vimfiles` on Windows).
View
11 README
@@ -16,7 +16,7 @@ For regular users:
- vim-ruby-devel-YYYY.MM.DD.tar.gz (cutting-edge features we'd like you
to test)
- Please give feedback through the bug tracking and feature request features
- of github.
+ of GitHub.
- Feel free to join discussions on the vim-ruby-devel mailing list:
http://rubyforge.org/mail/?group_id=16
@@ -29,19 +29,18 @@ Contents of the project:
- The autoload, compiler, ftdetect, ftplugin, indent and syntax directories
contain the ruby*.vim files that are to be copied to a location somewhere
in the Vim 'runtimepath'.
- - vim-ruby-install.rb performs this copying.
How you get these files into Vim:
- By downloading the project via a snapshot or Git, you can keep up with
the latest, make changes, and install the files to a Vim directory.
- By downloading one of the tarballs, you can easily install the latest
stable or development version wherever you like on your machine. No
- README, no vim-ruby-install.rb, just Vim files. You would typically
- install these into either $VIM/vimfiles, for system-wide use, or $HOME/.vim
- ($HOME/vimfiles on Windows) for personal use.
+ README etc. just Vim files. You would typically install these into either
+ $VIM/vimfiles, for system-wide use, or $HOME/.vim ($HOME/vimfiles on
+ Windows) for personal use.
- Remember that when you install Vim in the first place, all of these files
are present. The purpose of downloading and installing them from
- github is to get the latest version of them.
+ GitHub is to get the latest version of them.
Git topics:
- Project was migrated from CVS in August, 2008.
View
42 Rakefile
@@ -1,42 +0,0 @@
-require 'rubygems'
-require 'rake/gempackagetask'
-
-PACKAGE_NAME = 'vim-ruby'
-RELEASE_FILES = FileList[
- 'ChangeLog', 'CONTRIBUTORS', 'FAQ', 'INSTALL', 'NEWS', 'README', 'bin/*.rb',
- 'doc/*.txt','{autoload,compiler,ftdetect,ftplugin,indent,syntax}/*.vim'
-]
-PACKAGE_VERSION = Time.now.gmtime.strftime('%Y.%m.%d')
-
-desc "Build all the packages"
-task :default => :package
-
-
-def gemspec
- Gem::Specification.new do |s|
- s.name = PACKAGE_NAME
- s.version = PACKAGE_VERSION
- s.files = RELEASE_FILES.to_a
- s.summary = "Ruby configuration files for Vim. Run 'vim-ruby-install.rb' to complete installation."
- s.description = s.summary + "\n\nThis package doesn't contain a Ruby library."
- s.requirements << 'RubyGems 0.8+' << 'Vim 6.0+'
- s.required_ruby_version = '>= 1.8.0'
- s.require_path = '.'
- s.bindir = 'bin'
- s.executables = ['vim-ruby-install.rb']
- s.author = 'Gavin Sinclair et al.'
- s.email = 'gsinclair@soyabean.com.au'
- s.homepage = 'https://github.com/vim-ruby/vim-ruby'
- s.has_rdoc = false
- end
-end
-
-Rake::GemPackageTask.new(gemspec) do |t|
- t.package_dir = 'etc/package'
- t.need_tar = true
- t.need_zip = true
-end
-
-# Supporting methods
-
-# vim: nowrap sw=2 sts=2 ts=8 ff=unix ft=ruby:
View
455 bin/vim-ruby-install.rb
@@ -1,455 +0,0 @@
-#!/usr/bin/env ruby
-
-# vim-ruby-install: install the Vim config files for Ruby editing
-#
-# * scope out the target directory and get user to confirm
-# * if no directory found, ask user
-# * allow user to force a search for a Windows gvim installation
-# * find source files from gem or from top level directory
-# * copy to target directory, taking account of
-# * line endings (NL for Unix-ish; CRLF for Windows)
-# * permissions (755 for directories; 644 for files)
-#
-
-require 'rbconfig'
-include RbConfig
-require 'fileutils'
-require 'optparse'
-require 'pathname'
-
-SOURCE_FILES = %w{
- autoload/rubycomplete.vim
- compiler/eruby.vim
- compiler/rspec.vim
- compiler/ruby.vim
- compiler/rubyunit.vim
- ftdetect/ruby.vim
- ftplugin/eruby.vim
- ftplugin/ruby.vim
- indent/eruby.vim
- indent/ruby.vim
- syntax/eruby.vim
- syntax/ruby.vim
-}
-
-#
-# Miscellaneous functions in the user's environment.
-#
-class Env
- #
- # Returns :UNIX or :WINDOWS, according to CONFIG['host_os'] and $options[:windows].
- #
- def Env.determine_target_os
- os = CONFIG['host_os']
- if os =~ /mswin/ or $options[:windows]
- return :WINDOWS
- else
- return :UNIX
- end
- end
-
- #
- # Returns the path to the directory where the vim configuration files will be copied from.
- # The first preference is the directory above this script. If that fails, we look for the
- # RubyGems package 'vim-ruby'. Failing that, we return +nil+.
- #
- def Env.determine_source_directory
- # 1. Try the directory above this installation script.
- vim_ruby_source_dir = File.expand_path(File.join(File.dirname($0), '..'))
- return vim_ruby_source_dir if _valid_vim_ruby_dir(vim_ruby_source_dir)
- # 2. Try the gem 'vim-ruby'.
- begin
- require 'rubygems'
- raise "Need RubyGems 0.8+" if Gem::RubyGemsPackageVersion < '0.8'
- rescue LoadError
- return nil
- end
- #vim_ruby_gem_dir = Gem.latest_load_paths.grep(%r{gems/vim-ruby-\d{4}\.\d{2}\.\d{2}}).last
- vim_ruby_gem_dir = Gem.all_load_paths.grep(%r{gems/vim-ruby-\d{4}\.\d{2}\.\d{2}}).sort.last
- if vim_ruby_gem_dir and _valid_vim_ruby_dir(vim_ruby_gem_dir)
- return vim_ruby_gem_dir
- end
- return nil
- end
-
- # Returns the Vim installation directory ($VIM).
- # TODO: print warning if vim command not in PATH or appropriate key not in registry?
- def Env.determine_vim_dir
- installation_dir = ENV['VIM'] ||
- case Env.determine_target_os
- when :UNIX
- IO.popen('vim --version 2>/dev/null') do |version|
- dir = version.read[/fall-back for \$VIM: "(.*)"/, 1]
- end
- when :WINDOWS
- begin
- require 'win32/registry'
- Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Vim\Gvim') do |reg|
- path = reg['path', Win32::Registry::REG_SZ]
- dir = path.sub(/\\vim\d\d\\gvim.exe/i, '')
- end
- rescue Win32::Registry::Error
- nil
- end
- end
- return installation_dir
- end
-
- def Env.determine_home_dir
- home_dir = ENV['HOME'] ||
- case Env.determine_target_os
- when :WINDOWS
- ENV['HOMEDRIVE'] + ENV['HOMEPATH'] if ENV['HOMEDRIVE'] and ENV['HOMEPATH']
- end
- return home_dir
- end
-
- def Env.ask_user(message)
- print message
- gets.strip
- end
-
- private_class_method
-
- def Env._valid_vim_ruby_dir(dir)
- Dir.chdir(dir) do
- return SOURCE_FILES.all? { |path| FileTest.file?(path) }
- end
- end
-
-end # class Env
-
-
-#
-# A FileWriter writes files with pre-selected line endings and permissions.
-#
-# writer = FileWriter.new(:UNIX, 0664)
-# writer.copy(source, target)
-#
-class FileWriter
- LINE_ENDINGS = { :UNIX => "\n", :WINDOWS => "\r\n" }
-
- def initialize(ending, file_permissions=0644, directory_permissions=0755)
- @ending = LINE_ENDINGS[ending] or raise "No/invalid line ending given: #{ending}"
- @permissions = {
- :file => file_permissions,
- :dir => directory_permissions
- }
- end
-
- # Source and target paths assumed to be Pathname objects. Copy the source to the target,
- # ensuring the right line endings.
- def copy(source_path, target_path)
- _ensure_directory_exists(target_path)
- target_path.open('wb', @permissions[:file]) do |io|
- lines = source_path.read.split("\n")
- lines.each do |line|
- io.write(line.chomp + @ending)
- end
- end
- puts "#{source_path.to_s.ljust(25)} -> #{target_path}"
- end
-
- # Create the given directory with the correct directory permissions.
- def mkpath(directory)
- FileUtils.mkdir_p(directory.to_s, :mode => @permissions[:dir], :verbose => true)
- end
-
- def _ensure_directory_exists(path)
- dir = path.dirname
- unless dir.directory?
- # <XXX> FileUtils.mkdir_p already checks if it exists and is a
- # directory. What if it exists as a file? (HGS)</XXX>
- mkpath(dir)
- end
- end
-end # class FileWriter
-
-#
-# Represents the target base directory for installs. Handles writing the files through a
-# given FileWriter.
-#
-class TargetDirectory
- def self.finder
- TargetDirectory::Finder.new
- end
-
- def initialize(directory, writer)
- @directory = Pathname.new(directory)
- @writer = writer # FileWriter
- end
-
- # Copies the given relative path from the current directory to the target.
- def copy(path)
- source_path = Pathname.new(path)
- target_path = @directory + path
- @writer.copy(source_path, target_path)
- end
-
- def [](path)
- @directory + path
- end
-
- def path
- @directory
- end
-end # class TargetDirectory
-
-#
-# Represents the target directory. Can find candidates, based on the operating system and
-# user options; but is ultimately created with one in mind.
-#
-class TargetDirectory::Finder
- # Guides the user through a selection process, ending in a chosen directory.
- def find_target_directory
- # 1. Was a directory specified using the --directory option?
- if option_dir = $options[:target_dir]
- return option_dir
- end
- # 2. Try the potentials (if there are any).
- if dirs = _potential_directories and not dirs.empty?
- puts
- puts "Possible Vim installation directories:"
- dirs.each_with_index do |dir, idx|
- puts " #{idx+1}) #{dir}"
- end
- puts
- r = Env.ask_user "Please select one (or anything else to specify another directory): "
- if (1..dirs.size).include? r.to_i
- chosen_directory = dirs[r.to_i - 1]
- return chosen_directory
- end
- end
- # 3. We didn't find any, or the user wants to enter another.
- if dirs.empty?
- puts
- puts "Couldn't find any Vim installation directories."
- end
- entered_directory = Env.ask_user "Please enter the full path to your Vim installation directory: "
- entered_directory = File.expand_path(entered_directory)
- return entered_directory
- end
-
- private
-
- # Return an array of _potential_ directories (i.e. they exist). Take the options into
- # account.
- def _potential_directories
- dirs = []
- dirs << _vim_user_dir
- dirs << _vim_system_dir
- return dirs.compact.map { |dir| File.expand_path(dir) }
- end
-
- # Return the Vim system preferences directory
- def _vim_system_dir
- vim_dir = Env.determine_vim_dir
- system_dir = vim_dir + "/vimfiles" if vim_dir
- return system_dir
- end
-
- # Return the Vim user preferences directory
- def _vim_user_dir
- platform_dir = { :UNIX => "/.vim", :WINDOWS => "/vimfiles" }
- home_dir = Env.determine_home_dir
- user_dir = home_dir + platform_dir[Env.determine_target_os] if home_dir
- return user_dir
- end
-end # class TargetDirectory::Finder
-
-#
-# VimRubyInstaller is the class that copies the files from the source directory to the target
-# directory, both of which are provided.
-#
-class VimRubyInstaller
- # +source+ and +target+ are the base directories from and to which the configuration files
- # will be copied. Both are strings.
- def initialize(source, target)
- unless FileTest.directory?(source)
- raise "Automatically determined source directory ('#{source}') doesn't exist"
- end
- unless FileTest.directory?(target)
- raise "Chosen target directory ('#{target}') doesn't exist"
- end
- @source_dir = source
- file_writer = FileWriter.new(Env.determine_target_os)
- @target_dir = TargetDirectory.new(target, file_writer)
- end
-
- # Since we know the source and target directories, all we have to do is copy the files
- # across. If the --backup option was specified or the target file is
- # _newer_ than the source file, we make a backup of it and report that to
- # the user.
- def install
- backupdir = BackupDir.new("./vim-ruby-backup.#{Process.pid}")
- Dir.chdir(@source_dir) do
- SOURCE_FILES.each do |path|
- source_path = Pathname.new(path)
- target_path = @target_dir[path]
- # FIXME: Backup everything for now
- if $options[:backup] and target_path.file?
- backupdir.backup(@target_dir, path)
- elsif target_path.file? and target_path.mtime > source_path.mtime
- # We're going to overwrite a newer file; back it up, unless they're the same.
- unless _same_contents?(target_path, source_path)
- backupdir.backup(@target_dir, path)
- end
- end
- @target_dir.copy(path)
- end
- end
- backups = backupdir.contents
- unless backups.empty?
- puts
- puts "The following backups were made:"
- backups.each do |path|
- puts " * #{path}"
- end
- puts
- puts "These backups are located in this directory: #{backupdir.path}"
- end
- end
-
- private
-
- # Test two files for equality of contents, ignoring line endings.
- def _same_contents?(p1, p2)
- contents1 = p1.read.split("\n").map { |line| line.chomp }
- contents2 = p2.read.split("\n").map { |line| line.chomp }
- contents1 == contents2
- end
-
- # A directory for holding backups of configuration files.
- class BackupDir
- def initialize(path)
- @base = Pathname.new(path).expand_path
- end
-
- # Copy basedir/path to @path/path.
- def backup(basedir, path)
- @base.mkpath unless @base.directory?
- source = basedir.path + path
- target = @base + path
- target.dirname.mkpath
- FileUtils.cp(source.to_s, target.dirname.to_s, :verbose => true)
- end
-
- def [](path)
- @base + path
- end
-
- def contents
- return [] unless @base.directory?
- results = []
- Dir.chdir(@base) do
- Pathname.new('.').find do |path|
- results << path if path.file?
- end
- end
- results
- end
-
- def path
- @base
- end
- end # class VimRubyInstaller::BackupDir
-end # class VimRubyInstaller
-
-#
-# * * * M A I N * * *
-#
-
-begin
- $options = {
- :backup => false,
- :target_dir => nil,
- :windows => false
- }
-
- op = OptionParser.new do |p|
- p.banner = %{
- vim-ruby-install.rb: Install the vim-ruby configuration files
-
- About:
- * Detects the Vim user and system-wide preferences directories
- * User to confirm before proceeding
- * User may specify other directory
- * Takes config files from current directory or from vim-ruby gem
- * Writes files with correct permissions and line endings
-
- Usage:
- direct: ruby bin/vim-ruby-install.rb [options]
- gem: vim-ruby-install.rb [options]
-
- Options:
- }.gsub(/^ /, '')
- p.on('-b', '--backup', 'Backup existing runtime files') do |value|
- $options[:backup] = value
- end
- p.on('-d DIR', '--directory', 'Install into given directory') do |dir|
- $options[:target_dir] = dir
- end
- p.on('-w', '--windows', 'Install into Windows directories') do |value|
- $options[:windows] = value
- end
- p.on('-h', '--help', 'Show this message') do
- puts p
- exit
- end
- p.on_tail %{
- Notes:
-
- * "Direct" usage means unpacking a vim-ruby tarball and running this
- program from the vim-ruby directory.
-
- * The convenient alternative is to use RubyGems:
- gem install vim-ruby
- vim-ruby-install.rb
-
- * The --windows option is designed for forcing an install into the
- Windows (gvim) configuration directory; useful when running from
- Cygwin or MinGW.
-
- * This installer is quite new (2004-09-20). Please report bugs to
- gsinclair@soyabean.com.au.
- }.gsub(/^ /, '')
- end
- op.parse!(ARGV)
-
- if not ARGV.empty?
- raise "invalid argument: #{ARGV[0]}"
- end
-
- source_dir = Env.determine_source_directory
- if source_dir.nil?
- raise "Can't find source directory."
- end
-
- target_dir = TargetDirectory.finder.find_target_directory
- if not File.directory?(target_dir)
- puts
- puts "Target directory '#{target_dir}' does not exist."
- response = Env.ask_user "Do you want to create it? [Yn] "
- response = "y" if response.empty?
- if response.strip =~ /^y(es)?$/i
- FileUtils.mkdir_p(target_dir, :verbose => true)
- else
- puts
- puts "Installation aborted."
- exit
- end
- end
-
- VimRubyInstaller.new(source_dir, target_dir).install
-
-rescue
-
- raise if $DEBUG
- $stderr.puts
- $stderr.puts $!.message
- $stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
- exit 1
-
-end
-
-# vim: nowrap sw=2 sts=2 ts=8 ff=unix ft=ruby:

0 comments on commit 686546d

Please sign in to comment.