Skip to content

Commit

Permalink
Expose more information about 3rd party dependencies
Browse files Browse the repository at this point in the history
Added `install-deps` command as well as updated the `install` and `info` commands to deal with 3rd party dependencies, using the extra information now included in Strongback 2017.x versions.
  • Loading branch information
rhauch committed Jan 6, 2017
1 parent 833aca2 commit a55a96d
Show file tree
Hide file tree
Showing 2 changed files with 218 additions and 45 deletions.
28 changes: 28 additions & 0 deletions files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package files
import (
"archive/tar"
"bufio"
"bytes"
"compress/gzip"
"fmt"
"io"
Expand Down Expand Up @@ -64,6 +65,33 @@ func IsExistingDirectory(path string) bool {
return false
}

func FilesHaveSameContent(file1, file2 string) bool {
if !IsExistingFile(file1) || !IsExistingFile(file2) {
return false
}
sf, err := os.Open(file1)
if err != nil {
panic(err)
}

df, err := os.Open(file2)
if err != nil {
panic(err)
}

sscan := bufio.NewScanner(sf)
dscan := bufio.NewScanner(df)

for sscan.Scan() {
dscan.Scan()
if !bytes.Equal(sscan.Bytes(), dscan.Bytes()) {
return false
}
}

return true
}

func MkDir(path string) {
if _, err := os.Stat(path); os.IsNotExist(err) {
os.Mkdir(path, 0700)
Expand Down
Loading

0 comments on commit a55a96d

Please sign in to comment.