Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var glob = require('glob');
var fs = require('fs');

var Plugin = function () {

};

Plugin.prototype = nodeExtend(Plugin.prototype, {
Expand Down Expand Up @@ -39,7 +39,7 @@ Plugin.prototype = nodeExtend(Plugin.prototype, {
});
}
},

getStyles: function (styles) {
styles.push(fse.readFileSync( path.resolve(__dirname, './web/ngplugin.less'), 'utf8' ));
},
Expand All @@ -48,21 +48,21 @@ Plugin.prototype = nodeExtend(Plugin.prototype, {
var deferred = Q.defer();
promises.push(deferred.promise);
if(configuration.showAngularDocs) {

var dest = 'downloaded/angular/';
var version = configuration.showAngularDocs === true ? 'master' : 'v' + configuration.showAngularDocs;
console.log("Fetching angular source code for documentation");

request({url: 'https://github.com/angular/angular.js/archive/' + version + '.tar.gz', encoding: null})
.on('error', deferred.reject)
.pipe(zlib.Unzip())
.on('error', deferred.reject)
.pipe(require('tar').Extract( { path: dest } ) )
.pipe(require('tar').extract( { path: dest } ) )
.on('error', deferred.reject)
.on('end', function () {
console.log("Adding Angular docs to configuration");
var version = configuration.showAngularDocs === true ? 'master' : configuration.showAngularDocs;

configuration.groups.push({
groupTitle: 'Angular Docs',
groupId: 'angular',
Expand Down Expand Up @@ -101,37 +101,37 @@ Plugin.prototype = nodeExtend(Plugin.prototype, {
}
]
});

deferred.resolve();
});

} else {
deferred.resolve();
}

},

setupConfig: function (configuration, promises) {
configuration.angularModules.push('docular.plugin.ngdoc');
configuration.javascript.push('resources/plugins/ngdoc/ngplugin.js');
},

copyFiles: function (webappDir) {
fse.ensureDirSync(webappDir + '/resources/plugins/ngdoc');
fse.copySync(path.resolve(__dirname, './web'), webappDir + '/resources/plugins/ngdoc');
},

backfillData: function (fileData, allFiles) {
var parser = new Parser();
if(fileData.extension === 'ngdoc' || fileData.extension === 'js') {
parser.backfill(fileData, allFiles);
}
},

parseFile: function (fileData, allFiles, promises) {
var deferred = Q.defer(), parser = new Parser();
promises.push(deferred.promise);

var results = false;
if(fileData.extension === 'ngdoc' || fileData.extension === 'js') {
results = parser.parse(fileData, allFiles);
Expand All @@ -140,15 +140,15 @@ Plugin.prototype = nodeExtend(Plugin.prototype, {
deferred.resolve();
return;
}

for(var i = 0, l = results.length; i < l; i++) {
if(results[i]) {
fileData.docs.push(results[i]);
fileData.docs.push(results[i]);
}
}

deferred.resolve();
}
});

module.exports = Plugin;
module.exports = Plugin;