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