Skip to content

Commit 39454f7

Browse files
author
Yegor Bugayenko
committed
objectionary#58: skeleton
1 parent 3630d47 commit 39454f7

File tree

9 files changed

+412
-0
lines changed

9 files changed

+412
-0
lines changed

.gitattributes

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Check out all text files in UNIX format, with LF as end of line
2+
# Don't change this file. If you have any ideas about it, please
3+
# submit a separate issue about it and we'll discuss.
4+
5+
* text=auto eol=lf
6+
*.java ident
7+
*.xml ident
8+
*.png binary

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
target/
12
.idea
23
.DS_Store
4+
*.iml

.travis.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: java
2+
sudo: false
3+
cache:
4+
directories:
5+
- $HOME/.m2
6+
script:
7+
- set -e
8+
- mvn clean install -Pqulice --errors --batch-mode
9+
- mvn clean
10+
env:
11+
global:
12+
- MAVEN_OPTS="-Xmx256m"
13+
- JAVA_OPTS="-Xmx256m"
14+
jdk:
15+
- oraclejdk8
16+
- oraclejdk7

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 eolang.org
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included
13+
in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

pom.xml

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
* The MIT License (MIT)
4+
*
5+
* Copyright (c) 2016 eolang.org
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included
15+
* in all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
-->
25+
<project xmlns="http://maven.apache.org/POM/4.0.0"
26+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
27+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
28+
<modelVersion>4.0.0</modelVersion>
29+
<parent>
30+
<groupId>com.jcabi</groupId>
31+
<artifactId>parent</artifactId>
32+
<version>0.48</version>
33+
</parent>
34+
<groupId>org.eolang</groupId>
35+
<artifactId>compiler</artifactId>
36+
<version>1.0-SNAPSHOT</version>
37+
<packaging>jar</packaging>
38+
<name>compiler</name>
39+
<description>EO-to-Java Compiler</description>
40+
<url>https://github.com/yegor256/eo</url>
41+
<inceptionYear>2016</inceptionYear>
42+
<organization>
43+
<name>EO</name>
44+
<url>https://github.com/yegor256/eo</url>
45+
</organization>
46+
<licenses>
47+
<license>
48+
<name>MIT</name>
49+
<url>https://www.eolang.org/LICENSE.txt</url>
50+
<distribution>site</distribution>
51+
</license>
52+
</licenses>
53+
<developers>
54+
<developer>
55+
<id>1</id>
56+
<name>Yegor Bugayenko</name>
57+
<email>[email protected]</email>
58+
<organization>yegor256.com</organization>
59+
<organizationUrl>http://www.yegor256.com</organizationUrl>
60+
<roles>
61+
<role>Architect</role>
62+
<role>Developer</role>
63+
</roles>
64+
<timezone>-7</timezone>
65+
</developer>
66+
</developers>
67+
<issueManagement>
68+
<system>GitHub</system>
69+
<url>https://github.com/yegor256/eo/issues</url>
70+
</issueManagement>
71+
<scm>
72+
<connection>scm:git:[email protected]:yegor256/eo.git</connection>
73+
<developerConnection>scm:git:[email protected]:yegor256/eo.git</developerConnection>
74+
<url>https://github.com/yegor256/eo</url>
75+
</scm>
76+
<ciManagement>
77+
<system>rultor</system>
78+
<url>http://www.rultor.com/s/eo</url>
79+
</ciManagement>
80+
<distributionManagement>
81+
<site>
82+
<id>github-pages</id>
83+
<url>https://github.com/yegor256/eo</url>
84+
</site>
85+
</distributionManagement>
86+
<properties>
87+
<timestamp>${maven.build.timestamp}</timestamp>
88+
<jdk.version>1.7</jdk.version>
89+
</properties>
90+
<dependencies>
91+
<dependency>
92+
<groupId>org.projectlombok</groupId>
93+
<artifactId>lombok</artifactId>
94+
</dependency>
95+
<dependency>
96+
<groupId>commons-io</groupId>
97+
<artifactId>commons-io</artifactId>
98+
<scope>test</scope>
99+
</dependency>
100+
<dependency>
101+
<groupId>com.google.guava</groupId>
102+
<artifactId>guava</artifactId>
103+
<scope>test</scope>
104+
</dependency>
105+
<dependency>
106+
<groupId>com.jcabi</groupId>
107+
<artifactId>jcabi-matchers</artifactId>
108+
<scope>test</scope>
109+
</dependency>
110+
<dependency>
111+
<groupId>com.jcabi</groupId>
112+
<artifactId>jcabi-log</artifactId>
113+
<scope>test</scope>
114+
</dependency>
115+
</dependencies>
116+
<build>
117+
<plugins>
118+
<plugin>
119+
<artifactId>maven-compiler-plugin</artifactId>
120+
<configuration>
121+
<source>1.8</source>
122+
<target>1.8</target>
123+
</configuration>
124+
</plugin>
125+
</plugins>
126+
</build>
127+
<profiles>
128+
<profile>
129+
<id>qulice</id>
130+
<build>
131+
<plugins>
132+
<plugin>
133+
<groupId>com.qulice</groupId>
134+
<artifactId>qulice-maven-plugin</artifactId>
135+
<configuration>
136+
<excludes combine.children="append">
137+
<exclude>checkstyle:/src/site/resources/.*</exclude>
138+
</excludes>
139+
</configuration>
140+
</plugin>
141+
</plugins>
142+
</build>
143+
</profile>
144+
<profile>
145+
<id>coveralls</id>
146+
<build>
147+
<plugins>
148+
<plugin>
149+
<groupId>org.eluder.coveralls</groupId>
150+
<artifactId>coveralls-maven-plugin</artifactId>
151+
<executions>
152+
<execution>
153+
<phase>site</phase>
154+
<goals>
155+
<goal>report</goal>
156+
</goals>
157+
<configuration>
158+
<repoToken>${coveralls.token}</repoToken>
159+
</configuration>
160+
</execution>
161+
</executions>
162+
</plugin>
163+
</plugins>
164+
</build>
165+
</profile>
166+
</profiles>
167+
</project>

