Skip to content
Snippets Groups Projects
Commit f9dc4c8c authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

Merge branch 'master' into czr_pythons_pg

# Conflicts:
#	.gitlab-ci.yml
parent 53d437bd
No related branches found
No related tags found
No related merge requests found
Pipeline #636 passed with stage
in 51 seconds
# example # example
This is description of the box. It will be copied. Keep it short and single-line. Don't remove the line break before. Example box. Not compiled. Keep four lines in same order.
Version: 1.0 Version: 1.0
Write what this box consists of and how it behaves. This section will be automatically replaced by `python make.py` with auto-generated
First four lines have a special meaning - dont move them around. Change only version number, not the word. content of Vagrantfile that will refer to this box.
--- ---
This section will be automatically replaced by `python make.py` with auto-generated Usage in Vagrantfile:
content of Vagrantfile that will refer to this box. ```
config.vm.box = "henrietta/example"
config.vm.box_url = "http://dev.dms-serwis.com.pl/vagrant/example.box"
```
...@@ -30,15 +30,18 @@ def readfile(path, prefix=None, lines=False, strip=True): ...@@ -30,15 +30,18 @@ def readfile(path, prefix=None, lines=False, strip=True):
return d return d
def writefile(content, path, prefix=None): def writefile(content, path, prefix=None, lines=False):
if prefix is not None: if prefix is not None:
path = os.path.join(prefix, path) path = os.path.join(prefix, path)
with open(path, 'wb') as f: with open(path, 'w' if lines else 'wb') as f:
if not isinstance(content, list): if lines:
content = [content] f.writelines([q+'\n' for q in content])
for piece in content: else:
f.write(piece) if not isinstance(content, list):
content = [content]
for piece in content:
f.write(piece)
if __name__ == '__main__': if __name__ == '__main__':
...@@ -52,18 +55,20 @@ if __name__ == '__main__': ...@@ -52,18 +55,20 @@ if __name__ == '__main__':
for box in boxes: for box in boxes:
readme = '\n---\n'.join(readfile('README.md', box).split('\n---\n')[:-1]) readme = readfile('README.md', box, lines=True, strip=True)
readme = readme + '''
--- if '---' in readme:
try:
readme = readme[readme.index('---')+1:]
except IndexError:
readme = readme[:-1]
Usage in Vagrantfile: readme = readme + ['', '---', '', 'Usage in Vagrantfile:', '```',
``` 'config.vm.box = "'+PREFIX+box+'"',
config.vm.box = "$PREFIX$BOX" 'config.vm.box_url = "http://dev.dms-serwis.com.pl/vagrant/'+box+'.box"',
config.vm.box_url = "http://dev.dms-serwis.com.pl/vagrant/$BOX.box" '```']
```
'''.replace('$BOX', box).replace('$PREFIX', PREFIX)
writefile(readme, 'README.md', box) writefile(readme, 'README.md', box, lines=True)
try: try:
os.unlink(os.path.join(box, 'metadata.json')) os.unlink(os.path.join(box, 'metadata.json'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment