Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timob 14990 Added the suppressOutput plugin option #239

Merged
merged 3 commits into from
Aug 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions commands/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var path = require('path'),

wrench = require('wrench'),
winston = require('winston'),
semver = require('semver'),

appc = require('node-appc'),
ti, // Will be loaded in the config method
Expand All @@ -22,7 +23,7 @@ var path = require('path'),
__ = i18n.__,
__n = i18n.__n,

activeSDK,
latestSDK,

CodeProcessor = require('../'),
Runtime = require('../lib/Runtime'),
Expand All @@ -42,12 +43,13 @@ exports.config = function (logger, config, cli) {
locations = cli.env.os.sdkPaths.map(function (p) { return afs.resolvePath(p); }),
sdks = cli.env.sdks,
vers = Object.keys(sdks).sort().reverse();
activeSDK = config.get('sdk.selected', config.get('app.sdk'));
locations.indexOf(defaultInstallLocation) == -1 && locations.push(defaultInstallLocation);
if ((!activeSDK || activeSDK == 'latest') && vers.length) {
activeSDK = vers[0];
latestSDK = vers[0];
if (semver.lt(latestSDK.match(/^([0-9]*\.[0-9]*\.[0-9]*)/)[1], '3.2.0')) {
logger.error('The Titanium Code Processor requires version 3.2.0 of the Titanium CLI or newer');
process.exit(1);
}
ti = require(path.join(sdks[activeSDK].path, 'node_modules', 'titanium-sdk'));
ti = require(path.join(sdks[latestSDK].path, 'node_modules', 'titanium-sdk'));

// Create the config
return function (finished) {
Expand Down Expand Up @@ -434,7 +436,7 @@ function validateCLIParameters(logger, config, cli, callback) {
}

// Validate the platform
ti.validatePlatform(logger, cli.argv, 'platform');
ti.validatePlatform(logger, cli, 'platform');
if (ti.validatePlatformOptions(logger, config, cli, 'analyze') === false) {
callback(false);
return;
Expand Down
10 changes: 5 additions & 5 deletions lib/CodeProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ function init(sourceInformation, options, plugins, ast) {

// Initialize the runtime
Runtime.log('info', 'Initializing core engine');
debugger;
Base.createGlobalContext(ast && RuleProcessor.isBlockStrict(ast));
Base.init();
if (ast) {
Expand Down Expand Up @@ -504,6 +503,7 @@ function init(sourceInformation, options, plugins, ast) {
loadedPlugins[j] = require(plugins[j].path);
loadedPlugins[j].name = pluginDefinitions[j].name;
loadedPlugins[j].displayName = pluginDefinitions[j].displayName;
loadedPlugins[j].suppressOutput = plugins[j].suppressOutput;
if (loadedPlugins[j].init) {
loadedPlugins[j].init(plugins[j].options, dependencies);
}
Expand Down Expand Up @@ -1000,7 +1000,7 @@ function generateResultsPages(outputFormat, resultsDirectory, theme, callback) {
elevatedPluginList = [];
for (i = 0, len = plugins.length; i < len; i++) {
plugin = plugins[i];
if (plugin.getResultsPageData) {
if (plugin.getResultsPageData && !plugin.suppressOutput) {
(plugin.elevatePluginSummary ? elevatedPluginList : pluginList).push({
name: plugin.displayName,
overview: results.plugins[i].summary || ''
Expand Down Expand Up @@ -1050,7 +1050,7 @@ function generateResultsPages(outputFormat, resultsDirectory, theme, callback) {
if (outputFormat === 'report') {
for (i = 0, len = plugins.length; i < len; i++) {
plugin = plugins[i];
if (plugin.renderLogOutput) {
if (plugin.renderLogOutput && !plugin.suppressOutput) {
paddingLength = (40 - plugin.displayName.length) / 2;
resultsToLog += '\n\n' +
'******************************************\n' +
Expand Down Expand Up @@ -1115,7 +1115,7 @@ function generateResultsPages(outputFormat, resultsDirectory, theme, callback) {
// Create the header
for (i = 0, len = plugins.length; i < len; i++) {
plugin = plugins[i];
if (plugin.getResultsPageData) {
if (plugin.getResultsPageData && !plugin.suppressOutput) {
header.push({
name: plugin.displayName,
file: plugin.name + '.html'
Expand All @@ -1131,7 +1131,7 @@ function generateResultsPages(outputFormat, resultsDirectory, theme, callback) {
currentPage = 0;
for (i = 0, len = plugins.length; i < len; i++) {
plugin = plugins[i];
if (plugin.getResultsPageData) {
if (plugin.getResultsPageData && !plugin.suppressOutput) {
plugin = plugin.getResultsPageData(plugin.name + '.html', baseDirectory);
for (page in plugin) {
queueRender(plugin[page].template,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"mu2": "0.5.x",
"colors": "0.6.x",
"source-map": "0.1.x",
"node-appc": "0.1.30"
"node-appc": "0.1.30",
"semver": "2.1.x"
},
"devDependencies": {
"commander": "1.2.x",
Expand Down
2 changes: 1 addition & 1 deletion plugins/ti-api-require-finder/lib/TiApiRequireFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ exports.getResultsPageData = function getResultsPageData(entryFile) {
var template = {};

template[entryFile] = {
template: path.join(__dirname, '..', 'templates', 'requireFinderTemplate.html'),
template: path.join(__dirname, '..', 'templates', 'tiApiRequireFinderTemplate.html'),
data: renderData
};

Expand Down