{"size": 956, "ext": "js", "max_stars_repo_path": "features/google-analytics/analytics-gulpfile.js", "max_stars_repo_name": "CodeCorico/allons-y-google-analytics", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "features/google-analytics/analytics-gulpfile.js", "max_issues_repo_name": "CodeCorico/allons-y-google-analytics", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "features/google-analytics/analytics-gulpfile.js", "max_forks_repo_name": "CodeCorico/allons-y-google-analytics", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.3170731707, "max_line_length": 86, "alphanum_fraction": 0.539748954}
'use strict';

module.exports = function($allonsy, $gulp) {

  $gulp.task('google-analytics', function(done) {
    var through = require('through2'),
        path = require('path'),
        files = [];

    $gulp
      .src(path.join(__dirname, 'analytics-index.js'))
      .pipe(through.obj(function(file, encoding, throughDone) {
        files.push(file);

        throughDone();
      }, function(throughDone) {
        var transform = this;

        files.forEach(function(file) {
          file.contents = new Buffer(file.contents
            .toString()
            .replace(
              /{{GOOGLE_ANALYTICS_ID}}/g,
              process.env.GOOGLE_ANALYTICS_ID && process.env.GOOGLE_ANALYTICS_ID || ''
            )
          );

          transform.push(file);
        });

        throughDone();

        transform.emit('end');
      }))
      .pipe($gulp.dist('google-analytics'))
      .on('end', done);
  });

  return 'google-analytics';
};
