<commit_before>// Import modules:
var gulp = require('gulp')
,   pkg = require('./package.json')
,   less = require('gulp-less')
,   rename = require('gulp-rename')
,   concat = require('gulp-concat')
,   jshint = require('gulp-jshint')
,   header = require('gulp-header')
,   gutils = require('gulp-util')
,   replace = require('gulp-replace')
,   minifyCSS = require('gulp-minify-css')
,   uglify = require('gulp-uglify')
,   jshint = require('gulp-jshint')
,   header = require('gulp-header')
,   footer = require('gulp-footer');

//Add Trailing slash to projectPath if not exists.
if (pkg.projectPath !== "")
  pkg.projectPath = pkg.projectPath.replace(/\/?$/, '/');

// Define values for file headers:
var chui = ['ChUI-Android.css','ChUI-iOS.css','ChUI-Win.css','ChUI.js']
,   osNames = ['Android','iOS','Windows']
,   osTypes = ['android','ios','win'];

// Define header for ChUI files:
var chuiHeader = ['/*',
  '    pO\\',
  '   6  /\\',
  '     /OO\\',
  '    /OOOO\\',
  '   /OOOOOO\\',
  '  (OOOOOOOO)',
  '   \\:~==~:/',
  '',
  '<%= pkg.title %>',
  '<%= chuiName %>',
  'Copyright ' + gutils.date("yyyy") + ' Sourcebits www.sourcebits.com',
  'License: <%= pkg.licences[0].type %>',
  'Version: <%= pkg.version %>',
  '*/\n'].join('\n');

// Define header for minfied ChUI files:
var chuiHeaderMin = ['/*',
  '<%= pkg.title %>',
  '<%= chuiName %>',
  'Copyright ' + gutils.date("yyyy") + ' Sourcebits www.sourcebits.com',
  'License: <%= pkg.licences[0].type %>',
  'Version: <%= pkg.version %>',
  '*/\n'].join('\n');

// Define header for examples and demos:
var htmlHeader = ['<!DOCTYPE html>',
'<html lang="en"<%= langDir %>>',
'<head>',
'  <meta charset="utf-8">',
'  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">',
'  <meta name="apple-mobile-web-app-capable" content="yes">',
'  <meta name="mobile-web-app-capable" content="yes">',
'  <meta name="msapplication-tap-highlight" content="no">',
'  <title>ChocolateChip-UI <%= osName %></title>',
'  <link rel="stylesheet" href="../chui/chui-<%= osType %>-<%= pkg.version %>.css">',
'  <script src="<%= pkg.jquery.url %>"></script>',
'  <script src="../chui/chui-<%= pkg.version %>.js"></script>'].join('\n') + '\n';

var less_for = function (os, idx) {
    gulp.src('src/themes/' + os + '/main.less')
      .pipe(less())
      .pipe(rename('chui-' + os + '-' + pkg.version + '.css'))
      .pipe(header(chuiHeader, { pkg : pkg, chuiName: chui[idx] }))
      .pipe(gulp.dest(pkg.projectPath + 'chui/')).pipe(minifyCSS({}))
      .pipe(header(chuiHeaderMin, { pkg : pkg, chuiName: chui[idx] }))
      .pipe(rename('chui-' + os + '-' + pkg.version + '.min.css'))
      .pipe(gulp.dest(pkg.projectPath + './chui/'));;   
}

// Process, minify and output LESS:
gulp.task('less', function () {
  osTypes.forEach(less_for);
});

