aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2016-03-12 17:48:37 +0300
committerOleg Gaidarenko <markelog@gmail.com>2016-03-14 21:13:05 +0300
commit055cb7534e2dcf7ee8ad145be83cb2d74b5331c7 (patch)
tree295c6afce6b203f752eb6b0c8697b1d452f71151 /build
parent0c1f72667dd74bf00c6c514ebe8b7e92c3e7ad0e (diff)
downloadjquery-055cb7534e2dcf7ee8ad145be83cb2d74b5331c7.tar.gz
jquery-055cb7534e2dcf7ee8ad145be83cb2d74b5331c7.zip
Build: try insight package to get info about custom builds
Fixes gh-2890 Closes gh-2988
Diffstat (limited to 'build')
-rw-r--r--build/tasks/build.js43
1 files changed, 41 insertions, 2 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js
index 2ebb4c47e..1e1c6bb37 100644
--- a/build/tasks/build.js
+++ b/build/tasks/build.js
@@ -10,6 +10,8 @@ module.exports = function( grunt ) {
var fs = require( "fs" ),
requirejs = require( "requirejs" ),
+ Insight = require( "insight" ),
+ pkg = require( "../../package.json" ),
srcFolder = __dirname + "/../../src/",
rdefineEnd = /\}\s*?\);[^}\w]*$/,
read = function( fileName ) {
@@ -312,10 +314,47 @@ module.exports = function( grunt ) {
// grunt build:*:*:+ajax:-dimensions:-effects:-offset
grunt.registerTask( "custom", function() {
var args = this.args,
- modules = args.length ? args[ 0 ].replace( /,/g, ":" ) : "";
+ modules = args.length ? args[ 0 ].replace( /,/g, ":" ) : "",
+ done = this.async(),
+ insight = new Insight( {
+ trackingCode: "UA-1076265-4",
+ pkg: pkg
+ } );
+
+ function exec( trackingAllowed ) {
+ var tracks = args.length ? args[ 0 ].split( "," ) : [];
+ var defaultPath = [ "build", "custom" ];
+
+ tracks = tracks.map( function( track ) {
+ return track.replace( /\//g, "+" );
+ } );
+
+ if ( trackingAllowed ) {
+
+ // Track individuals
+ tracks.forEach( function( module ) {
+ var path = defaultPath.concat( [ "individual" ], module );
+
+ insight.track.apply( insight, path );
+ } );
+
+ // Track full command
+ insight.track.apply( insight, defaultPath.concat( [ "full" ], tracks ) );
+ }
+
+ grunt.task.run( [ "build:*:*" + ( modules ? ":" + modules : "" ), "uglify", "dist" ] );
+ done();
+ }
grunt.log.writeln( "Creating custom build...\n" );
- grunt.task.run( [ "build:*:*" + ( modules ? ":" + modules : "" ), "uglify", "dist" ] );
+ // Ask for permission the first time
+ if ( insight.optOut === undefined ) {
+ insight.askPermission( null, function( error, result ) {
+ exec( result );
+ } );
+ } else {
+ exec( !insight.optOut );
+ }
} );
};