Skip to content

Commit

Permalink
removing complexity in certifications to gitbook
Browse files Browse the repository at this point in the history
  • Loading branch information
geramirez committed Feb 2, 2016
1 parent 8ac6e61 commit 8ba09fa
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/renderers/certifications_to_gitbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ def is_url(item_path):
return True


def export_local_files(item_path, io_paths):
""" Export local files to the new directory """
if io_paths:
output_path = os.path.join(io_paths['output'], 'artifacts', item_path)
input_path = os.path.join(io_paths['input'], item_path)
utils.create_dir(os.path.dirname(output_path))
if not os.path.exists(output_path) or not filecmp.cmp(input_path, output_path):
shutil.copy(input_path, output_path)


def prepare_locally_stored_files(element, io_paths):
""" Prepare the files by moving locally stored files to the `artifacts` directory
and linking filepaths to that directory """
item_path = element.get('path')
if item_path and not is_url(item_path):
element['path'] = os.path.join('/artifacts', item_path).replace('\\', '/')
if io_paths:
output_path = os.path.join(io_paths['output'], 'artifacts', item_path)
input_path = os.path.join(io_paths['input'], item_path)
utils.create_dir(os.path.dirname(output_path))
if not os.path.exists(output_path) or not filecmp.cmp(input_path, output_path):
shutil.copy(input_path, output_path)


def convert_element(element, io_paths=None):
Expand Down

0 comments on commit 8ba09fa

Please sign in to comment.