Beispiel #1
0
func writeConceptToFile(concept string, conceptUsageText string, conceptFileName string, fileName string, info *gauge_messages.TextInfo) {
	if _, err := os.Stat(conceptFileName); os.IsNotExist(err) {
		os.Create(conceptFileName)
	}
	content, _ := common.ReadFileContents(conceptFileName)
	util.SaveFile(conceptFileName, content+"\n"+concept, true)
	text := ReplaceExtractedStepsWithConcept(info, conceptUsageText)
	util.SaveFile(fileName, text, true)
}
Beispiel #2
0
func writeToConceptAndSpecFiles(specs []*parser.Specification, conceptDictionary *parser.ConceptDictionary, specsRefactored map[*parser.Specification]bool, conceptFilesRefactored map[string]bool) ([]string, []string) {
	specFiles := make([]string, 0)
	conceptFiles := make([]string, 0)
	for _, spec := range specs {
		if specsRefactored[spec] {
			specFiles = append(specFiles, spec.FileName)
			formatted := formatter.FormatSpecification(spec)
			util.SaveFile(spec.FileName, formatted, true)
		}
	}
	conceptMap := formatter.FormatConcepts(conceptDictionary)
	for fileName, concept := range conceptMap {
		if conceptFilesRefactored[fileName] {
			conceptFiles = append(conceptFiles, fileName)
			util.SaveFile(fileName, concept, true)
		}
	}
	return specFiles, conceptFiles
}