File: install.rb

package info (click to toggle)
librexml-ruby 1.2.5-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 792 kB
  • ctags: 655
  • sloc: ruby: 3,778; xml: 1,609; java: 109; makefile: 43
file content (43 lines) | stat: -rw-r--r-- 753 bytes parent folder | download
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
#! /usr/bin/env ruby

require 'getoptlong'
require 'rbconfig'
require 'ftools'
require 'find'

SRC = 'rexml'


INSTDIR = File.join ENV['DESTDIR'], Config::CONFIG['rubylibdir']
DESTDIR = File.join INSTDIR, SRC

opts = GetoptLong.new( [ "--uninstall",	"-u",		GetoptLong::NO_ARGUMENT ] )

def install
	begin
		File.makedirs( DESTDIR )
		Find.find(SRC) { |file|
			dst = File.join( INSTDIR, file )
			File.makedirs(File.dirname(dst))
			File.install(file, dst, 0644, true) if file =~ /\.rb$/ and not /\.svn/
		}
	rescue
		puts $!
	end
end

def uninstall
	begin
		puts "Deleting:"
		Find.find(DESTDIR) { |file| File.rm_f file,true }
		puts DESTDIR
		Dir.delete DESTDIR
	rescue
	end
end

if (opt = opts.get) and opt[0] =~ /^-?-u/
	uninstall
else
	install
end