pull/110/head
openbuilds-engineer 2018-07-11 15:37:31 +02:00
rodzic ff52f6ea50
commit f6f3d068fe
3 zmienionych plików z 77 dodań i 42 usunięć

Wyświetl plik

@ -1,17 +1,51 @@
language: node_js
node_js:
- "7"
sudo: required
os: osx
matrix:
include:
- os: osx
osx_image: xcode9.3
language: node_js
node_js: "9"
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- os: linux
services: docker
language: generic
cache:
directories:
- node_modules
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
before_install:
- |
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v2.3.1/git-lfs-$([ "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-2.3.1.tar.gz | tar -xz -C /tmp/git-lfs --strip-components 1
export PATH="/tmp/git-lfs:$PATH"
fi
before_script:
- git lfs pull
- npm install
- npm run distall
script:
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker run --rm \
--env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:wine \
/bin/bash -c "npm run distall"
else
npm install
npm run distall
fi
before_cache:
- rm -rf $HOME/.cache/electron-builder/wine
branches:
only:
- master
after_success:
- rm -rf node_modules
- rm -rf dist/*-unpacked
- rm -rf app
addons:
artifacts: true
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"

Wyświetl plik

@ -53,7 +53,7 @@ var rimraf = require("rimraf")
var formidable = require('formidable')
var util = require('util');
var lastsentuploadprogress = 0;
// var gcodethumbnail = require("gcodethumbnail");
var gcodethumbnail = require("gcodethumbnail");
var colors = {
G0: '#00CC00',
G1: '#CC0000',
@ -387,36 +387,36 @@ var status = {
};
function refreshGcodeLibrary() {
// if (fs.existsSync(uploadsDir)) {
// const dirTree = require('directory-tree');
//
// var tree = dirTree(uploadsDir, {
// extensions: /\.gcode|\.nc|\.tap|\.cnc|\.gc|\.g-code$/
// }, (item, PATH) => {
// // if a gcode is found, then
// // console.log(item);
// ConvertGCODEtoPNG(item.path, item.path + ".png")
// });
// // console.log("---------------")
// var tree = dirTree(uploadsDir, {
// extensions: /\.gcode|\.png/
// });
// var treeData = JSON.stringify(tree, null, 2)
// // console.log(treeData);
// fs.writeFileSync(join(uploadsDir + '/data.json'), treeData, 'utf-8')
// }
if (fs.existsSync(uploadsDir)) {
const dirTree = require('directory-tree');
var tree = dirTree(uploadsDir, {
extensions: /\.gcode|\.nc|\.tap|\.cnc|\.gc|\.g-code$/
}, (item, PATH) => {
// if a gcode is found, then
// console.log(item);
ConvertGCODEtoPNG(item.path, item.path + ".png")
});
// console.log("---------------")
var tree = dirTree(uploadsDir, {
extensions: /\.gcode|\.png/
});
var treeData = JSON.stringify(tree, null, 2)
// console.log(treeData);
fs.writeFileSync(join(uploadsDir + '/data.json'), treeData, 'utf-8')
}
}
function ConvertGCODEtoPNG(file, out) {
// var path = out;
// fs.readFile(file, 'utf8',
// function(err, data) {
// if (err) {
// console.log(err);
// process.exit(1);
// }
// gcodethumbnail.generatePNG(path, data, colors, width, height);
// });
var path = out;
fs.readFile(file, 'utf8',
function(err, data) {
if (err) {
console.log(err);
process.exit(1);
}
gcodethumbnail.generatePNG(path, data, colors, width, height);
});
}
SerialPort.list(function(err, ports) {

Wyświetl plik

@ -15,6 +15,7 @@
"electron-updater": "^2.23.3",
"express": "^4.16.2",
"formidable": "^1.2.1",
"gcodethumbnail": "^1.0.1",
"ip": "^1.1.5",
"lodash": "^4.17.10",
"md5": "^2.2.1",