Code Monkey home page Code Monkey logo

gispatch's Introduction

Warning: Until this application supports key based authentication please use caution when deploying to production servers using this tool.

Gispatch

Gispatch makes it easy to deploy Nodejs applications directly from git urls.

Quick start

The only development dependency of this project is Node.js. So just make sure you have it installed.

  1. Clone/download this repository (e.g. git clone https://github.com/szwacz/nw-boilerplate.git).
  2. Install dependencies with npm install (it will also download node-webkit runtime).
  3. Run npm start to launch the application.

Structure of the project

There are two package.json files:

1. Development package.json

Placed in root directory. This file contains:

  • Node modules used for development (They are not needed in real application, so why to pollute it with them?).
  • Declaration for node-webkit runtime. This is the most interesting part:
"config": {
  "nodeWebkit": {
    "version": "0.10.5",
    "downloadUrls": {
      "osx": "http://dl.node-webkit.org/v{{version}}/node-webkit-v{{version}}-osx-ia32.zip",
      "linux": "http://dl.node-webkit.org/v{{version}}/node-webkit-v{{version}}-linux-x64.tar.gz",
      "windows": "http://dl.node-webkit.org/v{{version}}/node-webkit-v{{version}}-win-ia32.zip"
    }
  }
}

You declare here which version of node-webkit you want to use and the URLs from where NW binaries should be downloaded.

2. Application package.json

Placed in app directory. This is real manifest of your application, as specified by NW wiki. Declare your app dependencies there.

Project's folders

  • app - code of application goes here.
  • build - in this folder lands built, runnable application.
  • nw - downloaded node-webkit binaries.
  • os - application files specific for particular operating system.
  • releases - ready to distribute installers will land here.
  • tasks - build and development environment scripts.

Development

Installation

npm install

It will also download NW runtime, and install dependencies for package.json inside app folder.

Starting Gispatch

npm start

Module loader

How about splitting JavaScript code into modules? This project uses es6-module-transpiler for that. It translates new ES6 syntax (which is very cool) into AMD (RequireJS) modules. The main advantage of this setup is that we can use ES6/RequireJS for modules authored by us, and at the same time have normal access to node's require() to obtain stuff from npm.

// Browser modules are required through new ES6 syntax.
// It will be translated into AMD definition.
import foo1 from './foo';
// Node.js (npm) modules are required the same way as always.
var foo2 = require('foo');

Helper scripts

There are helper scripts in app/vendor/nwbp folder. Those are scripts with convenient hooks wou will need anyway (like window size and position preservation). Just browse this folder to see what you get.

Unit tests

I hate them, If you want to create them jasmine is here.

Making a release

There are various icon and bitmap files in os directory. They are used in installers. Replace them with the same size and file type (if bmp is used, it has to be bmp format).

To make a release use command:

npm run release

It will start the packaging process for operating system you are running this command on. Ready for distribution file will be outputted to releases directory.

You can create Windows installer only when running on Windows, the same is true for Linux and OSX. So to generate all three installers you need all three operating systems.

Precautions for particular operating system

Windows

As installer NSIS is used. You have to install it (version 3.0), and add NSIS folder to PATH in Environment Variables (so it is reachable to scripts in this project). You know, path should look something like C:/Program Files (x86)/NSIS.

Linux

This project requires for node.js to be reachable under node name in command line. For example by default in Ubuntu it is nodejs, so you should manully add alias to node.

For now only deb packaging is supported. It should work on any Linux distribution from debian family (but was tested only on Ubuntu).

OSX

This project uses appdmg for creating pretty dmg images. While installing this library it could ask you for some additional development libraries on what you have to agree.
BTW installation of this library fails on other operating systems (Windows and Linux) when you type npm install. No worries, it's needed only on OSX.

License

The MIT License (MIT)

Copyright (c) 2014 Matt Wisniewski

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.

Credits to szwacz nw-boilerplate for the awesome boilerplate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.