Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:unfoldingWord-dev/tx-manager int…
Browse files Browse the repository at this point in the history
…o Feature_7/Add_tN_to_md2html_Conversion

# Conflicts:
#	functions/convert_md2html/module.json
#	libraries/client/preprocessors.py
#	libraries/door43_tools/templaters.py
#	tests/converter_tests/test_md2html_converter.py
#	tests/door43_tools_tests/test_project_deployer.py
#	tests/integration_tests/test_conversion.py
  • Loading branch information
PhotoNomad0 committed Oct 19, 2017
2 parents 7362c2d + 34b320b commit 0a04233
Show file tree
Hide file tree
Showing 32 changed files with 1,388 additions and 49 deletions.
2 changes: 1 addition & 1 deletion functions/convert_md2html/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "md2html",
"version": "2",
"type": "converter",
"resource_types": ["obs", "ta", "tn"],
"resource_types": ["obs", "ta", "tq", "tw", "tn"],
"input_format": ["md"],
"output_format": ["html"],
"options": [],
Expand Down
43 changes: 21 additions & 22 deletions libraries/client/client_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def process_webhook(self):
'resource_type': rc.resource.type,
'title': rc.resource.title,
'manifest': json.dumps(rc.as_dict()),
'last_updated': datetime.utcnow()
}
# First see if manifest already exists in DB and update it if it is
tx_manifest = TxManifest.get(repo_name=repo_name, user_name=user_name)
Expand Down Expand Up @@ -170,6 +171,11 @@ def process_webhook(self):
# Create a build log
build_log_json = self.create_build_log(commit_id, commit_message, commit_url, compare_url, job,
pusher_username, repo_name, user_name)
# Upload an initial build_log
self.upload_build_log_to_s3(build_log_json, s3_commit_key)

# Update the project.json file
self.update_project_json(commit_id, job, repo_name, user_name)

# Convert and lint
if converter:
Expand Down Expand Up @@ -227,13 +233,6 @@ def process_webhook(self):
}
self.send_request_to_linter(book_job, linter, commit_url, extra_payload)

# Upload an initial build_log
self.upload_build_log_to_s3(build_log_json, s3_commit_key)

# Update the project.json file
self.update_project_json(commit_id, job, repo_name, user_name)


remove_tree(self.base_temp_dir) # cleanup
return build_log_json

Expand Down Expand Up @@ -265,15 +264,15 @@ def upload_build_log_to_s3(self, build_log, s3_commit_key, part=''):
def create_build_log(self, commit_id, commit_message, commit_url, compare_url, job, pusher_username, repo_name,
repo_owner):
"""
:param string commit_id:
:param string commit_message:
:param string commit_url:
:param string compare_url:
:param TxJob job:
:param string pusher_username:
:param string repo_name:
:param string repo_owner:
:return dict:
:param string commit_id:
:param string commit_message:
:param string commit_url:
:param string compare_url:
:param TxJob job:
:param string pusher_username:
:param string repo_name:
:param string repo_owner:
:return dict:
"""
build_log_json = dict(job)
build_log_json['repo_name'] = repo_name
Expand Down Expand Up @@ -344,7 +343,7 @@ def send_request_to_converter(self, job, converter):
"""
:param TxJob job:
:param TxModule converter:
:return bool:
:return bool:
"""
payload = {
'identifier': job.identifier,
Expand Down Expand Up @@ -469,18 +468,18 @@ def get_converter_module(self, job):
:param TxJob job:
:return TxModule:
"""
return TxModule.query().filter(TxModule.type=='converter')\
.filter(TxModule.input_format.contains(job.input_format))\
.filter(TxModule.output_format.contains(job.output_format))\
.filter(TxModule.resource_types.contains(job.resource_type))\
return TxModule.query().filter(TxModule.type=='converter') \
.filter(TxModule.input_format.contains(job.input_format)) \
.filter(TxModule.output_format.contains(job.output_format)) \
.filter(TxModule.resource_types.contains(job.resource_type)) \
.first()

def get_linter_module(self, job):
"""
:param TxJob job:
:return TxModule:
"""
linters = TxModule.query().filter(TxModule.type=='linter')\
linters = TxModule.query().filter(TxModule.type=='linter') \
.filter(TxModule.input_format.contains(job.input_format))
linter = linters.filter(TxModule.resource_types.contains(job.resource_type)).first()
if not linter:
Expand Down
Loading

0 comments on commit 0a04233

Please sign in to comment.