-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (23 loc) · 904 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
let rssFeedGenerator = require('./lib/rss-generator');
let broccoliFileCreator = require('broccoli-file-creator');
let Funnel = require('broccoli-funnel');
let chalk = require('chalk');
module.exports = {
name: require('./package').name,
treeForPublic() {
this._super.treeForPublic && this._super.treeForPublic.apply(this, arguments);
if (process.env.EMBER_ENV === 'production') {
let rssFeedOptions = this.app.options['rssFeed'];
try {
let feedContent = rssFeedGenerator(rssFeedOptions);
let tree = broccoliFileCreator('/prember-rss-feed/feed.xml', feedContent);
this.ui.writeLine(chalk.green('RSS Feed created successfully'));
return new Funnel(tree, { srcDir: 'prember-rss-feed' });
} catch (e) {
this.ui.writeLine(chalk.red('RSS Feed generation failed'));
this.ui.writeLine(e);
}
}
}
};