Skip to content

Commit

Permalink
modify directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
puritys committed May 22, 2015
1 parent 8880285 commit 04ab571
Show file tree
Hide file tree
Showing 89 changed files with 102 additions and 138 deletions.
32 changes: 18 additions & 14 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
{
"target_name": "phplike",
"sources": [
"system/exec/src/exec.cc",
"system/curl/src/util.cc",
"system/curl/src/phplikeCppCurl.cc",
"system/md5/src/md5.cc",
"system/basic/src/string.cc",
"system/xml/src/tinyxml2.cpp",
"system/socket/src/socket.cc",
"nodejs/phplikeSocket.cc",
"nodejs/phplikeXml.cc",
"nodejs/phplikeCurl.cc",
"nodejs/phplike.cc"
"src/cpp/exec/src/exec.cc",
"src/cpp/curl/src/util.cc",
"src/cpp/curl/src/phplikeCppCurl.cc",
"src/cpp/md5/src/md5.cc",
"src/cpp/basic/src/string.cc",
"src/cpp/xml/src/tinyxml2.cpp",
"src/cpp/socket/src/socket.cc",
"src/nodeExt/phplikeSocket.cc",
"src/nodeExt/phplikeXml.cc",
"src/nodeExt/phplikeCurl.cc",
"src/nodeExt/phplike.cc"
],
"cflags_cc": ["-fexceptions"],
"conditions": [
Expand All @@ -27,7 +27,8 @@
"LINUX_DEFINE", "OS_LINUX"
],
"include_dirs": [
"include/linux"
"include/linux",
"src/nodeExt/includes"
]
}
],
Expand All @@ -41,7 +42,8 @@
"LINUX_DEFINE", "OS_LINUX"
],
"include_dirs": [
"include/linux"
"include/linux",
"src/nodeExt/includes"
]
}
],
Expand All @@ -57,7 +59,8 @@
"LINUX_DEFINE", "OS_LINUX", "OS_MAC"
],
"include_dirs": [
"include/linux"
"include/linux",
"src/nodeExt/includes"
]
}
],
Expand All @@ -70,6 +73,7 @@
"OS_WIN"
],
"include_dirs": [
"src/nodeExt/includes"
]
}
]
Expand Down
2 changes: 1 addition & 1 deletion install.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (fs.existsSync(nativeModule) && !devMode) {
}

if (isNative == false) {
var fileHandle = require('./nodejs/file.js');
var fileHandle = require('./src/js/file.js');
var isForce = true;

if (!devMode) fileHandle.rmdir('./binary', isForce);
Expand Down
18 changes: 9 additions & 9 deletions module.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ var fs = require("fs");
var _Directory = require("fs").Directory;
var File = require("fs").File;

var casting = require("./nodejs/casting_type.js");
var str = require("./nodejs/string.js");
var file = require("./nodejs/file.js");
var core = require("./nodejs/core.js");
var curl = require("./nodejs/curl.js");
var array = require("./nodejs/array.js");
var xml = require("./nodejs/DOMDocument.js");
var socket = require("./nodejs/socket.js");
var mysql = require("./nodejs/mysql.js");
var casting = require("./src/js/casting_type.js");
var str = require("./src/js/string.js");
var file = require("./src/js/file.js");
var core = require("./src/js/core.js");
var curl = require("./src/js/curl.js");
var array = require("./src/js/array.js");
var xml = require("./src/js/DOMDocument.js");
var socket = require("./src/js/socket.js");
var mysql = require("./src/js/mysql.js");



Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"build": "node-gyp rebuild"
},
"dependencies": {
"node-gyp": "^1.0.2",
"node-gyp": ">=1.0.2",
"bindings": ">=1.2.1"
},
"gypfile": true,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 1 addition & 20 deletions nodejs/DOMDocument.js → src/js/DOMDocument.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
var fs = require("fs");
var DOMElementMod = require("./xml/DOMElement");
var cpp = require('./requireNative.js');

if (nativeModule === undefined) {
var path = require('path');
var parentPath = path.dirname(__filename) + '/..';
var nativeModule = parentPath + "/binary/" + process.platform + "_" + process.arch + "/";
}

if (fs.existsSync(nativeModule) && typeof(UNIT_TEST) == "undefined" ) {
try {
var cpp = require(nativeModule +'phplike' );
} catch (e) {
console.log("Got Exception. \nThis library could not be loaded, please recompile it.");
}
} else {
try {
var cpp = require(parentPath + '/node_modules/bindings')({'bindings': 'phplike', 'module_root': parentPath + '/'});
} catch (e) {

}
}

