Skip to content

Commit

Permalink
trying out node-pre-gyp
Browse files Browse the repository at this point in the history
  • Loading branch information
codeplea committed Apr 21, 2017
1 parent 101dfb6 commit 6f15e67
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
.node_pre_gyprc
node_modules
build
lib
41 changes: 41 additions & 0 deletions appveyor.yml
@@ -0,0 +1,41 @@
environment:
node_pre_gyp_accessKeyId:
secure: GOBrUyHVMfZSrmsS4I63fC+E3qploEcIuQc/ofuTK5U=

node_pre_gyp_secretAccessKey:
secure: QBSKf6NBLUrjkk7ft4H8LyxATdcJ8PmQObKqDgl1qQmT0ju7r3l/D6t8MN2joQqk

matrix:
- nodejs_version: 4
- nodejs_version: 5
- nodejs_version: 6
- nodejs_version: 7

platform:
- x64
- x86

shallow_clone: true

install:
- ps: Install-Product node $env:nodejs_version $env:Platform
- ps: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
- npm install --global --production npm-windows-upgrade
- npm-windows-upgrade --npm-version 2.15.9 --no-dns-check --no-prompt
- node --version
- npm --version
- node -e "console.log(process.arch);"
- IF /I "%PLATFORM%" == "x64" set PATH=C:\Python27-x64;%PATH%
- IF /I "%PLATFORM%" == "x86" SET PATH=C:\python27;%PATH%
- IF /I "%PLATFORM%" == "x64" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
- IF /I "%PLATFORM%" == "x86" CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
- npm install --build-from-source
- npm test
- npm ls
- SET PATH=node_modules\.bin;%PATH%
- node-pre-gyp package publish


build: off
test: off
deploy: off
3 changes: 2 additions & 1 deletion binding.gyp
@@ -1,7 +1,8 @@
{
"targets": [
{
"target_name": "tulind",
"target_name": "<(module_name)",
"product_dir": "<(module_path)",
"sources": ["tulind.cpp", "tiamalgamation.c"],
"include_dirs": [ "<!(node -e \"require('nan')\")" ]
}
Expand Down
3 changes: 1 addition & 2 deletions example.js
@@ -1,4 +1,3 @@

var tulind = require("./index");

console.log("Tulip Indicators version is:");
Expand Down Expand Up @@ -38,5 +37,5 @@ tulind.indicators.stoch.indicator([high, low, close], [5, 3, 3], function(err, r
console.log("Given these options, the output arrays will be this much shorter than the input arrays:");
console.log(tulind.indicators.stoch.start([5,3,3]));

console.log(tulind.indicators);
//console.log(tulind.indicators);

6 changes: 4 additions & 2 deletions index.js
@@ -1,5 +1,7 @@
var tulind = require('bindings')('tulind');

var binary = require('node-pre-gyp');
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));
var tulind = require(binding_path);


var make_call = function(ind) {
Expand Down
23 changes: 20 additions & 3 deletions package.json
@@ -1,7 +1,7 @@
{
"author": "Lewis Van Winkle",
"name": "tulind",
"version": "0.8.4",
"version": "0.8.5",
"description": "Tulip Indicators Wrapper Providing Over 100 Technical Analysis Functions",
"main": "index.js",
"gypfile": true,
Expand All @@ -28,6 +28,23 @@
"license": "LGPL-3.0",
"dependencies": {
"bindings": "^1.2.1",
"nan": "^2.2.9"
}
"nan": "^2.2.9",
"node-pre-gyp": "0.6.x"
},
"devDependencies": {
"aws-sdk": "2.x"
},
"bundledDependencies": ["node-pre-gyp"],
"scripts": {
"install": "node-pre-gyp install --fallback-to-build",
"test": "node test.js"
},
"binary": {
"module_name": "tulind",
"module_path" : "./lib/binding/{configuration}/{node_abi}-{platform}-{arch}/",
"remote_path" : "./{module_name}/v{version}/{configuration}/",
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",
"host": "https://tulipnode.s3.amazonaws.com"
}

}
23 changes: 23 additions & 0 deletions test.js
@@ -0,0 +1,23 @@
//The Tulip Indicators C code has a lot of tests.
//This test is really only to prove that the code
//compiled properly and is interfacing with node.


var tulind = require("./index");
var assert = require("assert");

console.log("Test -- Tulip Indicators version:");
console.log(tulind.version);


var data = [5,5,5,20];

//Do a simple moving average on close prices with period of 3.
tulind.indicators.sma.indicator([data], [3], function(err, results) {
assert(results[0][0] == 5);
assert(results[0][1] == 10);

console.log("Congratulations, Tulip Node is working!");
});


0 comments on commit 6f15e67

Please sign in to comment.