PATCH: installer source directory detection (was Re: The installer again -- further tests.)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PATCH: installer source directory detection (was Re: The installer again -- further tests.)

Doug Kearns
On Tue, Jan 04, 2005 at 11:29:06AM +0000, Hugh Sasse Staff Elec Eng wrote:
>
> OK, here is the diff with the extra diagnostic print statements
> removed.  this is against the CVS as grabbed with wget from
> http://rubyforge.org/cgi-bin/viewcvs.cgi/vim-ruby/bin/vim-ruby-install.rb?cvsroot=vim-ruby
>
> today.
>
> You don't need to worry about the change from env ruby on the first
> line of course...

OK, I'll stick my nose in where it doesn't belong and commit this. ;-)
Thanks Hugh!

Is there any reason we're trying the current directory as a possible
source directory first. Isn't it always going to be one up from the
installation script? Excluding the gems case because I know nothing of
RubyGems...

Committed as:

Index: bin/vim-ruby-install.rb
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/bin/vim-ruby-install.rb,v
retrieving revision 1.1
diff -u -r1.1 vim-ruby-install.rb
--- bin/vim-ruby-install.rb 19 Sep 2004 15:37:35 -0000 1.1
+++ bin/vim-ruby-install.rb 4 Jul 2005 06:23:44 -0000
@@ -52,8 +52,11 @@
       # 1. Try the current directory.
     if SOURCE_FILES.all? { |path| FileTest.file?(path) }
       return '.'
+      # 2. Try the directory above this installation script.
+    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'.
+      # 3. Try the gem 'vim-ruby'.
     begin
       require 'rubygems'
       raise "Need RubyGems 0.8+" if Gem::RubyGemsPackageVersion < '0.8'
@@ -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
@@ -366,6 +372,7 @@
 op.parse!(ARGV)
 
 source_dir = Env.determine_source_directory
+if source_dir.nil? then raise "Can't find source directory"; end
 target_dir = $options[:target_dir] || TargetDirectory.finder.find_target_directory
 VimRubyInstaller.new(source_dir, target_dir).install
 
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: installer source directory detection (was Re: The installer again -- further tests.)

Hugh Sasse
On Mon, 4 Jul 2005, Doug Kearns wrote:

> On Tue, Jan 04, 2005 at 11:29:06AM +0000, Hugh Sasse Staff Elec Eng wrote:
>>
>> OK, here is the diff with the extra diagnostic print statements
>
> OK, I'll stick my nose in where it doesn't belong and commit this. ;-)
> Thanks Hugh!
>
> Is there any reason we're trying the current directory as a possible
> source directory first. Isn't it always going to be one up from the
> installation script? Excluding the gems case because I know nothing of
> RubyGems...
>

Given we are in bin I'd tend to agree.  It's been a while since
writing that but I think I just added to what was there so I didn't
break anything.  And I did it afterwards for the same reason.

         Hugh
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: installer source directory detection (was Re: The installer again -- further tests.)

Hugh Sasse
I've just got the CVS tarball and tried to install it.

E:\Downloads\vim-ruby\vim-ruby\bin>vim-ruby-install.rb
E:/Downloads/vim-ruby/vim-ruby/bin/vim-ruby-install.rb:375: Can't find source di
rectory (RuntimeError)

E:\Downloads\vim-ruby\vim-ruby\bin>cd ..

E:\Downloads\vim-ruby\vim-ruby>.\bin\vim-ruby-install.rb
E:/Downloads/vim-ruby/vim-ruby/bin/vim-ruby-install.rb:375: Can't find source di
rectory (RuntimeError)

E:\Downloads\vim-ruby\vim-ruby>

running rake on the Rakefile didn't create the gem -- it didn't
"know" how to make Default.  Since it looked like a gemspec file I
just executed it instead of passing it to rake, but it produced
nothing.  thus I can's seem to get a gem out of the CVS tarball to
proceed that way either.

         Hugh

_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

PATCH: default rake target (was Re: PATCH: installer source directory detection)

Doug Kearns
On Wed, Jul 06, 2005 at 04:33:12PM +0100, Hugh Sasse wrote:

<snip>
 
> running rake on the Rakefile didn't create the gem -- it didn't
> "know" how to make Default.

See patch below...

> Since it looked like a gemspec file I
> just executed it instead of passing it to rake, but it produced
> nothing.  thus I can's seem to get a gem out of the CVS tarball to
> proceed that way either.

rake -T will list all the tasks.

Regards,
Doug


Index: Rakefile
===================================================================
RCS file: /var/cvs/vim-ruby/vim-ruby/Rakefile,v
retrieving revision 1.2
diff -u -r1.2 Rakefile
--- Rakefile    19 Sep 2004 15:36:50 -0000      1.2
+++ Rakefile    27 Jul 2005 09:42:37 -0000
@@ -8,6 +8,10 @@
 ]
 PACKAGE_VERSION = Time.now.strftime('%Y.%m.%d')

+desc "Build all the packages"
+task :default => :package
+
+
 def gemspec
   Gem::Specification.new do |s|
     s.name                  = PACKAGE_NAME
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: default rake target (was Re: PATCH: installer source directory detection)

Hugh Sasse
On Wed, 27 Jul 2005, Doug Kearns wrote:

> On Wed, Jul 06, 2005 at 04:33:12PM +0100, Hugh Sasse wrote:
>
> <snip>
>
>> running rake on the Rakefile didn't create the gem -- it didn't
>> "know" how to make Default.
>
> See patch below...
>
I grabbed the CVS which has this patch, I see...
         [...]
>
> rake -T will list all the tasks.

Thanks.  I'm not so fluent in Rake yet...

That worked.  I successfully ran the installation script too.  Thank
you.
>
> Regards,
> Doug
>
         Thank you,
         Hugh
_______________________________________________
vim-ruby-devel mailing list
[hidden email]
http://rubyforge.org/mailman/listinfo/vim-ruby-devel