forked from NAL-i5K/genomics-workspace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mitigation for NAL-i5K#307, NAL-i5K#312
and NAL-i5K#257 the removed file was desired and was done wile testing the clean.js script
- Loading branch information
1 parent
0defb98
commit 0f72aaf
Showing
3 changed files
with
68 additions
and
144 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const deleteFolderRecursive = function(path) { | ||
fs.readdirSync(path).forEach(function(file, index){ | ||
let curPath = path + "/" + file; | ||
if (fs.lstatSync(curPath).isDirectory()) { // recurse | ||
deleteFolderRecursive(curPath); | ||
} else { // delete file | ||
fs.unlinkSync(curPath); | ||
} | ||
}); | ||
fs.rmdirSync(path); | ||
}; | ||
|
||
const projectRootPath = path.resolve(__dirname, '..'); | ||
const gitIgnorePath = path.resolve(projectRootPath, '.gitignore'); | ||
|
||
let files = fs.readFileSync(gitIgnorePath) | ||
.toString() | ||
.split('\n') | ||
.filter(function(data){ | ||
if ( | ||
data !== '' && | ||
!data.startsWith('#') && | ||
!data.startsWith('*') && | ||
!data.startsWith('.') | ||
) { | ||
if ( | ||
data.startsWith('/app/static') || | ||
data.startsWith('/blast/static') || | ||
data.startsWith('/clustal/static') || | ||
data.startsWith('/hmmer/static') | ||
) | ||
return true; | ||
} | ||
}); | ||
|
||
for (let f of files) { | ||
f = path.resolve(projectRootPath, '.' + f); | ||
if (fs.existsSync(f)) { | ||
if (fs.lstatSync(f).isDirectory()) { | ||
deleteFolderRecursive(f); | ||
} else { | ||
fs.unlinkSync(f); | ||
} | ||
} | ||
} |