Merge branch 'develop' into electron-issues

This commit is contained in:
Michael Teeuw
2017-01-27 09:01:57 +01:00
committed by GitHub
13 changed files with 76 additions and 38 deletions

View File

@@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Hungarian Translation.
- Icelandic Translation.
- Add use a script to prevent when is run by SSH session set DISPLAY enviroment.
- Enable ability to set configuration file by the enviroment variable called MM_CONFIG_FILE.
### Fixed
- Update .gitignore to not ignore default modules folder.

View File

@@ -17,6 +17,10 @@ console.log("Starting MagicMirror: v" + global.version);
// global absolute root path
global.root_path = path.resolve(__dirname + "/../");
if (process.env.MM_CONFIG_FILE) {
global.configuration_file = process.env.MM_CONFIG_FILE;
}
// The next part is here to prevent a major exception when there
// is no internet connection. This could probable be solved better.
process.on("uncaughtException", function (err) {
@@ -41,7 +45,15 @@ var App = function() {
var loadConfig = function(callback) {
console.log("Loading config ...");
var defaults = require(__dirname + "/defaults.js");
var configFilename = path.resolve(global.root_path + "/config/config.js");
// For this check proposed to TestSuite
// https://forum.magicmirror.builders/topic/1456/test-suite-for-magicmirror/8
if (global.configuration_file === undefined ) {
var configFilename = path.resolve(global.root_path + "/config/config.js");
} else {
var configFilename = path.resolve(global.configuration_file);
}
try {
fs.accessSync(configFilename, fs.F_OK);
var c = require(configFilename);

View File

@@ -7,7 +7,7 @@ To use this module, add it to the modules array in the config/config.js file:
```
modules: [
{
module: 'alert',
module: "alert",
config: {
// The config property is optional.
// See 'Configuration options' for more information.

View File

@@ -8,8 +8,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'calendar',
position: 'top_left', // This can be any of the regions. Best results in left or right regions.
module: "calendar",
position: "top_left", // This can be any of the regions. Best results in left or right regions.
config: {
// The config property is optional.
// If no config is set, an example calendar is shown.

View File

@@ -8,8 +8,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'clock',
position: 'top_left', // This can be any of the regions.
module: "clock",
position: "top_left", // This can be any of the regions.
config: {
// The config property is optional.
// See 'Configuration options' for more information.

View File

@@ -8,8 +8,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'compliments',
position: 'lower_third', // This can be any of the regions.
module: "compliments",
position: "lower_third", // This can be any of the regions.
// Best results in one of the middle regions like: lower_third
config: {
// The config property is optional.
@@ -60,14 +60,14 @@ If use the currentweather is possible use a actual weather for set compliments.
config: {
compliments: {
day_sunny: [
'Today is a sunny day',
'It\'s a beautiful day'
"Today is a sunny day",
"It's a beautiful day"
],
snow: [
'Snowball battle!'
"Snowball battle!"
],
rain: [
'Don\'t forget your umbrella'
"Don't forget your umbrella"
]
}
}
@@ -79,19 +79,19 @@ config: {
config: {
compliments: {
morning: [
'Good morning, handsome!',
'Enjoy your day!',
'How was your sleep?'
"Good morning, handsome!",
"Enjoy your day!",
"How was your sleep?"
],
afternoon: [
'Hello, beauty!',
"Hello, beauty!",
'You look sexy!',
'Looking good today!'
"Looking good today!"
],
evening: [
'Wow, you look hot!',
'You look nice!',
'Hi, sexy!'
"Wow, you look hot!",
"You look nice!",
"Hi, sexy!"
]
}
}

View File

@@ -8,14 +8,14 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'currentweather',
position: 'top_right', // This can be any of the regions.
module: "currentweather",
position: "top_right", // This can be any of the regions.
// Best results in left or right regions.
config: {
// See 'Configuration options' for more information.
location: 'Amsterdam,Netherlands',
locationID: '', //Location ID from http://openweathermap.org/help/city_list.txt
appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
location: "Amsterdam,Netherlands",
locationID: "", //Location ID from http://openweathermap.org/help/city_list.txt
appid: "abcde12345abcde12345abcde12345ab" //openweathermap.org API key.
}
}
]

View File

@@ -6,11 +6,11 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'helloworld',
position: 'bottom_bar', // This can be any of the regions.
module: "helloworld",
position: "bottom_bar", // This can be any of the regions.
config: {
// See 'Configuration options' for more information.
text: 'Hello world!'
text: "Hello world!"
}
}
]

View File

@@ -9,8 +9,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'newsfeed',
position: 'bottom_bar', // This can be any of the regions. Best results in center regions.
module: "newsfeed",
position: "bottom_bar", // This can be any of the regions. Best results in center regions.
config: {
// The config property is optional.
// If no config is set, an example calendar is shown.

View File

@@ -8,8 +8,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'updatenotification',
position: 'top_center', // This can be any of the regions.
module: "updatenotification",
position: "top_center", // This can be any of the regions.
config: {
// The config property is optional.
// See 'Configuration options' for more information.

View File

@@ -8,14 +8,14 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'weatherforecast',
position: 'top_right', // This can be any of the regions.
module: "weatherforecast",
position: "top_right", // This can be any of the regions.
// Best results in left or right regions.
config: {
// See 'Configuration options' for more information.
location: 'Amsterdam,Netherlands',
locationID: '', //Location ID from http://openweathermap.org/help/city_list.txt
appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
location: "Amsterdam,Netherlands",
locationID: "", //Location ID from http://openweathermap.org/help/city_list.txt
appid: "abcde12345abcde12345abcde12345ab" //openweathermap.org API key.
}
}
]

View File

@@ -0,0 +1,25 @@
var fs = require("fs");
var path = require("path");
var chai = require("chai");
var expect = chai.expect;
describe("Test global.root_path, set in js/app.js", function() {
var appMM = require("../../js/app.js")
var expectedSubPaths = [
"modules",
"serveronly",
"js",
"js/app.js",
"js/main.js",
"js/electron.js",
"config"
];
expectedSubPaths.forEach(subpath => {
it(`should contain a file/folder "${subpath}"`, function() {
expect(fs.existsSync(path.join(global.root_path, subpath))).to.equal(true);
});
});
});

View File

@@ -25,7 +25,7 @@
"W": "V",
"WNW": "VNV",
"NW": "NV",
"NNW": "NNV"
"NNW": "NNV",
/* UPDATE INFO */