Skip to content

Commit f9ee9a9

Browse files
committed
Merge pull request #59 from onsip/prerelease-0.6.0
Release 0.6.0
2 parents 51f4204 + e71519f commit f9ee9a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+11424
-56088
lines changed

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
.grunt
3+
_SpecRunner.html

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
language: node_js
44

55
node_js:
6-
- 0.8
6+
- "0.10"
77

88
notifications:
99
email:

Gruntfile.js

Lines changed: 79 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = function(grunt) {
44

55
var srcFiles = [
66
'src/SIP.js',
7+
'src/Utils.js',
78
'src/LoggerFactory.js',
89
'src/EventEmitter.js',
910
'src/Constants.js',
@@ -25,16 +26,19 @@ module.exports = function(grunt) {
2526
'src/Subscription.js',
2627
'src/WebRTC.js',
2728
'src/UA.js',
28-
'src/Utils.js',
2929
'src/Hacks.js',
3030
'src/SanityCheck.js',
3131
'src/DigestAuthentication.js',
32+
'src/Grammar/dist/Grammar.js',
3233
'src/tail.js'
3334
];
3435

36+
var pkg = grunt.file.readJSON('package.json');
37+
3538
// Project configuration.
3639
grunt.initConfig({
37-
pkg: grunt.file.readJSON('package.json'),
40+
pkg: pkg,
41+
name: pkg.name.replace(/\.js$/, ''),
3842
meta: {
3943
banner: '\
4044
/*\n\
@@ -73,56 +77,40 @@ module.exports = function(grunt) {
7377
concat: {
7478
dist: {
7579
src: srcFiles,
76-
dest: 'dist/<%= pkg.name %>.js',
80+
dest: 'dist/<%= name %>.js',
7781
options: {
7882
banner: '<%= meta.banner %>',
7983
separator: '\n\n',
8084
process: true
8185
},
8286
nonull: true
8387
},
84-
post_dist: {
85-
src: [
86-
'dist/<%= pkg.name %>.js',
87-
'src/Grammar/dist/Grammar.js'
88-
],
89-
dest: 'dist/<%= pkg.name %>.js',
90-
nonull: true
91-
},
9288
devel: {
9389
src: srcFiles,
94-
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js',
90+
dest: 'dist/<%= name %>-<%= pkg.version %>.js',
9591
options: {
9692
banner: '<%= meta.banner %>',
9793
separator: '\n\n',
9894
process: true
9995
},
10096
nonull: true
101-
},
102-
post_devel: {
103-
src: [
104-
'dist/<%= pkg.name %>-<%= pkg.version %>.js',
105-
'src/Grammar/dist/Grammar.js'
106-
],
107-
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js',
108-
nonull: true
10997
}
11098
},
11199
includereplace: {
112100
dist: {
113101
files: {
114-
'dist': 'dist/<%= pkg.name %>.js'
102+
'dist': 'dist/<%= name %>.js'
115103
}
116104
},
117105
devel: {
118106
files: {
119-
'dist': 'dist/<%= pkg.name %>-<%= pkg.version %>.js'
107+
'dist': 'dist/<%= name %>-<%= pkg.version %>.js'
120108
}
121109
}
122110
},
123111
jshint: {
124-
dist: 'dist/<%= pkg.name %>.js',
125-
devel: 'dist/<%= pkg.name %>-<%= pkg.version %>.js',
112+
dist: 'dist/<%= name %>.js',
113+
devel: 'dist/<%= name %>-<%= pkg.version %>.js',
126114
options: {
127115
browser: true,
128116
curly: true,
@@ -140,19 +128,20 @@ module.exports = function(grunt) {
140128
supernew: true,
141129
globals: {
142130
module: true,
143-
define: true
131+
define: true,
132+
global: true
144133
}
145134
}
146135
},
147136
uglify: {
148137
dist: {
149138
files: {
150-
'dist/<%= pkg.name %>.min.js': ['dist/<%= pkg.name %>.js']
139+
'dist/<%= name %>.min.js': ['dist/<%= name %>.js']
151140
}
152141
},
153142
devel: {
154143
files: {
155-
'dist/<%= pkg.name %>-<%= pkg.version %>.min.js': ['dist/<%= pkg.name %>-<%= pkg.version %>.js']
144+
'dist/<%= name %>-<%= pkg.version %>.min.js': ['dist/<%= name %>-<%= pkg.version %>.js']
156145
}
157146
},
158147
options: {
@@ -162,14 +151,52 @@ module.exports = function(grunt) {
162151
jasmine: {
163152
components: {
164153
src: [
165-
'dist/sip.js'
154+
'dist/<%= name %>-<%= pkg.version %>.js'
166155
],
167156
options: {
168157
specs: 'test/spec/*.js',
169158
keepRunner : true,
170159
helpers: 'test/helpers/*.js'
171160
}
172161
}
162+
},
163+
peg: {
164+
grammar: {
165+
src: 'src/Grammar/src/Grammar.pegjs',
166+
dest: 'src/Grammar/dist/Grammar.js',
167+
options: {
168+
exportVar: 'SIP.Grammar',
169+
optimize: 'size',
170+
allowedStartRules: [
171+
'Contact',
172+
'Name_Addr_Header',
173+
'Record_Route',
174+
'Request_Response',
175+
'SIP_URI',
176+
'Subscription_State',
177+
'Via',
178+
'absoluteURI',
179+
'Call_ID',
180+
'Content_Length',
181+
'Content_Type',
182+
'CSeq',
183+
'displayName',
184+
'Event',
185+
'From',
186+
'host',
187+
'Max_Forwards',
188+
'Proxy_Authenticate',
189+
'quoted_string',
190+
'Refer_To',
191+
'stun_URI',
192+
'To',
193+
'turn_URI',
194+
'uuid',
195+
'WWW_Authenticate',
196+
'challenge'
197+
]
198+
}
199+
}
173200
}
174201
});
175202

@@ -180,43 +207,40 @@ module.exports = function(grunt) {
180207
grunt.loadNpmTasks('grunt-contrib-uglify');
181208
grunt.loadNpmTasks('grunt-contrib-jshint');
182209
grunt.loadNpmTasks('grunt-contrib-jasmine');
210+
grunt.loadNpmTasks('grunt-peg');
183211

184212

185213
// Task for building SIP.js Grammar.js and Grammar.min.js files.
186-
grunt.registerTask('grammar', function(){
187-
var done = this.async(); // This is an async task.
188-
var sys = require('sys');
189-
var exec = require('child_process').exec;
190-
var child;
191-
192-
// First compile SIP.js grammar with PEGjs.
193-
console.log('"grammar" task: compiling SIP.js PEGjs grammar into Grammar.js ...');
194-
child = exec('if [ -x "./node_modules/pegjs/bin/pegjs" ] ; then PEGJS="./node_modules/pegjs/bin/pegjs"; else PEGJS="pegjs" ; fi && $PEGJS -e SIP.Grammar src/Grammar/src/Grammar.pegjs src/Grammar/dist/Grammar.js', function(error, stdout, stderr) {
195-
if (error) {
196-
sys.print('ERROR: ' + stderr);
197-
done(false); // Tell grunt that async task has failed.
198-
}
199-
console.log('OK');
200-
201-
// Then modify the generated Grammar.js file with custom changes.
202-
console.log('"grammar" task: applying custom changes to Grammar.js ...');
203-
var fs = require('fs');
204-
var grammar = fs.readFileSync('src/Grammar/dist/Grammar.js').toString();
205-
var modified_grammar = grammar.replace(/throw new this\.SyntaxError\(([\s\S]*?)\);([\s\S]*?)}([\s\S]*?)return result;/, 'new this.SyntaxError($1);\n return -1;$2}$3return data;');
206-
fs.writeFileSync('src/Grammar/dist/Grammar.js', modified_grammar);
207-
console.log('OK');
208-
done(); // Tell grunt that async task has succeeded.
209-
210-
});
214+
grunt.registerTask('post_peg', function(){
215+
// Modify the generated Grammar.js file with custom changes.
216+
console.log('"grammar" task: applying custom changes to Grammar.js ...');
217+
var fs = require('fs');
218+
var grammar = fs.readFileSync('src/Grammar/dist/Grammar.js').toString();
219+
var modified_grammar = grammar.replace(/throw peg.*maxFailPos.*/, 'return -1;');
220+
modified_grammar = modified_grammar.replace(/return peg.*result.*/, 'return data;');
221+
modified_grammar = modified_grammar.replace(/parse:( *)parse/, 'parse:$1function (input, startRule) {return parse(input, {startRule: startRule});}');
222+
223+
// Don't jshint this big chunk of minified code
224+
modified_grammar =
225+
"/* jshint ignore:start */\n" +
226+
modified_grammar +
227+
"\n/* jshint ignore:end */\n"
228+
229+
fs.writeFileSync('src/Grammar/dist/Grammar.js', modified_grammar);
230+
console.log('OK');
211231
});
212232

233+
grunt.registerTask('grammar', ['peg', 'post_peg']);
234+
213235
// Task for building sip-devel.js (uncompressed), sip-X.Y.Z.js (uncompressed)
214236
// and sip-X.Y.Z.min.js (minified).
215237
// Both sip-devel.js and sip-X.Y.Z.js are the same file with different name.
216-
grunt.registerTask('build', ['concat:devel', 'includereplace:devel', 'jshint:devel', 'concat:post_devel', 'concat:dist', 'includereplace:dist', 'jshint:dist', 'concat:post_dist', 'uglify:dist', 'uglify:devel']);
238+
grunt.registerTask('build', ['concat:devel', 'includereplace:devel', 'jshint:devel', 'concat:dist', 'includereplace:dist', 'jshint:dist', 'uglify:dist', 'uglify:devel']);
217239

218240
// Task for building sip-devel.js (uncompressed).
219-
grunt.registerTask('devel', ['concat:devel', 'includereplace:devel', 'jshint:devel', 'concat:post_devel']);
241+
grunt.registerTask('devel', ['concat:devel', 'includereplace:devel', 'jshint:devel']);
242+
243+
grunt.registerTask('quick', ['concat:dist', 'includereplace:dist']);
220244

221245
// Test tasks.
222246
grunt.registerTask('test',['jasmine']);

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A JavaScript SIP stack for WebRTC, instant messaging, and more!
1515
## Download
1616

1717
* [sipjs.com/download](http://sipjs.com/download/)
18-
18+
* Bower: `bower install sip.js#0.5.0+bower`
1919

2020
## Authors
2121

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sip.js",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"authors": [
55
"Will Mitchell <[email protected]>",
66
"James Criscuolo <[email protected]>",

0 commit comments

Comments
 (0)