Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Fix options not being passed to taskConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
joscha committed Dec 30, 2014
1 parent af53eb6 commit f890889
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/crx.js
Expand Up @@ -135,7 +135,7 @@ exports.init = function(grunt){
taskConfig.options.privateKey = resolveHomeDirectory(taskConfig.options.privateKey);

if (!grunt.file.exists(taskConfig.options.privateKey)){
grunt.fail.fatal('Unable to locate your private key.');
grunt.fail.fatal('Unable to locate your private key at path "' + taskConfig.options.privateKey + '".');
}
else{
crxConfig.privateKey = grunt.file.read(taskConfig.options.privateKey);
Expand Down
7 changes: 6 additions & 1 deletion tasks/crx.js
Expand Up @@ -9,6 +9,7 @@
"use strict";

var async = require('async');
var _ = require('lodash');

module.exports = function(grunt) {
var extensionHelper = require('./../lib/crx').init(grunt);
Expand All @@ -20,7 +21,11 @@ module.exports = function(grunt) {

this.requiresConfig('crx');

var options = this.data.options;
this.files.forEach(function(taskConfig) {
if (options) {
taskConfig.options = _.extend(options, taskConfig.options || {});
}
var extension = extensionHelper.createObject(taskConfig, defaults);

// Building
Expand All @@ -43,4 +48,4 @@ module.exports = function(grunt) {
});

});
};
};
18 changes: 18 additions & 0 deletions test/lib-crx.js
Expand Up @@ -93,4 +93,22 @@ describe('lib/crx', function(){
done();
});
});

it('should work with a real-world grunt-crx run', function (done) {

// load the task as if done by grunt
var task = require('../tasks/crx.js');
task(grunt);

grunt.option('options.silently', true);

// run it as if done by grunt (just no log output)
grunt.log.muted = true;
grunt.tasks(['crx:standard'], {}, function() {
expect(grunt.file.expand('test/data/files/test.crx')).to.have.lengthOf(1);
grunt.log.muted = false;
done();
});

});
});

0 comments on commit f890889

Please sign in to comment.