diff --git a/Gemfile b/Gemfile index b79fdd8e16..e3d79c72e7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source "https://rubygems.org" -gem 'ascii_binder', '~>0.1.5' +gem 'ascii_binder', '~>1.0' diff --git a/_topic_map.yml b/_topic_maps/_topic_map.yml similarity index 100% rename from _topic_map.yml rename to _topic_maps/_topic_map.yml diff --git a/build.py b/build.py index 44fb9b4279..e6b46f8442 100755 --- a/build.py +++ b/build.py @@ -22,6 +22,7 @@ import sys import time import yaml import requests +import tempfile from aura import cli @@ -151,9 +152,25 @@ def find_build_config_file(): """ Finds the build config file to use, as it might be _topic_map.yml or _build_cfg.yml """ - config = os.path.abspath(os.path.join(CLONE_DIR, "_topic_map.yml")) + + # updated 23rd Nov to support files in _topic_maps folder + + # load everything from the _topic_maps folder + file_list = os.listdir(os.path.join(CLONE_DIR, "_topic_maps")) + + # create a temp file combining all values from that folder + # don't delete it immediately, and give it a suffix of swp which makes it ignored by git + with tempfile.NamedTemporaryFile(dir=CLONE_DIR, delete=False, suffix=".swp") as tmp: + for f in file_list: + with open(os.path.join(CLONE_DIR, "_topic_maps", f), "rb") as infile: + tmp.write(infile.read()) + + config = os.path.abspath(tmp.name) + log.info(config) + + # backup look for a single _topic_map in the cloned directory if not os.path.isfile(config): - config = os.path.abspath(os.path.join(CLONE_DIR, "_build_cfg.yml")) + config = os.path.abspath(os.path.join(CLONE_DIR, "_topic_map.yml")) return config diff --git a/build_for_portal.py b/build_for_portal.py index 8f3614ff21..167d4b748d 100644 --- a/build_for_portal.py +++ b/build_for_portal.py @@ -15,6 +15,7 @@ import sys import time import yaml import requests +import tempfile from aura import cli @@ -144,13 +145,28 @@ def find_build_config_file(): """ Finds the build config file to use, as it might be _topic_map.yml or _build_cfg.yml """ - config = os.path.abspath(os.path.join(CLONE_DIR, "_topic_map.yml")) + + # updated 23rd Nov to support files in _topic_maps folder + + # load everything from the _topic_maps folder + file_list = os.listdir(os.path.join(CLONE_DIR, "_topic_maps")) + + # create a temp file combining all values from that folder + # don't delete it immediately, and give it a suffix of swp which makes it ignored by git + with tempfile.NamedTemporaryFile(dir=CLONE_DIR, delete=False, suffix=".swp") as tmp: + for f in file_list: + with open(os.path.join(CLONE_DIR, "_topic_maps", f), "rb") as infile: + tmp.write(infile.read()) + + config = os.path.abspath(tmp.name) + log.info(config) + + # backup look for a single _topic_map in the cloned directory if not os.path.isfile(config): - config = os.path.abspath(os.path.join(CLONE_DIR, "_build_cfg.yml")) + config = os.path.abspath(os.path.join(CLONE_DIR, "_topic_map.yml")) return config - def parse_build_config(config): """ Parses the build config and returns a tree based structure for the config.