Skip to content

Commit 8dd54c1

Browse files
committed
Updates to builder comments for all files + build improvements
1 parent 218596e commit 8dd54c1

Some content is hidden

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

46 files changed

+681
-611
lines changed

gulp/gulp-stripper.js

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
'use strict';
2+
var gutil = require('gulp-util');
3+
var through = require('through2');
4+
5+
module.exports = function (config) {
6+
7+
return through.obj(function (file, enc, cb) {
8+
9+
if (file.isNull())
10+
{
11+
cb(null, file);
12+
}
13+
14+
if (file.isStream())
15+
{
16+
cb(new gutil.PluginError('gulp-stripper', 'Streaming not supported'));
17+
return;
18+
}
19+
20+
var START_TOKEN = "/* builder_helpers */";
21+
var END_TOKEN = "/* end_builder_helpers */";
22+
23+
try
24+
{
25+
var contents = file.contents.toString();
26+
27+
var i = -1;
28+
do
29+
{
30+
i = contents.indexOf(START_TOKEN);
31+
if (i > -1)
32+
{
33+
var j = contents.indexOf(END_TOKEN, i);
34+
if (j > -1)
35+
{
36+
contents = contents.substring(0, i) + contents.substring(j + END_TOKEN.length);
37+
}
38+
else
39+
{
40+
i = -1;
41+
}
42+
}
43+
}
44+
while (i !== -1);
45+
46+
file.contents = new Buffer(contents);
47+
cb(null, file);
48+
}
49+
catch (err)
50+
{
51+
cb(new gutil.PluginError('gulp-stripper', err, {fileName: file.path}));
52+
}
53+
});
54+
};

gulpfile.js

+33-58
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
var fs = require("fs");
2-
var gulp = require('gulp');
3-
var _ = require('lodash');
2+
var gulp = require("gulp");
3+
var _ = require("lodash");
44

5-
var es = require('event-stream');
6-
var exec = require('child_process').exec;
5+
var es = require("event-stream");
6+
var exec = require("child_process").exec;
77

8-
var pkg = require('./package.json');
8+
var pkg = require("./package.json");
99

10-
var concat = require('gulp-concat');
11-
var uglify = require('gulp-uglify');
12-
var handlebars = require('gulp-handlebars');
13-
var jshint = require('gulp-jshint');
14-
var minifyCss = require('gulp-minify-css');
15-
var rename = require('gulp-rename');
16-
var clean = require('gulp-clean');
10+
var concat = require("gulp-concat");
11+
var uglify = require("gulp-uglify");
12+
var handlebars = require("gulp-handlebars");
13+
var jshint = require("gulp-jshint");
14+
var minifyCss = require("gulp-minify-css");
15+
var rename = require("gulp-rename");
16+
var clean = require("gulp-clean");
1717
var declare = require("gulp-declare");
18-
var notify = require('gulp-notify');
19-
var runSequence = require('run-sequence');
20-
var nodemon = require('gulp-nodemon');
18+
var notify = require("gulp-notify");
19+
var runSequence = require("run-sequence");
20+
var nodemon = require("gulp-nodemon");
2121

22-
var wrap = require('gulp-wrap-umd');
22+
var wrap = require("gulp-wrap-umd");
23+
24+
// custom builder_helper stripper to remove builder helper functions
25+
var stripper = require("./gulp/gulp-stripper");
2326

