<commit_before>var gulp = require('gulp')
var task = require('./lib/task')
var vars = require('./lib/gen-vars')
var config = require('./lib/config')

exports.init = function (filePath) {
  filePath = {}.toString.call(filePath) === '[object String]' ? filePath : ''
  vars.init(filePath)
}

exports.watch = function (opts) {
  var build = function () {
    task.build(Object.assign(opts, {message: 'watch element theme'}))
  }

  gulp.task('build', build)
  gulp.watch(opts.config || config.config, ['build'])
  task.fonts(Object.assign(opts, {message: 'build theme font'}))
  build()
}

exports.run = function (opts) {
  task.fonts(Object.assign(opts, {message: 'build theme font'}))
  task.build(Object.assign(opts, {message: 'build element theme'}))
}<commit_msg>added callback and promise to run task<commit_after>var gulp = require('gulp')
var series = require('run-sequence').use(gulp);
var task = require('./lib/task')
var vars = require('./lib/gen-vars')
var config = require('./lib/config')

var build = function (opts) {
    return function buildTask() {
      return task.build(Object.assign(opts, {message: 'build element theme'}))
    }
}

var fonts = function (opts) {
    return function fontsTask() {
      return task.fonts(Object.assign(opts, {message: 'build theme font'}))
    }
}

exports.init = function (filePath) {
  filePath = {}.toString.call(filePath) === '[object String]' ? filePath : ''
  vars.init(filePath)
}

exports.watch = function (opts) {
  gulp.task('build', build(opts))
  exports.run(opts)
  gulp.watch(opts.config || config.config, ['build'])
}

exports.run = function (opts, cb) {
  gulp.task('build', build(opts))
  gulp.task('fonts', fonts(opts))
  return new Promise(function (resolve, reject) {
    series('build', 'fonts', function (err) {
      err ? reject(err) : resolve();
      if (err) { cb(err); }
    });
  });
}
{'fraction_non_alphanumeric': 0.18435155412647375, 'fraction_numerical': 0.0, 'mean_word_length': 4.186111111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '1604400', 'n_tokens_mistral': 618, 'n_tokens_neox': 605, 'n_words': 144}