home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cvs110.zip / cvs / jCVS-4.7.2 / install.cmd < prev   
OS/2 REXX Batch file  |  1998-08-04  |  4KB  |  126 lines

  1. /*
  2. ** $Id: install.cmd,v 1.1 1998/08/05 02:31:23 ahuber Exp $
  3. **
  4. ** Create a jCVS folder and install the program object and the
  5. ** HTML documentation.
  6. **
  7. ** Copyright (C) 1998  Andreas Huber <ahuber@ping.at>
  8. **
  9. ** This program is free software; you can redistribute it and/or
  10. ** modify it under the terms of the GNU General Public License
  11. ** as published by the Free Software Foundation; either version 2
  12. ** of the License, or (at your option) any later version.
  13. **
  14. ** This program is distributed in the hope that it will be useful,
  15. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ** GNU General Public License for more details.
  18. **
  19. ** You should have received a copy of the GNU General Public License
  20. ** along with this program; see the file COPYING. If not, write to
  21. ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  22. ** Boston, MA 02111-1307, USA.
  23. */
  24. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  25. call SysLoadFuncs
  26.  
  27. EXIT_SUCCESS = 0
  28. EXIT_FAILURE = 1
  29.  
  30. LOCATION = '<JCVS_FOLDER>'
  31.  
  32. NL = d2c(13)||d2c(10)
  33.  
  34. globals = 'EXIT_SUCCESS EXIT_FAILURE LOCATION argc argv. NL'
  35.  
  36. main:
  37.     argc = 2; argv. = ''; argv.0 = 'install'; argv.1 = arg(1)
  38.     if argv.1 \= '' then
  39.         install_dir = directory(argv.1)
  40.     else
  41.         install_dir = directory()
  42.     call make_jcvs
  43.     call make_folder 'jCVS'
  44.     call make_javapm install_dir||'/application', 'jCVS',,
  45.         './jcvs.jar', 'com.ice.jcvs.CVSApplication'
  46.     call make_file_url 'Read me!', install_dir||'/doc/README.html'
  47.     exit EXIT_SUCCESS
  48.  
  49. make_jcvs: procedure expose (globals)
  50.     'cd source'
  51.     'javac -O -depend com\ice\jcvs\CVSApplication.java'
  52.     'jar -cf ..\application\jcvs.jar',
  53.         'com\ice\jcvs\*.class',
  54.         'com\ice\cvsc\*.class',
  55.         'com\ice\jcvs\images\*.gif',
  56.         'com\ice\jcvs\images\icons\*.gif'
  57.     'del com\ice\jcvs\*.class >nul 2>&1'
  58.     'del com\ice\cvsc\*.class >nul 2>&1'
  59.     'cd ..'
  60.     return
  61.  
  62. make_folder: procedure expose (globals) LOCATION
  63.     parse arg title
  64.     if \SysCreateObject('WPFolder', title, '<WP_DESKTOP>',,
  65.             'OBJECTID='||LOCATION, 'update') then
  66.         call die 'Cannot create folder.'
  67.     return
  68.  
  69. make_javapm: procedure expose (globals) LOCATION
  70.     parse arg dir, title, classpath, class
  71.     dir = translate(dir, '\', '/')
  72.     classpath = classpath||';'||find_classes()
  73.     classpath = translate(classpath, '\', '/')
  74.     classpath = escape_path(classpath)
  75.     if \SysCreateObject('WPProgram', title, LOCATION,,
  76.             'PROGTYPE=PM;EXENAME=JAVAPM.EXE;STARTUPDIR='||dir||';'||,
  77.             'PARAMETERS=-classpath' classpath class, 'update') then
  78.         call die 'Cannot create program object.'
  79.     return
  80.  
  81. make_file_url: procedure expose (globals) LOCATION
  82.     parse arg title, path
  83.     path = translate(path, '\', '/')
  84.     call make_url title, 'file:///'||path
  85.     return
  86.  
  87. make_url: procedure expose (globals) LOCATION
  88.     parse arg title, url
  89.     if \SysCreateObject('WPUrl', title, LOCATION,,
  90.             'URL='||url, 'update') then
  91.         call die 'Cannot create URL object.'
  92.     return
  93.  
  94. escape_path: procedure expose (globals)
  95.     parse arg path
  96.     i = 1
  97.     do forever
  98.         i = pos(';', path, i)
  99.         if i = 0 then leave
  100.         path = insert('^', path, i-1);
  101.         i = i+2
  102.     end
  103.     return path
  104.  
  105. find_classes: procedure expose (globals)
  106.     java_home = value('JAVA_HOME',, 'OS2ENVIRONMENT')
  107.     if java_home \= '' then
  108.         return java_home||'\lib\classes.zip'
  109.     classpath = value('CLASSPATH',, 'OS2ENVIRONMENT')
  110.     do forever
  111.         parse var classpath classes ';' classpath
  112.         if classes = '' then
  113.             call die ,
  114. 'Couldn''t find lib\classes.zip in either your %JAVA_HOME%'||NL,
  115. ' directory or in your %CLASSPATH%. Set the JAVA_HOME environment'||NL,
  116. ' variable to point to your Java home directory and retry.'
  117.         if translate(right(classes, 16)) = '\LIB\CLASSES.ZIP' then leave
  118.     end
  119.     return classes
  120.  
  121. die: procedure expose (globals)
  122.     parse arg text
  123.     call lineout 'stderr:', argv.0||': '||text
  124.     exit EXIT_FAILURE
  125.  
  126.