// Concat, minify and output JavaScript:
gulp.task('js', function () {
  var chuijs_start = [
    '\(function\(\$\) {',
    '  \'use strict\';'
  ].join('\n');
  var chuijs_end = '\n\}\)\(window\.jQuery\);';

  gulp.src([
    'src/chui/utils.js', 
    'src/chui/events.js', 
    'src/chui/detectors.js', 
    'src/chui/browsers.js', 
    'src/chui/gestures.js', 
    'src/chui/desktop.js', 
    'src/chui/layout.js', 
    'src/chui/pubsub.js', 
    'src/chui/navigation.js', 
    'src/chui/buttons.js', 
    'src/chui/blockui.js', 
    'src/chui/center.js', 
    'src/chui/busy.js', 
    'src/chui/popup.js', 
    'src/chui/popover.js', 
    'src/chui/segmented.js', 
    'src/chui/togglePanel.js', 
    'src/chui/paging.js', 
    'src/chui/deletableList.js', 
    'src/chui/selectList.js', 
    'src/chui/sheet.js', 
    'src/chui/slideout.js', 
    'src/chui/stepper.js', 
    'src/chui/switch.js', 
    'src/chui/scroll.js', 
    'src/chui/tabbar.js', 
    'src/chui/templates.js', 
    'src/chui/search.js', 
    'src/chui/carousel.js',
    'src/chui/range.js',
    'src/chui/select.js'
  ])
    .pipe(concat("chui-" + pkg.version + ".js"))
    .pipe(replace(/\(function\(\$\) {\n^.*\'use strict\';/img, ''))
    .pipe(replace(/\}\)\(window\.jQuery\);/img, ''))
    .pipe(replace(/\n\n\n/img, ''))
    .pipe(replace(/\n\n/img, '\n'))
    .pipe(header(chuijs_start))
    .pipe(footer(chuijs_end))
    .pipe(header(chuiHeader, { pkg : pkg, chuiName: chui[3] }))
    .pipe(gulp.dest(pkg.projectPath + 'chui/'))
    .pipe(uglify())
    .pipe(header(chuiHeaderMin, { pkg : pkg, chuiName: chui[3] }))
    .pipe(rename("chui-" + pkg.version + ".min.js"))
    .pipe(gulp.dest(pkg.projectPath + 'chui/'));;
});

// Copy out media:
gulp.task('copy', function() {
  gulp.src('src/images/**/*')
    .pipe(gulp.dest(pkg.projectPath + 'images/'));
  gulp.src('src/data/**/*')
    .pipe(gulp.dest(pkg.projectPath + 'data/'));
});

// JSHint:<commit_msg>Updated Gulpjs to create dist files.<commit_after>// Import modules:
var gulp = require('gulp')
,   pkg = require('./package.json')
,   less = require('gulp-less')
,   rename = require('gulp-rename')
,   concat = require('gulp-concat')
,   jshint = require('gulp-jshint')
,   header = require('gulp-header')
,   gutils = require('gulp-util')
,   replace = require('gulp-replace')
,   minifyCSS = require('gulp-minify-css')
,   uglify = require('gulp-uglify')
,   jshint = require('gulp-jshint')
,   header = require('gulp-header')
,   footer = require('gulp-footer');

//Add Trailing slash to projectPath if not exists.
if (pkg.projectPath !== "")
  pkg.projectPath = pkg.projectPath.replace(/\/?$/, '/');

// Define values for file headers:
var chui = ['ChUI-Android.css','ChUI-iOS.css','ChUI-Win.css','ChUI.js']
,   osNames = ['Android','iOS','Windows']
,   osTypes = ['android','ios','win'];

// Define header for ChUI files:
var chuiHeader = ['/*',
  '    pO\\',
  '   6  /\\',
  '     /OO\\',
  '    /OOOO\\',
  '   /OOOOOO\\',
  '  (OOOOOOOO)',
  '   \\:~==~:/',
  '',
  '<%= pkg.title %>',
  '<%= chuiName %>',
  'Copyright ' + gutils.date("yyyy") + ' Sourcebits www.sourcebits.com',
  'License: <%= pkg.licences[0].type %>',
  'Version: <%= pkg.version %>',
  '*/\n'].join('\n');

// Define header for minfied ChUI files:
var chuiHeaderMin = ['/*',
  '<%= pkg.title %>',
  '<%= chuiName %>',
  'Copyright ' + gutils.date("yyyy") + ' Sourcebits www.sourcebits.com',
  'License: <%= pkg.licences[0].type %>',
  'Version: <%= pkg.version %>',
  '*/\n'].join('\n');

// Define header for examples and demos:
var htmlHeader = ['<!DOCTYPE html>',
'<html lang="en"<%= langDir %>>',
'<head>',
'  <meta charset="utf-8">',
'  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">',
'  <meta name="apple-mobile-web-app-capable" content="yes">',
'  <meta name="mobile-web-app-capable" content="yes">',
'  <meta name="msapplication-tap-highlight" content="no">',
'  <title>ChocolateChip-UI <%= osName %></title>',
'  <link rel="stylesheet" href="../chui/chui-<%= osType %>-<%= pkg.version %>.css">',
'  <script src="<%= pkg.jquery.url %>"></script>',
'  <script src="../chui/chui-<%= pkg.version %>.js"></script>'].join('\n') + '\n';

var less_for = function (os, idx) {
    gulp.src('src/themes/' + os + '/main.less')
      .pipe(less())
      .pipe(rename('chui-' + os + '-' + pkg.version + '.css'))
      .pipe(header(chuiHeader, { pkg : pkg, chuiName: chui[idx] }))
      .pipe(gulp.dest(pkg.projectPath + 'chui/')).pipe(minifyCSS({}))
      .pipe(gulp.dest(pkg.projectPath + 'dist/')).pipe(minifyCSS({}))
      .pipe(header(chuiHeaderMin, { pkg : pkg, chuiName: chui[idx] }))
      .pipe(rename('chui-' + os + '-' + pkg.version + '.min.css'))
      .pipe(gulp.dest(pkg.projectPath + './chui/'))
      .pipe(gulp.dest(pkg.projectPath + './dist/')); 
}

// Process, minify and output LESS:
gulp.task('less', function () {
  osTypes.forEach(less_for);
});

// Concat, minify and output JavaScript:
gulp.task('js', function () {
  var chuijs_start = [
    '\(function\(\$\) {',
    '  \'use strict\';'
  ].join('\n');
  var chuijs_end = '\n\}\)\(window\.jQuery\);';

  gulp.src([
    'src/chui/utils.js', 
    'src/chui/events.js', 
    'src/chui/detectors.js', 
    'src/chui/browsers.js', 
    'src/chui/gestures.js', 
    'src/chui/desktop.js', 
    'src/chui/layout.js', 
    'src/chui/pubsub.js', 
    'src/chui/navigation.js', 
    'src/chui/buttons.js', 
    'src/chui/blockui.js', 
    'src/chui/center.js', 
    'src/chui/busy.js', 
    'src/chui/popup.js', 
    'src/chui/popover.js', 
    'src/chui/segmented.js', 
    'src/chui/togglePanel.js', 
    'src/chui/paging.js', 
    'src/chui/deletableList.js', 
    'src/chui/selectList.js', 
    'src/chui/sheet.js', 
    'src/chui/slideout.js', 
    'src/chui/stepper.js', 
    'src/chui/switch.js', 
    'src/chui/scroll.js', 
    'src/chui/tabbar.js', 
    'src/chui/templates.js', 
    'src/chui/search.js', 
    'src/chui/carousel.js',
    'src/chui/range.js',
    'src/chui/select.js'
  ])
    .pipe(concat("chui-" + pkg.version + ".js"))
    .pipe(replace(/\(function\(\$\) {\n^.*\'use strict\';/img, ''))
    .pipe(replace(/\}\)\(window\.jQuery\);/img, ''))
    .pipe(replace(/\n\n\n/img, ''))
    .pipe(replace(/\n\n/img, '\n'))
    .pipe(header(chuijs_start))
    .pipe(footer(chuijs_end))
    .pipe(header(chuiHeader, { pkg : pkg, chuiName: chui[3] }))
    .pipe(gulp.dest(pkg.projectPath + 'chui/'))
    .pipe(gulp.dest(pkg.projectPath + './dist/'))
    .pipe(uglify())
    .pipe(header(chuiHeaderMin, { pkg : pkg, chuiName: chui[3] }))
    .pipe(rename("chui-" + pkg.version + ".min.js"))
    .pipe(gulp.dest(pkg.projectPath + 'chui/'))
    .pipe(gulp.dest(pkg.projectPath + './dist/'));
});

// Copy out media:
gulp.task('copy', function() {
  gulp.src('src/images/**/*')
    .pipe(gulp.dest(pkg.projectPath + 'images/'));
  gulp.src('src/data/**/*')
    .pipe(gulp.dest(pkg.projectPath + 'data/'));
});

// JSHint:
{'fraction_non_alphanumeric': 0.251812519146329, 'fraction_numerical': 0.0020422750944552232, 'mean_word_length': 3.091060985797828, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3651193', 'n_tokens_mistral': 4073, 'n_tokens_neox': 3903, 'n_words': 564}