Skip to content

Commit

Permalink
Added GitHub Directory
Browse files Browse the repository at this point in the history
Updated Gradle and Dependencies
Updated Copyright
  • Loading branch information
SethFalco committed Feb 20, 2020
1 parent b911cb6 commit f8b15ea
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [Elypia]
custom: ['https://elypia.org/donate']
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Please do not interact with the repository on GitHub.
You can do the pull request on GitLab: https://gitlab.com/Elypia/commandler-example
2 changes: 2 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Commandler Examples
Copyright 2019-2020 Elypia CIC (https://elypia.org/)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Commandler Examples [![discord-members]][Discord] [![gitlab-build]][gitlab] [![gitlab-coverage]][gitlab] [![donate-shield]][elypia-donate]
# Commandler Examples [![matrix-members]][matrix] [![discord-members]][Discord] [![gitlab-build]][gitlab] [![gitlab-coverage]][gitlab] [![donate-shield]][elypia-donate]

## About
These are examples that creates minimal console applications using
Expand Down Expand Up @@ -34,11 +34,13 @@ Should any problems occur, come visit us over on [Discord]! We're always around
there are ample developers that would be willing to help; if it's a problem with the library
itself then we'll make sure to get it sorted.

[matrix]: https://matrix.to/#/+elypia:matrix.org "Matrix Invite"
[Discord]: https://discordapp.com/invite/hprGMaM "Discord Invite"
[gitlab]: https://gitlab.com/Elypia/commandler-examples/commits/master "Repository on GitLab"
[elypia-donate]: https://elypia.org/donate "Donate to Elypia"
[Commandler]: https://gitlab.com/Elypia/commandler "Commandler on GitLab"

[matrix-members]: https://img.shields.io/matrix/elypia-general:matrix.org?logo=matrix "Matrix Shield"
[discord-members]: https://discordapp.com/api/guilds/184657525990359041/widget.png "Discord Shield"
[gitlab-build]: https://gitlab.com/Elypia/commandler-examples/badges/master/pipeline.svg "GitLab Build Shield"
[gitlab-coverage]: https://gitlab.com/Elypia/commandler-examples/badges/master/coverage.svg "GitLab Coverage Shield"
Expand Down
3 changes: 0 additions & 3 deletions annotation-example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
dependencies {
implementation "org.elypia.commandler:annotation:${version}"

// TODO: We're not actually using this, Commandler is just getting mad without it.
runtimeOnly "org.yaml:snakeyaml:1.25"
}

shadowJar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@ public class AnnotationExample {

public static void main(String[] args) {
// Setup Commandler, this will initialize Commandler and perform any validation.
Commandler commandler = new Commandler();
Commandler commandler = Commandler.create();

// Run Commandler, this actually sets up all integrations and starts receiving and handling events.
commandler.run();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions annotation-example/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.1" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019-2019 Elypia CIC
~ Copyright 2019-2020 Elypia CIC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down
28 changes: 25 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0' apply false
id "io.spring.dependency-management" version "1.0.9.RELEASE" apply false
}

allprojects() {
Expand All @@ -10,6 +11,10 @@ allprojects() {
version = "4.0.0"
description = "An example project to demonstrate the usage of Commandler."

ext {
deltaSpikeVersion = "1.9.3"
}

repositories {
mavenLocal()
mavenCentral()
Expand All @@ -23,6 +28,7 @@ allprojects() {
subprojects() {
apply plugin: "java"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "io.spring.dependency-management"

/** Adds the commandlerdoc task for exporting docs for your Commandler application. */
// apply plugin: "org.elypia.commandler" version "1.0.0"
Expand All @@ -32,6 +38,22 @@ subprojects() {

[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'

dependencyManagement {
imports {
mavenBom "org.apache.deltaspike.distribution:distributions-bom:${deltaSpikeVersion}"
}
}

sourceSets {
main {
output.resourcesDir = output.classesDirs.singleFile
}

test {
output.resourcesDir = output.classesDirs.singleFile
}
}

dependencies {
// The core of Commandler, always required for any Commandler application.
implementation "org.elypia.commandler:core:${version}"
Expand All @@ -40,12 +62,12 @@ subprojects() {
implementation "org.elypia.commandler:console:${version}"

// Logging
implementation "org.slf4j:slf4j-api:1.7.29"
implementation "org.slf4j:slf4j-api:1.7.30"
runtimeOnly "ch.qos.logback:logback-classic:1.2.3"

// Testing
testImplementation "org.junit.jupiter:junit-jupiter:5.5.2"
testImplementation "org.mockito:mockito-core:3.2.0"
testImplementation "org.junit.jupiter:junit-jupiter:5.6.0"
testImplementation "org.mockito:mockito-core:3.2.4"
}

/** Testing */
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@
import org.elypia.commandler.api.Controller;
import org.slf4j.*;

import javax.inject.Singleton;
import javax.enterprise.context.ApplicationScoped;
import javax.validation.constraints.*;
import java.util.concurrent.ThreadLocalRandom;

Expand All @@ -30,7 +30,7 @@
*
* @author [email protected] (Seth Falco)
*/
@Singleton
@ApplicationScoped
public class HotColdController implements Controller {

private Logger logger = LoggerFactory.getLogger(HotColdController.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@ public class JavaxValidationExample {

public static void main(String[] args) {
// Setup Commandler, this will initialize Commandler and perform any validation.
Commandler commandler = new Commandler();
Commandler commandler = Commandler.create();

// Run Commandler, this actually sets up all integrations and starts receiving and handling events.
commandler.run();
Expand Down
4 changes: 2 additions & 2 deletions javax-validation-example/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.1" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019-2019 Elypia CIC
~ Copyright 2019-2020 Elypia CIC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,8 @@
import org.elypia.commandler.api.Controller;
import org.elypia.commandler.dispatchers.MatchDispatcher;

import java.util.Objects;

/**
* The converstion controller uses the {@link MatchDispatcher}
* to find commands that succesfully match the regular expression
Expand Down Expand Up @@ -49,6 +51,8 @@ public String convertWeight(int value, String units) {
convertedUnits = "KG";
}

Objects.requireNonNull()

return value + units + " is equal to " + convertedValue + convertedUnits;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@ public class MatchDispatcherExample {

public static void main(String[] args) {
// Setup Commandler, this will initialize Commandler and perform any validation.
Commandler commandler = new Commandler();
Commandler commandler = Commandler.create();

// Run Commandler, this actually sets up all integrations and starts receiving and handling events.
commandler.run();
Expand Down
4 changes: 2 additions & 2 deletions match-dispatcher-example/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.1" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019-2019 Elypia CIC
~ Copyright 2019-2020 Elypia CIC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@ public class PrefixExample {

public static void main(String[] args) {
// Setup Commandler, this will initialize Commandler and perform any validation.
Commandler commandler = new Commandler();
Commandler commandler = Commandler.create();

// Run Commandler, this actually sets up all integrations and starts receiving and handling events.
commandler.run();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions prefix-example/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.1" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019-2019 Elypia CIC
~ Copyright 2019-2020 Elypia CIC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 4 additions & 0 deletions simple-controller-example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
dependencies {
// Allows Configuration with YAML (Apache Commons Configuration will pick this up on it's own.)
runtimeOnly "org.yaml:snakeyaml:1.25"


runtimeOnly "org.jboss.weld.se:weld-se-core:3.1.3.Final"
runtimeOnly "org.apache.deltaspike.core:deltaspike-core-impl:${deltaSpikeVersion}"
}

shadowJar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@ public class SimpleControllerExample {

public static void main(String[] args) {
// Setup Commandler, this will initialize Commandler and perform any validation.
Commandler commandler = new Commandler();
Commandler commandler = Commandler.create();

// Run Commandler, this actually sets up all integrations and starts receiving and handling events.
commandler.run();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2019 Elypia CIC
* Copyright 2019-2020 Elypia CIC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,7 @@

import org.elypia.commandler.api.Controller;

import javax.enterprise.context.ApplicationScoped;
import java.util.stream.IntStream;

/**
Expand All @@ -26,6 +27,7 @@
*
* @author [email protected] (Seth Falco)
*/
@ApplicationScoped
public class UtilityController implements Controller {

/**
Expand Down
28 changes: 28 additions & 0 deletions simple-controller-example/src/main/resources/META-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
~ Copyright 2019-2020 Elypia CIC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
bean-discovery-mode="annotated" version="2.0">
<scan>
<exclude name="com.**"/>
<exclude name="javax.**"/>
<exclude name="org.apache.commons.**"/>
<exclude name="org.jboss.**"/>
<exclude name="org.slf4j.**"/>
</scan>
</beans>
6 changes: 3 additions & 3 deletions simple-controller-example/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.1" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019-2019 Elypia CIC
~ Copyright 2019-2020 Elypia CIC
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
~ limitations under the License.
-->
<configuration>
<logger name="org.jboss" level="WARN"/>
<logger name="org.jboss" level="ALL"/>
<logger name="org.jboss.weld.Validator" level="ERROR"/>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
Expand Down

0 comments on commit f8b15ea

Please sign in to comment.