old_contents: 'use strict';
  
  var node_path   = require('path');
  var option_cwd  = require('../util/cwd');
  var fs = require('fs');
  
  exports.shorthands = {
    c: 'cwd',
  };
  
  exports.options = {
    // cortex build abc
    cwd: option_cwd,
  
    ranges: {
      type: Boolean,
      info: 'check ranges and build local files with range pathes.',
      default: true
    },
  
    preinstall: {
      enumerable: false,
      type: Boolean,
      default: false
    },
  
    prebuild: {
      enumerable: false,
      type: Boolean,
      default: true
    },
  
    dest: {
      type: node_path,
  
      // default to be profile.built_root
      info: 'the destination directory to be built into',
      setter: function (dest) {
        var done = this.async();
        if (!dest) {
          dest = node_path.join(this.get('cwd'), 'neurons');
  
          function cb (err) {
            done(err || null, dest);
          }
  
          // legacy
          // If `neurons` exists and is not a directory, try to unlink it.
          fs.lstat(dest, function (err, stat) {
            if (err) {
              if (err.code === 'ENOENT') {
                return cb();
              }
              return cb(err);
            }
  
            if (stat.isDirectory()) {
              return cb();
            }
  
            fs.unlink(dest, cb);
          });
          return;
        }
  
        done(null, dest);
      }
    },
  
    link: {
      enumerable: false,
      type: Boolean,
      info: 'link the neurons/ folder to built root.',
      default: true
    }
  };
  
  
  exports.info = 'Build module wrapper, and publish to cortex server root.';
  
  exports.usage = [
    '{{name}} build [options]'
  ];
  
new_contents: 'use strict';
  
  var node_path   = require('path');
  var option_cwd  = require('../util/cwd');
  var fs = require('fs');
  
  exports.shorthands = {
    c: 'cwd',
  };
  
  exports.options = {
    // cortex build abc
    cwd: option_cwd,
  
    ranges: {
      type: Boolean,
      info: 'check ranges and build local files with range pathes.',
      default: true
    },
  
    preinstall: {
      enumerable: false,
      type: Boolean,
      default: false
    },
  
    prebuild: {
      enumerable: false,
      type: Boolean,
      default: true
    },
  
    dest: {
      type: node_path,
  
      // default to be profile.built_root
      info: 'the destination directory to be built into',
      setter: function (dest) {
        var done = this.async();
  
        function cb (err) {
          // '/abc/' -> '/abc'
          done(err || null, node_path.resolve(dest));
        }
  
        if (!dest) {
          dest = node_path.join(this.get('cwd'), 'neurons');
          // legacy
          // If `neurons` exists and is not a directory, try to unlink it.
          fs.lstat(dest, function (err, stat) {
            if (err) {
              if (err.code === 'ENOENT') {
                return cb();
              }
              return cb(err);
            }
  
            if (stat.isDirectory()) {
              return cb();
            }
  
            fs.unlink(dest, cb);
          });
          return;
        }
  
        cb();
      }
    },
  
    link: {
      enumerable: false,
      type: Boolean,
      info: 'link the neurons/ folder to built root.',
      default: true
    }
  };
  
  
  exports.info = 'Build module wrapper, and publish to cortex server root.';
  
  exports.usage = [
    '{{name}} build [options]'
  ];
  
subject: resolve options.dest; #397