Lots of rework in the gulp processes

This commit is contained in:
140b8f67-ec51-4b64-9606-bff2dffa0170 2016-03-28 20:59:19 -07:00
parent 63904dac7a
commit 6567b2b018
3 changed files with 76 additions and 130 deletions

View file

@ -108,66 +108,36 @@ var buildJsonVersion = function(output, destination, name, attributes) {
} }
/** /**
* (build) local apps * Tasks to build the AppDrive
* * @jobs
* These tasks handles the example apps
*/ */
var appsPathInput = "./apps/", var appDrivePathOutput = output + 'appdrive/',
appsPathOutput = output + 'apps/system/casdk/apps/'; systemPathOutput = appDrivePathOutput + 'system/',
frameworkPathInput = input + 'framework/',
frameworkPathOutput = systemPathOutput,
// (cleanup) customPathInput = input + 'custom/',
gulp.task('apps-cleanup', function() { appsPathInput = 'apps/',
return del( appsPathOutput = appDrivePathOutput + 'apps/';
[appsPathOutput + '**/*']
);
});
// (copy)
gulp.task('apps-copy', function() {
return gulp.src(appsPathInput + "**/*", {
base: appsPathInput
})
.pipe(gulp.dest(appsPathOutput));
});
// (register)
gulp.task('apps-register', function() {
return;
});
// (build)
gulp.task('build-apps', function(callback) {
runSequence(
'apps-cleanup',
'apps-copy',
'apps-register',
callback
);
});
/** /**
* tasks to build the framework * Removes old artifacts from the Appdrive
* @job appdrive-cleanup
*/ */
gulp.task('appdrive-cleanup', function() {
var systemPathOutput = output + "system/",
frameworkPathInput = input + "framework/",
frameworkPathOutput = systemPathOutput + "framework/",
customPathInput = input + "custom/";
// (cleanup)
gulp.task('framework-cleanup', function() {
return del( return del(
[systemPathOutput + '**/*'] [appDrivePathOutput + '**/*']
); );
}); });
// (skeleton) /**
gulp.task('framework-skeleton', function() { * Builds the framework skeleton
* @job apdrive-framework-skeleton
*/
gulp.task('appdrive-framework-skeleton', function() {
return gulp.src(frameworkPathInput + "skeleton/**/*", { return gulp.src(frameworkPathInput + "skeleton/**/*", {
base: frameworkPathInput + "skeleton" base: frameworkPathInput + "skeleton"
@ -175,9 +145,11 @@ gulp.task('framework-skeleton', function() {
.pipe(gulp.dest(frameworkPathOutput)); .pipe(gulp.dest(frameworkPathOutput));
}); });
/**
// (less) * Processes the less files into css
gulp.task('framework-less', function() { * @job appdrive-framework-less
*/
gulp.task('appdrive-framework-less', function() {
return gulp.src(frameworkPathInput + "less/*", { return gulp.src(frameworkPathInput + "less/*", {
base: frameworkPathInput + "less" base: frameworkPathInput + "less"
@ -187,9 +159,11 @@ gulp.task('framework-less', function() {
.pipe(gulp.dest(frameworkPathOutput)); .pipe(gulp.dest(frameworkPathOutput));
}); });
/**
// (Concatenate & Minify) * Compiles the javascript for the framework
gulp.task('framework-js', function() { * @job appdrive-framework-js
*/
gulp.task('appdrive-framework-js', function() {
return gulp.src(frameworkPathInput + "js/*", { return gulp.src(frameworkPathInput + "js/*", {
base: frameworkPathInput + "js" base: frameworkPathInput + "js"
@ -202,34 +176,52 @@ gulp.task('framework-js', function() {
.pipe(gulp.dest(frameworkPathOutput)); .pipe(gulp.dest(frameworkPathOutput));
}); });
// (copy custom app) /**
gulp.task('framework-custom', function() { * Copy's the custom application for the JCI system
* @job appdrive-framework-custom
*/
gulp.task('appdrive-framework-custom', function() {
return gulp.src(customPathInput + "**/*", { return gulp.src(customPathInput + "**/*", {
base: customPathInput base: customPathInput
}) })
.pipe(gulp.dest(systemPathOutput)); .pipe(gulp.dest(frameworkPathOutput));
}); });
/** @job system-version */ /**
gulp.task('framework-version', function() { * Copy's the local apps to the AppDrive
* @job appdrive-app
*/
gulp.task('appdrive-apps', function() {
return gulp.src(appsPathInput + "**/*", {
base: appsPathInput
})
.pipe(gulp.dest(appsPathOutput));
});
buildJsonVersion("framework.json", frameworkPathOutput, "framework-package", function(package) { /**
* Creates the AppDrive JSON - This is usually managed through the AppDrive app
* @appdrive-apps-json
*/
gulp.task('appdrive-apps-json', function() {
buildJsonVersion("appdrive.json", appDrivePathOutput, "appdrive-package", function(package) {
return { return {
framework: true, framework: true,
} }
}); });
}); });
// (build framework) // (build framework)
gulp.task('build-framework', function(callback) { gulp.task('build-appdrive', function(callback) {
runSequence( runSequence(
'framework-cleanup', 'appdrive-cleanup',
'framework-skeleton', 'appdrive-framework-skeleton',
'framework-less', 'appdrive-framework-less',
'framework-js', 'appdrive-framework-js',
'framework-custom', 'appdrive-framework-custom',
'framework-version', 'appdrive-apps',
'appdrive-apps-json',
callback callback
); );
}); });
@ -339,51 +331,6 @@ gulp.task('build-uninstall', function(callback) {
); );
}); });
/**
* (build) builds the actual sd card content
*
*/
var SDCardPathOutput = output + 'sdcard/',
SDCardSystemPathOutput = SDCardPathOutput + "system/";
// (cleanup)
gulp.task('sdcard-cleanup', function() {
return del(
[SDCardPathOutput + '**/*']
);
});
// (copy)
gulp.task('sdcard-copy', function() {
// copy system
gulp.src(systemPathOutput + "**/*", {
base: systemPathOutput
})
.pipe(gulp.dest(SDCardSystemPathOutput));
// copy apps
gulp.src("apps/**/*", {
base: "apps/"
})
.pipe(gulp.dest(SDCardPathOutput + 'apps'));
});
// (build)
gulp.task('build-sdcard', function(callback) {
runSequence(
'sdcard-cleanup',
'sdcard-copy',
callback
);
});
/** /**
* Build documentation * Build documentation
*/ */
@ -601,10 +548,9 @@ gulp.task('clean', function() {
gulp.task('default', function(callback) { gulp.task('default', function(callback) {
runSequence( runSequence(
'clean', 'clean',
'build-framework', 'build-appdrive',
'build-install', 'build-install',
'build-uninstall', 'build-uninstall',
'build-sdcard',
//'build-docs', //'build-docs',
callback callback
); );

View file

@ -55,15 +55,16 @@ const RESULT_ERROR = 500;
const MOUNTROOT_PATH = "/tmp/mnt/"; const MOUNTROOT_PATH = "/tmp/mnt/";
const APPDRIVE_PATH = "/appdrive/"; const APPDRIVE_PATH = "/appdrive/";
const APPDRIVE_JSON = "appdrive.json";
const APPLICATIONS_PATH = "apps/";
const APPLICATION_JSON = "app.json"; const APPLICATION_JSON = "app.json";
const APPLICATION_CSS = "app.css"; const APPLICATION_CSS = "app.css";
const APPLICATION_JS = "app.js"; const APPLICATION_JS = "app.js";
const APPLICATION_WORKER = "worker.js"; const APPLICATION_WORKER = "worker.js";
const APPDRIVE_JSON = "appdrive.json"; const SYSTEM_PATH = "system/";
const FRAMEWORK_PATH = "/system/framework/";
const FRAMEWORK_JS = "framework.js"; const FRAMEWORK_JS = "framework.js";
const FRAMEWORK_CSS = "framework.css"; const FRAMEWORK_CSS = "framework.css";
@ -269,21 +270,16 @@ cmu.prototype = {
var frameworkPath = [MOUNTROOT_PATH, mountPoint, FRAMEWORK_PATH].join(""); var frameworkPath = [MOUNTROOT_PATH, mountPoint, FRAMEWORK_PATH].join("");
if(this._isDir) var appDrivePath = [MOUNTROOT_PATH, mountPoint, APPDRIVE_PATH].join(""),
var applicationsPath = [MOUNTROOT_PATH, mountPoint, APPLICATIONS_PATH].join(""), appDriveFilename = [appDrivePath, APPDRIVE_JSON].join("");
appdriveFilename = [path, APPDRIVE_JSON].join(""),
if(this._isFile(appdriveFilename)) { if(this._isFile(appDriveFilename)) {
this.appdrive = require(appdriveFilename); this.appdrive = require(appDriveFilename);
}
if(this._isDir(applicationsPath)) { var files = fs.readdirSync(appDrivePath);
var files = fs.readdirSync(applicationsPath);
if(files.length) files.forEach(function(appId) { if(files.length) files.forEach(function(appId) {
@ -294,7 +290,7 @@ cmu.prototype = {
if(!this.applications[appId]) { if(!this.applications[appId]) {
var applicationPath = [applicationsPath, appId, "/"].join(""); var applicationPath = [appDrivePath, appId, "/"].join("");
if(this._isDir(applicationPath)) { if(this._isDir(applicationPath)) {

View file

@ -374,6 +374,10 @@ window.CustomApplications = {
}.bind(this), 100); }.bind(this), 100);
} }
console.log(result);
Logger.debug(this.ID, "requestAppdrive", result);
// Continue here // Continue here
}.bind(this))); }.bind(this)));