REM.. Copyright (C) 2017 Bryan A. Jones.

This file is part of E-Book Binder.

E-Book Binder is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

E-Book Binder is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with E-Book Binder. If not, see <http://www.gnu.org/licenses/>.

deploy.bat - Deploy the e-book to HerokuΒΆ

This batch files deploys the current repo to Heroku. It should be run from the root of this project: build/Heroku/deploy.bat. This assumes that:

  1. The xc16 files are in the build/xc16 directory.
  2. The build/Flask/config.py file is present.

First, update the docs. Force the grades to be updated. This is a poor-man’s touch.

type NUL >> book/grades.rst
sphinx-build -d _build\doctrees . _build\html
if errorlevel 1 goto fail

Next, update the build and zip file.

python waf build gdist
if errorlevel 1 goto fail
 

Copy the Heroku config files.

copy /y build\heroku\*.* .

Add all the files which the new ignore patterns now include.

git add .

set the executable bit for xc16 files

pushd build\xc16\v1.30\bin
git update-index --chmod=+x sim30 xc16-as xc16-bin2hex xc16-cc1 xc16-gcc xc16-ld
cd bin
git update-index --chmod=+x elf-as elf-bin2hex elf-cc1 elf-gcc elf-ld
popd

Commit this.

git commit -m "Heroku deploy."

Send it to Heroku.

git push --force heroku master

Roll back.

git reset --mixed HEAD~1

Remove the Heroku files. Note that ~nx returns the filename and extension of %i, per the last table in https://technet.microsoft.com/en-us/library/bb490909.aspx.

for %%i in (build\Heroku\*.*) do del %%~nxi

Restore .gitignore.

git checkout -- .gitignore

Open up a Heroku command line to allow manual database updates. See https://linux.die.net/man/1/bash.

heroku run bash -c "cd build/Flask; python book_webapp.py"

:fail