From f3070e7117ab8667d73bf4bc35e9e0ff280bb553 Mon Sep 17 00:00:00 2001 From: Thibault Meyer <meyer.thibault@gmail.com> Date: Thu, 29 Oct 2020 19:18:02 +0100 Subject: [PATCH] Initial commit Signed-off-by: Thibault Meyer <meyer.thibault@gmail.com> --- .editorconfig | 24 ++++++ .gitignore | 31 ++++++++ .travis.yml | 8 ++ CONTRIBUTING.md | 122 ++++++++++++++++++++++++++++++ LICENSE | 21 ++++++ README.md | 34 +++++++++ checkstyle-suppressions.xml | 8 ++ checkstyle.xml | 92 +++++++++++++++++++++++ pom.xml | 145 ++++++++++++++++++++++++++++++++++++ 9 files changed, 485 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 checkstyle-suppressions.xml create mode 100644 checkstyle.xml create mode 100644 pom.xml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0692c07 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,24 @@ +# editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +spaces_around_operators = true + +[*.java] +indent_size = 4 + +[*.xml] +indent_size = 4 + +[*.yml] +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..73326f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +*.class +*.java~ + + +# IntelliJ IDEA +.idea/ +*.iml + + +# Other IDE +.classpath +.project +.settings + + +# Package Files # +*.jar +target/ +/test + + +# MacOS / Windows +.DS_Store +Thumbs.db +ehthumbs.db +ehthumbs_vista.db +*.lnk + + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3029021 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: java + +jdk: + - oraclejdk11 + +script: + - mvn compile + - mvn test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..028ac88 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,122 @@ +# Contribution Guidelines + +## Introduction + +This document explains how to contribute changes to the play-rconf project. + + + + +## Bug reports + +Please search the issues on the issue tracker with a variety of keywords to +ensure your bug is not already reported. + +If unique, [open an issue](https://github.com/play-rconf/play-rconf-http/issues) and answer the questions +so we can understand and reproduce the problematic behavior. + +The burden is on you to convince us that it is actually a bug in +play-remote-configuration. This is easiest to do when you write clear, concise +instructions so we can reproduce the behavior (even if it seems obvious). The +more detailed and specific you are, the faster we will be able to help you. +Check out [How to Report Bugs Effectively](https://www.chiark.greenend.org.uk/~sgtatham/bugs.html). + +Please be kind, remember that play-remote-configuration comes at no cost to you, +and you're getting free help. + + + + +## Code review + +Changes to play-remote-configuration must be reviewed before they are accepted, +no matter who makes the change even if it is an owner or a maintainer. We use +GitHub's pull request workflow to do that. + +Please try to make your pull request easy to review for us. Please read the +"[How to get faster PR reviews](https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md)" guide, it has lots of +useful tips for any project you may want to contribute. Some of the key points: + +* Make small pull requests. The smaller, the faster to review and the more + likely it will be merged soon. +* Don't make changes unrelated to your PR. Maybe there are typos on some + comments, maybe refactoring would be welcome on a function... but if that + is not related to your PR, please make *another* PR for that. +* Split big pull requests in multiple small ones. An incremental change will + be faster to review than a huge PR. + + + + +## Sign your work + +The sign-off is a simple line at the end of the explanation for the patch. Your +signature certifies that you wrote the patch or otherwise have the right to pass +it on as an open-source patch. + +``` +Signed-off-by: John Smith <john.smith@email.com> +``` + +Please use your real name, we really dislike pseudonyms or anonymous +contributions. We are in the opensource world without secrets. If you have set +your `user.name` and `user.email`, you can sign your commit automatically +with `git commit -s`. + + + + +## Write a good commit message + +A good commit message serve at least three important purposes: + +* To speed up the reviewing process. + +* To help us write a good release note. + +* To help the future maintainers of play-remote-configuration, say five years + into the future, to find out why a particular change was made to the code or + why a specific feature was added. + +Structure your commit message like this: + +From: [[http://git-scm.com/book/ch5-2.html]] + +> ``` +> Short (50 chars or less) summary of changes +> +> More detailed explanatory text, if necessary. Wrap it to about 72 +> characters or so. In some contexts, the first line is treated as the +> subject of an email and the rest of the text as the body. The blank +> line separating the summary from the body is critical (unless you omit +> the body entirely); tools like rebase can get confused if you run the +> two together. +> +> Further paragraphs come after blank lines. +> +> - Bullet points are okay, too +> +> - Typically a hyphen or asterisk is used for the bullet, preceded by a +> single space, with blank lines in between, but conventions vary here +> ``` + +#### DO +* Write the summary line and description of what you have done in the imperative + mode, that is as if you were commanding someone. Start the line with "Fix", + "Add", "Change" instead of "Fixed", "Added", "Changed". +* Always leave the second line blank. +* Line break the commit message (to make the commit message readable without + having to scroll horizontally in `gitk`). + +#### DON'T +* Don't end the summary line with a period - it's a title and titles don't end + with a period. + +#### Tips +* If it seems difficult to summarize what your commit does, it may be because + it includes several logical changes or bug fixes, and are better split up + into several commits using `git add -p`. + +#### References +The following blog post has a nice discussion of commit messages: +http://chris.beams.io/posts/git-commit/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0cf1795 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 The Play Remote Configuration Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..345e3b8 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Play Remote Configuration - GIT + + +Retrieves configuration hosted on a GIT repository +***** + +## About this project +In production, it is not always easy to manage the configuration files of a +Play Framework application, especially when it running on multiple servers. +The purpose of this project is to provide a simple way to use a remote +configuration with a Play Framework application. + + + +## How to use + +To enable this provider, just add the classpath `"io.playrconf.provider.GitProvider"` +and the following configuration: + +```hocon +remote-configuration { + + ## Provider - GIT + # ~~~~~ + # Retrieves configuration hosted on a GIT repository + git { + + } +} +``` + + +## License +This project is released under terms of the [MIT license](https://raw.githubusercontent.com/play-rconf/play-rconf-git/master/LICENSE). diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml new file mode 100644 index 0000000..bcb0edc --- /dev/null +++ b/checkstyle-suppressions.xml @@ -0,0 +1,8 @@ +<?xml version="1.0"?> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> + +<suppressions> +</suppressions> diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000..4df4594 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,92 @@ +<?xml version="1.0"?> +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.2//EN" + "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> +<module name="Checker"> + <module name="NewlineAtEndOfFile"> + <property name="lineSeparator" value="lf"/> + </module> + <module name="FileLength"/> + <module name="FileTabCharacter"/> + <module name="RegexpSingleline"> + <property name="format" value="\s+$"/> + <property name="message" value="Line has trailing spaces."/> + </module> + <module name="RegexpMultiline"> + <property name="format" value="\r?\n[\t ]*\r?\n[\t ]*\r?\n"/> + <property name="message" value="Unnecessary consecutive lines"/> + </module> + <module name="RegexpSingleline"> + <property name="format" value="/\*\* +\p{javaLowerCase}"/> + <property name="fileExtensions" value="java"/> + <property name="message" value="First sentence in a comment should start with a capital letter"/> + </module> + <module name="RegexpMultiline"> + <property name="format" value="/\*\*\W+\* +\p{javaLowerCase}"/> + <property name="fileExtensions" value="java"/> + <property name="message" value="First sentence in a comment should start with a capital letter"/> + </module> + <module name="TreeWalker"> + <module name="ConstantName"/> + <module name="LocalFinalVariableName"/> + <module name="LocalVariableName"/> + <module name="MemberName"/> + <module name="MethodName"/> + <module name="MethodLength"/> + <module name="PackageName"/> + <module name="ParameterName"/> + <module name="StaticVariableName"/> + <module name="TypeName"/> + <module name="IllegalImport"/> + <module name="UnusedImports"> + <property name="processJavadoc" value="true"/> + </module> + <module name="LineLength"> + <property name="max" value="180"/> + </module> + <module name="GenericWhitespace"/> + <module name="EmptyForIteratorPad"/> + <module name="MethodParamPad"/> + <module name="NoWhitespaceAfter"> + <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/> + </module> + <module name="NoWhitespaceBefore"/> + <module name="OperatorWrap"/> + <module name="ParenPad"/> + <module name="OneTopLevelClass"/> + <module name="TypecastParenPad"/> + <module name="WhitespaceAfter"/> + <module name="WhitespaceAround"/> + <module name="LeftCurly"/> + <module name="RightCurly"/> + <module name="CovariantEquals"/> + <module name="EmptyStatement"/> + <module name="EqualsAvoidNull"/> + <module name="EqualsHashCode"/> + <module name="IllegalInstantiation"/> + <module name="MissingSwitchDefault"/> + <module name="SimplifyBooleanExpression"/> + <module name="SimplifyBooleanReturn"/> + <module name="InterfaceIsType"/> + <module name="FinalClass"/> + <module name="ArrayTypeStyle"/> + <module name="UpperEll"/> + <module name="FinalParameters"/> + <module name="ArrayTrailingComma"/> + <module name="DeclarationOrder"/> + <module name="DefaultComesLast"/> + <module name="ExplicitInitialization"/> + <module name="FallThrough"/> + <module name="FinalLocalVariable"/> + <module name="HiddenField"> + <property name="ignoreConstructorParameter" value="true"/> + <property name="ignoreSetter" value="true"/> + <property name="setterCanReturnItsClass" value="true"/> + </module> + <module name="IllegalThrows"/> + <module name="IllegalToken"/> + <module name="IllegalTokenText"/> + <module name="IllegalType"/> + <module name="InnerAssignment"/> + </module> +</module> diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..759115e --- /dev/null +++ b/pom.xml @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://maven.apache.org/POM/4.0.0" + 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>io.play-rconf</groupId> + <artifactId>play-rconf-git</artifactId> + <version>20.10</version> + <name>Play Remote Configuration - GIT</name> + <description>Retrieves configuration hosted on a GIT repository</description> + <url>https://github.com/play-rconf/play-rconf-git</url> + + <scm> + <connection>scm:git:https://github.com/play-rconf/play-rconf-git.git</connection> + <developerConnection>scm:git:https://github.com/play-rconf/play-rconf-git.git</developerConnection> + <url>https://github.com/play-rconf/play-rconf-git.git</url> + </scm> + + <issueManagement> + <url>https://github.com/play-rconf/play-rconf-git/issues</url> + <system>GitHub Issues</system> + </issueManagement> + + <licenses> + <license> + <name>The MIT License (MIT)</name> + <url>https://github.com/play-rconf/play-rconf-git/master/LICENSE</url> + </license> + </licenses> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <repositories> + <repository> + <id>jitpack.io</id> + <url>https://jitpack.io</url> + </repository> + </repositories> + + <build> + <plugins> + <!-- Java version to use --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + <!-- Javadoc --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <encoding>UTF-8</encoding> + <show>package</show> + </configuration> + <executions> + <execution> + <id>attach-javadocs</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + <!-- Attach sources --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <version>3.0.1</version> + <executions> + <execution> + <id>attach-sources</id> + <goals> + <goal>jar</goal> + </goals> + </execution> + </executions> + </plugin> + <!-- Check style --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <configLocation>checkstyle.xml</configLocation> + <encoding>UTF-8</encoding> + <consoleOutput>true</consoleOutput> + <failsOnError>true</failsOnError> + <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation> + <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression> + <linkXRef>false</linkXRef> + </configuration> + <executions> + <execution> + <id>validate</id> + <phase>validate</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + <resources> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + </resource> + </resources> + <testResources> + <testResource> + <filtering>true</filtering> + <directory>src/test/resources</directory> + </testResource> + </testResources> + </build> + + <dependencies> + <dependency> + <groupId>com.github.play-rconf</groupId> + <artifactId>play-rconf-sdk</artifactId> + <version>release~18.05</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>2.16.0</version> + <scope>test</scope> + </dependency> + </dependencies> +</project>