1515import time
1616import traceback
1717from urlparse import urljoin
18+ import glob
1819
1920from flask import Flask , jsonify , request , abort
2021
@@ -188,15 +189,12 @@ def deploy_tarball(tar_gz_url, build_dir):
188189 )
189190 )
190191
191- def _raise (ex ):
192- raise ex
193-
194- # --config config.json=../../config.json --config config.localhost.json=./localhost.json
192+ # --include ../../config.json ./localhost.json homepages/*
195193 parser .add_argument (
196- "--config " , action = "append" , dest = "configs" ,
197- type = lambda kv : kv . split ( "=" , 1 ) if "=" in kv else _raise ( Exception ( "Missing =" )), help = (
198- "A list of configs to symlink into the extracted tarball . \
199- For example, --config config.json=../config.json config2.json=../test/config.json "
194+ "--include " , nargs = '*' , default = './config*.json' , help = (
195+ "Symlink these files into the root of the deployed tarball. \
196+ Useful for config files and home pages. Supports glob syntax . \
197+ (Default: '%(default)s') "
200198 )
201199 )
202200 parser .add_argument (
@@ -220,7 +218,11 @@ def _raise(ex):
220218 deployer = Deployer ()
221219 deployer .bundles_path = args .bundles_dir
222220 deployer .should_clean = args .clean
223- deployer .config_locations = dict (args .configs ) if args .configs else {}
221+
222+ deployer .symlink_paths = {}
223+
224+ for include in args .include :
225+ deployer .symlink_paths .update ({ os .path .basename (pth ): pth for pth in glob .iglob (include ) })
224226
225227
226228 # we don't pgp-sign jenkins artifacts; instead we rely on HTTPS access to
@@ -234,13 +236,13 @@ def _raise(ex):
234236 deploy_tarball (args .tarball_uri , build_dir )
235237 else :
236238 print (
237- "Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Config locations : %s" %
239+ "Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Include patterns : %s" %
238240 (args .port ,
239241 arg_extract_path ,
240242 " (clean after)" if deployer .should_clean else "" ,
241243 arg_symlink ,
242244 arg_jenkins_url ,
243- deployer .config_locations ,
245+ deployer .symlink_paths ,
244246 )
245247 )
246248 app .run (host = "0.0.0.0" , port = args .port , debug = True )
0 commit comments