src/main/java/org/eolang/Main.java

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/**
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2016 eolang.org
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included
14+
* in all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.eolang;
25+
26+
import java.io.PrintStream;
27+
28+
/**
29+
* Main.
30+
*
31+
* @author Yegor Bugayenko ([email protected])
32+
* @version $Id$
33+
* @since 0.1
34+
*/
35+
public final class Main {
36+
37+
/**
38+
* Print stream for the output.
39+
*/
40+
private final PrintStream stdout;
41+
42+
/**
43+
* Arguments.
44+
*/
45+
private final String[] args;
46+
47+
/**
48+
* Ctor.
49+
* @param out Output stream
50+
* @param input Input args
51+
*/
52+
public Main(final PrintStream out, final String... input) {
53+
this.stdout = out;
54+
this.args = input;
55+
}
56+
57+
/**
58+
* Entry point.
59+
* @param input Command line arguments
60+
* @checkstyle ProhibitPublicStaticMethods (3 lines)
61+
*/
62+
public static void main(final String... input) {
63+
new Main(System.out, input).exec();
64+
}
65+
66+
/**
67+
* Entry point.
68+
*/
69+
public void exec() {
70+
if ("--help".equals(this.args[0])) {
71+
this.stdout.append("It is just a skeleton");
72+
} else {
73+
this.stdout.append("Usage: --help");
74+
}
75+
}
76+
77+
}
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2016 eolang.org
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included
14+
* in all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
/**
26+
* EO Compiler.
27+
*
28+
* @author Yegor Bugayenko ([email protected])
29+
* @version $Id$
30+
* @since 0.1
31+
* @see <a href="http://www.eolang.org">project site www.eolang.org</a>
32+
* @see <a href="https://github.com/yegor256/eo">GitHub project</a>
33+
*/
34+
package org.eolang;
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2016 eolang.org
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included
14+
* in all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package org.eolang;
25+
26+
import java.io.PrintStream;
27+
import org.apache.commons.io.output.ByteArrayOutputStream;
28+
import org.hamcrest.MatcherAssert;
29+
import org.hamcrest.Matchers;
30+
import org.junit.Test;
31+
32+
/**
33+
* Test case for {@link Main}.
34+
* @author Yegor Bugayenko ([email protected])
35+
* @version $Id$
36+
* @since 0.1
37+
*/
38+
public final class MainTest {
39+
40+
/**
41+
* Main can print a simple text.
42+
* @throws Exception If some problem inside
43+
*/
44+
@Test
45+
public void printsSimpleResponse() throws Exception {
46+
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
47+
new Main(new PrintStream(baos), "--help").exec();
48+
MatcherAssert.assertThat(
49+
new String(baos.toByteArray()),
50+
Matchers.containsString("skeleton")
51+
);
52+
}
53+
}
54+
55+
}

0 commit comments

Comments
 (0)