home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / msumlinsta.tcl < prev    next >
Text File  |  1997-06-03  |  4KB  |  120 lines

  1. # Copyright (c) 1997 by Cayenne Software Inc.
  2. #
  3. # This software is furnished under a license and may be used only in
  4. # accordance with the terms of such license and with the inclusion of
  5. # the above copyright notice. This software or any other copies thereof
  6. # may not be provided or otherwise made available to any other person.
  7. # No title to and ownership of the software is hereby transferred.
  8. #
  9. # The information in this software is subject to change without notice
  10. # and should not be construed as a commitment by Cayenne Software Inc
  11. #
  12. #---------------------------------------------------------------------------
  13. #
  14. #       File            : @(#)msumlinsta.tcl    /main/hindenburg/2
  15. #       Author          : H. Broeze
  16. #       Original date   : 12 Febuary 1997
  17. #       Description     : MS Repository project configuration
  18. #
  19. #---------------------------------------------------------------------------
  20. #
  21. source [m4_path_name tcl libocl.tcl]
  22.  
  23. set requiredEtcFiles "msumldesk.mnu"
  24.  
  25. #check arguments
  26. if { [llength $argv] != 1} {
  27.         puts "ERROR: invalid number of arguments"
  28.         puts "USAGE: otsh -f <M4_home>/contrib/ObjectTeamMsRepUml/tcl/msumlinsta.tcl -- <OT project name>"
  29.         exit
  30. }
  31.  
  32.  
  33. # check the existance of the required custom files
  34. #
  35. set M4home [m4_var get M4_home]
  36. set fullFileName [path_name concat $M4home contrib] 
  37. set fullFileName [path_name concat $fullFileName ObjectTeamMsRepUml]
  38. set fullFileName [path_name concat $fullFileName etc]
  39. set fullFileName [path_name concat $fullFileName msumldesk.mnu]
  40.  
  41. if ![file isfile $fullFileName] {
  42.     puts "Required etc-file $fullFileName does not exist"
  43.     exit
  44. }
  45.  
  46. # Just some help features
  47. #
  48. proc CustomName {name} {
  49.     set entries [split $name '.']
  50.     return [lindex $entries 0]
  51. }
  52. proc CustomType {name} {
  53.     set entries [split $name '.']
  54.     return [lindex $entries 1]
  55. }
  56.  
  57.  
  58.  
  59. # Append a file
  60. #
  61. proc append_text_file {from to } {
  62.         set max 8092
  63.         set in [open $from r]
  64.         set out [open $to a]
  65.         while {[set result [read $in $max]] != ""} {
  66.                 puts $out $result nonewline
  67.         }
  68.         close $in
  69.         close $out
  70. }
  71.  
  72. set cont [ClientContext::global]
  73. set corp [$cont currentCorporate]
  74. if [$corp isNil] {
  75.         puts "LevelPath [$cont currentLevelString] has no corporate"
  76.         exit
  77. }
  78. set projName  [lindex $argv 0]
  79. set project [$corp findProject $projName]
  80. if [$project isNil] {
  81.         puts "Project $projName does not exist"
  82.         exit
  83. }
  84.  
  85. set etcFile $requiredEtcFiles 
  86. #for 
  87.  
  88. set installEtcFileName [CustomName $etcFile]
  89. set etcFileName "desk"
  90. set customFileV [$project findCustomFileVersion  \
  91.                 $etcFileName [CustomType $etcFile]]
  92. if ![$customFileV isNil] {
  93.     $customFileV edit
  94.     $customFileV quit
  95. }
  96.  
  97. set etcFile $requiredEtcFiles 
  98. # for loop
  99. set concatTmpFile [args_file {}]
  100. set installEtcFileName [CustomName $etcFile]
  101. set etcFileName "desk"
  102. set customFileV [$project findCustomFileVersion  \
  103.                 $etcFileName [CustomType $etcFile]]
  104.  
  105. if [$customFileV isNil] {
  106.     set customFileV [$project createCustomFileVersion \
  107.                 $etcFileName [CustomType $etcFile] ]
  108. } else {
  109.     $customFileV downLoad $concatTmpFile
  110. }
  111.  
  112. append_text_file  $fullFileName $concatTmpFile
  113. $customFileV edit
  114. $customFileV upLoad $concatTmpFile
  115. $customFileV quit
  116.  
  117. puts "Installation of MSRepository integration menu extension finished."
  118. puts "After reentering your project in ObjectTeam the Utilities menu will be extended when you are at config or phase level"
  119.  
  120.