'use strict';

var Y             = require('yuidocjs');
var rsvp          = require('rsvp');
var optsGenerator = require('../options');

module.exports = {
  name: 'ember-cli-yuidoc',

  description: 'Generates html documentation using YUIDoc',

  run: function(opts, rawArgs) {
    var options = optsGenerator.generate();

    var yuidocCompiler = new Y.YUIDoc(options);
    var json = yuidocCompiler.run();
    var builder = new Y.DocBuilder(options, json);

    return new rsvp.Promise(function(resolve) {
      builder.compile(function() { resolve(); });
    });
  }
}

'use strict';


module.exports = {
  name: 'ember-cli-yuidoc',

  description: 'Generates html documentation using YUIDoc',

  run: function(opts, rawArgs) {
    var Y             = require('yuidocjs');
    var rsvp          = require('rsvp');
    var optsGenerator = require('../options');
    var options       = optsGenerator.generate();

    var yuidocCompiler = new Y.YUIDoc(options);
    var json = yuidocCompiler.run();
    var builder = new Y.DocBuilder(options, json);

    return new rsvp.Promise(function(resolve) {
      builder.compile(function() { resolve(); });
    });
  }
}

Move require statements to the run command
Move require statements to the run command

Yuidoc now requires an internet connection to work, and since this addon
is required even if you're not using it at the moment, it was preventing
users to work offline.

TODO: Fix yuidoc itself. Having local assets would also fix #14
