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