2427
var paths = {
2528
scripts: {
@@ -245,36 +248,6 @@ gulp.task('scripts', function(cb) {
245248

246249
// alpaca umd
247250
var wrapper = "" + fs.readFileSync("./config/umd-wrapper.txt");
248-
/*
249-
var web_wrap = {
250-
deps: ['jquery', 'handlebars'],
251-
params: ['$', 'Handlebars'],
252-
namespace: "Alpaca",
253-
exports: "Alpaca",
254-
template: wrapper
255-
};
256-
var bootstrap_wrap = {
257-
deps: ['jquery', 'handlebars', 'bootstrap'],
258-
params: ['$', 'Handlebars', 'bootstrap'],
259-
namespace: "Alpaca",
260-
exports: "Alpaca",
261-
template: wrapper
262-
};
263-
var jqueryui_warp = {
264-
deps: ['jquery', 'handlebars', 'jquery-ui'],
265-
params: ['$', 'Handlebars', 'jqueryui'],
266-
namespace: "Alpaca",
267-
exports: "Alpaca",
268-
template: wrapper
269-
};
270-
var jquerymobile_wrap = {
271-
deps: ['jquery', 'handlebars', 'jquery-mobile'],
272-
params: ['$', 'Handlebars', 'jqm'],
273-
namespace: "Alpaca",
274-
exports: "Alpaca",
275-
template: wrapper
276-
};
277-
*/
278251

279252
var web_wrap = {
280253
deps: [{
@@ -348,7 +321,6 @@ gulp.task('scripts', function(cb) {
348321
defaultView: 'jquerymobile'
349322
};
350323

351-
352324
// core
353325
var first = gulp.src(paths.scripts.core)
354326
.pipe(concat('scripts-core.js'))
@@ -362,40 +334,43 @@ gulp.task('scripts', function(cb) {
362334
gulp.src(paths.scripts.web)
363335
.pipe(concat('alpaca.js'))
364336
.pipe(wrap(web_wrap))
337+
.pipe(gulp.dest('build/alpaca/web'))
338+
.pipe(concat('alpaca.min.js'))
339+
.pipe(uglify())
365340
.pipe(gulp.dest('build/alpaca/web')),
341+
/*
366342
gulp.src(paths.scripts.web)
367-
.pipe(uglify())
368-
.pipe(concat('alpaca.min.js'))
343+
.pipe(concat('alpaca-nobuilder.js'))
344+
.pipe(wrap(web_wrap))
345+
.pipe(stripper())
369346
.pipe(gulp.dest('build/alpaca/web')),
347+
*/
370348

371349
// bootstrap
372350
gulp.src(paths.scripts.bootstrap)
373351
.pipe(concat('alpaca.js'))
374352
.pipe(wrap(bootstrap_wrap))
375-
.pipe(gulp.dest('build/alpaca/bootstrap')),
376-
gulp.src(paths.scripts.bootstrap)
377-
.pipe(uglify())
353+
.pipe(gulp.dest('build/alpaca/bootstrap'))
378354
.pipe(concat('alpaca.min.js'))
355+
.pipe(uglify())
379356
.pipe(gulp.dest('build/alpaca/bootstrap')),
380357

381358
// jqueryui
382359
gulp.src(paths.scripts.jqueryui)
383360
.pipe(concat('alpaca.js'))
384361
.pipe(wrap(jqueryui_warp))
385-
.pipe(gulp.dest('build/alpaca/jqueryui')),
386-
gulp.src(paths.scripts.jqueryui)
387-
.pipe(uglify())
362+
.pipe(gulp.dest('build/alpaca/jqueryui'))
388363
.pipe(concat('alpaca.min.js'))
364+
.pipe(uglify())
389365
.pipe(gulp.dest('build/alpaca/jqueryui')),
390366

391367
// jquerymobile
392368
gulp.src(paths.scripts.jquerymobile)
393369
.pipe(concat('alpaca.js'))
394370
.pipe(wrap(jquerymobile_wrap))
395-
.pipe(gulp.dest('build/alpaca/jquerymobile')),
396-
gulp.src(paths.scripts.jquerymobile)
397-
.pipe(uglify())
371+
.pipe(gulp.dest('build/alpaca/jquerymobile'))
398372
.pipe(concat('alpaca.min.js'))
373+
.pipe(uglify())
399374
.pipe(gulp.dest('build/alpaca/jquerymobile'))
400375

401376
).pipe(es.wait(function() {

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
"phantom": "0.6.3",
3131
"q": "^1.0.1",
3232
"run-sequence": "*",
33-
"wd": ""
33+
"wd": "",
34+
35+
"gulp-util": "*",
36+
"through2": "*"
37+
3438
}
3539
}

src/js/ContainerField.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,10 @@
692692
{
693693
this.children[i].focus();
694694
}
695-
},
695+
}
696696

697-
//__BUILDER_HELPERS
697+
/* builder_helpers */
698+
,
698699

699700
/**
700701
* @private
@@ -759,7 +760,8 @@
759760
}
760761
}
761762
});
762-
}//__END_OF_BUILDER_HELPERS
763+
}
764+
/* end_builder_helpers */
763765
});
764766

765767
})(jQuery);

src/js/ControlField.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,11 @@
448448
*/
449449
onClick: function(e)
450450
{
451-
},
451+
}
452452

453453

454-
//__BUILDER_HELPERS
454+
/* builder_helpers */
455+
,
455456

456457
/**
457458
* @private
@@ -512,7 +513,8 @@
512513
}
513514
}
514515
});
515-
}//__END_OF_BUILDER_HELPERS
516+
}
517+
/* end_builder_helpers */
516518
});
517519

518520
// Registers additional messages

src/js/Field.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,6 @@
16111611
{
16121612
return "";
16131613
},
1614-
//__BUILDER_HELPERS
16151614

16161615
/**
16171616
* Finds if this field is a container of other fields.
@@ -1620,7 +1619,10 @@
16201619
*/
16211620
isContainer: function() {
16221621
return false;
1623-
},
1622+
}
1623+
1624+
/* builder_helpers */
1625+
,
16241626

16251627
/**
16261628
* Returns field title.
@@ -2035,7 +2037,8 @@
20352037
}
20362038

20372039
return optionsForOptions;
2038-
}//__END_OF_BUILDER_HELPERS
2040+
}
2041+
/* end_builder_helpers */
20392042
});
20402043

20412044
// Registers additional messages

src/js/fields/advanced/AddressField.js

+25-22
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,30 @@
202202
});
203203
},
204204

205-
//__BUILDER_HELPERS
205+
/**
206+
* @see Alpaca.Fields.ObjectField#getType
207+
*/
208+
getType: function() {
209+
return "any";
210+
}
211+
212+
213+
/* builder_helpers */
214+
,
215+
216+
/**
217+
* @see Alpaca.Fields.ObjectField#getTitle
218+
*/
219+
getTitle: function() {
220+
return "Address";
221+
},
222+
223+
/**
224+
* @see Alpaca.Fields.ObjectField#getDescription
225+
*/
226+
getDescription: function() {
227+
return "Standard US Address with Street, City, State and Zip. Also comes with support for Google map.";
228+
},
206229

207230
/**
208231
* @private
@@ -239,29 +262,9 @@
239262
}
240263
}
241264
});
242-
},
243-
/**
244-
* @see Alpaca.Fields.ObjectField#getTitle
245-
*/
246-
getTitle: function() {
247-
return "Address";
248-
},
249-
250-
/**
251-
* @see Alpaca.Fields.ObjectField#getDescription
252-
*/
253-
getDescription: function() {
254-
return "Standard US Address with Street, City, State and Zip. Also comes with support for Google map.";
255-
},
256-
257-
/**
258-
* @see Alpaca.Fields.ObjectField#getType
259-
*/
260-
getType: function() {
261-
return "any";
262265
}
263266

264-
//__END_OF_BUILDER_HELPERS
267+
/* end_builder_helpers */
265268
});
266269

267270
Alpaca.registerFieldClass("address", Alpaca.Fields.AddressField);

0 commit comments

Comments
 (0)