Advertisement
Skreffnet

Untitled

May 24th, 2020
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.53 KB | None | 0 0
  1. /**
  2. *
  3. *  Crea los directorios necesarios
  4. *
  5. * @cons CREATESERVICE
  6. *
  7. * @param service devuelve el nombre del servicio a crear.
  8. *
  9. */
  10. alias CREATESERVICE {
  11.   if (!$1) {
  12.     error No ha especificado el nombre de ningún servicio.
  13.   }
  14.   if ($exists($+($BOTS_DIRECTORY,$1)) == $true) || ($exists($+($CLIENTS_DIRECTORY,$1)) == $true) {
  15.     error Ya existe un proyecto con este nombre en $iif($exists($+($BOTS_DIRECTORY,$1)),$qt($+($BOTS_DIRECTORY,$1)),$qt($+($CLIENTS_DIRECTORY,$1)))
  16.   }
  17.   if (!$2) {
  18.     error no ha especificado el tipo de proyecto. Opciones válidas: $+(Local,$chr(32),|,$chr(32),Cliente)
  19.   }
  20.   if ($2 == local) {
  21.     mkdir $+($MAIN_FOLDER,\Bots\ $+ $1 $+ \)
  22.   }
  23.   elseif ($2 == cliente) {
  24.     mkdir $+($MAIN_FOLDER,\Clientes\ $+ $1 $+ \)
  25.   }
  26.   else {
  27.     error La opción $2 no es válida. $+(Local,$chr(32),|,$chr(32),Cliente)
  28.   }
  29.   alias SERVICE_NAME { return $1 }
  30.  
  31.   mkdir $+($MAIN_FOLDER,\Data\ $+ $1 $+ \)
  32.   mkdir $+($MAIN_FOLDER,\src\ $+ $1 $+ \)
  33.   mkdir $+($MAIN_FOLDER,\src\ $+ $1 $+ \modules)
  34.   mkdir $+($MAIN_FOLDER,\src\ $+ $1 $+ \public)
  35.   mkdir $+($MAIN_FOLDER,\src\ $+ $1 $+ \Documentacion\)
  36.  
  37.   copy -o $+($MAIN_FOLDER,\src\templates\CHANGELOG.md) $+($MAIN_FOLDER,\src\ $+ $SERVICE_NAME $+ \CHANGELOG.md)
  38.   var %archivo = $+($MAIN_FOLDER,\src\ $+ $1 $+ \CHANGELOG.md)
  39.   var %lineas = $lines(%archivo)
  40.   while (%lineas) {
  41.     if ($+($chr(36),SERVICE_NAME) ISIN $read(%archivo,%lineas) {
  42.       write -l $+ %lineas %archivo $replace($read(%archivo),%lineas),$+($chr(36),SERVICE_NAME),$me)
  43.     }
  44.     dec %lineas
  45.     if (%lineas == 0) {
  46.       write -l9 %archivo $read(%archivo,9) $asctime(yyyy-mm-dd)
  47.       write -l10 %archivo + Se crea el proyecto de $me
  48.     }
  49.   }
  50.   copy -o $+($MAIN_FOLDER,\src\templates\README.md) $+($MAIN_FOLDER,\src\ $+ $SERVICE_NAME $+ \README.md)
  51.   copy -o $+($MAIN_FOLDER,\src\templates\loader.mRC) $+($MAIN_FOLDER,\src\ $+ $SERVICE_NAME $+ \loader.mRC)
  52.   copy -o $+($MAIN_FOLDER,\src\templates\tools.mRC) $+($MAIN_FOLDER,\src\ $+ $SERVICE_NAME $+ \tools.mRC)
  53.   copy -o $+($MAIN_FOLDER,\src\templates\definitions.mRC) $+($MAIN_FOLDER,\src\ $+ $SERVICE_NAME $+ \definitions.mRC)
  54.   success Plantilla copiada correctamente.
  55.   echo -s 
  56.   echo -s Estructura para $1
  57.   echo -s 
  58.   echo -s $+($MAIN_FOLDER,\Bots\ $+ $1 $+ \)
  59.   echo -s $+($MAIN_FOLDER,\Data\ $+ $1 $+ \)
  60.   echo -s $+($MAIN_FOLDER,\src\ $+ $1 $+ \)
  61.   echo -s $+($MAIN_FOLDER,\src\ $+ $1 $+ \modules\)
  62.   echo -s $+($MAIN_FOLDER,\src\ $+ $1 $+ \public\)
  63.   echo -s $+($MAIN_FOLDER,\src\ $+ $1 $+ \Documentacion\)
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement