Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/0.0.1'
Browse files Browse the repository at this point in the history
Release: com.io7m.claypot 0.0.1
  • Loading branch information
io7m committed Jun 26, 2020
2 parents 603731d + 24a213b commit 1248cf6
Show file tree
Hide file tree
Showing 45 changed files with 2,209 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.iml
.idea
pom.xml.versionsBackup
target
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule ".jenkins"]
path = .jenkins
url = https://www.github.com/io7m/jenkinsfiles
1 change: 1 addition & 0 deletions .jenkins
Submodule .jenkins added at 61a9d1
21 changes: 21 additions & 0 deletions .travis.yml
@@ -0,0 +1,21 @@
language: java

jdk:
- oraclejdk11
- openjdk11

before_install:
- wget https://archive.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.zip
- unzip -qq apache-maven-3.6.2-bin.zip
- export M2_HOME=$PWD/apache-maven-3.6.2
- export PATH=$M2_HOME/bin:$PATH

install: true

script:
- mvn --errors clean verify site
- bash <(curl -s https://codecov.io/bash) -f ./com.io7m.claypot.tests/target/site/jacoco-aggregate/jacoco.xml

notifications:
irc: "chat.freenode.net#io7m"

11 changes: 11 additions & 0 deletions README-CHANGES.xml
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<c:changelog project="com.io7m.claypot" xmlns:c="urn:com.io7m.changelog:4.0">
<c:releases>
<c:release date="2020-06-26T14:07:02+00:00" ticket-system="com.github.io7m.claypot" version="0.0.1">
<c:changes/>
</c:release>
</c:releases>
<c:ticket-systems>
<c:ticket-system default="true" id="com.github.io7m.claypot" url="https://www.github.com/io7m/claypot/issues/"/>
</c:ticket-systems>
</c:changelog>
11 changes: 11 additions & 0 deletions README.md
@@ -0,0 +1,11 @@
claypot
===

[![Travis](https://img.shields.io/travis/io7m/claypot.png?style=flat-square)](https://travis-ci.org/io7m/claypot)
[![Maven Central](https://img.shields.io/maven-central/v/com.io7m.claypot/com.io7m.claypot.png?style=flat-square)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.io7m.claypot%22)
[![Maven Central (snapshot)](https://img.shields.io/nexus/s/https/oss.sonatype.org/com.io7m.claypot/com.io7m.claypot.svg?style=flat-square)](https://oss.sonatype.org/content/repositories/snapshots/com/io7m/claypot/)
[![Codacy grade](https://img.shields.io/codacy/grade/e6b8b59da8fb4d8383f26601bcc37d48.png?style=flat-square)](https://www.codacy.com/app/github_79/claypot)
[![Codecov](https://img.shields.io/codecov/c/github/io7m/claypot.png?style=flat-square)](https://codecov.io/gh/io7m/claypot)

![claypot](./src/site/resources/claypot.jpg?raw=true)

57 changes: 57 additions & 0 deletions com.io7m.claypot.core/pom.xml
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>

<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>

<parent>
<artifactId>com.io7m.claypot</artifactId>
<groupId>com.io7m.claypot</groupId>
<version>0.0.1</version>
</parent>

<artifactId>com.io7m.claypot.core</artifactId>

<description>JCommander conventions for io7m projects (Core)</description>
<name>com.io7m.claypot.core</name>
<url>https://www.github.com/io7m/claypot</url>

<dependencies>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<dependency>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.io7m.immutables.style</groupId>
<artifactId>com.io7m.immutables.style</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.bundle</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.versioning</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
@@ -0,0 +1,104 @@
/*
* Copyright © 2020 Mark Raynsford <code@io7m.com> http://io7m.com
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

package com.io7m.claypot.core;

import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import org.osgi.annotation.versioning.ProviderType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Objects;

/**
* An abstract command.
*/

@ProviderType
@Parameters(resourceBundle = "com.io7m.claypot.core.Claypot")
public abstract class CLPAbstractCommand implements CLPCommandType
{
private final JCommander commander;
private final CLPCommandContextType context;

@Parameter(
names = "--verbose",
converter = CLPLogLevelConverter.class,
descriptionKey = "com.io7m.claypot.rootDescription"
)
private CLPLogLevel verbose = CLPLogLevel.LOG_INFO;

/**
* Construct a command.
*
* @param inContext The command context
*/

public CLPAbstractCommand(
final CLPCommandContextType inContext)
{
this.context = Objects.requireNonNull(inContext, "context");
this.commander = this.context.commander();
}

protected final JCommander commander()
{
return this.commander;
}

protected final CLPCommandContextType context()
{
return this.context;
}

protected final Logger logger()
{
return this.configuration().logger();
}

protected final CLPApplicationConfiguration configuration()
{
return this.context().configuration();
}

protected abstract Status executeActual()
throws Exception;

/**
* Set up logging for other commands.
*
* @return The command status
*
* @throws Exception On errors
*/

@Override
public final Status execute()
throws Exception
{
if (this.verbose == null) {
this.verbose = CLPLogLevel.LOG_INFO;
}

final ch.qos.logback.classic.Logger root =
(ch.qos.logback.classic.Logger) LoggerFactory.getLogger(
Logger.ROOT_LOGGER_NAME);
root.setLevel(this.verbose.toLevel());
return this.executeActual();
}
}
@@ -0,0 +1,56 @@
/*
* Copyright © 2020 Mark Raynsford <code@io7m.com> http://io7m.com
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

package com.io7m.claypot.core;

import org.osgi.annotation.versioning.ProviderType;

import java.text.MessageFormat;
import java.util.Objects;
import java.util.ResourceBundle;

/**
* An abstract implementation of the {@link CLPStringsType} interface.
*/

@ProviderType
public abstract class CLPAbstractStrings implements CLPStringsType
{
private final ResourceBundle resources;

protected CLPAbstractStrings(
final ResourceBundle inResources)
{
this.resources = Objects.requireNonNull(inResources, "inResources");
}

@Override
public final ResourceBundle resources()
{
return this.resources;
}

@Override
public final String format(
final String id,
final Object... args)
{
Objects.requireNonNull(id, "id");
Objects.requireNonNull(args, "args");
return MessageFormat.format(this.resources.getString(id), args);
}
}

@@ -0,0 +1,34 @@
/*
* Copyright © 2020 Mark Raynsford <code@io7m.com> http://io7m.com
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

package com.io7m.claypot.core;

import com.io7m.immutables.styles.ImmutablesStyleType;
import org.immutables.value.Value;
import org.slf4j.Logger;

import java.util.List;

@ImmutablesStyleType
@Value.Immutable
public interface CLPApplicationConfigurationType
{
Logger logger();

String programName();

List<CLPCommandConstructorType> commands();
}

0 comments on commit 1248cf6

Please sign in to comment.