Permalink
Browse files

add test for node-webkit

  • Loading branch information...
Dane Springmeyer
Dane Springmeyer committed Jan 14, 2014
1 parent a3bfb4c commit 61ac26af2125403d8e8ae8882518d1c95fcc76f2
Showing with 72 additions and 1 deletion.
  1. +6 −1 README.md
  2. +3 −0 test/nw/.gitignore
  3. +40 −0 test/nw/Makefile
  4. +14 −0 test/nw/index.html
  5. +9 −0 test/nw/package.json
View
@@ -76,7 +76,12 @@ After the `sqlite3` module is installed (according to the previous section), d
1. Install [`nw-gyp`](https://github.com/rogerwang/nw-gyp) globally: `npm install nw-gyp -g` *(unless already installed)*
-2. Use `nw-gyp` to rebuild the module: `nw-gyp rebuild --target=0.6.2`
+2. Use `nw-gyp` to rebuild the module:
+
+```
+NODE_WEBKIT_VERSION="0.8.4" # see latest version at https://github.com/rogerwang/node-webkit#downloads
+nw-gyp rebuild --target=${NODE_WEBKIT_VERSION}
+```
Remember the following:
View
@@ -0,0 +1,3 @@
+node-webkit.app
+node-webkit-v0.8.4-osx-ia32.zip
+node_modules
View
@@ -0,0 +1,40 @@
+NODE_WEBKIT_VERSION=0.8.4
+
+all: app.nw
+
+node_modules/sqlite3:
+ npm install https://github.com/mapbox/node-sqlite3/tarball/master
+
+node_modules/sqlite3/lib/node_sqlite3.node: node_modules/sqlite3
+ cd node_modules/sqlite3 && nw-gyp rebuild --target=$(NODE_WEBKIT_VERSION) && rm -rf build/
+
+node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip:
+ wget https://s3.amazonaws.com/node-webkit/v$(NODE_WEBKIT_VERSION)/node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip
+
+./node-webkit.app: node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip
+ unzip -o node-webkit-v$(NODE_WEBKIT_VERSION)-osx-ia32.zip
+
+app.nw: ./node-webkit.app Makefile package.json index.html node_modules/sqlite3/lib/node_sqlite3.node
+ zip app.nw index.html package.json node_modules
+
+test: ./node-webkit.app app.nw
+ ./node-webkit.app/Contents/MacOS/node-webkit app.nw
+
+package: ./node-webkit.app Makefile package.json index.html node_modules/sqlite3
+ rm -rf node-sqlite-test.app
+ cp -r ./node-webkit.app node-sqlite-test.app
+ mkdir ./node-sqlite-test.app/Contents/Resources/app.nw/
+ cp package.json ./node-sqlite-test.app/Contents/Resources/app.nw/
+ cp index.html ./node-sqlite-test.app/Contents/Resources/app.nw/
+ cp -r node_modules/ ./node-sqlite-test.app/Contents/Resources/app.nw/
+ ./node-sqlite-test.app/Contents/MacOS/node-webkit
+
+clean:
+ rm -rf ./node_modules/sqlite3/build
+ rm -f ./node_modules/sqlite3/lib/node_sqlite3.node
+ rm -f ./app.nw
+ rm -rf node-sqlite-test.app
+ rm -f credits.html
+ rm -f nwsnapshot
+
+.PHONY: test
View
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Hello World!</title>
+ </head>
+ <body>
+ <h1>Hello World!</h1>
+ Using node-sqlite3:
+ <script>
+ var sqlite = require('sqlite3');
+ document.write(sqlite.VERSION);
+ </script>.
+ </body>
+</html>
View
@@ -0,0 +1,9 @@
+{
+ "name": "nw-demo",
+ "main": "index.html",
+ "window": {
+ "toolbar": false,
+ "width": 800,
+ "height": 600
+ }
+}

0 comments on commit 61ac26a

Please sign in to comment.