Use maven version in greeting
This commit is contained in:
parent
735f1d584a
commit
3ef8712f2f
35
pom.xml
35
pom.xml
|
@ -1,11 +1,18 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.bitbucket</groupId>
|
||||
|
||||
<groupId>com.gitlab</groupId>
|
||||
<artifactId>transcendental-lisp</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.2.0</version>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test</testSourceDirectory>
|
||||
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>test</directory>
|
||||
|
@ -14,6 +21,7 @@
|
|||
</excludes>
|
||||
</testResource>
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
@ -23,6 +31,7 @@
|
|||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
|
@ -43,32 +52,50 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.lanterna</groupId>
|
||||
<artifactId>lanterna</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-all</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.fitnesse</groupId>
|
||||
<artifactId>fitnesse</artifactId>
|
||||
<version>20161106</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.stefanbirkner</groupId>
|
||||
<artifactId>system-rules</artifactId>
|
||||
|
@ -76,7 +103,9 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,6 +1,7 @@
|
|||
package main;
|
||||
|
||||
import static com.googlecode.lanterna.terminal.IOSafeTerminalAdapter.createRuntimeExceptionConvertingAdapter;
|
||||
import static java.text.MessageFormat.format;
|
||||
import static terminal.LispTerminal.END_OF_SEGMENT;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -22,7 +23,7 @@ import terminal.TerminalConfiguration;
|
|||
|
||||
public class LispMain {
|
||||
|
||||
public static final String GREETING = "Transcendental Lisp - Version 1.2.0";
|
||||
public static final String GREETING = "Transcendental Lisp - Version {0}";
|
||||
|
||||
public static final String ANSI_RESET = "\u001B[0m";
|
||||
public static final String ANSI_RED = "\u001B[31m";
|
||||
|
@ -91,10 +92,14 @@ public class LispMain {
|
|||
}
|
||||
|
||||
private void printGreeting() {
|
||||
output.println(GREETING);
|
||||
output.println(format(GREETING, getVersion()));
|
||||
output.println();
|
||||
}
|
||||
|
||||
private String getVersion() {
|
||||
return getClass().getPackage().getImplementationVersion();
|
||||
}
|
||||
|
||||
private LispInterpreter buildInteractiveInterpreter() {
|
||||
builder.setInput(inputReader, "terminal");
|
||||
builder.setOutput(output);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package main;
|
||||
|
||||
import static com.googlecode.lanterna.input.KeyType.Enter;
|
||||
import static java.text.MessageFormat.format;
|
||||
import static main.LispMain.ANSI_GREEN;
|
||||
import static main.LispMain.ANSI_PURPLE;
|
||||
|
@ -19,7 +20,6 @@ import org.junit.contrib.java.lang.system.ExpectedSystemExit;
|
|||
import org.junit.contrib.java.lang.system.SystemErrRule;
|
||||
import org.junit.contrib.java.lang.system.SystemOutRule;
|
||||
|
||||
import com.googlecode.lanterna.input.KeyType;
|
||||
import com.googlecode.lanterna.terminal.virtual.DefaultVirtualTerminal;
|
||||
|
||||
import environment.RuntimeEnvironment;
|
||||
|
@ -76,6 +76,10 @@ public class MainTest {
|
|||
return systemErrRule.getLogWithNormalizedLineSeparator();
|
||||
}
|
||||
|
||||
private String getExpectedGreeting() {
|
||||
return format(GREETING, getClass().getPackage().getImplementationVersion());
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ExpectedSystemExit exit = ExpectedSystemExit.none();
|
||||
|
||||
|
@ -123,10 +127,10 @@ public class MainTest {
|
|||
|
||||
terminal.waitForPrompt();
|
||||
terminal.enterCharacters("'hi");
|
||||
terminal.pressKey(KeyType.Enter);
|
||||
terminal.pressKey(Enter);
|
||||
terminal.waitForPrompt();
|
||||
terminal.assertCursorPosition(2, 5);
|
||||
terminal.assertScreenText(GREETING, " ", "~ 'hi ", " ", "HI ", "~ ");
|
||||
terminal.assertScreenText(getExpectedGreeting(), " ", "~ 'hi ", " ", "HI ", "~ ");
|
||||
terminal.enterControlCharacter('d');
|
||||
terminal.assertInputStreamClosed();
|
||||
|
||||
|
|
Loading…
Reference in New Issue