-use_taobao_mirror = true
-
 # *** INCLUDE ***
 os = require 'os'
 path = require 'path-extra'

  theme_root = path.join stage1_app, 'assets', 'themes'

  try
    yield Promise.join \
      (fs.removeAsync stage1_app),
      (fs.removeAsync stage2_app)
  catch e
  fs.ensureDirSync stage1_app
  fs.ensureDirSync stage2_app

  # Check npm version
  npm_version = (yield execAsync "'#{npm_path}' --version").trim()
  log "You are using npm v#{npm_version}"
  if semver.major(npm_version) == 2
    log "*** USING npm 2 TO BUILD poi IS PROHIBITED ***"

build_dir_name = 'build'
download_dir_name = 'download'
release_dir_name = 'release'
config = (->  
  # global.* variables are assigned to adapt for requiring 'config'
  global.ROOT = __dirname
  system_appdata_path = process.env.APPDATA || (
    if process.platform == 'darwin'
    then path.join(process.env.HOME, 'Library/Application Support')
    else '/var/local')
  global.APPDATA_PATH = path.join system_appdata_path, 'poi'
  global.EXROOT = global.APPDATA_PATH
  require './lib/config')()

# If !use_taobao_mirror, download Electron from GitHub.
use_taobao_mirror = config.get 'buildscript.useTaobaoMirror', true
npm_exec_path = path.join __dirname, 'node_modules', 'npm', 'bin', 'npm-cli.js'
bower_exec_path = path.join __dirname, 'node_modules', 'bower', 'bin', 'bower'