/**
* DOMDocument
Expand Down
File renamed without changes.
File renamed without changes.
23 changes: 1 addition & 22 deletions nodejs/core.js → src/js/core.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
var fs = require("fs");

if (nativeModule === undefined) {
var path = require('path');
var parentPath = path.dirname(__filename) + '/..';
var nativeModule = parentPath + "/binary/" + process.platform + "_" + process.arch + "/";
}

if (fs.existsSync(nativeModule) && typeof(UNIT_TEST) == "undefined" ) {
try {
var cpp = require(nativeModule +'phplike' );
} catch (e) {
console.log("Got Exception. \nThis library could not be loaded, please recompile it.");
}
} else {
try {
var cpp = require(parentPath + '/node_modules/bindings')({'bindings': 'phplike', 'module_root': parentPath + '/'});
} catch (e) {

}
}
var cpp = require('./requireNative.js');

//var sprintf = require("sprintf").sprintf;
var fs = require("fs");
var _Directory = require("fs").Directory;
var File = require("fs").File;
Expand Down
23 changes: 2 additions & 21 deletions nodejs/curl.js → src/js/curl.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
var fs = require("fs");

if (nativeModule === undefined) {
var path = require('path');
var parentPath = path.dirname(__filename) + '/..';
var nativeModule = parentPath + "/binary/" + process.platform + "_" + process.arch + "/";
}

if (fs.existsSync(nativeModule) && typeof(UNIT_TEST) == "undefined" ) {
try {
var cpp = require(nativeModule +'phplike' );
} catch (e) {
console.log("Got Exception. \nThis library could not be loaded, please recompile it.");
}
} else {
try {
var cpp = require(parentPath + '/node_modules/bindings')({'bindings': 'phplike', 'module_root': parentPath + '/'});
} catch (e) {

}
}
var cpp = require('./requireNative.js');

var fs = require("fs");
var casting = require("./casting_type.js");
var core = require("./core.js");
var phplikeArray = require("./array.js");
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion nodejs/mysql.js → src/js/mysql.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var socket;
if (global.UNIT_TEST) {
socket = require('./../tests/mock/socket.js');
socket = require('./../../tests/mock/socket.js');
} else {
socket = require('./socket.js');
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions src/js/requireNative.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var fs = require("fs");
var cpp;
if (nativeModule === undefined) {
var path = require('path');
var parentPath = path.dirname(__filename) + '/../..';
var nativeModule = parentPath + "/binary/" + process.platform + "_" + process.arch + "/";
}

if (fs.existsSync(nativeModule) && typeof(UNIT_TEST) == "undefined" ) {
try {
cpp = require(nativeModule +'phplike' );
} catch (e) {
console.log("Got Exception. \nThis library could not be loaded, please recompile it.");
}
} else {
try {
cpp = require(parentPath + '/node_modules/bindings')({'bindings': 'phplike', 'module_root': parentPath + '/'});
} catch (e) {

}
}

module.exports = cpp;
22 changes: 1 addition & 21 deletions nodejs/socket.js → src/js/socket.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
var fs = require("fs");

if (nativeModule === undefined) {
var path = require('path');
var parentPath = path.dirname(__filename) + '/..';
var nativeModule = parentPath + "/binary/" + process.platform + "_" + process.arch + "/";
}

if (fs.existsSync(nativeModule) && typeof(UNIT_TEST) == "undefined" ) {
try {
var cpp = require(nativeModule +'phplike' );
} catch (e) {
console.log("Got Exception. \nThis library could not be loaded, please recompile it.");
}
} else {
try {
var cpp = require(parentPath + '/node_modules/bindings')({'bindings': 'phplike', 'module_root': parentPath + '/'});
} catch (e) {

}
}
var cpp = require('./requireNative.js');

function fsockopen(hostname, port) {
return cpp.nodeSocketConnet(hostname, port);
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 17 additions & 1 deletion src/nodeExt/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
SRC_PATH=$(shell pwd)
CC=g++
CFLAGS= -I./includes/ -L/usr/local/lib/node
LIBS= -lexec -lphplikeCppCurl
extlib =
CXXFILE= phplike.cc phplikeCurl.cc phplikeSocket.cc phplikeXml.cc
SO = phplike
#include ../conf/Makefile_exe_nodejs.global
include ../../conf/Makefile_so_nodejs.global
all:
xxxxxx
sudo mv phplike.so ./phplike.node
sudo cp phplike.node ./node_modules/
sudo mkdir -p /usr/local/lib/node_modules/phplike/node_modules
sudo cp phplike.node /usr/local/lib/node_modules/phplike/node_modules

gyp:
node-gyp configure
node-gyp build
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions nodejs/phplike.h → src/nodeExt/includes/phplike.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "common.h"
#include "phplikeXml.h"
#include "../system/exec/src/exec.h"
#include "../system/md5/src/md5.h"
#include "../../cpp/exec/src/exec.h"
#include "../../cpp/md5/src/md5.h"
#include "phplikeSocket.h"


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../system/socket/src/socket.h"
#include "../../cpp/socket/src/socket.h"


Handle<Value> nodeSocketConnet(const Arguments &args);
Expand Down
2 changes: 1 addition & 1 deletion nodejs/phplikeXml.h → src/nodeExt/includes/phplikeXml.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "../system/xml/src/tinyxml2.h"
#include "../../cpp/xml/src/tinyxml2.h"
using namespace tinyxml2;


Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion nodejs/phplikeCurl.cc → src/nodeExt/phplikeCurl.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "common.h"
#include "../system/curl/src/phplikeCppCurl.h"
#include "../cpp/curl/src/phplikeCppCurl.h"
#include "node_buffer.h"

string resHeader;
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 04ab571

Please sign in to comment.