@@ -521,6 +521,51 @@ def easy_versioning_build():
521521
522522 start_quick_server (link_data [0 ], link_data [1 ])
523523
524+ ################################################################################## Library utils functions
525+ def initial_set_up ():
526+ """
527+ Simple easy-versioning project set-up.
528+ """
529+ args = sys .argv [1 :] # Takes the parameters from the command line
530+ title = args [0 ] if len (args ) > 0 else "Documentation"
531+ author = args [1 ] if len (args ) > 1 else "Author"
532+
533+ src_path = os .path .join (TEMP_PATH , "src" ) # "src" folder path
534+ data_path = os .path .join (TEMP_PATH , "data" ) # "data" folder path
535+ version_paths = [
536+ [os .path .join (TEMP_PATH , "src" , "V. 1.0" ), "1.0" ],
537+ [os .path .join (TEMP_PATH , "src" , "V. 2.0" ), "2.0" ]
538+ ] # Versions of the documentation folder
539+
540+ if not os .path .exists (src_path ): # If no "src" folder is found
541+ for version in version_paths :
542+ os .makedirs (version [0 ], exist_ok = True ) # Creating the src/version folder
543+ command = [
544+ "sphinx-quickstart" ,
545+ "--quiet" ,
546+ "-p" , title ,
547+ "-a" , author ,
548+ "-v" , version [1 ],
549+ "--sep"
550+ ]
551+
552+ try :
553+ # Running the build command inside of the specific folder
554+ result = subprocess .run (
555+ command , capture_output = True , text = True , cwd = version [0 ]
556+ )
557+
558+ if result .returncode == 0 :
559+ success (f"Sphinx set-up completed for { version [1 ]} ." )
560+ else :
561+ error (f"Sphinx set-up failed for { version [1 ]} ." )
562+ error (f"{ result .stderr } ." )
563+ except Exception as e :
564+ error (f"Exception during the set-up { e } ." )
565+
566+ if not os .path .exists (data_path ):
567+ os .makedirs (data_path , exist_ok = True )
568+
524569################################################################################## Main
525570
526571if __name__ == "__main__" :
0 commit comments