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

root/tags/RELEASE_1_5_5/install.rb

Revision 1557, 2.0 kB (checked in by nahi, 4 years ago)

install xmlscan if redist directory contains it. closes #22.

  • 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
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(srcbase, *path)
21   from_path = File.join(srcbase, *path)
22   unless FileTest.directory?(from_path)
23     raise RuntimeError.new("'#{ from_path }' not found.")
24   end
25   to_path_rubylib = File.join(RUBYLIBDIR, *path)
26   to_path_sitelib = File.join(SITELIBDIR, *path)
27   Dir[File.join(from_path, '*.rb')].each do |from_file|
28     basename = File.basename(from_file)
29     to_file_rubylib = File.join(to_path_rubylib, basename)
30     to_file_sitelib = File.join(to_path_sitelib, basename)
31     if File.exist?(to_file_rubylib)
32       if File.exist?(to_file_sitelib)
33         raise RuntimeError.new(
34           "trying to install '#{ to_file_rubylib }' but '#{ to_file_sitelib }' exists.  please remove '#{ to_file_sitelib }' first to avoid versioning problem and run installer again.")
35       end
36       install(from_file, to_path_rubylib)
37     else
38       File.mkpath(to_path_sitelib, true)
39       install(from_file, to_path_sitelib)
40     end
41   end
42 end
43
44 begin
45   install_dir(SRCPATH, 'soap')
46   install_dir(SRCPATH, 'soap', 'rpc')
47   install_dir(SRCPATH, 'soap', 'mapping')
48   install_dir(SRCPATH, 'soap', 'encodingstyle')
49   install_dir(SRCPATH, 'soap', 'header')
50   install_dir(SRCPATH, 'wsdl')
51   install_dir(SRCPATH, 'wsdl', 'xmlSchema')
52   install_dir(SRCPATH, 'wsdl', 'soap')
53   install_dir(SRCPATH, 'xsd')
54   install_dir(SRCPATH, 'xsd', 'codegen')
55   install_dir(SRCPATH, 'xsd', 'xmlparser')
56
57   # xmlscan
58   xmlscansrcdir = File.join('redist', 'xmlscan', 'xmlscan-20050522', 'lib')
59   if File.exists?(xmlscansrcdir)
60     install_dir(xmlscansrcdir, 'xmlscan')
61   end
62
63   puts "install succeed!"
64
65 rescue
66   puts "install failed!"
67   puts $!
68
69 end
Note: See TracBrowser for help on using the browser.