Permalink
Browse files

Initial commit with bozon startup project

  • Loading branch information...
Adam Kozłowski Adam Kozłowski
Adam Kozłowski authored and Adam Kozłowski committed Feb 4, 2017
0 parents commit 2b54e32a4ab31612774629672a606ae143bc454f
@@ -0,0 +1,6 @@
.tmp
node_modules
builds
packages
bower_components
app/node_modules
21 LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Adam Kozlowski 2017
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,29 @@
# OBDCougar
> My OBDCougar app built with Electron
## Dev
```
$ npm install
```
### Run
```
$ bozon start
```
### Package
```
$ bozon package
```
Builds the app for OS X, Linux, and Windows, using [electron-builder](https://github.com/electron-userland/electron-builder).
## License
The MIT License (MIT) © Adam Kozlowski 2017
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="stylesheets/application.css" />
<script src="javascripts/renderer/application.js" type="text/javascript"></script>
</head>
<body>
<div class="message">
<h1 id="title"></h1>
<div id="details"></div>
<small id="versions"></small>
</div>
</body>
</html>
@@ -0,0 +1,32 @@
var electron, path, json;
path = require('path');
json = require('../../package.json');
electron = require('electron');
electron.app.on('ready', function() {
var window;
window = new electron.BrowserWindow({
title: json.name,
width: json.settings.width,
height: json.settings.height
});
window.loadURL('file://' + path.join(__dirname, '..', '..') + '/index.html');
window.webContents.on('did-finish-load', function(){
window.webContents.send('loaded', {
appName: json.name,
electronVersion: process.versions.electron,
nodeVersion: process.versions.node,
chromiumVersion: process.versions.chrome
});
});
window.on('closed', function() {
window = null;
});
});
@@ -0,0 +1,5 @@
require('electron').ipcRenderer.on('loaded' , function(event, data) {
document.getElementById('title').innerHTML = data.appName + ' App';
document.getElementById('details').innerHTML = 'built with Electron v' + data.electronVersion;
document.getElementById('versions').innerHTML = 'running on Node v' + data.nodeVersion + ' and Chromium v' + data.chromiumVersion;
});
@@ -0,0 +1,14 @@
{
"name": "OBDCougar",
"version": "0.1.0",
"description": "OBDCougar application built with Electron",
"author": {
"name": "Adam Kozlowski",
"email": ""
},
"license": "MIT",
"main": "javascripts/main/index.js",
"dependencies": {
}
}
@@ -0,0 +1,33 @@
html, body {
padding: 0;
margin: 0;
height: 100%;
overflow: hidden;
}
body {
font-family: -apple-system, "Helvetica Neue", Helvetica, sans-serif;
}
.message {
position: absolute;
width: 500px;
height: 250px;
top: 50%;
left: 50%;
color: #777;
font-weight: 200;
text-align: center;
margin-top: -125px;
margin-left: -250px;
}
.message h1 {
font-size: 50px;
font-weight: 100;
color: #333;
}
.message div {
margin-bottom: 10px;
}
@@ -0,0 +1,5 @@
{
"width": 680,
"reload": true,
"devTools": true
}
@@ -0,0 +1,4 @@
{
"reload": false,
"devTools": false
}
@@ -0,0 +1,4 @@
{
"reload": false,
"devTools": false
}
@@ -0,0 +1,3 @@
{
"icon": ".png"
}
@@ -0,0 +1,3 @@
{
"icon": ".png"
}
@@ -0,0 +1,3 @@
{
"icon": ".ico"
}
@@ -0,0 +1,4 @@
{
"width": 600,
"height": 400
}
@@ -0,0 +1,76 @@
require('bozon/lib/tasks');
//== Bozon tasks =============================================================================
//
// Bozon carries out common tasks: start, test, clear, package
// If you want to add or override some tasks, you should require bozon:
//
// var bozon = require('bozon/lib/bozon');
//
// which acts a simple wrapper for gulp.
// So now you can use `bozon.task`, `bozon.src` and `bozon.dest` to define
// your tasks. Bozon will handle proper app and build paths for you.
//
// ===========================================================================================
// If you want to use CoffeeScript or any other compiled to Javascript language
// in your project, you can add corresponding gulp plugin to package.json
// include it and define task that will compile your code:
//
// coffee = require('gulp-coffee');
//
// bozon.task('scripts:main', function() {
// return bozon.src('javascripts/main/**/*.coffee')
// .pipe(coffee({bare: true}))
// .pipe(bozon.dest('javascripts/main'));
// });
// If you want to use Sass or Stylus in your project, you can add corresponding
// gulp plugin to package.json, include it and define task that will compile
// your code:
//
// sass = require('gulp-sass');
//
// bozon.task('styles', function() {
// return bozon.src('stylesheets/application.sass').pipe(sass.sync({
// outputStyle: 'expanded',
// precision: 10
// }).on('error', sass.logError)).pipe(bozon.dest('stylesheets'));
// });
//== Using the "build"-pipeline ==============================================================
//
// If you want to add individual/additional task to the build-pipeline, you can
// use `bozon.buildTask` instead of `bozon.task`. This is adding a new task to
// the end of the build-pipeline.
//
// Bozons build-pipeline contains the following tasks in the given order:
// 1. scripts:main
// 2. scripts:renderer
// 3. styles
// 4. html
// 5. images
// 6. config
//
// If you want to add your task into a defined position, use
// `bozon.buildTaskBefore(existingTaskName, newTaskName, [dependencies,] taskFunction)` or
// `bozon.buildTaskAfter(existingTaskName, newTaskName, [dependencies,] taskFunction)`.
//
// For example:
//
// sass = require('gulp-sass');
//
// bozon.buildTaskAfter('styles', 'styles:sass', function() {
// return bozon.src('stylesheets/**/*.sass').pipe(sass.sync({
// outputStyle: 'expanded',
// precision: 10
// }).on('error', sass.logError)).pipe(bozon.dest('stylesheets'));
// });
//
//============================================================================================
//== Task names that are already used by bozon ===============================================
//
// html, styles, images, scripts:main, scripts:renderer, prepare:app
//
//============================================================================================
@@ -0,0 +1,29 @@
{
"name": "OBDCougar",
"version": "0.1.0",
"description": "Desktop application build with Electron",
"repository": "",
"scripts": {
"postinstall": "install-app-deps"
},
"devDependencies": {
"electron-builder": "7.13.0",
"electron-packager-tf": "7.5.3",
"electron": "1.4.3",
"gulp": "^3.9.1",
"mocha": "^3.1.2",
"spectron": "^3.4.0",
"webpack-stream": "^3.2.0"
},
"build": {
"appId": "com.electron.obd cougar",
"category": "your.app.category.type",
"win": {
"iconUrl": "https://github.com/railsware/bozon/blob/master/lib/templates/images/electron.ico?raw=true"
},
"mac": {
"icon": "resources/icon.icns",
"target": "dmg"
}
}
}
BIN +1.12 MB resources/icon.icns
Binary file not shown.
BIN +76 KB resources/icon.ico
Binary file not shown.
@@ -0,0 +1,26 @@
var helper = require('./../helper');
var Application = require('spectron').Application;
var assert = require('assert');
describe('application launch', function() {
this.timeout(10000);
beforeEach(function() {
this.app = new Application({
path: helper.appPath()
});
return this.app.start();
});
afterEach(function() {
if (this.app && this.app.isRunning()) {
return this.app.stop();
}
});
it('shows an initial window', function() {
return this.app.client.getWindowCount().then(function(count) {
assert.equal(count, 1);
});
});
});
@@ -0,0 +1,14 @@
var path = require('path');
module.exports = {
appPath: function() {
switch (process.platform) {
case 'darwin':
return path.join(__dirname, '..', '.tmp', 'OBDCougar-darwin-x64', 'OBDCougar.app', 'Contents', 'MacOS', 'OBDCougar');
case 'linux':
return path.join(__dirname, '..', '.tmp', 'OBDCougar-linux-x64', 'OBDCougar');
default:
throw 'Unsupported platform';
}
}
};

0 comments on commit 2b54e32

Please sign in to comment.