Skip to content
This repository
Browse code

* use fileutils.rb instead of ftools.rb (removed from 1.9)

  • Loading branch information...
commit 5ff42749b704165e728e4566cd6b0ba83bd871db 1 parent 7928b1c
authored February 10, 2008

Showing 1 changed file with 9 additions and 7 deletions. Show diff stats Hide diff stats

  1. 16  install.rb
16  install.rb
@@ -3,18 +3,20 @@
3 3
 # Installer for httpclient
4 4
 
5 5
 require "rbconfig"
6  
-require "ftools"
  6
+require "fileutils"
7 7
 
8 8
 include Config
9 9
 
10  
-RV = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
11  
-SITELIBDIR = CONFIG["sitedir"] + "/" +  RV 
  10
+SITELIBDIR = CONFIG["sitelibdir"]
12 11
 SRCPATH = File.join(File.dirname($0), 'lib')
13 12
 
14 13
 def install_file(from, to)
15  
-  to_path = File.catname(from, to)
16  
-  unless FileTest.exist?(to_path) and File.compare(from, to_path)
17  
-    File.install(from, to_path, 0644, true)
  14
+  unless File.directory?(to)
  15
+    to = File.dirname(to)
  16
+  end
  17
+  to_path = File.join(to, File.basename(from))
  18
+  unless FileTest.exist?(to_path) and FileUtils.compare_file(from, to_path)
  19
+    FileUtils.install(from, to_path, :mode => 0644, :preserve => true, :verbose => true)
18 20
   end
19 21
 end
20 22
 
@@ -23,7 +25,7 @@ def install(*path)
23 25
   if FileTest.directory?(from_path)
24 26
     to_path_sitelib = File.join(SITELIBDIR, *path)
25 27
     Dir[File.join(from_path, '*.rb')].each do |name|
26  
-      File.mkpath(to_path_sitelib, true)
  28
+      FileUtils.mkdir_p(to_path_sitelib)
27 29
       install_file(name, to_path_sitelib)
28 30
     end
29 31
   else

0 notes on commit 5ff4274

Please sign in to comment.
Something went wrong with that request. Please try again.