Fix delete-after, compile changelog.

This commit is contained in:
Rob Nelson
2014-08-18 16:32:29 -07:00
parent c546dc243c
commit 52c70c54f7
5 changed files with 35 additions and 9 deletions

View File

@@ -84,6 +84,11 @@ ADDING CREDITS? EDIT templates/header.html (or footer.html if they're for old t
<h3 class="author">Dylanstrategie updated:</h3>
<ul class="changes bgimages16">
<li class="wip">Changed cloner functionality. Base cloning time has seen a pretty steep increase (between 3 and 6 minutes) but the cloning time and biomass use can be reduced by replacing the cloning pod's parts. This change should make cloning people less of a choice early in the round and reverse "clone everything" mentality with the recent changes to defibrillators and other planned changes</li>
<li class="bugfix">R&D now makes HUDSunglasses instead of the old "Sec HUD" item</li>
</ul>
<h3 class="author">N3X15 updated:</h3>
<ul class="changes bgimages16">
<li class="rscadd">Added delete-after directive to changelog YML files.</li>
</ul>
</div>

View File

@@ -703,3 +703,6 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py.
by replacing the cloning pod's parts. This change should make cloning people
less of a choice early in the round and reverse "clone everything" mentality
with the recent changes to defibrillators and other planned changes
- bugfix: R&D now makes HUDSunglasses instead of the old "Sec HUD" item
N3X15:
- rscadd: Added delete-after directive to changelog YML files.

View File

@@ -1,3 +1,2 @@
author: Dylanstrategie
changes:
- bugfix: R&D now makes HUDSunglasses instead of the old "Sec HUD" item
changes: []

View File

@@ -24,6 +24,9 @@
# Your name.
author: N3X15
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
#delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.

View File

@@ -125,31 +125,40 @@ if failed_cache_read and os.path.isfile(args.targetFile):
else:
all_changelog_entries[date] = entry
del_after = []
print('Reading changelogs...')
for fileName in glob.glob(os.path.join(args.ymlDir, "*.yml")):
name, ext = os.path.splitext(os.path.basename(fileName))
if name.startswith('.'): continue
if name == 'example': continue
fileName = os.path.abspath(fileName)
print(' Reading {}...'.format(fileName))
cl = {}
with open(fileName, 'r') as f:
cl = yaml.load(f)
f.close()
if today not in all_changelog_entries:
all_changelog_entries[today] = {}
author_entries = all_changelog_entries[today].get(cl['author'], [])
if len(cl['changes']):
new = 0
for change in cl['changes']:
'''
for css,comment in change.items():
c=(css,comment)
if c not in author_entries:
author_entries += [c]
'''
if change not in author_entries:
(change_type, _) = dictToTuples(change)[0]
if change_type not in validPrefixes:
print(' {0}: Invalid prefix {1}'.format(fileName, change_type), file=sys.stderr)
author_entries += [change]
new += 1
all_changelog_entries[today][cl['author']] = author_entries
if new > 0:
print(' Added {0} new changelog entries.'.format(new))
if cl.get('delete-after', False):
if os.path.isfile(fileName):
if args.dryRun:
print(' Would delete {0} (delete-after set)...'.format(fileName))
else:
del_after += [fileName]
if args.dryRun: continue
@@ -180,7 +189,7 @@ with open(args.targetFile.replace('.htm', '.dry.htm') if args.dryRun else args.t
changes_added += [change]
author_htm += '\t\t\t\t<li class="{css_class}">{change}</li>\n'.format(css_class=css_class, change=change.strip())
author_htm += '\t\t\t</ul>\n'
if len(changes_added)>0:
if len(changes_added) > 0:
entry_htm += author_htm
entry_htm += '\t\t</div>\n'
if write_entry:
@@ -194,3 +203,10 @@ with open(args.targetFile.replace('.htm', '.dry.htm') if args.dryRun else args.t
with open(changelog_cache, 'w') as f:
cache_head = 'DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py.'
yaml.dump_all([cache_head, all_changelog_entries], f, default_flow_style=False)
if len(del_after):
print('Cleaning up...')
for fileName in del_after:
if os.path.isfile(fileName):
print(' Deleting {0} (delete-after set)...'.format(fileName))
os.remove(fileName)