Skip to content

Instantly share code, notes, and snippets.

@Richienb
Last active June 15, 2018 04:45
Show Gist options
  • Save Richienb/3c2d339b4a2128e20159a1ed4423166e to your computer and use it in GitHub Desktop.
Save Richienb/3c2d339b4a2128e20159a1ed4423166e to your computer and use it in GitHub Desktop.
Travis Variable Encryption Wizard

Travis Variable Encryption Wizard

What is this?

Encrypt Travis variables with this simple wizard for Windows

How do I use it?

Download the .bat file and run it. Ensure that Ruby is installed.

@echo off
title Travis Variable Encryption Wizard
cls
echo Welcome to the Travis Variable encryption wizard
echo An installation of Ruby is required to continue
echo Press enter to confirm that Ruby is installed...
pause>nul
:start
echo.
set /p updategems=Update Ruby Gems? (Y/n):
IF /I %updategems%=="y" ( goto updateruby )
IF /I %updategems%=="" ( goto updateruby )
goto afterupdateruby
:updateruby
echo Updating Ruby Gems...
gem update --system>nul
echo Update Complete
:afterupdateruby
echo.
set /p installthegem=Install Travis Ruby Gem (if not already)? (Y/n):
IF /I %installthegem%=="y" ( goto installtravis )
IF /I %installthegem%=="" ( goto installtravis )
goto afterinstalltravis
:installtravis
echo Installing Travis Ruby Gem...
gem install travis>nul
echo Installation Complete
:afterinstalltravis
echo.
set /p projectdir=Enter the directory of your repository:
set /p varname=Enter the name of the new variable:
set /p varcontent=Enter the content of the new variable:
set /p autoadd=Automatically append the variable to the .travis.yml file? (y/N):
echo.
IF /I %autoadd%=="y" ( goto addvalauto )
echo Generating key and adding to .travis.yml file...
travis encrypt %varname%="%varcontent%"
echo Generation Complete
goto afteraddvalauto
:addvalauto
echo Generating key and adding to .travis.yml file...
travis encrypt %varname%="%varcontent%" --add
echo Generation Complete
:afteraddvalauto
set /p createanother=Encrypt another variable? (Y/n):
IF /I %createanother%=="y" ( goto start )
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment