install-rb_for_ruby-1-9-1.diff

Al Hoang, 09/08/2009 04:44 pm

Download (1.7 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

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

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