<commit_before>/**
 * https://github.com/loopline-systems/electron-builder
 * Licensed under the MIT license.
 */
var fs = require('fs');
var path = require('path');
var os = require('os');
var debug = require('debug')('electron-installer-dmg');

function build(opts, done) {
  var appdmg = require('appdmg');
  var spec = {
    title: opts.title || opts.productName || opts.name,
    contents: opts.contents,
    icon: opts.icon,
    'icon-size': opts['icon-size'],
    background: opts.background
  };
  var contents = JSON.stringify(spec, null, 2);

  debug('DMG spec is:\n', spec);

  var src = path.resolve(os.tmpDir(), 'appdmg.json');
  debug('writing config to `%s`', src);

  fs.writeFile(src, contents, function(err) {
    if (err) return done(err);
    debug('creating dmg...');
    appdmg({
      source: src,
      target: opts.dmgPath
    }).on('progress', function(info) {
      if (info.type === 'step-begin') {
        debug('appdmg [%d/%d]: %s...', info.current, info.total, info.title);
      }
    }).on('finish', function() {
      debug('appdmg finished!');
      debug('cleaning up temp config at `%s`', src);
      fs.unlink(src, function(err2) {
        if (err2) return done(err2);
        done(null, opts);
      });
    }).on('error', function(err3) {
      done(err3);
    });
  });
}

module.exports = function(opts, done) {
  if (process.platform !== 'darwin') {
    return done(new Error('Must be run on OSX'));
  }
  if (!opts.background) {
    opts.background = path.resolve(__dirname, 'resources/mac/background.png');
  } else {
    opts.background = path.resolve(opts.background);
  }
  if (!opts.icon) {
    opts.icon = path.resolve(__dirname, 'resources/mac/atom.icns');
  } else {
    opts.icon = path.resolve(opts.icon);
  }

  opts['icon-size'] = opts['icon-size'] || 80;

  opts.appPath = path.resolve(process.cwd(), opts.appPath);
  opts.dmgPath = path.resolve(opts.dmgPath || path.join(opts.out, opts.name + '.dmg'));

  opts.overwrite = opts.overwrite || false;

  opts.contents = opts.contents || [
    {
      x: 448,
      y: 344,
      type: 'link',
      path: '/Applications'
    },
    {
      x: 192,
      y: 344,
      type: 'file',<commit_msg>fix out is not default<commit_after>/**
 * https://github.com/loopline-systems/electron-builder
 * Licensed under the MIT license.
 */
var fs = require('fs');
var path = require('path');
var os = require('os');
var debug = require('debug')('electron-installer-dmg');

function build(opts, done) {
  var appdmg = require('appdmg');
  var spec = {
    title: opts.title || opts.productName || opts.name,
    contents: opts.contents,
    icon: opts.icon,
    'icon-size': opts['icon-size'],
    background: opts.background
  };
  var contents = JSON.stringify(spec, null, 2);

  debug('DMG spec is:\n', spec);

  var src = path.resolve(os.tmpDir(), 'appdmg.json');
  debug('writing config to `%s`', src);

  fs.writeFile(src, contents, function(err) {
    if (err) return done(err);
    debug('creating dmg...');
    appdmg({
      source: src,
      target: opts.dmgPath
    }).on('progress', function(info) {
      if (info.type === 'step-begin') {
        debug('appdmg [%d/%d]: %s...', info.current, info.total, info.title);
      }
    }).on('finish', function() {
      debug('appdmg finished!');
      debug('cleaning up temp config at `%s`', src);
      fs.unlink(src, function(err2) {
        if (err2) return done(err2);
        done(null, opts);
      });
    }).on('error', function(err3) {
      done(err3);
    });
  });
}

module.exports = function(opts, done) {
  if (process.platform !== 'darwin') {
    return done(new Error('Must be run on OSX'));
  }
  if (!opts.background) {
    opts.background = path.resolve(__dirname, 'resources/mac/background.png');
  } else {
    opts.background = path.resolve(opts.background);
  }
  if (!opts.icon) {
    opts.icon = path.resolve(__dirname, 'resources/mac/atom.icns');
  } else {
    opts.icon = path.resolve(opts.icon);
  }

  opts['icon-size'] = opts['icon-size'] || 80;
  opts['out'] = opts['out'] || process.cwd();
  
  opts.appPath = path.resolve(process.cwd(), opts.appPath);
  opts.dmgPath = path.resolve(opts.dmgPath || path.join(opts.out, opts.name + '.dmg'));

  opts.overwrite = opts.overwrite || false;

  opts.contents = opts.contents || [
    {
      x: 448,
      y: 344,
      type: 'link',
      path: '/Applications'
    },
    {
      x: 192,
      y: 344,
      type: 'file',
{'fraction_non_alphanumeric': 0.18931057713900742, 'fraction_numerical': 0.008982708286548395, 'mean_word_length': 2.938107869142352, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5839261', 'n_tokens_mistral': 1565, 'n_tokens_neox': 1513, 'n_words': 332}