Skip to content

Commit 6ff9178

Browse files
committed
Rename 'config' option to 'symlink'
because that's really all it's doing and we can use it for other things
1 parent be938ac commit 6ff9178

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

‎scripts/deploy.py‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(self):
6767
self.bundles_path = None
6868
self.should_clean = False
6969
# filename -> symlink path e.g 'config.localhost.json' => '../localhost/config.json'
70-
self.config_locations = {}
70+
self.symlink_paths = {}
7171
self.verify_signature = True
7272

7373
def deploy(self, tarball, extract_path):
@@ -99,11 +99,11 @@ def deploy(self, tarball, extract_path):
9999

100100
print ("Extracted into: %s" % extracted_dir)
101101

102-
if self.config_locations:
103-
for config_filename, config_loc in self.config_locations.iteritems():
102+
if self.symlink_paths:
103+
for link_path, file_path in self.symlink_paths.iteritems():
104104
create_relative_symlink(
105-
target=config_loc,
106-
linkname=os.path.join(extracted_dir, config_filename)
105+
target=file_path,
106+
linkname=os.path.join(extracted_dir, link_path)
107107
)
108108

109109
if self.bundles_path:
@@ -166,9 +166,10 @@ def download_file(self, url):
166166
)
167167
)
168168
parser.add_argument(
169-
"--config", nargs='*', default='./config*.json', help=(
170-
"Write a symlink at config.json in the extracted tarball to this \
171-
location. (Default: '%(default)s')"
169+
"--symlink", nargs='*', default='./config*.json', help=(
170+
"Symlink these files into the root of the deployed tarball. \
171+
Useful for config files and home pages. Supports glob syntax. \
172+
(Default: '%(default)s')"
172173
)
173174
)
174175
parser.add_argument(
@@ -184,9 +185,11 @@ def download_file(self, url):
184185
deployer.bundles_path = args.bundles_dir
185186
deployer.should_clean = args.clean
186187

187-
deployer.config_locations = {}
188+
deployer.symlink_paths = {}
188189

189-
for c in args.config:
190-
deployer.config_locations.update({ os.path.basename(c): pth for pth in glob.iglob(c) })
190+
for symlink in args.symlink:
191+
deployer.symlink_paths.update({ os.path.basename(pth): pth for pth in glob.iglob(symlink) })
192+
193+
print("%r", (deployer.symlink_paths,))
191194

192195
deployer.deploy(args.tarball, args.extract_path)

0 commit comments

Comments
 (0)