merge styles v9.5.2
[rnaseq-cwl-training.git] / bin / lesson_initialize.py
1 #!/usr/bin/env python3
2
3 """Initialize a newly-created repository."""
4
5
6 import sys
7 import os
8 import shutil
9
10 BOILERPLATE = (
11     '.travis.yml',
12     'AUTHORS',
13     'CITATION',
14     'CODE_OF_CONDUCT.md',
15     'CONTRIBUTING.md',
16     'README.md',
17     '_config.yml',
18     '_episodes/01-introduction.md',
19     '_extras/about.md',
20     '_extras/discuss.md',
21     '_extras/figures.md',
22     '_extras/guide.md',
23     'aio.md',
24     'index.md',
25     'reference.md',
26     'setup.md',
27 )
28
29
30 def main():
31     """Check for collisions, then create."""
32
33     # Check.
34     errors = False
35     for path in BOILERPLATE:
36         if os.path.exists(path):
37             print('Warning: {0} already exists.'.format(path), file=sys.stderr)
38             errors = True
39     if errors:
40         print('**Exiting without creating files.**', file=sys.stderr)
41         sys.exit(1)
42
43     # Create.
44     for path in BOILERPLATE:
45         shutil.copyfile(
46             "bin/boilerplate/{}".format(path),
47             path
48         )
49
50
51 if __name__ == '__main__':
52     main()