| 1 |
#!/usr/bin/env ruby |
|---|
| 2 |
|
|---|
| 3 |
require 'rbconfig' |
|---|
| 4 |
require 'ftools' |
|---|
| 5 |
require '_installedFiles' |
|---|
| 6 |
|
|---|
| 7 |
include Config |
|---|
| 8 |
|
|---|
| 9 |
RV = CONFIG["MAJOR"] + "." + CONFIG["MINOR"] |
|---|
| 10 |
DSTPATH = CONFIG["sitedir"] + "/" + RV |
|---|
| 11 |
|
|---|
| 12 |
$installed = InstalledFiles.new |
|---|
| 13 |
|
|---|
| 14 |
def join( *arg ) |
|---|
| 15 |
File.join( *arg ) |
|---|
| 16 |
end |
|---|
| 17 |
|
|---|
| 18 |
def install( from, to ) |
|---|
| 19 |
toPath = File.catname( from, to ) |
|---|
| 20 |
unless FileTest.exist?( toPath ) and File.compare( from, toPath ) |
|---|
| 21 |
File.install( from, toPath, 0644, true ) |
|---|
| 22 |
$installed << InstalledFile.new( toPath ) |
|---|
| 23 |
end |
|---|
| 24 |
end |
|---|
| 25 |
|
|---|
| 26 |
begin |
|---|
| 27 |
unless FileTest.directory?( join( 'lib', 'soap' )) |
|---|
| 28 |
raise RuntimeError.new( "'lib/soap' not found." ) |
|---|
| 29 |
end |
|---|
| 30 |
unless FileTest.directory?( "redist" ) |
|---|
| 31 |
raise RuntimeError.new( "'redist' not found." ) |
|---|
| 32 |
end |
|---|
| 33 |
unless FileTest.directory?( join( 'redist', 'soap' )) |
|---|
| 34 |
raise RuntimeError.new( "'redist/soap' not found." ) |
|---|
| 35 |
end |
|---|
| 36 |
|
|---|
| 37 |
File.mkpath( join( DSTPATH, 'soap' ), true ) |
|---|
| 38 |
Dir[ 'lib/soap/*.rb' ].each do | name | |
|---|
| 39 |
install( name, join( DSTPATH, 'soap' )) |
|---|
| 40 |
end |
|---|
| 41 |
Dir[ 'redist/soap/*.rb' ].each do | name | |
|---|
| 42 |
install( name, join( DSTPATH, 'soap' )) |
|---|
| 43 |
end |
|---|
| 44 |
Dir[ 'redist/*.rb' ].each do | name | |
|---|
| 45 |
install( name, DSTPATH ) |
|---|
| 46 |
end |
|---|
| 47 |
|
|---|
| 48 |
$installed.dump |
|---|
| 49 |
|
|---|
| 50 |
puts "install succeed!" |
|---|
| 51 |
|
|---|
| 52 |
rescue |
|---|
| 53 |
puts "install failed!" |
|---|
| 54 |
puts $! |
|---|
| 55 |
|
|---|
| 56 |
end |
|---|