commit
3faec602a7
40
apps.json
40
apps.json
|
|
@ -1,25 +1,35 @@
|
|||
---
|
||||
# =================================================================
|
||||
# ALL THE INFORMATION INSIDE APPS.JSON HAS NOW BEEN MOVED
|
||||
#
|
||||
# You'll find it inside a file called apps/yourapp/metadata.json
|
||||
#
|
||||
# Otherwise nothing has changed. GitHub Pages will automatically
|
||||
# create apps.json as your site is hosted, or if you're hosting
|
||||
# yourself you can run bin/create_apps_json.sh
|
||||
#
|
||||
# =================================================================
|
||||
|
||||
# Uncomment the following line if you only want explicitly listed
|
||||
# apps to be available on your site
|
||||
|
||||
# restricted: ["boot", "launch", "antonclk", "health", "setting", "about", "widbat", "widbt", "widlock", "widid"]
|
||||
---
|
||||
{% comment %}
|
||||
=================================================================
|
||||
ALL THE INFORMATION INSIDE APPS.JSON HAS NOW BEEN MOVED
|
||||
|
||||
You'll find it inside a file called apps/yourapp/metadata.json
|
||||
|
||||
Otherwise nothing has changed. GitHub Pages will automatically
|
||||
create apps.json as your site is hosted, or if you're hosting
|
||||
yourself you can run bin/create_apps_json.sh
|
||||
|
||||
=================================================================
|
||||
{% endcomment %}
|
||||
{%- assign apps = site.static_files | where: "name", "metadata.json" -%}
|
||||
{%- if page.restricted == nil -%}
|
||||
{%- assign apps = site.static_files | where: "name", "metadata.json" | map: "path" -%}
|
||||
{%- else -%}
|
||||
{%- capture temp -%}
|
||||
{%- for app in page.restricted %} /apps/{{app}}/metadata.json {%- endfor -%}
|
||||
{%- endcapture -%}
|
||||
{%- assign apps = temp | strip | split: " " -%}
|
||||
{%- endif -%}
|
||||
|
||||
[
|
||||
|
||||
{%- include_relative {{ apps.first.path }} -%}
|
||||
{%- include_relative {{ apps.first }} -%}
|
||||
|
||||
{%- for app in apps offset:1 -%}
|
||||
,{%- include_relative {{ app.path }} -%}
|
||||
,{%- include_relative {{ app }} -%}
|
||||
{%- endfor -%}
|
||||
|
||||
]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ var SETTINGS = {
|
|||
var path = require('path');
|
||||
var ROOTDIR = path.join(__dirname, '..');
|
||||
var APPDIR = ROOTDIR+'/apps';
|
||||
var APPJSON = ROOTDIR+'/apps.json';
|
||||
var OUTFILE = ROOTDIR+'/firmware.js';
|
||||
var DEVICE = "BANGLEJS";
|
||||
var APPS = [ // IDs of apps to install
|
||||
|
|
@ -28,7 +27,6 @@ global.Const = {
|
|||
};
|
||||
|
||||
var AppInfo = require(ROOTDIR+"/core/js/appinfo.js");
|
||||
var appjson = JSON.parse(fs.readFileSync(APPJSON).toString());
|
||||
var appfiles = [];
|
||||
|
||||
function fileGetter(url) {
|
||||
|
|
@ -58,8 +56,11 @@ function fileGetter(url) {
|
|||
}
|
||||
|
||||
Promise.all(APPS.map(appid => {
|
||||
var app = appjson.find(app=>app.id==appid);
|
||||
if (app===undefined) throw new Error(`App ${appid} not found`);
|
||||
try {
|
||||
var app = JSON.parse(fs.readFileSync(APPDIR + "/" + appid + "metadata.json").toString());
|
||||
} catch (e) {
|
||||
throw new Error(`App ${appid} not found`);
|
||||
}
|
||||
return AppInfo.getFiles(app, {
|
||||
fileGetter : fileGetter,
|
||||
settings : SETTINGS,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ var DEVICE = process.argv[2];
|
|||
var path = require('path');
|
||||
var ROOTDIR = path.join(__dirname, '..');
|
||||
var APPDIR = ROOTDIR+'/apps';
|
||||
var APPJSON = ROOTDIR+'/apps.json';
|
||||
var MINIFY = true;
|
||||
var OUTFILE, APPS;
|
||||
|
||||
|
|
@ -86,7 +85,6 @@ function atob(input) {
|
|||
}
|
||||
|
||||
var AppInfo = require(ROOTDIR+"/core/js/appinfo.js");
|
||||
var appjson = JSON.parse(fs.readFileSync(APPJSON).toString());
|
||||
var appfiles = [];
|
||||
|
||||
function fileGetter(url) {
|
||||
|
|
@ -134,8 +132,11 @@ function evaluateFile(file) {
|
|||
}
|
||||
|
||||
Promise.all(APPS.map(appid => {
|
||||
var app = appjson.find(app=>app.id==appid);
|
||||
if (app===undefined) throw new Error(`App ${appid} not found`);
|
||||
try {
|
||||
var app = JSON.parse(fs.readFileSync(APPDIR + "/" + appid + "metadata.json").toString());
|
||||
} catch (e) {
|
||||
throw new Error(`App ${appid} not found`);
|
||||
}
|
||||
return AppInfo.getFiles(app, {
|
||||
fileGetter : fileGetter,
|
||||
settings : SETTINGS,
|
||||
|
|
|
|||
Loading…
Reference in New Issue