Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/ratchet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2015-04-30 09:31:15 +0300
committerXhmikosR <xhmikosr@gmail.com>2015-04-30 09:32:11 +0300
commitd7fa4b7b5fe3a730cc53a390262a5fbaa8bb79a8 (patch)
treeebb64f9dc3892c8cc4980b1b80041c02eaa30aec
parenta722ffc9ca3252b51b90425f8543c5f3414b39c6 (diff)
Update grunt/ratchicons-data-generator.js to the latest upstream version.
-rw-r--r--Gruntfile.js2
-rw-r--r--grunt/ratchicons-data-generator.js11
2 files changed, 10 insertions, 3 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index 5045b08..9e19d91 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -401,7 +401,7 @@ module.exports = function (grunt) {
grunt.registerTask('server', ['dist', 'jekyll:docs', 'connect', 'watch']);
grunt.registerTask('prep-release', ['dist', 'jekyll:github', 'htmlmin', 'compress']);
- grunt.registerTask('build-ratchicons-data', generateRatchiconsData);
+ grunt.registerTask('build-ratchicons-data', function () { generateRatchiconsData.call(this, grunt); });
// Version numbering task.
// grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
diff --git a/grunt/ratchicons-data-generator.js b/grunt/ratchicons-data-generator.js
index 8d2b428..0cf07ec 100644
--- a/grunt/ratchicons-data-generator.js
+++ b/grunt/ratchicons-data-generator.js
@@ -8,9 +8,10 @@
/* jshint node: true */
'use strict';
+
var fs = require('fs');
-module.exports = function generateRatchiconsData() {
+module.exports = function generateRatchiconsData(grunt) {
// Pass encoding, utf8, so `readFileSync` will return a string instead of a
// buffer
var ratchiconsFile = fs.readFileSync('sass/ratchicons.scss', 'utf8');
@@ -20,6 +21,7 @@ module.exports = function generateRatchiconsData() {
var iconClassName = /^\.(icon-[^\s]+)/;
var ratchiconsData = '# This file is generated via Grunt task. **Do not edit directly.**\n' +
'# See the \'build-ratchicons-data\' task in Gruntfile.js.\n\n';
+ var ratchiconsYml = 'docs/_data/ratchicons.yml';
for (var i = 0, len = ratchiconsLines.length; i < len; i++) {
var match = ratchiconsLines[i].match(iconClassName);
@@ -33,5 +35,10 @@ module.exports = function generateRatchiconsData() {
fs.mkdirSync('docs/_data');
}
- fs.writeFileSync('docs/_data/ratchicons.yml', ratchiconsData);
+ try {
+ fs.writeFileSync(ratchiconsYml, ratchiconsData);
+ } catch (err) {
+ grunt.fail.warn(err);
+ }
+ grunt.log.writeln('File ' + ratchiconsYml.cyan + ' created.');
};