ruby-1-9-1_ftools.diff

Al Hoang, 09/07/2009 04:18 pm

Download (1.8 kB)

b/install.rb
35 35
require 'rbconfig'
36 36
require 'find'
37 37
require 'fileutils'
38
require 'ftools' # apparently on some system ftools doesn't get loaded
38
begin
39
  require 'ftools' # apparently on some system ftools doesn't get loaded
40
  $haveftools = true
41
rescue LoadError
42
  puts "ftools not found.  Using FileUtils instead.."
43
  $haveftools = false
44
end
39 45
require 'optparse'
40 46
require 'ostruct'
41 47

  
......
91 97
    libs.each do |lf|
92 98
        olf = File.join(InstallOptions.site_dir, lf.gsub(/#{strip}/, ''))
93 99
        op = File.dirname(olf)
94
        File.makedirs(op, true)
95
        File.chmod(0755, op)
96
        File.install(lf, olf, 0644, true)
100
        if $haveftools
101
          File.makedirs(op, true)
102
          File.chmod(0755, op)
103
          File.install(lf, olf, 0644, true)
104
        else
105
          FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
106
          FileUtils.chmod(0755, op)
107
          FileUtils.install(lf, olf, {:mode => 0644, :verbose => true})
108
        end
97 109
    end
98 110
end
99 111

  
......
101 113
    man.each do |mf|
102 114
        omf = File.join(InstallOptions.man_dir, mf.gsub(/#{strip}/, ''))
103 115
        om = File.dirname(omf)
104
        File.makedirs(om, true)
105
        File.chmod(0644, om)
106
        File.install(mf, omf, 0644, true)
116
        if $haveftools
117
          File.makedirs(om, true)
118
          File.chmod(0644, om)
119
          File.install(mf, omf, 0644, true)
120
        else
121
          FileUtils.makedirs(om, {:mode => 0755, :verbose => true})
122
          FileUtils.chmod(0755, om)
123
          FileUtils.install(mf, omf, {:mode => 0644, :verbose => true})
124
        end
107 125
        gzip = %x{which gzip}
108 126
        gzip.chomp!
109 127
        %x{#{gzip} -f #{omf}}