Documentation
¶
Overview ¶
Copyright © 2018 Mephis Pheies <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2018 Mephis Pheies <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2018 Mephis Pheies <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright © 2018 Mephis Pheies <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- Variables
- func Check(checker IgnoreSupport, path string, info os.FileInfo) bool
- func CopyFile(src, dst string) (err error)
- func HomeDir() string
- func IsDir(path string) bool
- func IsNotExist(path string) bool
- func ReadFile(path string) ([]byte, error)
- func WriteFile(path string, data []byte) error
- type BaseSupport
- func (bs *BaseSupport) Done(path string, info os.FileInfo)
- func (bs *BaseSupport) Fail(path string, info os.FileInfo)
- func (bs *BaseSupport) Next() IgnoreSupport
- func (bs *BaseSupport) SetName(n string)
- func (bs *BaseSupport) SetNext(n IgnoreSupport) IgnoreSupport
- func (bs *BaseSupport) SetNexts(ns []IgnoreSupport) IgnoreSupport
- func (bs *BaseSupport) String() string
- type GitIgnoreSupport
- type IgnoreDotSupport
- type IgnoreRegexpMatchSupport
- type IgnoreSpecialMadeSupport
- type IgnoreSupport
- func NewGitIgnoreSupport(path string) (IgnoreSupport, error)
- func NewIgnoreDotSupport() (IgnoreSupport, error)
- func NewIgnoreRegexpMatchSupport(expr string) (IgnoreSupport, error)
- func NewIgnoreUnregularSupport() (IgnoreSupport, error)
- func NewMultiIgnoreRegexpMatchSupports(exprs []string) ([]IgnoreSupport, error)
- type Item
- type Walker
Constants ¶
const (
PERM_OF_AUTO_CREATE_DIR os.FileMode = 0755
)
Variables ¶
var ( Debug = Logger.Debug Debugf = Logger.Debugf Debugln = Logger.Debugln Info = Logger.Info Infof = Logger.Infof Infoln = Logger.Infoln Warn = Logger.Warn Warnf = Logger.Warnf Warnln = Logger.Warnln Error = Logger.Error Errorf = Logger.Errorf Errorln = Logger.Errorln Fatal = Logger.Fatal Fatalf = Logger.Fatalf Fatalln = Logger.Fatalln Panic = Logger.Panic Panicf = Logger.Panicf Panicln = Logger.Panicln )
var Logger = log.New()
Functions ¶
func Check ¶
func Check(checker IgnoreSupport, path string, info os.FileInfo) bool
Check calls each IsIgnore method of each IgnoreSupport in chain of repositories.
func CopyFile ¶
CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, copy the file contents from src to dst.
func IsNotExist ¶
Types ¶
type BaseSupport ¶
type BaseSupport struct {
// contains filtered or unexported fields
}
BaseSupport implements almost methods of IgnoreSupport interface except `IsIgnore`. It should be embeded into a concrete IgnoreSupport.
func (*BaseSupport) Done ¶
func (bs *BaseSupport) Done(path string, info os.FileInfo)
Done does nothing but implement IgnoreSupport interface
func (*BaseSupport) Fail ¶
func (bs *BaseSupport) Fail(path string, info os.FileInfo)
Fail does nothing but implement IgnoreSupport interface
func (*BaseSupport) SetName ¶
func (bs *BaseSupport) SetName(n string)
SetName set n to name This method should only be used when concrete IgnoreSupport inits, so it is not a part of IgnoreSupport interface.
func (*BaseSupport) SetNext ¶
func (bs *BaseSupport) SetNext(n IgnoreSupport) IgnoreSupport
SetNext assign another IgnoreSupport to inner next field. It is used to construct a chain of IgnoreSupports.
func (*BaseSupport) SetNexts ¶
func (bs *BaseSupport) SetNexts(ns []IgnoreSupport) IgnoreSupport
SetNexts assign a IgnoreSupport link list to inner next field.
func (*BaseSupport) String ¶
func (bs *BaseSupport) String() string
String describe the chain of IgnoreSupport
type GitIgnoreSupport ¶
type GitIgnoreSupport struct {
BaseSupport
// contains filtered or unexported fields
}
type IgnoreDotSupport ¶
type IgnoreDotSupport struct {
BaseSupport
}
IgnoreDotSupport ignore all dot fies.
type IgnoreRegexpMatchSupport ¶
type IgnoreRegexpMatchSupport struct {
BaseSupport
// contains filtered or unexported fields
}
type IgnoreSpecialMadeSupport ¶
type IgnoreSpecialMadeSupport struct {
BaseSupport
// contains filtered or unexported fields
}
IgnoreSpecialMadeSupport ignore special type fies.
type IgnoreSupport ¶
type IgnoreSupport interface {
SetNext(IgnoreSupport) IgnoreSupport
SetNexts([]IgnoreSupport) IgnoreSupport
Next() IgnoreSupport
String() string
IsIgnore(path string, info os.FileInfo) (bool, error)
Done(path string, info os.FileInfo)
Fail(path string, info os.FileInfo)
}
IgnoreSupport is a part of abstract Support.
func NewGitIgnoreSupport ¶
func NewGitIgnoreSupport(path string) (IgnoreSupport, error)
func NewIgnoreDotSupport ¶
func NewIgnoreDotSupport() (IgnoreSupport, error)
func NewIgnoreRegexpMatchSupport ¶
func NewIgnoreRegexpMatchSupport(expr string) (IgnoreSupport, error)
func NewIgnoreUnregularSupport ¶
func NewIgnoreUnregularSupport() (IgnoreSupport, error)
func NewMultiIgnoreRegexpMatchSupports ¶
func NewMultiIgnoreRegexpMatchSupports(exprs []string) ([]IgnoreSupport, error)
type Walker ¶
type Walker struct {
// contains filtered or unexported fields
}
Walker walk the directory 'dir' to check each pathes of file undet it, then put path of valid file into pipe channel.
func NewWalker ¶
func NewWalker(dir string, checker IgnoreSupport, cap int) *Walker
NewWalker read and collect files recursively under the dir Directory