Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Started adding support for task skipping and task defaults.

  • Loading branch information...
commit ae894ac6841729d00731aafaba1d60f667691f11 1 parent edf74e5
mosen authored
View
7 CHANGELOG.md
@@ -0,0 +1,7 @@
+v0.0.3
+------
++ Initial release
+
+v0.0.4
+------
++ Skip tasks is now an array instead of an object literal, and takes the names of the tasks to skip in the queue.
View
8 bin/cli.js
@@ -83,6 +83,14 @@ function build(component) {
logger: logger
};
+ if (component.skip.length > 0) {
+ queueOpts.skip = component.skip;
+ }
+
+ if (Object.keys(component.tasks).length > 0) {
+ queueOpts.defaults = component.tasks;
+ }
+
taskQueues.push(queues._createSourceQueue(component, queueOpts));
if (component.skinnable) {
View
26 lib/component.js
@@ -28,7 +28,7 @@ var Component = function() {
} else {
try {
var fs = require('fs'),
- buildfile, buildspec,
+ buildfile,
component = Object.create(Component.prototype, ATTRS);
if (arguments[0] !== undefined && path.existsSync(arguments[0])) {
@@ -36,14 +36,14 @@ var Component = function() {
component._buildSpec = JSON.parse(buildfile);
component._sourceDir = path.dirname(arguments[0]);
} else {
- buildspec = default_spec;
+ throw new TypeError('The build.json file does not exist or was not specified');
}
component._initFileNames();
return component;
} catch (e) {
- throw new TypeError('The build spec file was not readable or parseable: ' + arguments[0] + ' Original error: ' + e);
+ throw new TypeError('The build.json file was not readable or not parseable: ' + arguments[0] + ' Original error: ' + e);
}
}
};
@@ -290,6 +290,26 @@ var ATTRS = {
return ', { ' + details.join(', ') + ' }';
}
// no setter, use individual detail accessor
+ },
+
+ /**
+ * @property skip
+ * @type Array
+ */
+ skip : {
+ get : function() {
+ return this._buildSpec.skip || [];
+ }
+ },
+
+ /**
+ * @property defaults
+ * @type Object
+ */
+ tasks : {
+ get : function() {
+ return this._buildSpec.tasks || {};
+ }
}
};
View
17 lib/default_spec.js
@@ -10,22 +10,19 @@
*/
var defaultBuildSpecification = module.exports = {
name : "component",
- type : "js",
+ type : "js", // js | css | lang
version : "@VERSION@",
- skip : {
- clean : false,
- register : false,
- lint : false,
- logger: false
- },
+ skip : [],
sourceDir : "js",
- sourceFiles : ["component.js"],
+ sourceFiles : ["component.js"], // By default this should be replaced with component name.js
buildDir : "../build",
assetsDir : "assets",
- tools : {
+ tasks : {
template : {
yuivar : "Y",
- module_template : "../templates/moduletemplate.handlebars"
+ module_template : "../templates/moduletemplate.handlebars",
+ lang_template : "../templates/lang.handlebars",
+ rollup_template : "../templates/rollup.handlebars"
},
replace : {
regex: '^.*?(?:logger|Y.log).*?(?:;|\\).*;|(?:\r?\n.*?)*?\\).*;).*;?.*?\r?\n',
View
4 package.json
@@ -1,6 +1,6 @@
{
"name" : "ybuild",
- "version" : "0.0.3",
+ "version" : "0.0.4",
"description" : "YUI module builder",
"keywords" : ["yui", "yuibuild"],
"author" : {
@@ -19,7 +19,7 @@
"url" : "https://github.com/mosen/ybuild.git"
},
"dependencies" : {
- "buildy" : "0.0.5",
+ "buildy" : "0.0.6",
"nopt" : "1.0.x",
"winston" : "0.5.x",
"pkginfo" : "0.2.x"
View
28 test/fixtures/build.json
@@ -2,34 +2,26 @@
"name" : "component",
"type" : "js",
"version" : "@VERSION@",
- "skip" : {
- "clean" : false,
- "register" : false,
- "lint" : false,
- "logger" : false
- },
+ "skip" : [
+ "files"
+ ],
"sourceDir" : "js",
"sourceFiles" : [
- "component.js"
+ "./component.js"
],
- "buildDir" : "../build",
- "assetsDir" : "assets",
- "tools" : {
- "jslint" : {
- "jslint option" : null
- },
- "csslint" : {
- "csslint option" : null
- }
+ "buildDir" : "./build",
+ "assetsDir" : "./assets",
+ "tasks" : {
+
},
"details" : {
- "use" : null,
+ "use" : null,
"supersedes" : null,
"requires" : ["base"],
"optional" : null,
"after" : null,
"after_map" : {},
"lang" : ["en-US"],
- "skinnable" : true
+ "skinnable" : false
}
}
View
4 test/fixtures/component.js
@@ -0,0 +1,4 @@
+// Test File
+
+var x = 1;
+alert(x);
View
26 test/fixtures/skip/build.json
@@ -0,0 +1,26 @@
+{
+ "name" : "component",
+ "type" : "js",
+ "version" : "@VERSION@",
+ "skip" : [
+ ],
+ "sourceDir" : "js",
+ "sourceFiles" : [
+ "../component.js"
+ ],
+ "buildDir" : "../build",
+ "assetsDir" : "../assets",
+ "tasks" : {
+
+ },
+ "details" : {
+ "use" : null,
+ "supersedes" : null,
+ "requires" : ["base"],
+ "optional" : null,
+ "after" : null,
+ "after_map" : {},
+ "lang" : ["en-US"],
+ "skinnable" : false
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.