Exemplo n.º 1
0
Arquivo: build.go Projeto: get3w/get3w
func (parser *Parser) buildCopy(excludeKeys, includeKeys []string) error {
	files, err := parser.Storage.GetAllFiles(parser.Storage.GetSourcePrefix(""))
	if err != nil {
		return err
	}

	for _, file := range files {
		if file.IsDir || isUnderscoreOrDotPrefix(file.Path) {
			continue
		}
		sourceKey := parser.Storage.GetSourceKey(file.Path)
		destinationKey := parser.Storage.GetDestinationKey(file.Path)

		if stringutils.HasPrefixIgnoreCase(excludeKeys, sourceKey) {
			if !stringutils.HasPrefixIgnoreCase(includeKeys, sourceKey) {
				continue
			}
		}

		err := parser.Storage.CopyToDestination(sourceKey, destinationKey)
		if err != nil {
			return err
		}
	}

	return nil
}
Exemplo n.º 2
0
Arquivo: utils.go Projeto: get3w/get3w
// IsLocalFile returns true if the file is local only
func (parser *Parser) IsLocalFile(file *get3w.File) bool {
	if strings.HasPrefix(file.Path, parser.Config.Destination) {
		return true
	}
	if stringutils.HasPrefixIgnoreCase(localOnlyPrefixes, file.Path) {
		return true
	}
	return false
}