Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

root/tags/RELEASE_1_4_3/uninstall.rb

Revision 458, 1.2 kB (checked in by nahi, 7 years ago)

Added uninstaller.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to author date id revision
Line 
1 #!/usr/bin/env ruby
2
3 require 'rbconfig'
4 require 'ftools'
5 require '_installedFiles'
6
7 include Config
8
9 RV = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
10 DSTPATH = CONFIG["sitedir"] + "/" +  RV
11
12 $installed = InstalledFiles.new
13
14 def join( *arg )
15   File.join( *arg )
16 end
17
18 def uninstall( name, path )
19   filePath = join( path, File.basename( name ))
20   if FileTest.exist?( filePath )
21     target = InstalledFile.new( filePath )
22     if $installed.uninstall( target )
23       STDERR.puts "File: #{ target.path } uninstalled."
24     end
25   end
26 end
27
28 def delPath( dirPath )
29   entries = Dir.entries( dirPath )
30   entries.delete( "." )
31   entries.delete( ".." )
32
33   if entries.empty?
34     Dir.unlink( dirPath )
35   else
36     STDERR.puts "Directory: #{ dirPath } is not empty.  The directory is not removed."
37   end
38 end
39
40 begin
41   Dir[ 'lib/soap/*.rb' ].each do | name |
42     uninstall( name, join( DSTPATH, 'soap' ))
43   end
44   Dir[ 'redist/soap/*.rb' ].each do | name |
45     uninstall( name, join( DSTPATH, 'soap' ))
46   end
47   Dir[ 'redist/*.rb' ].each do | name |
48     uninstall( name, DSTPATH )
49   end
50
51   delPath( join( DSTPATH, 'soap' ))
52
53   $installed.dump
54
55   puts "uninstall succeed!"
56
57 rescue
58   puts "uninstall failed!"
59   puts $!
60
61 end
Note: See TracBrowser for help on using the browser.