Last active
August 29, 2015 14:05
-
-
Save danbradham/40c915467cebb7e0141e to your computer and use it in GitHub Desktop.
Deploy a package from a github repo, to a local or remote location.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
SET GIT_REPOS=\path\to\git_repos | |
SET REMOTE_ROOT=\\remote\deploy\location | |
SET LOCAL_ROOT=%USERPROFILE%\Documents\maya\2015-x64\scripts | |
if "%1"=="-h" ( GOTO :help_msg ) | |
if "%1"=="--help" ( GOTO :help_msg ) | |
if "%1"=="-l" ( GOTO :list_packs ) | |
if "%1"=="--list" ( GOTO :list_packs ) | |
if "%1"=="--local" ( GOTO :local ) | |
if "%1"=="--remote" ( GOTO :remote ) | |
GOTO :help_msg | |
:local | |
ECHO DEPLOYING LOCALLY | |
SET DEST_ROOT=%LOCAL_ROOT% | |
GOTO :deploy | |
:remote | |
ECHO DEPLOYING REMOTELY | |
SET DEST_ROOT=%REMOTE_ROOT% | |
GOTO :deploy | |
:deploy | |
if "%~2"=="" ( | |
ECHO You must specify a package to deploy. ^(use deploy --list^) | |
GOTO :eof | |
) | |
SET DEST=%DEST_ROOT%\%2 | |
SET SRC=%GIT_REPOS%\%2\%2 | |
ECHO Copying %SRC% to %DEST% | |
IF EXIST %DEST% ( | |
SET /p DO_REMOVE="Remove existing deployment? (y/n)" | |
if "%DO_REMOVE%"=="y" ( | |
rmdir /s /q %DEST% | |
) | |
) | |
XCOPY %SRC% %DEST%\* /E /Y | |
ECHO Successfully deployed! | |
GOTO :eof | |
:list_packs | |
ECHO Packages available for deployment: | |
ECHO. | |
dir %GIT_REPOS% /a:d /b | |
GOTO :eof | |
:help_msg | |
ECHO Deploys a python package from a git repo in %GIT_REPOS% locally or remotely. | |
ECHO. | |
ECHO e.g. | |
ECHO deploy --remote [package_name] | |
ECHO deploy --local [package_name] | |
ECHO. | |
ECHO --local: Deploy to local maya scripts location | |
ECHO --remote: Deploy to remote maya scripts location | |
ECHO --list (-l): List available packages | |
ECHO --help (-h): Show this help message | |
GOTO :eof | |
:eof | |
ECHO. | |
@echo on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment