[Ruby-session-devel-cvs] CVS: ruby-session Makefile,NONE,1.1 install.rb,NONE,1.1 uninstall.rb,NONE,1
Status: Alpha
Brought to you by:
thetitan
|
From: Sean C. <the...@us...> - 2001-08-25 21:44:42
|
Update of /cvsroot/ruby-session/ruby-session
In directory usw-pr-cvs1:/tmp/cvs-serv22294
Added Files:
Makefile install.rb uninstall.rb
Log Message:
Added installation/uninstallation targests and scripts
--- NEW FILE: Makefile ---
# $Id: Makefile,v 1.1 2001/08/25 21:44:39 thetitan Exp $
install:
@ruby install.rb
uninstall:
@ruby uninstall.rb
--- NEW FILE: install.rb ---
#! /usr/bin/env ruby
#
# Copyright (c) 2001 by Sean Chittenden <se...@ch...>
# Adapted from an install script originally by Jim Menard <ji...@io...>
#
=begin
= Introduction
This script installs ruby-session into the Ruby site-local library directory.
= Usage
install.rb
=end
require 'getoptlong'
require 'ftools'
require 'find'
SRCDIR = 'src'
def instdir
g = GetoptLong.new(['--install-dir', '-i', GetoptLong::REQUIRED_ARGUMENT])
g.each { | name, arg |
if name == '--install-dir'
return arg
else
$stderr.puts "usage: $0 [--install-dir dir]"
end
}
begin
require 'rbconfig'
libdir = Config::CONFIG['sitedir'] + "/" +
Config::CONFIG['MAJOR'] + "." +
Config::CONFIG['MINOR']
rescue ScriptError
$LOAD_PATH.each do |l|
if l =~ /site_ruby/ && l =~ /\d$/ && l !~ /#{PLATFORM}/
libdir = l
break
end
end
STDERR.puts "Can't find required file `rbconfig.rb'."
STDERR.puts "The `ruby-tmpl' files need to be installed manually in" +
" #{libdir}"
end
return libdir
end
INSTALL_DIR = instdir()
File.makedirs(File.join(INSTALL_DIR, 'apache','session'))
Find.find(SRCDIR) { |f|
File.install(f, File.join(INSTALL_DIR, f).gsub!(/#{SRCDIR}/, ''), 0644, true) if f =~ /.rb$/
}
--- NEW FILE: uninstall.rb ---
#! /usr/bin/env ruby
#
# Copyright (c) 2001 by Sean Chittenden <se...@ch...>
# Adapted from an install script originally by Jim Menard <ji...@io...>
#
=begin
= Introduction
This script uninstalls ruby-session from the Ruby site-local library directory.
= Usage
uninstall.rb
=end
require 'getoptlong'
require 'ftools'
require 'find'
SRCDIR = 'src'
def instdir
g = GetoptLong.new(['--install-dir', '-i', GetoptLong::REQUIRED_ARGUMENT])
g.each { | name, arg |
if name == '--install-dir'
return arg
else
$stderr.puts "usage: $0 [--install-dir dir]"
end
}
begin
require 'rbconfig'
libdir = Config::CONFIG['sitedir'] + "/" +
Config::CONFIG['MAJOR'] + "." +
Config::CONFIG['MINOR']
rescue ScriptError
$LOAD_PATH.each do |l|
if l =~ /site_ruby/ && l =~ /\d$/ && l !~ /#{PLATFORM}/
libdir = l
break
end
end
STDERR.puts "Can't find required file `rbconfig.rb'."
STDERR.puts "The `ruby-tmpl' files need to be installed manually in" +
" #{libdir}"
end
return libdir
end
INSTALL_DIR = instdir()
dirs = []
Find.find(SRCDIR) { |f|
fm = File.join(INSTALL_DIR, f).gsub(/#{Regexp.escape(SRCDIR)}/, '')
begin
File.delete(fm) if fm =~ /.rb$/
rescue Errno::ENOENT
$stderr.puts "#{fm} does not exist"
end
begin
if File.stat(fm).directory?
dirs.push(String.new(fm))
end
rescue Errno::ENOENT
# NO OP
end
}
dirs.each {|d|
begin
Dir.delete(d)
rescue Errno::ENOTEMPTY
# NO OP
end
}
|