Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #92 from zillow/omit-assets

Omit assets in non-skinnable builds when mod.assets === false
  • Loading branch information...
commit e2233b0f99f903798c2354f45aa420792a659583 2 parents d0e0117 + 420aa91
@caridy caridy authored
View
2  lib/builder.js
@@ -159,7 +159,7 @@ exports.start = function (json, options, buildCallback) {
Object.keys(json.builds).forEach(function (name) {
var mod = json.builds[name];
- if (!mod.skinnable && !(mod.config && mod.config.skinnable)) {
+ if (!mod.skinnable && !(mod.config && mod.config.skinnable) && mod.assets !== false) {
mod.assets = !hasSkin;
}
if (!options.modules || has(options.modules, name)) {
View
21 tests/5-builder.js
@@ -102,6 +102,27 @@ var tests = {
'coverage should be same': function(err, results) {
assert.equal(results.pre['yql-coverage.js'], results.post['yql-coverage.js']);
}
+ },
+ 'should respect mod.assets=false and': {
+ topic: function() {
+ var self = this;
+ fs.stat(path.join(buildBase, 'yql', 'assets'), function (err) {
+ self.callback(null, err);
+ });
+ },
+ 'should not create build/yql/assets': function(foo, err) {
+ assert.isNotNull(err);
+ assert.equal(err.code, 'ENOENT');
+ }
+ },
+ 'should copy assets in postbuild and': {
+ topic: function() {
+ fs.stat(path.join(buildBase, 'yql2', 'assets'), this.callback);
+ },
+ 'should create build/yql2/assets': function(err, stat) {
+ assert.isNull(err);
+ assert.isTrue(stat.isDirectory());
+ }
}
}
}
View
9 tests/6-builder-uglify-calendar.js
@@ -178,6 +178,15 @@ function createTests(buildSkin) {
assert.isTrue(stat.toString().indexOf('http://foobar.com/baz/calendar/assets/skins/sam/my-image.png') > -1);
}
};
+ context['should create calendar-base/assets dir and'] = {
+ topic: function() {
+ fs.stat(path.join(buildBase, 'calendar-base', 'assets'), this.callback);
+ },
+ 'should override mod.assets=false when skinnable': function(err, stat) {
+ assert.isNull(err);
+ assert.isTrue(stat.isDirectory());
+ }
+ };
} else {
context['should not create assets dir and'] = {
topic: function() {
View
1  tests/assets/yql/src/calendar/build.json
@@ -2,6 +2,7 @@
"name": "calendar",
"builds": {
"calendar-base": {
+ "assets": false,
"jsfiles": [
"calendar-base.js"
]
View
1  tests/assets/yql/src/yql/assets/foo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  tests/assets/yql/src/yql/build.json
@@ -5,6 +5,7 @@
],
"builds": {
"yql": {
+ "assets": false,
"exec": [
"shifter --config test.json --no-global-config",
"echo 'Foobar'"
View
1  tests/assets/yql/src/yql/test.json
@@ -5,6 +5,7 @@
],
"builds": {
"yql": {
+ "assets": false,
"jsfiles": [
"yql.js"
]
View
1  tests/assets/yql/src/yql2/assets/foo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.