Skip to content

Commit

Permalink
More CMU backend works
Browse files Browse the repository at this point in the history
  • Loading branch information
flyandi committed Mar 26, 2016
1 parent fb1eb10 commit 846dd7e
Show file tree
Hide file tree
Showing 11 changed files with 829 additions and 54 deletions.
5 changes: 5 additions & 0 deletions apps/app.helloworld/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "app.helloworld",
"name": "Hello World",
"enabled": true
}
1 change: 1 addition & 0 deletions apps/appdrive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"bla": "foo"}
93 changes: 59 additions & 34 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ var
del = require('del'),
fs = require('fs'),
glob = require('glob'),
exec = require('child_process').exec;
exec = require('child_process').exec,
using = require('gulp-using'),
flatten = require('gulp-flatten');

/**
* @package
Expand Down Expand Up @@ -109,7 +111,7 @@ var buildJsonVersion = function(output, destination, name, attributes) {
/**
* (build) local apps
*
* These tasks handle the copy and build of the local apps
* These tasks handles the example apps
*/

var appsPathInput = "./apps/",
Expand Down Expand Up @@ -149,85 +151,85 @@ gulp.task('build-apps', function(callback) {


/**
* tasks to build the runtime
* tasks to build the framework
*/

var systemPathOutput = output + "system/",
runtimePathInput = input + "runtime/",
runtimePathOutput = systemPathOutput + "runtime/",
frameworkPathInput = input + "framework/",
frameworkPathOutput = systemPathOutput + "framework/",
customPathInput = input + "custom/";

// (cleanup)
gulp.task('system-cleanup', function() {
gulp.task('framework-cleanup', function() {
return del(
[systemPathOutput + '**/*']
);
});

// (skeleton)
gulp.task('system-runtime-skeleton', function() {
gulp.task('framework-skeleton', function() {

return gulp.src(runtimePathInput + "skeleton/**/*", {
base: runtimePathInput + "skeleton"
return gulp.src(frameworkPathInput + "skeleton/**/*", {
base: frameworkPathInput + "skeleton"
})
.pipe(gulp.dest(runtimePathOutput));
.pipe(gulp.dest(frameworkPathOutput));
});


// (less)
gulp.task('system-runtime-less', function() {
gulp.task('framework-less', function() {

return gulp.src(runtimePathInput + "less/*", {
base: runtimePathInput + "less"
return gulp.src(frameworkPathInput + "less/*", {
base: frameworkPathInput + "less"
})
.pipe(concat('runtime.css'))
.pipe(concat('framework.css'))
.pipe(less())
.pipe(gulp.dest(runtimePathOutput));
.pipe(gulp.dest(frameworkPathOutput));
});


// (Concatenate & Minify)
gulp.task('system-runtime-js', function() {
gulp.task('framework-js', function() {

return gulp.src(runtimePathInput + "js/*", {
base: runtimePathInput + "js"
return gulp.src(frameworkPathInput + "js/*", {
base: frameworkPathInput + "js"
})
.pipe(concat('runtime.js'))
.pipe(concat('framework.js'))
.pipe(uglify())
.pipe(concatutil.header(fs.readFileSync(runtimePathInput + "resources/header.txt", "utf8"), {
.pipe(concatutil.header(fs.readFileSync(frameworkPathInput + "resources/header.txt", "utf8"), {
pkg: package
}))
.pipe(gulp.dest(runtimePathOutput));
.pipe(gulp.dest(frameworkPathOutput));
});

// (copy custom app)
gulp.task('system-custom', function() {
gulp.task('framework-custom', function() {
return gulp.src(customPathInput + "**/*", {
base: customPathInput
})
.pipe(gulp.dest(systemPathOutput));
});

/** @job system-version */
gulp.task('system-version', function() {
gulp.task('framework-version', function() {

buildJsonVersion("runtime.json", runtimePathOutput, "runtime-package", function(package) {
buildJsonVersion("framework.json", frameworkPathOutput, "framework-package", function(package) {
return {
runtime: true,
framework: true,
}
});
});


// (build system)
gulp.task('build-system', function(callback) {
// (build framework)
gulp.task('build-framework', function(callback) {
runSequence(
'system-cleanup',
'system-runtime-skeleton',
'system-runtime-less',
'system-runtime-js',
'system-custom',
'system-version',
'framework-cleanup',
'framework-skeleton',
'framework-less',
'framework-js',
'framework-custom',
'framework-version',
callback
);
});
Expand Down Expand Up @@ -380,6 +382,8 @@ gulp.task('build-sdcard', function(callback) {
});




/**
* Build documentation
*/
Expand Down Expand Up @@ -597,11 +601,32 @@ gulp.task('clean', function() {
gulp.task('default', function(callback) {
runSequence(
'clean',
'build-system',
'build-framework',
'build-install',
'build-uninstall',
'build-sdcard',
//'build-docs',
callback
);
});


/**
* Node
*/

var nodePathInput = input + 'node-cmu/',
nodePathSource = input + 'node/latest/',
nodePathOutput = output + 'node/';


// (cleanup)
gulp.task('node', function() {

// copy embeeded files
gulp.src(nodePathInput + "**/*.js", {
base: nodePathInput
}).pipe(flatten()).pipe(gulp.dest(nodePathOutput + 'cmu'));


});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"gulp-concat": "^2.6.0",
"gulp-concat-util": "^0.5.5",
"gulp-file": "^0.2.0",
"gulp-flatten": "^0.2.0",
"gulp-git": "^1.7.0",
"gulp-jsdoc": "^0.1.5",
"gulp-less": "^3.0.5",
Expand All @@ -23,6 +24,7 @@
"gulp-replace": "^0.5.4",
"gulp-tar": "^1.8.0",
"gulp-uglify": "^1.5.2",
"gulp-using": "^0.1.0",
"gulp-webserver": "^0.9.1",
"run-sequence": "^1.1.5"
},
Expand Down
51 changes: 51 additions & 0 deletions src/node-cmu/cmu-utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Custom Application SDK for Mazda Connect Infotainment System
*
* A micro framework that allows to write custom applications for the Mazda Connect Infotainment System
* that includes an easy to use abstraction layer to the JCI system.
*
* Written by Andreas Schwarz (http://github.com/flyandi/mazda-custom-applications-sdk)
* Copyright (c) 2016. All rights reserved.
*
* WARNING: The installation of this application requires modifications to your Mazda Connect system.
* If you don't feel comfortable performing these changes, please do not attempt to install this. You might
* be ending up with an unusuable system that requires reset by your Dealer. You were warned!
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see http://www.gnu.org/licenses/
*
*/


'use strict';


/**
* A minimal implementation of the extend algorithm
* @param Any object
* @return object Returns an objec
*/
exports.extend = function(out) {

out = out || {};

for (var i = 1; i < arguments.length; i++) {
if (!arguments[i])
continue;

for (var key in arguments[i]) {
if (arguments[i].hasOwnProperty(key))
out[key] = arguments[i][key];
}
}

return out;
};
Loading

0 comments on commit 846dd7e

Please sign in to comment.