Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
sverdlov93 committed Sep 19, 2024
1 parent 38d76ba commit 9efe576
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions archive/unarchive.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func IsSupportedArchive(filePath string) bool {
return ok
}

// The 'archive' dependency includes an API called 'Unarchive' to extract archive files. This API uses the archive file
// The 'archiver' dependency includes an API called 'Unarchive' to extract archive files. This API uses the archive file
// extension to determine the archive type.
// We therefore need to use the file name as it was in Artifactory, and not the file name which was downloaded. To achieve this,
// we added a new implementation of the 'Unarchive' func and use it instead of the default one.
Expand All @@ -58,7 +58,7 @@ func (u *Unarchiver) Unarchive(archivePath, archiveName, destinationPath string)
return unarchiver.Unarchive(archivePath, destinationPath)
}

// Instead of using 'archive.byExtension' that by default sets OverwriteExisting to false, we implement our own.
// Instead of using 'archiver.byExtension' that by default sets OverwriteExisting to false, we implement our own.
func (u *Unarchiver) byExtension(filename string) (interface{}, error) {
var ec interface{}
for _, c := range supportedArchives {
Expand Down
12 changes: 6 additions & 6 deletions archive/unarchive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ func TestUnarchive(t *testing.T) {
// Create temp directory
tmpDir := t.TempDir()

// Run archive on archive created on Unix
// Run unarchive on archive created on Unix
err := runUnarchive(t, uarchiver, "unix."+extension, "archives", filepath.Join(tmpDir, "unix"))
assert.NoError(t, err)
assert.FileExists(t, filepath.Join(tmpDir, "unix", "link"))
assert.FileExists(t, filepath.Join(tmpDir, "unix", "dir", "file"))

// Run archive on archive created on Windows
// Run unarchive on archive created on Windows
err = runUnarchive(t, uarchiver, "win."+extension, "archives", filepath.Join(tmpDir, "win"))
assert.NoError(t, err)
assert.FileExists(t, filepath.Join(tmpDir, "win", "link.lnk"))
Expand Down Expand Up @@ -104,13 +104,13 @@ func TestUnarchiveWithStripComponents(t *testing.T) {
// Create temp directory
tmpDir := t.TempDir()

// Run archive on archive created on Unix
// Run unarchive on archive created on Unix
err := runUnarchive(t, uarchiver, "strip-components."+extension, "archives", filepath.Join(tmpDir, "unix"))
assert.NoError(t, err)
assert.DirExists(t, filepath.Join(tmpDir, "unix", "nested_folder_1"))
assert.DirExists(t, filepath.Join(tmpDir, "unix", "nested_folder_2"))

// Run archive on archive created on Windows
// Run unarchive on archive created on Windows
err = runUnarchive(t, uarchiver, "strip-components."+extension, "archives", filepath.Join(tmpDir, "win"))
assert.NoError(t, err)
assert.DirExists(t, filepath.Join(tmpDir, "win", "nested_folder_1"))
Expand All @@ -119,12 +119,12 @@ func TestUnarchiveWithStripComponents(t *testing.T) {
}
}

// Test archive file with a directory named "." in the root directory
// Test unarchive file with a directory named "." in the root directory
func TestUnarchiveDotDir(t *testing.T) {
// Create temp directory
tmpDir := t.TempDir()

// Run archive
// Run unarchive
err := runUnarchive(t, Unarchiver{}, "dot-dir.tar.gz", "archives", tmpDir+string(os.PathSeparator))
assert.NoError(t, err)
assert.DirExists(t, filepath.Join(tmpDir, "dir"))
Expand Down

0 comments on commit 9efe576

Please sign in to comment.