Skip to content

Commit

Permalink
final small changes to README generation
Browse files Browse the repository at this point in the history
  • Loading branch information
benpullman committed Apr 13, 2020
1 parent 6e9cd7a commit ab8bbc2
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

@task
def release_text(c, workflow_name):
makefile = read_makefile('.')
base_dir = '.'
tools = read_all_tools('..')
dependencies = output_tool_dependencies(workflow_name, base_dir)
makefile = read_makefile(base_dir)
readme = 'README.md'
previous_readme_lines = []
if os.path.isfile(readme):
Expand All @@ -34,13 +37,37 @@ def release_text(c, workflow_name):

update_text = "Last updated: {}.".format(makefile['LAST_UPDATED'])

dependency_text = []
seen = {}

for (dependency, dependency_version) in dependencies:

status = "N/V"
if dependency not in seen or (dependency in seen and seen[dependency] != dependency_version):
if dependency in tools:

local_version, workflow = tools[dependency]

if dependency_version == local_version:
status = "({})".format(dependency_version)
else:
status = "({}, latest is {})".format(dependency_version, local_version)

dependency_text.append("* {} {}".format(dependency, status))
else:
dependency_text.append("* {} (untracked)".format(dependency))

seen[dependency] = dependency_version

with open(readme, 'w') as w:
w.write('## {}\n\n'.format(name))
w.write('#### Version: {}\n\n'.format(version))
if description:
w.write('#### Description: \n{}\n\n'.format(description[1:-1]))
if len(dependency_text) > 0:
w.write('#### Dependencies: \n{}\n\n'.format("\n".join(dependency_text)))
w.write('_{}_\n\n'.format(update_text))
w.write('<data id=CCMS_DEPLOYMENTS_HEADER_BREAK_ELEMENT_CAUTION_ANYTHING_ABOVE_WILL_BE_AUTOGENERATED />')
w.write('<data id=CCMS_DEPLOYMENTS_HEADER_BREAK_ELEMENT_CAUTION_ANYTHING_ABOVE_WILL_BE_AUTOGENERATED />\n\n')
for previous_readme_line in previous_readme_lines:
w.write(previous_readme_line)

Expand Down

0 comments on commit ab8bbc2

Please sign in to comment.