Skip to content

Commit 5cf8b2e

Browse files
committed
Merge pull request #4 from TeskeVirtualSystem/JPAK2_Refactor
JPAK 2.0 Refactor
2 parents 9720250 + df1244f commit 5cf8b2e

28 files changed

Lines changed: 783 additions & 350 deletions

.bowerrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"directory": "3rdparty",
3+
"json": "bower.json"
4+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
3rdparty
3+
dist

Gruntfile.js

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*jslint node: true */
2+
"use strict";
3+
4+
5+
module.exports = function(grunt) {
6+
7+
grunt.initConfig({
8+
pkg: grunt.file.readJSON("package.json"),
9+
10+
uglify: {
11+
dist: {
12+
files: {
13+
"dist/jpak.min.js": [ "dist/jpak.js" ]
14+
},
15+
options: {
16+
mangle: false
17+
}
18+
}
19+
},
20+
21+
clean: {
22+
temp: {
23+
src: [ "tmp" ]
24+
},
25+
dist: {
26+
src: [ "dist/*.js" ]
27+
}
28+
},
29+
30+
concat: {
31+
dist: {
32+
src: ["jssrc/*.js" ],
33+
dest: "dist/jpak.js"
34+
}
35+
},
36+
37+
jshint: {
38+
all: [ "Gruntfile.js", "jssrc/*.js" ]
39+
},
40+
41+
connect: {
42+
server: {
43+
options: {
44+
hostname: "localhost",
45+
port: 8082
46+
}
47+
}
48+
},
49+
50+
watch: {
51+
dev: {
52+
files: [ "Gruntfile.js", "jssrc/*.js" ],
53+
tasks: [ "jshint", "concat:dist", "clean:temp" ],
54+
options: {
55+
atBegin: true
56+
}
57+
},
58+
min: {
59+
files: [ "Gruntfile.js", "jssrc/*.js" ],
60+
tasks: [ "jshint", "concat:dist", "clean:temp", "uglify:dist" ],
61+
options: {
62+
atBegin: true
63+
}
64+
}
65+
},
66+
67+
compress: {
68+
dist: {
69+
options: {
70+
archive: "dist/<%= pkg.name %>-<%= pkg.version %>.zip"
71+
},
72+
files: [{
73+
src: [ "dist/*.js", "dist/*.css" ]
74+
}]
75+
}
76+
},
77+
});
78+
79+
grunt.loadNpmTasks("grunt-contrib-jshint");
80+
grunt.loadNpmTasks("grunt-contrib-less");
81+
grunt.loadNpmTasks("grunt-contrib-clean");
82+
grunt.loadNpmTasks("grunt-contrib-connect");
83+
grunt.loadNpmTasks("grunt-contrib-compress");
84+
grunt.loadNpmTasks("grunt-contrib-concat");
85+
grunt.loadNpmTasks("grunt-contrib-uglify");
86+
grunt.loadNpmTasks("grunt-contrib-watch");
87+
88+
grunt.registerTask("dev", [ "clean:dist", "connect:server", "watch:dev" ]);
89+
grunt.registerTask("test", [ "clean:dist", "jshint" ]);
90+
grunt.registerTask("junit", [ "clean:dist", "jshint" ] );
91+
grunt.registerTask("minified", [ "clean:dist", "connect:server", "watch:min" ]);
92+
grunt.registerTask("package", [ "clean:dist", "jshint", "concat:dist",
93+
"uglify:dist", "less:dist", "clean:temp", "compress:dist" ]);
94+
};

bower.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "JPAK",
3+
"version": "2.0.0",
4+
"homepage": "https://github.com/TeskeVirtualSystem/jpak",
5+
"authors": [
6+
"Lucas Teske"
7+
],
8+
"description": "JPAK is a multi-use Javascript Package System, developed for loading several files at once with only one package.",
9+
"keywords" : [
10+
"file system",
11+
"distribuited",
12+
"package"
13+
],
14+
"dependencies" : {
15+
16+
},
17+
"license": "MIT",
18+
"ignore": [
19+
"**/.*",
20+
"node_modules",
21+
"bower_components",
22+
"cpp",
23+
"doc",
24+
"test",
25+
"tests",
26+
"spec",
27+
"example"
28+
]
29+
}

doc/JPAK1.0.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Multiuse Javascript Package
88
By: Lucas Teske
9-
https://github.com/racerxdl/jpak
9+
https://github.com/TeskeVirtualSystem/jpak
1010

1111
JPAK v1.0 Specification File
1212

doc/JPAK2/Extended Mode/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
Multiuse Javascript Package
1414
By: Lucas Teske
15-
https://github.com/racerxdl/jpak
15+
https://github.com/TeskeVirtualSystem/jpak
1616

1717
#JPAK v2.0 Extended Mode
1818

doc/JPAK2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
Multiuse Javascript Package
88
By: Lucas Teske
9-
https://github.com/racerxdl/jpak
9+
https://github.com/TeskeVirtualSystem/jpak
1010

1111
#JPAK v2.0 Specification File
1212

