-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.rb
61 lines (49 loc) · 1.66 KB
/
install.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/ruby -w
require "rbconfig"
require "fileutils"
require "ftools"
module Percolate
Package = "percolate-mail"
class Install
def self.install(prefix=nil, opts = {})
include Config
if opts[:destdir]
destdir = opts[:destdir]
else
destdir = '/'
end
if prefix then
dest = File.join destdir, prefix, "lib"
else
version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
sitedir = CONFIG["sitedir"]
dest = File.join(destdir,sitedir,version)
end
FileUtils.mkdir_p dest
destper = File.join(dest,"percolate")
print "Installing #{Package}.rb in #{dest}...\n"
File.install(File.join("lib","#{Package}.rb"), dest, 0644)
FileUtils.mkdir_p destper
Dir.glob(File.join("lib","percolate","*.rb")).each { |f|
puts "Installing #{f} in #{destper}..."
File.install(f,destper)
}
FileUtils.mkdir_p File.join(destper, "smtp");
Dir.glob(File.join("lib", "percolate", "smtp", "*.rb")).each do |f|
puts "Installing #{f} in #{destper}/smtp..."
File.install(f,File.join(destper,"smtp"))
end
end
end
end
if __FILE__ == $0 then
$destdir = nil
require 'optparse'
opts = OptionParser.new do |o|
o.on("--destdir DESTDIR", String, "Install into DESTDIR") do |p|
$destdir = p
end
end
opts.parse(ARGV)
Percolate::Install.install(nil, :destdir => $destdir)
end