diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..3908207cf --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +# Check out all text files in UNIX format, with LF as end of line +# Don't change this file. If you have any ideas about it, please +# submit a separate issue about it and we'll discuss. + +* text=auto eol=lf +*.java ident +*.xml ident +*.png binary diff --git a/.gitignore b/.gitignore index 090a1f02d..0f15aad19 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +target/ .idea .DS_Store +*.iml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..84e57aa99 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: java +sudo: false +cache: + directories: + - $HOME/.m2 +script: + - set -e + - mvn clean install -Pqulice --errors --batch-mode + - mvn clean +env: + global: + - MAVEN_OPTS="-Xmx256m" + - JAVA_OPTS="-Xmx256m" +jdk: + - oraclejdk8 + - oraclejdk7 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 000000000..93682bee0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 eolang.org + +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 NON-INFRINGEMENT. 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/pom.xml b/pom.xml new file mode 100644 index 000000000..5abaa4ddd --- /dev/null +++ b/pom.xml @@ -0,0 +1,167 @@ + + + + 4.0.0 + + com.jcabi + parent + 0.48 + + org.eolang + compiler + 1.0-SNAPSHOT + jar + compiler + EO-to-Java Compiler + https://github.com/yegor256/eo + 2016 + + EO + https://github.com/yegor256/eo + + + + MIT + https://www.eolang.org/LICENSE.txt + site + + + + + 1 + Yegor Bugayenko + yegor256@gmail.com + yegor256.com + http://www.yegor256.com + + Architect + Developer + + -7 + + + + GitHub + https://github.com/yegor256/eo/issues + + + scm:git:git@github.com:yegor256/eo.git + scm:git:git@github.com:yegor256/eo.git + https://github.com/yegor256/eo + + + rultor + http://www.rultor.com/s/eo + + + + github-pages + https://github.com/yegor256/eo + + + + ${maven.build.timestamp} + 1.7 + + + + org.projectlombok + lombok + + + commons-io + commons-io + test + + + com.google.guava + guava + test + + + com.jcabi + jcabi-matchers + test + + + com.jcabi + jcabi-log + test + + + + + + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + qulice + + + + com.qulice + qulice-maven-plugin + + + checkstyle:/src/site/resources/.* + + + + + + + + coveralls + + + + org.eluder.coveralls + coveralls-maven-plugin + + + site + + report + + + ${coveralls.token} + + + + + + + + + diff --git a/src/main/java/org/eolang/Main.java b/src/main/java/org/eolang/Main.java new file mode 100644 index 000000000..b91521b78 --- /dev/null +++ b/src/main/java/org/eolang/Main.java @@ -0,0 +1,77 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2016 eolang.org + * + * 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 NON-INFRINGEMENT. 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. + */ +package org.eolang; + +import java.io.PrintStream; + +/** + * Main. + * + * @author Yegor Bugayenko (yegor256@gmail.com) + * @version $Id$ + * @since 0.1 + */ +public final class Main { + + /** + * Print stream for the output. + */ + private final PrintStream stdout; + + /** + * Arguments. + */ + private final String[] args; + + /** + * Ctor. + * @param out Output stream + * @param input Input args + */ + public Main(final PrintStream out, final String... input) { + this.stdout = out; + this.args = input; + } + + /** + * Entry point. + * @param input Command line arguments + * @checkstyle ProhibitPublicStaticMethods (3 lines) + */ + public static void main(final String... input) { + new Main(System.out, input).exec(); + } + + /** + * Entry point. + */ + public void exec() { + if ("--help".equals(this.args[0])) { + this.stdout.append("It is just a skeleton"); + } else { + this.stdout.append("Usage: --help"); + } + } + +} diff --git a/src/main/java/org/eolang/package-info.java b/src/main/java/org/eolang/package-info.java new file mode 100644 index 000000000..79bc3b296 --- /dev/null +++ b/src/main/java/org/eolang/package-info.java @@ -0,0 +1,34 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2016 eolang.org + * + * 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 NON-INFRINGEMENT. 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. + */ + +/** + * EO Compiler. + * + * @author Yegor Bugayenko (yegor256@gmail.com) + * @version $Id$ + * @since 0.1 + * @see project site www.eolang.org + * @see GitHub project + */ +package org.eolang; diff --git a/src/test/java/org/eolang/MainTest.java b/src/test/java/org/eolang/MainTest.java new file mode 100644 index 000000000..0ec782615 --- /dev/null +++ b/src/test/java/org/eolang/MainTest.java @@ -0,0 +1,55 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2016 eolang.org + * + * 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 NON-INFRINGEMENT. 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. + */ +package org.eolang; + +import java.io.PrintStream; +import org.apache.commons.io.output.ByteArrayOutputStream; +import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; +import org.junit.Test; + +/** + * Test case for {@link Main}. + * @author Yegor Bugayenko (yegor256@gmail.com) + * @version $Id$ + * @since 0.1 + */ +public final class MainTest { + + /** + * Main can print a simple text. + * @throws Exception If some problem inside + */ + @Test + public void printsSimpleResponse() throws Exception { + try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) { + new Main(new PrintStream(baos), "--help").exec(); + MatcherAssert.assertThat( + new String(baos.toByteArray()), + Matchers.containsString("skeleton") + ); + } + } + +} diff --git a/src/test/java/org/eolang/package-info.java b/src/test/java/org/eolang/package-info.java new file mode 100644 index 000000000..ea59cae95 --- /dev/null +++ b/src/test/java/org/eolang/package-info.java @@ -0,0 +1,32 @@ +/** + * The MIT License (MIT) + * + * Copyright (c) 2016 eolang.org + * + * 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 NON-INFRINGEMENT. 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. + */ + +/** + * EO Compiler, tests. + * + * @author Yegor Bugayenko (yegor256@gmail.com) + * @version $Id$ + * @since 0.1 + */ +package org.eolang;