<commit_before>path = require 'path'
fs = require 'fs-extra'
_s = require 'underscore.string'

module.exports = (grunt) ->
  grunt.loadTasks('tasks')

  appName = 'Particle Dev'
  workDir = path.join(__dirname, '..', 'dist', 'atom-work-dir')
  buildDir = path.join(__dirname, '..', 'dist', process.platform)


  if fs.existsSync(workDir) && !!grunt.option('keepAtomWorkDir')
    fs.removeSync(workDir)
  fs.ensureDirSync(workDir)

  # Get Atom Version from .atomrc
  atomrc = fs.readFileSync(path.join(__dirname, '..', '.atomrc')).toString()
  lines = atomrc.split "\n"
  atomVersion = null
  for line in lines
    [key, value] = line.split '='
    if key.indexOf('ATOM_VERSION') > 0
      atomVersion = _s.trim(value)
  grunt.log.writeln '(i) Atom version is ' + atomVersion

  # Get Particle Dev version from options/current sources
  if !!grunt.option('particleDevVersion')
    particleDevVersion = grunt.option('particleDevVersion')
  else if !!process.env.TRAVIS_TAG
    # Drop the "v" from tag name
    particleDevVersion = process.env.TRAVIS_TAG.slice(1)
  else
    packageJson = path.join(__dirname, '..', 'package.json')
    packageObject = JSON.parse(fs.readFileSync(packageJson))
    particleDevVersion = packageObject.version + '-' + process.env.JANKY_SHA1
  grunt.log.writeln '(i) Particle Dev version is ' + particleDevVersion

  grunt.initConfig
    workDir: workDir
    atomVersion: atomVersion
    particleDevVersion: particleDevVersion
    appName: appName
    buildDir: buildDir

  tasks = []

  if !grunt.option('keepAtomWorkDir')
    tasks = tasks.concat [
      'download-atom',
      'patch-atom-version',
      'inject-packages',
      'install-unpublished-packages',
      'bootstrap-atom',
      'copy-resources',
      'install-particle-dev',
      'patch-code',
    ]

  tasks = tasks.concat [
    'build-app',
  ]

  grunt.registerTask('default', tasks)
<commit_msg>Use root dir for build on Windows<commit_after>path = require 'path'
fs = require 'fs-extra'
_s = require 'underscore.string'

module.exports = (grunt) ->
  grunt.loadTasks('tasks')

  appName = 'Particle Dev'
  if process.platform == 'win32'
    root = process.cwd().split(path.sep)[0]
    workDir = path.join(root, 'atom-work-dir')
    buildDir = path.join(root, 'particle-dev-' + process.platform)
  else
    workDir = path.join(__dirname, '..', 'dist', 'atom-work-dir')
    buildDir = path.join(__dirname, '..', 'dist', process.platform)


  if fs.existsSync(workDir) && !!grunt.option('keepAtomWorkDir')
    fs.removeSync(workDir)
  fs.ensureDirSync(workDir)

  # Get Atom Version from .atomrc
  atomrc = fs.readFileSync(path.join(__dirname, '..', '.atomrc')).toString()
  lines = atomrc.split "\n"
  atomVersion = null
  for line in lines
    [key, value] = line.split '='
    if key.indexOf('ATOM_VERSION') > 0
      atomVersion = _s.trim(value)
  grunt.log.writeln '(i) Atom version is ' + atomVersion

  # Get Particle Dev version from options/current sources
  if !!grunt.option('particleDevVersion')
    particleDevVersion = grunt.option('particleDevVersion')
  else if !!process.env.TRAVIS_TAG
    # Drop the "v" from tag name
    particleDevVersion = process.env.TRAVIS_TAG.slice(1)
  else
    packageJson = path.join(__dirname, '..', 'package.json')
    packageObject = JSON.parse(fs.readFileSync(packageJson))
    particleDevVersion = packageObject.version + '-' + process.env.JANKY_SHA1
  grunt.log.writeln '(i) Particle Dev version is ' + particleDevVersion

  grunt.initConfig
    workDir: workDir
    atomVersion: atomVersion
    particleDevVersion: particleDevVersion
    appName: appName
    buildDir: buildDir

  tasks = []

  if !grunt.option('keepAtomWorkDir')
    tasks = tasks.concat [
      'download-atom',
      'patch-atom-version',
      'inject-packages',
      'install-unpublished-packages',
      'bootstrap-atom',
      'copy-resources',
      'install-particle-dev',
      'patch-code',
    ]

  tasks = tasks.concat [
    'build-app',
  ]

  grunt.registerTask('default', tasks)

{'fraction_non_alphanumeric': 0.1388334995014955, 'fraction_numerical': 0.002243270189431705, 'mean_word_length': 3.5089887640449438, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5965419', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1314, 'n_words': 271}