home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / config_pb.tcl < prev    next >
Text File  |  1997-04-10  |  2KB  |  79 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc. 1996
  4. #
  5. #      File:        @(#)config_pb.tcl    /main/hindenburg/4
  6. #      Author:         
  7. #      Description:    Configure PB Environment, i.e.:
  8. #        - in ObjectDesign: import system 'PBBuiltins' with PB builtins
  9. #        - in Implementation: install Cayenne class library
  10. #---------------------------------------------------------------------------
  11. # SccsId = @(#)config_pb.tcl    /main/hindenburg/4   10 Apr 1997 Copyright 1996 Cayenne Software Inc.
  12.  
  13. proc m4copydir {dir} {
  14.     set save_dir [pwd]
  15.     set subdir [location config $dir]
  16.     if [catch {set cddir [location [m4_var get M4_home] $subdir]}] {
  17.         return
  18.     }
  19.     cd $cddir
  20.     set files [glob -nocomplain classlib.pbl *.sru]
  21.  
  22.         set cc [ClientContext::global]
  23.     set dest [location [[$cc currentPhase] path] src]
  24.     if {! [file exist $dest]} {
  25.         mkdir -path [list $dest]
  26.     }
  27.     set pblFile [path_name concat $dest classlib pbl]
  28.     if [file exist $pblFile] {
  29.         puts "PowerBuilder library '$pblFile' already exists. "
  30.         puts -nonewline "Do you want to continue? \[no\]: "
  31.         set answer [gets stdin]
  32.         switch -glob -- [string tolower $answer] {
  33.             y* {}
  34.             default {return}
  35.         }
  36.         puts ""
  37.     }
  38.     foreach file $files {
  39.         puts "Copying $file to $dest ..."
  40.         BasicFS::copyFile $file [location $dest $file]
  41.     }
  42.     cd $save_dir
  43. }    
  44.  
  45. proc importBuiltins {} {
  46.     set cc [ClientContext::global]
  47.     set phaseV [$cc currentPhase]
  48.     set sysV [$phaseV findSystemVersion "PBBuiltins" "system"]
  49.     if {![$sysV isNil]} {
  50.         puts -nonewline "System 'PBBuiltins' already exists. "
  51.         puts -nonewline "Do you want to continue? \[no\]: "
  52.         set answer [gets stdin]
  53.         switch -glob -- [string tolower $answer] {
  54.             y* {}
  55.             default {return}
  56.         }
  57.     }
  58.     set srcDir [location [m4_var get M4_home] config src PB]
  59.     set file [path_name concat $srcDir PBBuiltins tcl]
  60.     if {! [file exist $file]} {
  61.         puts "'Configure PB Environment' failed:\
  62.             file '$file' not found."
  63.     } else {
  64.         puts "Importing system 'PBBuiltins' ..."
  65.         source $file
  66.     }
  67. }
  68.  
  69. set cc [ClientContext::global]
  70. set phaseType [[[$cc currentPhase] phase] type]
  71. if {$phaseType == "ObjectDesign"} {
  72.     importBuiltins
  73. } elseif {$phaseType == "Implementation"} {
  74.     m4copydir [location src PB]
  75. } else {
  76.     puts "'Configure PB Environment' failed: invalid phase type '$phaseType'."
  77. }
  78.  
  79.