PATCH: default installation directories

Doug Kearns dougkearns at gmail.com
Tue Aug 16 11:28:20 EDT 2005


On Tue, Aug 16, 2005 at 12:25:42PM +0100, Hugh Sasse wrote:
> Oh, I see those patches aren't in the CVS yet.  OK.

Well it's Gavin's installer so I was going to wait for his comments
since this changes it's behaviour. However, it seems he might be away or
similar so I'll commit it.

> Reading through
> I noticed a couple of things that may cause problems, so I've added
> comments and express them in the form of a patch for convenience.
> 
> I think my mods to _same_contents *may* cover macs as well now, 
> which I think used \r as a line ending.  Probably not MacOSX.

Does Ruby run on 'Macs'?
 
>         HTH
>         Hugh
> 
> --- vim-ruby/bin/vim-ruby-install.rb.orig	2005-08-16 
> 11:39:51.236954000 +0100
> +++ vim-ruby/bin/vim-ruby-install.rb	2005-08-16 12:09:37.698997000 +0100
> @@ -119,6 +119,8 @@
>    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>

Yes, I'm not sure what this indirection is about either so I'll just add
your comment until Gavin can elucidate further.

<snip>

>        Dir.glob("#{dir}/vim*").select { |d| d =~ /vim\d+/ }.sort.last
> +      # <XXX> I think this may fail at vim version 10 or if vim
> +      # 6.22 were replaced by Vim 7.  Not sure of a good fix at this
> +      # time (HGS)</XXX>

This code was removed by the patch.

<snip>
 
>      # 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 }
> +    ending = /[\r\n]+/
> +    contents1 = p1.read.split(ending).map { |line| line.chomp }
> +    contents2 = p2.read.split(ending).map { |line| line.chomp }
>      contents1 == contents2
>    end

Doesn't this make the 'map' call redundant too?

FWIW, I'm not sure that silently replacing a file with one which differs
only in it's line endings is a good idea anyway.

Regards,
Doug


More information about the vim-ruby-devel mailing list