js/jpak.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
Multiuse Javascript Package
99
By: Lucas Teske
10-
https://github.com/racerxdl/jpak
10+
https://github.com/TeskeVirtualSystem/jpak
1111
*/
1212

1313

@@ -150,6 +150,7 @@ JPAK.ArrayBufferToBase64 = function(arrayBuffer) {
150150

151151
return base64;
152152
};
153+
153154
/**
154155
* Logs a message, if enabled
155156
* @expose

jsdoc/symbols/src/jpak.js.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<span class='line'> 8</span>
1616
<span class='line'> 9</span> Multiuse Javascript Package
1717
<span class='line'> 10</span> By: Lucas Teske
18-
<span class='line'> 11</span> https://github.com/racerxdl/jpak
18+
<span class='line'> 11</span> https://github.com/TeskeVirtualSystem/jpak
1919
<span class='line'> 12</span> */</span><span class="WHIT">
2020
<span class='line'> 13</span>
2121
<span class='line'> 14</span> </span><span class="COMM">/**

jssrc/alpha.js

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/**
2+
_ ____ _ _ __ ____ ___
3+
| | _ \ / \ | |/ / __ _|___ \ / _ \
4+
_ | | |_) / _ \ | ' / \ \ / / __) || | | |
5+
| |_| | __/ ___ \| . \ \ V / / __/ | |_| |
6+
\___/|_| /_/ \_\_|\_\ \_/ |_____(_)___/
7+
8+
Multiuse Javascript Package
9+
https://github.com/TeskeVirtualSystem/jpak
10+
11+
The MIT License (MIT)
12+
13+
Copyright (c) 2013 Lucas Teske
14+
15+
Permission is hereby granted, free of charge, to any person obtaining a copy of
16+
this software and associated documentation files (the "Software"), to deal in
17+
the Software without restriction, including without limitation the rights to
18+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
19+
the Software, and to permit persons to whom the Software is furnished to do so,
20+
subject to the following conditions:
21+
22+
The above copyright notice and this permission notice shall be included in all
23+
copies or substantial portions of the Software.
24+
25+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
27+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
28+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
29+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31+
32+
**/
33+
34+
var JPAK = {
35+
Generics: {},
36+
Loader: {},
37+
Classes: {},
38+
Tools : {}
39+
};
40+
41+
(function() {
42+
43+
var inNode = (typeof module !== 'undefined' && typeof module.exports !== 'undefined');
44+
45+
if (inNode) {
46+
JPAK.Tools.toBuffer = function(ab) {
47+
var buffer = new Buffer(ab.byteLength);
48+
var view = new Uint8Array(ab);
49+
for (var i = 0; i < buffer.length; ++i) {
50+
buffer[i] = view[i];
51+
}
52+
return buffer;
53+
};
54+
55+
JPAK.Tools.toArrayBuffer = function(buffer) {
56+
var ab = new ArrayBuffer(buffer.length);
57+
var view = new Uint8Array(ab);
58+
for (var i = 0; i < buffer.length; ++i) {
59+
view[i] = buffer[i];
60+
}
61+
return ab;
62+
};
63+
}
64+
65+
/*
66+
* Extends the Uint8Array to be able to be converted to a string
67+
*/
68+
Uint8Array.prototype.asString = function() {
69+
var o = "";
70+
for(var i=0;i<this.byteLength;i++)
71+
o += String.fromCharCode(this[i]);
72+
return o;
73+
};
74+
75+
/*
76+
* Puts a string inside the UInt8Array
77+
*/
78+
Uint8Array.prototype.putString = function(offset, string) {
79+
if (string === undefined) {
80+
string = offset;
81+
offset = 0;
82+
}
83+
for (var i=0;i<string.length;i++) {
84+
this[offset+i] = string.charCodeAt(i);
85+
}
86+
return offset+string.length;
87+
};
88+
89+
/*
90+
* Converts itself to an object.
91+
*
92+
* To associate with a prototype.
93+
*/
94+
JPAK.Generics.genericToObject = function() {
95+
var output = {};
96+
for (var property in this) {
97+
if (this.hasOwnProperty(property)) {
98+
output[property] = this[property].toObject !== undefined ? this[property].toObject() : this[property];
99+
}
100+
}
101+
return output;
102+
};
103+
104+
/*
105+
* Fills its own properties based on a input object.
106+
*
107+
* To associate with a prototype.
108+
*/
109+
JPAK.Generics.genericFromObject = function(object) {
110+
for (var property in object) {
111+
if (object.hasOwnProperty(property)) {
112+
this[property] = object[property];
113+
}
114+
}
115+
};
116+
117+
118+
/*
119+
* Converts itself to a JSON.
120+
*
121+
* To associate with a prototype.
122+
*/
123+
JPAK.Generics.genericjToJSON = function() {
124+
return JSON.stringify(this.toObject());
125+
};
126+
127+
128+
/*
129+
* Fills its own properties based on a json
130+
*
131+
* To associate with a prototype.
132+
*/
133+
JPAK.Generics.genericjFromJSON = function(json) {
134+
this.fromObject(JSON.parse(json));
135+
};
136+
137+
138+
})();

0 commit comments

Comments
 (0)