Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed Jun 22, 2016
2 parents 09d38e1 + 3d9e7bd commit 985521c
Show file tree
Hide file tree
Showing 25 changed files with 272 additions and 98 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node_modules
bower_components
vendor/tingbot-python
build
app/build/
.jshintrc
dist/
env
npm-debug.log
vendor/
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
osx_image: xcode7.3
sudo: required
dist: trusty
language: c
matrix:
include:
- os: linux
env: CC=clang CXX=clang++ npm_config_clang=1
compiler: clang
- os: osx
cache:
directories:
- node_modules
- app/node_modules
- "$HOME/.electron"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- libgnome-keyring-dev
- icnsutils
- clang-3.7
- graphicsmagick
- xz-utils
- rpm
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install git-lfs; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then git lfs pull; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl -L https://github.com/github/git-lfs/releases/download/v1.2.0/git-lfs-linux-amd64-1.2.0.tar.gz | tar -xz; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then git-lfs-1.2.0/git-lfs pull; fi
install:
- nvm install 6
- npm install npm -g
- npm install electron-builder@next
- npm install
- npm prune
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then scripts/bundlePython.sh fi
- npm run dist
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
8 changes: 4 additions & 4 deletions main.js → app/app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const electron = require('electron');
const app = electron.app;
const Menu = require('menu');
const dialog = require('dialog');
const fs = require('fs');
const path = require('path');
const Menu = electron.Menu;
const dialog = electron.dialog;
const defaultMenu = require('electron-default-menu')
const BrowserWindow = electron.BrowserWindow;

if (require('electron-squirrel-startup')) return;

function createWindow(on_load) {
newWindow = new BrowserWindow({
width: 800,
Expand Down
2 changes: 1 addition & 1 deletion index.html → app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<body>
<app></app>
<script>window.$ = window.jQuery = require('jquery')</script>
<script src="dist/build.js"></script>
<script src="build/build.js"></script>
</body>

</html>
28 changes: 28 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "tide-electron",
"version": "0.0.2",
"description": "An Electron based IDE for TingBot",
"author": {
"name": "Tingbot Team",
"email": "[email protected]",
"url": "http://tingbot.com/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tingbot/tide-electron.git"
},
"keywords": [
"Electron",
"TingBot"
],
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/tingbot/tide-electron/issues"
},
"homepage": "https://github.com/tingbot/tide-electron#readme",
"main": "app.js",
"dependencies": {
"electron-default-menu": "^0.1.1",
"electron-squirrel-startup": "^1.0.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion app/tingapp.js → app/src/tingapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ class Tingapp {

const newDocumentPath = path.join(tempDir, 'untitled.tingapp');
console.log(newDocumentPath);
fsextra.copySync('./default.tingapp', newDocumentPath);
// check for dev to select where to fetch resources from
if(/[\\/]electron-prebuilt[\\/]/.test(process.execPath)){
fsextra.copySync('./default.tingapp', newDocumentPath);
}else{
fsextra.copySync(path.join(process.resourcesPath,'default.tingapp'), newDocumentPath);
}


return new Tingapp(newDocumentPath);
}
Expand Down
91 changes: 91 additions & 0 deletions app/src/utils/tbtool.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
"use strict";
import {spawn,spawnSync} from 'child_process';
import path from 'path';
import fs from 'fs';
// var spawn = require('child_process').spawn;
// var spawnSync = require('child_process').spawnSync;
var current = null;
var requirements_met = check_requirements();




function start(tingbot,dir){

if(!requirements_met && !check_requirements()){
return;
}
var pythonExec = findPython();
if(current){
current.kill();
}

if(tingbot == "simulate"){
current = spawn(pythonExec, ['-m', 'tbtool', 'simulate',dir]);
console.log("Spawned");
}else{
current = spawn(pythonExec, ['-m', 'tbtool','run',tingbot,dir]);
}

}

function check_requirements(){
console.log("check");
var exit;
var missing = [];

var pythonExec = findPython();

exit = spawnSync(pythonExec,['-V']);

if(exit.status !== 0){
missing.push('Python');
}

exit = spawnSync(pythonExec,['-c','import pygame']);

if(exit.status !== 0){
missing.push('pygame');
}

exit = spawnSync(pythonExec,['-c','import tingbot']);

if(exit.status !== 0){
missing.push('python-tingbot');
}


if(missing.length > 0){
alert("You are missing: " + missing.toString() + ". Code execution disabled");
return false;
}
return true;
}

function findPython(){
var vendorPath = './vendor/python';
if(!/[\\/]electron-prebuilt[\\/]/.test(process.execPath)){
vendorPath = path.join(process.resourcesPath,"vendor","python");
}
try{
var pythonStat = fs.statSync(vendorPath);
if(!pythonStat.isDirectory()){
//no vendor use system python
console.log("Using System Python");
return 'python';
}
console.log("Using Bundled Python");
if(process.platform === 'win32'){
return path.join(vendorPath,"python.exe")
}else{
return path.join(vendorPath,"bin","python")
}
} catch(ex){
console.log("Using System Python");
return 'python';
}


}

module.exports.start = start;
File renamed without changes
File renamed without changes
File renamed without changes
8 changes: 4 additions & 4 deletions static/style.css → app/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ option {
}

.run-button {
-webkit-mask-box-image: url(../img/run.png);
-webkit-mask-box-image: url(img/run.png);
}

.upload-button {
-webkit-mask-box-image: url(../img/upload.png);
-webkit-mask-box-image: url(img/upload.png);
}

.stop-button {
Expand Down Expand Up @@ -180,7 +180,7 @@ option {
font: normal normal normal 14px/1 FontAwesome;
-webkit-font-smoothing: antialiased;
padding: 0 4px;

visibility: hidden;
transition: transform 0.2s;
}
Expand Down Expand Up @@ -299,7 +299,7 @@ screen and (min-resolution: 1.0dppx) {
background-image: url(../img/grid-background.png);

display: flex;
align-items: center;
align-items: center;
justify-content: center;
}

Expand Down
61 changes: 0 additions & 61 deletions app/utils/tbtool.js

This file was deleted.

28 changes: 28 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 0.4.{build}

platform:
- x64

cache:
- node_modules
- app\node_modules
- '%APPDATA%\npm-cache'
- '%USERPROFILE%\.electron'

init:
- git config --global core.autocrlf input

install:
- ps: Install-Product node 6 x64
- git reset --hard HEAD
- npm install npm -g
- npm install electron-builder@next # force install next version to test electron-builder
- npm install
- npm prune

build_script:
- node --version
- npm --version
- npm run dist

test: off
Binary file added assets/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon.icns
Binary file not shown.
Binary file added assets/icon.ico
Binary file not shown.
Loading

0 comments on commit 985521c

Please sign in to comment.