github.com/jaylevin/jenkins-library@v1.230.4/pkg/whitesource/utils.go (about)

     1  package whitesource
     2  
     3  import (
     4  	"io"
     5  	"os"
     6  
     7  	"github.com/SAP/jenkins-library/pkg/maven"
     8  )
     9  
    10  // File defines the method subset we use from os.File
    11  type File interface {
    12  	io.Writer
    13  	io.StringWriter
    14  	io.Closer
    15  }
    16  
    17  // Utils captures all external functionality that needs to be exchangeable in tests.
    18  type Utils interface {
    19  	maven.Utils
    20  
    21  	Chdir(path string) error
    22  	Getwd() (string, error)
    23  	FileRead(path string) ([]byte, error)
    24  	FileWrite(path string, content []byte, perm os.FileMode) error
    25  	FileRemove(path string) error
    26  	FileRename(oldPath, newPath string) error
    27  	GetExitCode() int
    28  	RemoveAll(path string) error
    29  	FileOpen(name string, flag int, perm os.FileMode) (File, error)
    30  
    31  	FindPackageJSONFiles(config *ScanOptions) ([]string, error)
    32  	InstallAllNPMDependencies(config *ScanOptions, packageJSONFiles []string) error
    33  }