def Run() -> bool: for siteNamespace in Sites.GetAllSiteNames(): # type: str Sites.BuildSite(siteNamespace) print("All sites built. " + datetime.datetime.now().strftime("%I:%M %p")) return True
def VerifyStripping() -> None: print("Verifying stripping.") print("Verifying environment file stripping.") environmentIncludedPaths = GetIncludedPaths( Paths.StrippingEnvironmentFilePath, Paths.RootPath) # type: typing.List[str] _VerifyStripped(Paths.RootPath, environmentIncludedPaths) for modName in Mods.GetAllModNames(): # type: str print("Verifying mod '" + modName + "' file stripping.") modPath = Mods.GetModPath(modName) # type: str modIncludedPaths = GetIncludedPaths(Paths.StrippingModsFilePath, modPath) _VerifyStripped(modPath, modIncludedPaths) for siteName in Sites.GetAllSiteNames(): # type: str print("Verifying site '" + siteName + "' file stripping.") sitePath = Sites.GetSitePath(siteName) # type: str siteIncludedPaths = GetIncludedPaths(Paths.StrippingSitesFilePath, sitePath) _VerifyStripped(sitePath, siteIncludedPaths)
def Run() -> bool: namespace = "NeonOcean.NOC.Mods.Distribution" # type: str Sites.BuildSite(namespace) Publishing.PublishSite(namespace) return True
def Run () -> bool: namespace = "NeonOcean.NOC.Mods.Distribution" # type: str siteHostingPath = Sites.GetSite(namespace).GetHostingPath() # type: typing.Optional[str] if siteHostingPath is not None: subprocess.call([sys.executable, "-m" "http.server"], cwd = siteHostingPath) else: print("Cannot host the website at '" + namespace + "' as no hosting directory has been specified.", file = sys.stderr) return True
def PublishSite(siteNamespace: str) -> None: print("Publishing site '" + siteNamespace + "'.") site = Sites.GetSite(siteNamespace) if Paths.WebsitesDistributionPath is None: raise Exception( "No website distribution path has been specified via automation settings." ) buildDirectoryPath = site.GetBuildPath() # type: str distributionPath = os.path.join(Paths.WebsitesDistributionPath, site.GetGithubName() + "_Hosting") # type: str if not os.path.exists(distributionPath): os.makedirs(distributionPath) if os.path.exists(distributionPath): for githubFileName in os.listdir(distributionPath): if githubFileName.startswith("."): continue distributionFilePath = os.path.join(distributionPath, githubFileName) # type: str if os.path.isdir(distributionFilePath): dir_util.remove_tree(distributionFilePath) else: os.remove(distributionFilePath) for buildFileName in os.listdir(buildDirectoryPath): # type: str buildFilePath = os.path.join(buildDirectoryPath, buildFileName) # type: str buildFileDistributionPath = os.path.join(distributionPath, buildFileName) # type: str if os.path.isdir(buildFilePath): dir_util.copy_tree(buildFilePath, buildFileDistributionPath) else: file_util.copy_file(buildFilePath, buildFileDistributionPath)