summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphan Gorget <phantez@gmail.com>2009-11-05 00:51:34 +0100
committerStéphan Gorget <phantez@gmail.com>2009-11-05 00:51:34 +0100
commit5412eab12df89a7a701ffea4f5dfb98d0f56985e (patch)
treed0e5dddee68b5e5aa9c774e114e15f6b6d3ec47f
parent5b95a128f369615cb7d7c08f8a9047cc9b44d3f3 (diff)
downloadfacter-5412eab12df89a7a701ffea4f5dfb98d0f56985e.tar.gz
facter-5412eab12df89a7a701ffea4f5dfb98d0f56985e.tar.xz
facter-5412eab12df89a7a701ffea4f5dfb98d0f56985e.zip
Fixed : 2788 - ftools missing in Ruby 1.9
Signed-off-by: Stéphan Gorget <phantez@gmail.com>
-rwxr-xr-xinstall.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/install.rb b/install.rb
index ec16c4b..1280f04 100755
--- a/install.rb
+++ b/install.rb
@@ -35,7 +35,13 @@
require 'rbconfig'
require 'find'
require 'fileutils'
-require 'ftools' # apparently on some system ftools doesn't get loaded
+begin
+ require 'ftools' # apparently on some system ftools doesn't get loaded
+ $haveftools = true
+rescue LoadError
+ puts "ftools not found. Using FileUtils instead.."
+ $haveftools = false
+end
require 'optparse'
require 'ostruct'
@@ -91,9 +97,15 @@ def do_libs(libs, strip = 'lib/')
libs.each do |lf|
olf = File.join(InstallOptions.site_dir, lf.gsub(/#{strip}/, ''))
op = File.dirname(olf)
- File.makedirs(op, true)
- File.chmod(0755, op)
- File.install(lf, olf, 0644, true)
+ if $haveftools
+ File.makedirs(op, true)
+ File.chmod(0755, op)
+ File.install(lf, olf, 0644, true)
+ else
+ FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
+ FileUtils.chmod(0755, op)
+ FileUtils.install(lf, olf, {:mode => 0644, :verbose => true})
+ end
end
end