コード例 #1
0
ファイル: main.go プロジェクト: Stromausfall/ssmpg
func main() {
	// validate arguments
	configFile, baseHtml, contentFolder, outputPath := input.BasicValidationOfConsoleArguments(os.Args[1:])

	/*
		configFile := "C:/Users/Matthias/OneDrive/GO/ssmpg/input/test.yaml"
		baseHtml := "C:/Users/Matthias/OneDrive/GO/ssmpg/input/base.html"
		contentFolder := "C:/Users/Matthias/OneDrive/GO/ssmpg/input/content"
		outputPath := "C:/xxx/output/"
	*/

	os.Mkdir(filepath.Join(outputPath, "content"), 777)
	os.Mkdir(filepath.Join(outputPath, "categories"), 777)

	configData := input.CreateConfigData(configFile)
	baseHtmlContent := input.LoadBaseHtmlData(baseHtml)
	contentData := input.LoadContentData(contentFolder)

	// create index
	page.CreateIndexPage(outputPath, configData, contentData, baseHtmlContent)

	// create category pages
	categories := sidebar.CollectCategories(contentData)

	// we need to synchronize the go routines
	waitGroup := sync.WaitGroup{}

	createCategories(&waitGroup, categories, outputPath, configData, contentData, baseHtmlContent)
	createContent(&waitGroup, outputPath, configData, contentData, baseHtmlContent)

	// wait until all go routines have finished
	waitGroup.Wait()
}
コード例 #2
0
ファイル: page_test.go プロジェクト: Stromausfall/ssmpg
func setupTestEnvironment(id string) (string, input.ConfigData, []input.ContentData) {
	baseDir := filepath.Join(test.GetTestPath(), "pageTest"+id)
	outputDirectory := filepath.Join(baseDir, "output")
	test.CreateTestDirectory(baseDir)
	test.CreateTestDirectory(outputDirectory)

	configDataPath := createConfigFile(baseDir)
	contentPath := createContent(baseDir)

	configData := input.CreateConfigData(configDataPath)
	elements := input.LoadContentData(contentPath)

	return outputDirectory, configData, elements
}