1 | var path = require('path'); |
||
2 | var jsonfile = require('jsonfile'); |
||
3 | |||
4 | /** |
||
5 | * updates the pattern-library JSON data-file |
||
6 | */ |
||
7 | function updateDataFile ( ) { |
||
8 | |||
9 | var _this = this, |
||
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
10 | patterns = this.data.patterns, |
||
11 | categories = this.data.categories, |
||
12 | destPath = path.join(this.options.dest, this.options.basepath) |
||
13 | ; |
||
14 | |||
15 | // complete library data |
||
16 | var file = path.join(destPath, 'patternlibrary.json'); |
||
17 | jsonfile.writeFileSync(file, this.data, {spaces: 4}); |
||
18 | |||
19 | if (this.options.nogui === false) { |
||
20 | |||
21 | // search data |
||
22 | this.options.pageRoot = path.join(this.options.basepath, ''); |
||
23 | this.buildsearch(path.join(destPath, 'search.json'), function() { |
||
24 | |||
25 | // pattern data |
||
26 | var file = path.join(destPath, 'patterns.json'); |
||
27 | jsonfile.writeFileSync(file, patterns, {spaces: 4}); |
||
28 | |||
29 | // categorie data |
||
30 | var file = path.join(destPath, 'categories.json'); |
||
31 | jsonfile.writeFileSync(file, categories, {spaces: 4}); |
||
32 | |||
33 | }); |
||
34 | |||
35 | } |
||
36 | |||
37 | } |
||
38 | |||
39 | module.exports = updateDataFile; |
||
40 |