github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/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  }