|
Revision 37, 1.0 kB
(checked in by nahi, 3 years ago)
|
removed svn:executable
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
author date id revision
|
| Line | |
|---|
| 1 |
#!/usr/bin/env ruby |
|---|
| 2 |
|
|---|
| 3 |
require 'rbconfig' |
|---|
| 4 |
require 'ftools' |
|---|
| 5 |
|
|---|
| 6 |
include Config |
|---|
| 7 |
|
|---|
| 8 |
RUBYLIBDIR = CONFIG["rubylibdir"] |
|---|
| 9 |
RV = CONFIG["MAJOR"] + "." + CONFIG["MINOR"] |
|---|
| 10 |
SITELIBDIR = CONFIG["sitedir"] + "/" + RV |
|---|
| 11 |
SRCPATH = File.join(File.dirname($0), 'lib') |
|---|
| 12 |
|
|---|
| 13 |
def install(from, to) |
|---|
| 14 |
to_path = File.catname(from, to) |
|---|
| 15 |
unless FileTest.exist?(to_path) and File.compare(from, to_path) |
|---|
| 16 |
File.install(from, to_path, 0644, true) |
|---|
| 17 |
end |
|---|
| 18 |
end |
|---|
| 19 |
|
|---|
| 20 |
def install_dir(*path) |
|---|
| 21 |
from_path = File.join(SRCPATH, *path) |
|---|
| 22 |
unless FileTest.directory?(from_path) |
|---|
| 23 |
raise RuntimeError.new("'#{ from_path }' not found.") |
|---|
| 24 |
end |
|---|
| 25 |
to_path_sitelib = File.join(SITELIBDIR, *path) |
|---|
| 26 |
Dir[File.join(from_path, '*.rb')].each do |name| |
|---|
| 27 |
basename = File.basename(name) |
|---|
| 28 |
File.mkpath(to_path_sitelib, true) |
|---|
| 29 |
install(name, to_path_sitelib) |
|---|
| 30 |
end |
|---|
| 31 |
end |
|---|
| 32 |
|
|---|
| 33 |
begin |
|---|
| 34 |
install_dir('pgp') |
|---|
| 35 |
install_dir('pgp', 'packet') |
|---|
| 36 |
install_dir('pgp', 'packet', 'sigsubpacket') |
|---|
| 37 |
install_dir('pgp', 'packet', 'userattrsubpacket') |
|---|
| 38 |
|
|---|
| 39 |
puts "install succeed!" |
|---|
| 40 |
|
|---|
| 41 |
rescue |
|---|
| 42 |
puts "install failed!" |
|---|
| 43 |
puts $! |
|---|
| 44 |
|
|---|
| 45 |
end |
|---|