forked from matrix/element-web
Rename 'config' option to 'symlink'
because that's really all it's doing and we can use it for other things
This commit is contained in:
parent
be938ac0f4
commit
6ff91789b2
|
@ -67,7 +67,7 @@ class Deployer:
|
||||||
self.bundles_path = None
|
self.bundles_path = None
|
||||||
self.should_clean = False
|
self.should_clean = False
|
||||||
# filename -> symlink path e.g 'config.localhost.json' => '../localhost/config.json'
|
# filename -> symlink path e.g 'config.localhost.json' => '../localhost/config.json'
|
||||||
self.config_locations = {}
|
self.symlink_paths = {}
|
||||||
self.verify_signature = True
|
self.verify_signature = True
|
||||||
|
|
||||||
def deploy(self, tarball, extract_path):
|
def deploy(self, tarball, extract_path):
|
||||||
|
@ -99,11 +99,11 @@ class Deployer:
|
||||||
|
|
||||||
print ("Extracted into: %s" % extracted_dir)
|
print ("Extracted into: %s" % extracted_dir)
|
||||||
|
|
||||||
if self.config_locations:
|
if self.symlink_paths:
|
||||||
for config_filename, config_loc in self.config_locations.iteritems():
|
for link_path, file_path in self.symlink_paths.iteritems():
|
||||||
create_relative_symlink(
|
create_relative_symlink(
|
||||||
target=config_loc,
|
target=file_path,
|
||||||
linkname=os.path.join(extracted_dir, config_filename)
|
linkname=os.path.join(extracted_dir, link_path)
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.bundles_path:
|
if self.bundles_path:
|
||||||
|
@ -166,9 +166,10 @@ if __name__ == "__main__":
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--config", nargs='*', default='./config*.json', help=(
|
"--symlink", nargs='*', default='./config*.json', help=(
|
||||||
"Write a symlink at config.json in the extracted tarball to this \
|
"Symlink these files into the root of the deployed tarball. \
|
||||||
location. (Default: '%(default)s')"
|
Useful for config files and home pages. Supports glob syntax. \
|
||||||
|
(Default: '%(default)s')"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -184,9 +185,11 @@ if __name__ == "__main__":
|
||||||
deployer.bundles_path = args.bundles_dir
|
deployer.bundles_path = args.bundles_dir
|
||||||
deployer.should_clean = args.clean
|
deployer.should_clean = args.clean
|
||||||
|
|
||||||
deployer.config_locations = {}
|
deployer.symlink_paths = {}
|
||||||
|
|
||||||
for c in args.config:
|
for symlink in args.symlink:
|
||||||
deployer.config_locations.update({ os.path.basename(c): pth for pth in glob.iglob(c) })
|
deployer.symlink_paths.update({ os.path.basename(pth): pth for pth in glob.iglob(symlink) })
|
||||||
|
|
||||||
|
print("%r", (deployer.symlink_paths,))
|
||||||
|
|
||||||
deployer.deploy(args.tarball, args.extract_path)
|
deployer.deploy(args.tarball, args.extract_path)
|
||||||
|
|
Loading…
Reference in New Issue