home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # Copyright (c) 1995 by Cayenne Software Inc., Delft, The Netherlands.
- #
- # This software is furnished under a license and may be used only in
- # accordance with the terms of such license and with the inclusion of
- # the above copyright notice. This software or any other copies thereof
- # may not be provided or otherwise made available to any other person.
- # No title to and ownership of the software is hereby transferred.
- #
- # The information in this software is subject to change without notice
- # and should not be construed as a commitment by Cayenne Software Inc..
- #
- #---------------------------------------------------------------------------
- #
- # File : @(#)config_ne.tcl /main/hindenburg/1
- # Original date : 28-02-1995
- # Description : Script for NewEra configuration. Currently this means
- # copying files from lw4omtne to the user environment
- # at configuration level.
- #
- #---------------------------------------------------------------------------
- #
-
- source [m4_path_name tcl cginit.tcl]
-
- require wmt_util.tcl
-
- proc config_newera {} {
- set clientContext [ClientContext::global]
- set configV [$clientContext currentConfig]
- if {[$configV isNil]} {
- puts "Open a configuration to configure first"
- return
- }
- set confName [[$configV config] name]
- set confVersion [$configV versionName]
- set header_line "Configure NewEra class library for configuration\
- version '${confName}.${confVersion}'"
- while {"true"} {
- puts "\n\t$header_line"
- puts "\t[print_n [string length $header_line] -]\n"
- puts "\ti.\tInstall library"
- puts "\tr.\tRemove library"
- puts -nonewline "\n\tChoice (q to quit): "
- set answer [gets stdin]
- if {$answer == "q"} {
- return
- }
- if {$answer == "r"} {
- do_rm
- continue
- }
- if {$answer == "i"} {
- do_install
- continue
- }
- }
- }
-
- proc print_n {count symbol} {
- if {$count <= 0} {
- return
- }
- set result ""
- incr count -1
- while {$count} {
- incr count -1
- append result $symbol
- }
- append result $symbol
- }
-
- proc m4basedir {} {
- set clientContext [ClientContext::global]
- set configV [$clientContext currentConfig]
- if {[$configV isNil]} {
- return ""
- }
- return [$configV path]
- }
-
- proc do_rm {} {
- set clientContext [ClientContext::global]
- set configV [$clientContext currentConfig]
- if {[$configV isNil]} {
- puts "Open a configuration first"
- return
- }
- set verbose 1
- puts ""
- set pdir [$configV path]
- if [file exists [location $pdir src]] {
- puts "Removing directory [location $pdir src]"
- BasicFS::removeDirAll [location $pdir src]
- }
-
- if [file exists [location $pdir include]] {
- puts "Removing directory [location $pdir include]"
- BasicFS::removeDirAll [location $pdir include]
- }
- }
-
- proc do_install {} {
- m4copydir [location src lw4omtne]
- }
-
- proc m4copydir {dir} {
- set save_dir [pwd]
- set loc [location config $dir]
- if [catch {set cddir [m4_path_name $loc main.4gl]}] {
- return
- }
- set clientContext [ClientContext::global]
- set configV [$clientContext currentConfig]
- if {[$configV isNil]} {
- puts "Open a configuration first"
- return
- }
- cd [path_name directory $cddir]
- set base [$configV path]
-
- set files [glob -nocomplain *.4gl]
- set dest [location $base $dir]
- if {! [file exist $dest]} {
- mkdir -path [list $dest]
- }
- foreach file $files {
- puts "cp $file $dest"
- copy_text_file $file [location $dest $file]
- }
-
- set files [glob -nocomplain *.4gh]
- set dest [location $base include]
- if {! [file exist $dest]} {
- mkdir -path [list $dest]
- }
- foreach file $files {
- puts "cp $file $dest"
- copy_text_file $file [location $dest $file]
- }
-
- puts ""
- puts "Now build the library by using the NewEra Application Builder."
-
- cd $save_dir
- }
-
- config_newera
-