Skip to content

Commit

Permalink
Change override to overwrite in names
Browse files Browse the repository at this point in the history
  • Loading branch information
EzzhevNikita committed Sep 22, 2020
1 parent c0f49d1 commit f372c09
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"loc.input.help.destinationFolder": "Destination folder into which archive files should be extracted. Use [variables](https://go.microsoft.com/fwlink/?LinkID=550988) if files are not in the repo. Example: $(agent.builddirectory)",
"loc.input.label.cleanDestinationFolder": "Clean destination folder before extracting",
"loc.input.help.cleanDestinationFolder": "Select this option to clean the destination directory before archive contents are extracted into it.",
"loc.input.label.overrideExistingFiles": "Override existing files",
"loc.input.help.overrideExistingFiles": "Select this option to override any existing files in the destination directory.",
"loc.input.label.overwriteExistingFiles": "Overwrite existing files",
"loc.input.help.overwriteExistingFiles": "Select this option to overwrite existing files in the destination directory.",
"loc.messages.ExtractDirFailedinFindFiles": "Specified archive: %s can not be extracted because it is a directory.",
"loc.messages.ExtractNotFileFailed": "Specified archive: %s can not be extracted because it is not a file.",
"loc.messages.ExtractNotAccessibleFile": "Specified archive: %s can not be extracted because it can not be accessed: %s",
Expand Down
12 changes: 6 additions & 6 deletions Tasks/ExtractFilesV1/Tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('ExtractFile Suite', function () {
it('Successfully extracts a single zip', (done: MochaDone) => {
this.timeout(5000);
process.env['archiveFilePatterns'] = 'zip1.zip';
process.env['overrideExistingFiles'] = 'true';
process.env['overwriteExistingFiles'] = 'true';
delete process.env['cleanDestinationFolder'];

let tp: string = path.join(__dirname, 'L0Extract.js');
Expand All @@ -37,7 +37,7 @@ describe('ExtractFile Suite', function () {
it('Successfully extracts multiple zips', (done: MochaDone) => {
this.timeout(5000);
process.env['archiveFilePatterns'] = 'zip1.zip\nzip2.zip';
process.env['overrideExistingFiles'] = 'true';
process.env['overwriteExistingFiles'] = 'true';
delete process.env['cleanDestinationFolder'];

let tp: string = path.join(__dirname, 'L0Extract.js');
Expand All @@ -54,7 +54,7 @@ describe('ExtractFile Suite', function () {
it('Successfully extracts a tar', (done: MochaDone) => {
this.timeout(5000);
process.env['archiveFilePatterns'] = 'tar.tar';
process.env['overrideExistingFiles'] = 'true';
process.env['overwriteExistingFiles'] = 'true';
delete process.env['cleanDestinationFolder'];

let tp: string = path.join(__dirname, 'L0Extract.js');
Expand All @@ -70,7 +70,7 @@ describe('ExtractFile Suite', function () {
it('Successfully cleans destination', (done: MochaDone) => {
this.timeout(5000);
process.env['archiveFilePatterns'] = 'zip1.zip';
process.env['overrideExistingFiles'] = 'true';
process.env['overwriteExistingFiles'] = 'true';
process.env['cleanDestinationFolder'] = 'true';

let tp: string = path.join(__dirname, 'L0Extract.js');
Expand All @@ -87,7 +87,7 @@ describe('ExtractFile Suite', function () {
it('Successfully overwrites files from zip in output directory', (done: MochaDone) => {
this.timeout(5000);
process.env['archiveFilePatterns'] = 'zip1.zip';
process.env['overrideExistingFiles'] = 'true';
process.env['overwriteExistingFiles'] = 'true';
delete process.env['cleanDestinationFolder'];

let tp: string = path.join(__dirname, 'L0Extract.js');
Expand All @@ -105,7 +105,7 @@ describe('ExtractFile Suite', function () {
it('Successfully overwrites files from tar in output directory', (done: MochaDone) => {
this.timeout(5000);
process.env['archiveFilePatterns'] = 'tar.tar';
process.env['overrideExistingFiles'] = 'true';
process.env['overwriteExistingFiles'] = 'true';
delete process.env['cleanDestinationFolder'];

let tp: string = path.join(__dirname, 'L0Extract.js');
Expand Down
2 changes: 1 addition & 1 deletion Tasks/ExtractFilesV1/Tests/L0Extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ process.env['SYSTEM_DEFAULTWORKINGDIRECTORY'] = __dirname;
tmr.setInput('archiveFilePatterns', process.env['archiveFilePatterns']);
tmr.setInput('destinationFolder', __dirname);
tmr.setInput('cleanDestinationFolder', process.env['cleanDestinationFolder']);
tmr.setInput('overrideExistingFiles', process.env['overrideExistingFiles']);
tmr.setInput('overwriteExistingFiles', process.env['overwriteExistingFiles']);
const osType = os.type();
const isWindows = !!osType.match(/^Win/);

Expand Down
8 changes: 4 additions & 4 deletions Tasks/ExtractFilesV1/extractfilestask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import os = require('os');
var archiveFilePatterns: string[] = tl.getDelimitedInput('archiveFilePatterns', '\n', true);
var destinationFolder: string = path.normalize(tl.getPathInput('destinationFolder', true, false).trim());
var cleanDestinationFolder: boolean = tl.getBoolInput('cleanDestinationFolder', false);
var overrideExistingFiles: boolean = tl.getBoolInput('overrideExistingFiles', false);
var overwriteExistingFiles: boolean = tl.getBoolInput('overwriteExistingFiles', false);

var repoRoot: string = tl.getVariable('System.DefaultWorkingDirectory');
tl.debug('repoRoot: ' + repoRoot);
Expand Down Expand Up @@ -192,7 +192,7 @@ function unzipExtract(file, destinationFolder) {
}
var unzip = tl.tool(xpUnzipLocation);
unzip.arg(file);
if (overrideExistingFiles) {
if (overwriteExistingFiles) {
unzip.arg('-o');
}
unzip.arg('-d');
Expand All @@ -203,7 +203,7 @@ function unzipExtract(file, destinationFolder) {
function sevenZipExtract(file, destinationFolder) {
console.log(tl.loc('SevenZipExtractFile', file));
var sevenZip = tl.tool(getSevenZipLocation());
if (overrideExistingFiles) {
if (overwriteExistingFiles) {
sevenZip.arg('-aoa');
}
sevenZip.arg('x');
Expand All @@ -219,7 +219,7 @@ function tarExtract(file, destinationFolder) {
}
var tar = tl.tool(xpTarLocation);
tar.arg('-xvf'); // tar will correctly handle compression types outlined in isTar()
if (overrideExistingFiles) {
if (overwriteExistingFiles) {
tar.arg('-k');
}
tar.arg(file);
Expand Down
6 changes: 3 additions & 3 deletions Tasks/ExtractFilesV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
"helpMarkDown": "Select this option to clean the destination directory before archive contents are extracted into it."
},
{
"name": "overrideExistingFiles",
"name": "overwriteExistingFiles",
"type": "boolean",
"label": "Override existing files",
"label": "Overwrite existing files",
"required": true,
"defaultValue": "true",
"helpMarkDown": "Select this option to override any existing files in the destination directory."
"helpMarkDown": "Select this option to overwrite existing files in the destination directory."
}
],
"execution": {
Expand Down
6 changes: 3 additions & 3 deletions Tasks/ExtractFilesV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
"helpMarkDown": "ms-resource:loc.input.help.cleanDestinationFolder"
},
{
"name": "overrideExistingFiles",
"name": "overwriteExistingFiles",
"type": "boolean",
"label": "ms-resource:loc.input.label.overrideExistingFiles",
"label": "ms-resource:loc.input.label.overwriteExistingFiles",
"required": true,
"defaultValue": "true",
"helpMarkDown": "ms-resource:loc.input.help.overrideExistingFiles"
"helpMarkDown": "ms-resource:loc.input.help.overwriteExistingFiles"
}
],
"execution": {
Expand Down

0 comments on commit f372c09

Please sign in to comment.