From cc61be5b6aaab5ae47de9548d4c80dcf7ba774c2 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Tue, 28 Feb 2017 16:29:21 +0100 Subject: [PATCH] Inform users about the newly available Corda training programs at startup and in the docsite. --- .../main/kotlin/net/corda/core/utilities/Emoji.kt | 4 +++- docs/source/index.rst | 2 ++ node/src/main/kotlin/net/corda/node/Corda.kt | 13 ++++++++++--- .../corda/node/utilities/ANSIProgressRenderer.kt | 5 +++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/core/src/main/kotlin/net/corda/core/utilities/Emoji.kt b/core/src/main/kotlin/net/corda/core/utilities/Emoji.kt index 146cb150b7..0da89e4c8d 100644 --- a/core/src/main/kotlin/net/corda/core/utilities/Emoji.kt +++ b/core/src/main/kotlin/net/corda/core/utilities/Emoji.kt @@ -19,7 +19,8 @@ object Emoji { @JvmStatic val CODE_PAPERCLIP: String = codePointsString(0x1F4CE) @JvmStatic val CODE_COOL_GUY: String = codePointsString(0x1F60E) @JvmStatic val CODE_NO_ENTRY: String = codePointsString(0x1F6AB) - @JvmStatic val SKULL_AND_CROSSBONES: String = codePointsString(0x2620) + @JvmStatic val CODE_SKULL_AND_CROSSBONES: String = codePointsString(0x2620) + @JvmStatic val CODE_BOOKS: String = codePointsString(0x1F4DA) /** * When non-null, toString() methods are allowed to use emoji in the output as we're going to render them to a @@ -35,6 +36,7 @@ object Emoji { val leftArrow: String get() = if (emojiMode.get() != null) "$CODE_LEFT_ARROW " else "" val paperclip: String get() = if (emojiMode.get() != null) "$CODE_PAPERCLIP " else "" val coolGuy: String get() = if (emojiMode.get() != null) "$CODE_COOL_GUY " else "" + val books: String get() = if (emojiMode.get() != null) "$CODE_BOOKS " else "" inline fun renderIfSupported(body: () -> T): T { emojiMode.set(this) // Could be any object. diff --git a/docs/source/index.rst b/docs/source/index.rst index a7c9ab1d9a..0b08738904 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -13,6 +13,8 @@ is the `Introduction to Corda webinar `_ they become more familiar with Corda, readers with a technical background will also want to dive into the `Technical white paper`_, which describes the platform's envisioned end-state. +.. note:: Corda training is now available in London, New York and Singapore! `Learn more. `_ + Corda is designed so that developers can easily extend its functionality by writing CorDapps (**Cor**\ da **D**\ istributed **App**\ lication\ **s**\ ). Some example CorDapps are available in the Corda repo's `samples `_ directory. To run these yourself, make diff --git a/node/src/main/kotlin/net/corda/node/Corda.kt b/node/src/main/kotlin/net/corda/node/Corda.kt index 8d33cc67f4..3ba3c6abb1 100644 --- a/node/src/main/kotlin/net/corda/node/Corda.kt +++ b/node/src/main/kotlin/net/corda/node/Corda.kt @@ -164,14 +164,21 @@ private fun drawBanner() { // This line makes sure ANSI escapes work on Windows, where they aren't supported out of the box. AnsiConsole.systemInstall() - val (msg1, msg2) = Emoji.renderIfSupported { messageOfTheDay() } + Emoji.renderIfSupported { + val (msg1, msg2) = messageOfTheDay() - println(Ansi.ansi().fgBrightRed().a( + println(Ansi.ansi().fgBrightRed().a( """ ______ __ / ____/ _________/ /___ _ / / __ / ___/ __ / __ `/ """).fgBrightBlue().a(msg1).newline().fgBrightRed().a( "/ /___ /_/ / / / /_/ / /_/ / ").fgBrightBlue().a(msg2).newline().fgBrightRed().a( """\____/ /_/ \__,_/\__,_/""").reset().newline().newline().fgBrightDefault().bold(). -a("--- DEVELOPER SNAPSHOT ------------------------------------------------------------").newline().reset()) + a("--- MILESTONE 9 -------------------------------------------------------------------"). + newline(). + newline(). + a("${Emoji.books}New! ").reset().a("Training now available worldwide, see https://corda.net/corda-training/"). + newline(). + reset()) + } } diff --git a/node/src/main/kotlin/net/corda/node/utilities/ANSIProgressRenderer.kt b/node/src/main/kotlin/net/corda/node/utilities/ANSIProgressRenderer.kt index a6b9ba9179..2701268474 100644 --- a/node/src/main/kotlin/net/corda/node/utilities/ANSIProgressRenderer.kt +++ b/node/src/main/kotlin/net/corda/node/utilities/ANSIProgressRenderer.kt @@ -3,7 +3,7 @@ package net.corda.node.utilities import net.corda.core.utilities.Emoji.CODE_GREEN_TICK import net.corda.core.utilities.Emoji.CODE_NO_ENTRY import net.corda.core.utilities.Emoji.CODE_RIGHT_ARROW -import net.corda.core.utilities.Emoji.SKULL_AND_CROSSBONES +import net.corda.core.utilities.Emoji.CODE_SKULL_AND_CROSSBONES import net.corda.core.utilities.ProgressTracker import net.corda.node.utilities.ANSIProgressRenderer.progressTracker import org.apache.logging.log4j.LogManager @@ -128,7 +128,8 @@ object ANSIProgressRenderer { var newLinesDrawn = 1 + pt.renderLevel(ansi, 0, error != null) if (error != null) { - ansi.a("$SKULL_AND_CROSSBONES $error") + // TODO: This should be using emoji only on supported platforms. + ansi.a("$CODE_SKULL_AND_CROSSBONES $error") ansi.eraseLine(Ansi.Erase.FORWARD) ansi.newline() newLinesDrawn++