Skip to content

Commit

Permalink
Merge pull request #120 from tamada/release/v2.6.0
Browse files Browse the repository at this point in the history
Release/v2.6.0
  • Loading branch information
tamada authored Dec 13, 2021
2 parents 43282b5 + 5dfbe7a commit c688c2d
Show file tree
Hide file tree
Showing 50 changed files with 356 additions and 164 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
[![codebeat badge](https://codebeat.co/badges/8e8c5e70-cb07-4f58-941c-3ddb64f3c059)](https://codebeat.co/projects/github-com-tamada-pochi-main)

[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://github.com/tamada/pochi/blob/master/LICENSE)
[![Version](https://img.shields.io/badge/Version-2.5.2-green.svg)](https://github.com/tamada/pochi/releases/tag/v2.5.2)
[![Version](https://img.shields.io/badge/Version-2.6.0-green.svg)](https://github.com/tamada/pochi/releases/tag/v2.6.0)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.4271132-green.svg)](https://zenodo.org/badge/latestdoi/82773287)

[![Javadoc](https://img.shields.io/badge/Javadoc-v2.5.2-blue?logo=java)](https://tamada.github.io/pochi/apidocs)
[![Docker](https://img.shields.io/badge/Docker-ghcr.io%2Ftamada%2Fpochi%3A2.5.2-blue?logo=docker)](https://github.com/users/tamada/packages/container/package/pochi)
[![Javadoc](https://img.shields.io/badge/Javadoc-v2.6.0-blue?logo=java)](https://tamada.github.io/pochi/apidocs)
[![Docker](https://img.shields.io/badge/Docker-ghcr.io%2Ftamada%2Fpochi%3A2.6.0-blue?logo=docker)](https://github.com/users/tamada/packages/container/package/pochi)
[![GitHub Discussion](https://img.shields.io/badge/GitHub-Discussions-blue?logo=github)](https://github.com/tamada/pochi/discussions)

Detecting the software theft, the birthmark toolkit for the JVM platform.
Expand Down Expand Up @@ -83,7 +83,8 @@ For more detail, see [:ant: Examples](https://tamada.github.io/pochi/examples).
Container images of **pochi** for Docker are:
* [`ghcr.io/tamada/pochi`](https://github.com/users/tamada/packages/container/package/pochi)
* `2.5.2`, `latest`
* `2.6.0`, `latest`
* `2.5.2`
* `2.5.1`
* `2.5.0`
* `2.4.6`
Expand All @@ -106,7 +107,7 @@ Container images of **pochi** for Docker are:
* `1.0.0`
* accept only `.js` script files.
[![Docker](https://img.shields.io/badge/Docker-ghcir.io%2Ftamada%2Fpochi%3A2.5.2-blue?logo=docker)](https://github.com/users/tamada/packages/container/package/pochi)
[![Docker](https://img.shields.io/badge/Docker-ghcir.io%2Ftamada%2Fpochi%3A2.6.0-blue?logo=docker)](https://github.com/users/tamada/packages/container/package/pochi)
To run **pochi** on Docker container OS, type the following commands.
Expand Down Expand Up @@ -158,10 +159,10 @@ Then, add the dependencies of your `pom.xml`.
| groupId | artifactId | version |
|--------------------|--------------|---------|
|`jp.cafebabe.pochi` | `kunai2` | `2.5.2` |
|`jp.cafebabe.pochi` | `pochi-core` | `2.5.2` |
|`jp.cafebabe.pochi` | `pochi-api` | `2.5.2` |
|`jp.cafebabe.pochi` | `pochi-cmd` | `2.5.2` |
|`jp.cafebabe.pochi` | `kunai2` | `2.6.0` |
|`jp.cafebabe.pochi` | `pochi-core` | `2.6.0` |
|`jp.cafebabe.pochi` | `pochi-api` | `2.6.0` |
|`jp.cafebabe.pochi` | `pochi-cmd` | `2.6.0` |
## Modules
Expand Down
2 changes: 1 addition & 1 deletion bin/build_site.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh

VERSION="2.5.2"
VERSION="2.6.0"

function build_apidocs() {
mkdir -p site/msp
Expand Down
2 changes: 1 addition & 1 deletion bin/make_dist.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh

VERSION="2.5.2"
VERSION="2.6.0"

function mkdirIfNeeded () {
if [ ! -d $1 ] ; then
Expand Down
2 changes: 1 addition & 1 deletion dockers/pochi-groovysh/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apk --no-cache add openjdk11=11.0.4_p4-r1 \
# building pochi
FROM alpine:3.10.1

ARG PochiVersion="2.5.2"
ARG PochiVersion="2.6.0"
ARG GroovyVersion="3.0.9"

LABEL maintainer="Haruaki Tamada" \
Expand Down
2 changes: 1 addition & 1 deletion dockers/pochi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apk --no-cache add openjdk11=11.0.4_p4-r1 \
# building pochi
FROM alpine:3.10.1

ARG PochiVersion="2.5.2"
ARG PochiVersion="2.6.0"

LABEL maintainer="Haruaki Tamada" \
pochi-version="${PochiVersion}" \
Expand Down
4 changes: 2 additions & 2 deletions kunai2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Kunai2 implemented for Java 8 and used streaming API.
```java
// Reading
Path sourcePath = Paths.get("path/of/source/file/or/directory");
DataSourceFactory sourceFactory = new DefaultDataSourceFactory();
DataSourceFactory sourceFactory = DataSourceFactory.instance();
try(DataSource source = sourceFactory.build(sourcePath)){
// Storing
Path outputPath = Paths.get("path/of/output/file.jar");
DataSinkFactory sinkFactory = new DefaultDataSinkFactory();
DataSinkFactory sinkFactory = DataSinkFactory.instance();
try(DataSink sink = sinkFactory.build(outputPath)){
sink.consume(source);
// above lines means following code.
Expand Down
4 changes: 2 additions & 2 deletions kunai2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>jp.cafebabe</groupId>
<artifactId>pochi</artifactId>
<version>2.5.2</version>
<version>2.6.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -19,7 +19,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>8.0.1</version>
<version>9.2</version>
</dependency>
</dependencies>

Expand Down
8 changes: 4 additions & 4 deletions kunai2/src/main/java/jp/cafebabe/kunai/Demo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
import java.nio.file.Paths;

import jp.cafebabe.kunai.sink.DataSink;
import jp.cafebabe.kunai.sink.factories.DefaultDataSinkFactory;
import jp.cafebabe.kunai.sink.factories.DataSinkFactory;
import jp.cafebabe.kunai.source.DataSource;
import jp.cafebabe.kunai.source.factories.DefaultDataSourceFactory;
import jp.cafebabe.kunai.source.factories.DataSourceFactory;

public class Demo {
public Demo(String[] args) throws Exception{
copy(args[0], args[1]);
}

private void copy(String from, String to) throws Exception{
try(DataSource source = new DefaultDataSourceFactory().build(Paths.get(from));
DataSink sink = new DefaultDataSinkFactory().create(Paths.get(to))){
try(DataSource source = DataSourceFactory.instance().build(Paths.get(from));
DataSink sink = DataSinkFactory.instance().create(Paths.get(to))) {
copy(source, sink);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ public KunaiException(String message) {
super(message);
}

public KunaiException(Exception e) {
super(e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ public interface DataSinkFactory {
DataSink create(Path path);

boolean isTarget(Path path);

static DataSinkFactory instance() {
return new DefaultDataSinkFactory();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import jp.cafebabe.kunai.sink.JarFileDataSink;
import jp.cafebabe.kunai.sink.WarFileDataSink;

public class DefaultDataSinkFactory implements DataSinkFactory{
class DefaultDataSinkFactory implements DataSinkFactory{
private List<DataSinkFactory> factories = new ArrayList<>();

public DefaultDataSinkFactory(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ default DataSource build(Path path) throws KunaiException{
default DataSource build(File file) throws KunaiException{
return build(file.toPath());
}

static DataSourceFactory instance() {
return new DefaultDataSourceFactory();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import jp.cafebabe.kunai.entries.KunaiException;
import jp.cafebabe.kunai.source.DataSource;

public class DefaultDataSourceFactory implements DataSourceFactory{
class DefaultDataSourceFactory implements DataSourceFactory{
private DataSourceFactories factories = new DataSourceFactories();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Typical usage is:
* <pre>
* Path path = Paths.get("some/data/source/path");
* DataSourceFactory factory = DefaultDataSourceFactory();
* DataSourceFactory factory = DataSourceFactory.instance();
* try(DataSource source = factory.build(path)){
* source.stream()
* .forEach(entry -&gt;
Expand Down
9 changes: 5 additions & 4 deletions kunai2/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import jp.cafebabe.kunai.sink.DataSink;
import jp.cafebabe.kunai.sink.factories.DefaultDataSinkFactory;
import jp.cafebabe.kunai.sink.factories.DataSinkFactory;
import jp.cafebabe.kunai.source.DataSource;
import jp.cafebabe.kunai.source.factories.DefaultDataSourceFactory;
import jp.cafebabe.kunai.source.factories.DataSourceFactory;

/**
* <p>
Expand All @@ -15,8 +15,8 @@
*
* <pre>
* public void copy(String from, String to) throws Exception {
* try({@link DataSource} source = new {@link DefaultDataSourceFactory}().build(Paths.get(from));
* {@link DataSink} sink = new {@link DefaultDataSinkFactory}().create(Paths.get(to))){
* try({@link DataSource} source = {@link DataSourceFactory}.instance().build(Paths.get(from));
* {@link DataSink} sink = {@link DataSinkFactory}.instance().create(Paths.get(to))){
* copy(source, sink);
* }
* }
Expand All @@ -33,6 +33,7 @@

exports jp.cafebabe.kunai.entries;
exports jp.cafebabe.kunai.sink;
exports jp.cafebabe.kunai.sink.factories;
exports jp.cafebabe.kunai.source;
exports jp.cafebabe.kunai.source.factories;
}
17 changes: 17 additions & 0 deletions kunai2/src/test/java/jp/cafebabe/kunai/entries/NameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,21 @@ public void testBasic(){
assertThat(name.toString(), is("Haruaki Tamada"));
assertThat(name.name(), is("Haruaki Tamada"));
}

@Test
public void testMatch() {
assertThat(name.matches("H.*Tamada"), is(true));
assertThat(name.matches("tamada"), is(false));
assertThat(name.contains("ki Ta"), is(true));
assertThat(name.endsWith("a"), is(true));
assertThat(name.startsWith("H"), is(true));
}

@Test
public void testEquals() {
assertThat(name.equals(new Name("Haruaki Tamada")), is(true));
assertThat(name.equals(new Name("Different Name")), is(false));
assertThat(name.equals(new Object()), is(false));
assertThat(name.equals(null), is(false));
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
package jp.cafebabe.kunai.sink;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import jp.cafebabe.kunai.entries.Entry;
import jp.cafebabe.kunai.source.DataSource;
import jp.cafebabe.kunai.source.factories.DataSourceFactory;
import jp.cafebabe.kunai.util.PathHelper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import jp.cafebabe.kunai.entries.Entry;
import jp.cafebabe.kunai.source.DataSource;
import jp.cafebabe.kunai.source.factories.DefaultDataSourceFactory;
import jp.cafebabe.kunai.util.PathHelper;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class DirectoryDataSinkTest {
@Before
public void setUp() throws Exception{
Path path = Paths.get("target/test-classes/hello/target/hello-1.0-SNAPSHOT.jar");
try(DataSource source = new DefaultDataSourceFactory().build(path)){
try(DataSource source = DataSourceFactory.instance().build(path)){
try(DataSink sink = new DirectoryDataSink(Paths.get("dir"))){
sink.consume(source);
}
Expand All @@ -30,7 +29,7 @@ public void setUp() throws Exception{

@Test
public void testCreatedDirectory() throws Exception{
DataSource source = new DefaultDataSourceFactory().build(Paths.get("dir"));
DataSource source = DataSourceFactory.instance().build(Paths.get("dir"));

List<Entry> list = new ArrayList<>();
source.forEach(entry -> list.add(entry));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
package jp.cafebabe.kunai.sink;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import jp.cafebabe.kunai.entries.Entry;
import jp.cafebabe.kunai.source.DataSource;
import jp.cafebabe.kunai.source.factories.DataSourceFactory;
import org.junit.After;
import org.junit.Test;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Test;

import jp.cafebabe.kunai.entries.Entry;
import jp.cafebabe.kunai.source.DataSource;
import jp.cafebabe.kunai.source.factories.DefaultDataSourceFactory;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class JarFileDataSinkTest {
@Test
public void testCreatedJarFile() throws Exception{
Path path = Paths.get("target/test-classes/hello/target/classes/");
try(DataSource source = new DefaultDataSourceFactory().build(path)){
try(DataSource source = DataSourceFactory.instance().build(path)){
try(DataSink sink = new JarFileDataSink(Paths.get("hoge.jar"))){
sink.consume(source);
}
}

DataSource source = new DefaultDataSourceFactory().build(Paths.get("hoge.jar"));
DataSource source = DataSourceFactory.instance().build(Paths.get("hoge.jar"));

List<Entry> list = new ArrayList<>();
source.forEach(entry -> list.add(entry));
Expand All @@ -37,13 +36,13 @@ public void testCreatedJarFile() throws Exception{
@Test
public void testJarFromJar() throws Exception{
Path path = Paths.get("target/test-classes/hello/target/hello-1.0-SNAPSHOT.jar");
try(DataSource source = new DefaultDataSourceFactory().build(path)){
try(DataSource source = DataSourceFactory.instance().build(path)){
try(DataSink sink = new JarFileDataSink(Paths.get("hoge.jar"))){
sink.consume(source);
}
}

DataSource source = new DefaultDataSourceFactory().build(Paths.get("hoge.jar"));
DataSource source = DataSourceFactory.instance().build(Paths.get("hoge.jar"));

List<Entry> list = new ArrayList<>();
source.forEach(entry -> list.add(entry));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package jp.cafebabe.kunai.source;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;

import java.nio.file.Paths;

import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class AbstractDataSourceTest{
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package jp.cafebabe.kunai.source;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import jp.cafebabe.kunai.entries.ClassName;
import jp.cafebabe.kunai.entries.Entry;
import jp.cafebabe.kunai.source.factories.DataSourceFactory;
import org.junit.Before;
import org.junit.Test;

import java.nio.file.Path;
import java.nio.file.Paths;

import org.junit.Before;
import org.junit.Test;

import jp.cafebabe.kunai.entries.ClassName;
import jp.cafebabe.kunai.entries.Entry;
import jp.cafebabe.kunai.source.factories.DataSourceFactory;
import jp.cafebabe.kunai.source.factories.DefaultDataSourceFactory;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class ClassFileDataSourceTest {
private Path path;
Expand All @@ -24,7 +22,7 @@ public void setUp(){

@Test
public void testDataSource() throws Exception{
DataSourceFactory factory = new DefaultDataSourceFactory();
DataSourceFactory factory = DataSourceFactory.instance();

assertThat(factory.isTarget(path), is(true));

Expand Down
Loading

0 comments on commit c688c2d

Please sign in to comment.