Skip to content

Commit

Permalink
#1895 Add support for customizing product name
Browse files Browse the repository at this point in the history
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
  • Loading branch information
benoitf committed Aug 25, 2016
1 parent a3cc195 commit 4a87e51
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dockerfiles/lib/typescript/src/internal/dir/che-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {CheFileStructWorkspaceCommandImpl} from "./chefile-struct/che-file-struc
import {CheFileStructWorkspaceLoadingCommand} from "./chefile-struct/che-file-struct";
import {ArgumentProcessor} from "../../spi/decorator/argument-processor";
import {Parameter} from "../../spi/decorator/parameter";
import {ProductName} from "../../utils/product-name";


/**
Expand Down Expand Up @@ -154,7 +155,7 @@ export class CheDir {
}

run() : Promise<string> {
Log.context = 'che(dir)';
Log.context = ProductName.getShortDisplayName() + '(dir)';

// call the method analyzed from the argument
return this.parseArgument().then((methodName) => {
Expand Down
3 changes: 2 additions & 1 deletion dockerfiles/lib/typescript/src/internal/test/che-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {Argument} from "../../spi/decorator/parameter";
import {ArgumentProcessor} from "../../spi/decorator/argument-processor";
import {PostFlightCheckTest} from "./impl/post-flight-check-test";
import {Log} from "../../spi/log/log";
import {ProductName} from "../../utils/product-name";
/**
* Entrypoint for the Tests.
* @author Florent Benoit
Expand Down Expand Up @@ -56,7 +57,7 @@ export class CheTest {
let classOfTest: any = this.mapOfTests.get(this.testName);
if (classOfTest) {
// update logger
Log.context = 'che(test/' + this.testName + ')';
Log.context = ProductName.getShortDisplayName() + '(test/' + this.testName + ')';

var instance = Object.create(classOfTest.prototype);
// here we use an array of array as constructor instance is an array and apply method is also using array to give parameter
Expand Down
3 changes: 2 additions & 1 deletion dockerfiles/lib/typescript/src/spi/log/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
*/


import {ProductName} from "../../utils/product-name";
/**
* Logging class allowing to log message
* @author Florent Benoit
*/
export class Log {

static debugEnabled : boolean = false;
static context : string = 'che';
static context : string = ProductName.getShortDisplayName();
static logger : Log;
static disabledPrefix : boolean = false;

Expand Down
26 changes: 26 additions & 0 deletions dockerfiles/lib/typescript/src/utils/product-name.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2016 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*/


/**
* Creates an helper class for getting product name
* @author Florent Benoit
*/
export class ProductName {
static getShortDisplayName() : string {
let productName: string = process.env.CHE_MINI_PRODUCT_NAME;
if (!productName) {
return 'che';
}
return productName;
}

}

0 comments on commit 4a87e51

Please sign in to comment.