The installer again -- further tests.

Hugh Sasse Staff Elec Eng hgs at dmu.ac.uk
Tue Jan 4 04:41:04 EST 2005


On Sat, 18 Dec 2004, Gavin Sinclair wrote:

> Hugh, are you saying I can patch this against the latest CVS and all
> will be well? :)

I went away for Christmas before reading this. 
I'm pretty sure I wasn't working from the CVS, I think I should get
that.  FYI
MD5 (vim-ruby-install.rb) = d3c8f86bdb8b6f2e0fac9306dfda85e8
MD5 (vim-ruby-install.rb.orig) = fd2ea32f57d23a47b7bfe3a86d357645

>
> Gavin
>
>
I'm still quoting this bit as it is a while since this
correspondance....

         Hugh
> On Saturday, December 18, 2004, 2:37:56 AM, Hugh wrote:
>
>> I think I have traced the problem to the backup function.
>> This seems to be treated as if it is to backup file to file, instead
>> of file to directory.  When doing an install patched as below I get
>
>> ruby ./bin/vim-ruby-install.rb
>
>> Possible Vim installation directories:
>>    1) /usr/local/share/vim/vim63
>
>> Please select one (or anything else to specify another directory): 1
>> in install: source_path is compiler/ruby.vim
>> in install: target_path is
>> /usr/local/share/vim/vim63/compiler/ruby.vim
>> in backup @base is ./vim-ruby-backup.10788
>> in backup basedir is /usr/local/share/vim/vim63/compiler/ruby.vim
>> in backup path is compiler/ruby.vim
>> in backup: source is
>> /usr/local/share/vim/vim63/compiler/ruby.vim/compiler/ruby.vim
>> in backup: target is ./vim-ruby-backup.10788/compiler/ruby.vim
>> /usr/local/lib/ruby/1.8/fileutils.rb:859:in `stat': Not a
>> directory -
>> /usr/local/share/vim/vim63/compiler/ruby.vim/compiler/ruby.vim
>> (Errno::ENOTDIR)
>>          from /usr/local/lib/ruby/1.8/fileutils.rb:859:in `fu_same?'
>>          from /usr/local/lib/ruby/1.8/fileutils.rb:838:in `fu_each_src_dest'
>>          from /usr/local/lib/ruby/1.8/fileutils.rb:837:in `fu_each_src_dest0'
>>          from /usr/local/lib/ruby/1.8/fileutils.rb:837:in `fu_each_src_dest'
>>          from /usr/local/lib/ruby/1.8/fileutils.rb:333:in `cp'
>>          from ./bin/vim-ruby-install.rb:303:in `backup'
>>          from ./bin/vim-ruby-install.rb:261:in `install'
>>          from ./bin/vim-ruby-install.rb:253:in `each'
>>          from ./bin/vim-ruby-install.rb:253:in `install'
>>          from ./bin/vim-ruby-install.rb:252:in `chdir'
>>          from ./bin/vim-ruby-install.rb:252:in `install'
>>          from ./bin/vim-ruby-install.rb:384
>
>
>> I'm not sure which way to fix this: make the code respect backup's
>> file to directory semantics or fix backup to be file to file.
>
>>          Hugh
>
>> --- ./vim-ruby-install.rb.orig	2004-10-27 13:18:10.948557000 +0100
>> +++ ./vim-ruby-install.rb	2004-12-17 15:30:26.634622000 +0000
>> @@ -1,6 +1,7 @@
>>   #!/usr/local/bin/ruby
>
>>   # vim-ruby-install: install the Vim config files for Ruby editing
>> +# vim:set sw=2 et:
>>   #
>>   #  * scope out the target directry and get user to confirm
>>   #    * if no directory found, ask user
>> @@ -52,6 +53,8 @@
>>         # 1. Try the current directory.
>>       if SOURCE_FILES.all? { |path| FileTest.file?(path) }
>>         return '.'
>> +    elsif SOURCE_FILES.map{|f| File.join(File.dirname($0),
>> '..',f)}.all? { |path| FileTest.file?(path) }
>> +      return File.join(File.dirname($0), '..')
>>       end
>>         # 2. Try the gem 'vim-ruby'.
>>       begin
>> @@ -231,6 +234,9 @@
>>       # will be copied.  Both are strings.
>>     def initialize(source, target)
>>       @source_dir = source
>> +    unless FileTest.directory?(@source_dir)
>> +      raise "Automatically determined source directory
>> ('#{@source_dir}') doesn't exist"
>> +    end
>>       unless FileTest.directory?(target)
>>         raise "Chosen target directory ('#{target}') doesn't exist"
>>       end
>> @@ -247,6 +253,8 @@
>>         SOURCE_FILES.each do |path|
>>           source_path = Pathname.new(path)
>>           target_path = @target_dir[path]
>> +        puts "in install: source_path is #{source_path.to_s}"
>> +        puts "in install: target_path is #{target_path.to_s}"
>>           if 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)
>> @@ -283,10 +291,15 @@
>>       end
>>         # Copy basedir/path to @path/path.
>>       def backup(basedir, path)
>> +      puts "in backup @base is #{@base}"
>> +      puts "in backup basedir is #{basedir}"
>> +      puts "in backup path is #{path}"
>>         @base.mkpath unless @base.directory?
>>         source = Pathname.new(basedir) + path
>>         target = @base + path
>>         target.dirname.mkpath
>> +      puts "in backup: source is #{source.to_s}"
>> +      puts "in backup: target is #{target.to_s}"
>>         FileUtils.cp(source.to_s, target.to_s)
>>       end
>>       def [](path)
>> @@ -366,6 +379,7 @@
>>   op.parse!(ARGV)
>
>>   source_dir = Env.determine_source_directory
>> +if source_dir.nil? then raise "source_dir is Nil"; end
>>   target_dir = $options[:target_dir] ||
>> TargetDirectory.finder.find_target_directory
>>   VimRubyInstaller.new(source_dir, target_dir).install
>
>
>
>
>
> _______________________________________________
> vim-ruby-devel mailing list
> vim-ruby-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/vim-ruby-devel
>



More information about the vim-ruby-devel mailing list