require "rbconfig"
require "ftools"
include Config

sitedir = CONFIG['sitelibdir']

files = %w/format.rb olewriter.rb biffwriter.rb workbook.rb worksheet.rb excel.rb/

begin
   unless File.exist?("#{sitedir}/spreadsheet")
      Dir.mkdir("#{sitedir}/spreadsheet")
   end
   files.each{ |f|
      f = "spreadsheet/" + f
      puts "cp #{f} #{sitedir}/spreadsheet"
      File.copy(f,"#{sitedir}/spreadsheet")
   }
rescue
   puts "Unable to copy files to sitelibdir [#{sitedir}]: " + $!
   exit
end

puts "Spreadsheet/Excel installed successfully"
