diff options
Diffstat (limited to 'scripts/danger')
-rw-r--r-- | scripts/danger/clean/cleaner.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/danger/clean/cleaner.js b/scripts/danger/clean/cleaner.js index d1e218145..1a1e3dee7 100644 --- a/scripts/danger/clean/cleaner.js +++ b/scripts/danger/clean/cleaner.js | |||
@@ -1,3 +1,4 @@ | |||
1 | const eachSeries = require('async/eachSeries') | ||
1 | const rimraf = require('rimraf') | 2 | const rimraf = require('rimraf') |
2 | 3 | ||
3 | const constants = require('../../../server/initializers/constants') | 4 | const constants = require('../../../server/initializers/constants') |
@@ -10,14 +11,15 @@ db.init(true, function () { | |||
10 | console.info('Tables of %s deleted.', db.sequelize.config.database) | 11 | console.info('Tables of %s deleted.', db.sequelize.config.database) |
11 | 12 | ||
12 | const STORAGE = constants.CONFIG.STORAGE | 13 | const STORAGE = constants.CONFIG.STORAGE |
13 | Object.keys(STORAGE).forEach(function (storage) { | 14 | eachSeries(Object.keys(STORAGE), function (storage, callbackEach) { |
14 | const storageDir = STORAGE[storage] | 15 | const storageDir = STORAGE[storage] |
15 | 16 | ||
16 | rimraf(storageDir, function (err) { | 17 | rimraf(storageDir, function (err) { |
17 | if (err) throw err | 18 | console.info('%s deleted.', storageDir) |
18 | 19 | return callbackEach(err) | |
19 | console.info('Deleting %s.', storageDir) | ||
20 | }) | 20 | }) |
21 | }, function () { | ||
22 | process.exit(0) | ||
21 | }) | 23 | }) |
22 | }) | 24 | }) |
23 | }) | 25 | }) |