File: thumbspage/build/x-publish-external-demos-prod/_publish-@-ziptools.sh

#===================================================================
# Automatically build+publish this folder's content, only.
#
# Launch this script from Terminal in its own folder, with:
#     cd $C/mergeall/test/ziptools
#     bash _publish.sh
#
# NOT run by $W/_admin/BUILD-THUMBSPAGE-CLIENTS/_PUBLISH.sh:
# no thumbspage galleries here.
#
# This app has no separate build/ folder: this IS its build script.
#===================================================================

# get common defs
source ~/MY-STUFF/Websites/_admin/BUILD-THUMBSPAGE-CLIENTS/common.sh

# caution: run __sloc.py__ first if code changed


# 1) zip in Code

cd $C/mergeall/test
mv ziptools/__private__ $temp
py3 $Z/zip-create.py ziptools.zip ziptools -skipcruft    # this is what users get (test READMEs)
mv $temp/__private__ ziptools


# 2) unzip in Websites/../Complete/ziptools

cd $W/Programs/Current/Complete/ziptools                 # this has its own .htaccess
rm -rf ziptools*                                         # nested ziptools/ziptools
cp -p $C/mergeall/test/ziptools.zip .
mv $C/mergeall/test/ziptools.zip $Z/__private__/ziptools--$stamp.zip
py3 $Z/zip-extract.py ziptools.zip . -permissions        # makes ziptools subdir here, alongside zip

# already has, but may change
py3 $M/insert-analytics.py ziptools/_README.html


# 3) publish to UNION and zip there

# copies README=>_README; would add ip-anon line to .htaccess but added manually
cd $W
py3 _PUBLISH.py | tail -n 20
cd UNION
py3 $Z/zip-create.py ziptools.zip ziptools -skipcruft    # ziptools/{ziptools.zip, ziptools/} 


# 4) upload UNION/ziptools.zip to site's root (was filezilla)
SCP ziptools.zip htdocs

# unzip at site
SSH <<-EOF
	cd htdocs                                            # site root
	rm -rf ziptools                                      # entire top-level folder; or via filezilla
	unzip -d . ziptools.zip                              # recreates top ziptools/ folder: ziptools/{ziptools.zip, ziptools/}
	rm ziptools.zip                                      # top (root level) zip, not the nested one!
	exit
	# keep .zip and unzipped content in top ziptools/
	EOF

rm ziptools.zip   # in local UNION



[Home page] Books Code Blog Python Author Train Find ©M.Lutz