@@ -1090,6 +1090,39 @@ def parse_repo_config(config_file, distro, version):
1090
1090
return repo_urls
1091
1091
1092
1092
1093
+ def collect_master_adoc_files (project_path = os .path .abspath (os .curdir )):
1094
+ """Given the project path, return a list of all master.adoc file paths."""
1095
+
1096
+ master_adoc_collection = []
1097
+
1098
+ for project_dir , dirs , files in os .walk (project_path , topdown = True ):
1099
+ if "master.adoc" in files :
1100
+ master_path = os .path .join (project_dir , "master.adoc" )
1101
+ master_adoc_collection .append (master_path )
1102
+
1103
+ return master_adoc_collection
1104
+
1105
+
1106
+ def create_symlinks_to_project_root_from_master_files (
1107
+ list_of_master_file_paths , distro = "openshift-enterprise"
1108
+ ):
1109
+ """Create symlinks for every master.adoc-containing
1110
+ directory to the openshift-docs project root."""
1111
+
1112
+ drupal_build_path_includes_dir = os .path .join (
1113
+ os .path .abspath (os .curdir ), "drupal-build" , distro , "includes"
1114
+ )
1115
+
1116
+ if not os .path .exists (drupal_build_path_includes_dir ):
1117
+ os .mkdir (drupal_build_path_includes_dir )
1118
+
1119
+ for path in list_of_master_file_paths :
1120
+ directory = os .path .split (path )[0 ]
1121
+ book_includes_dir = os .path .join (directory , "includes" )
1122
+ if not os .path .isdir (book_includes_dir ):
1123
+ os .symlink (drupal_build_path_includes_dir , book_includes_dir )
1124
+
1125
+
1093
1126
def main ():
1094
1127
parser = setup_parser ()
1095
1128
args = parser .parse_args ()
@@ -1138,6 +1171,10 @@ def main():
1138
1171
log .info ("Building the drupal files" )
1139
1172
build_master_files (info )
1140
1173
1174
+ create_symlinks_to_project_root_from_master_files (
1175
+ collect_master_adoc_files (), args .distro
1176
+ )
1177
+
1141
1178
# Copy the original data and reformat for drupal
1142
1179
reformat_for_drupal (info )
1143
1180
0 commit comments