Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adeshinao/rcopy
programmatically copy remote Git repo into local filesystem
https://github.com/adeshinao/rcopy
Last synced: 18 days ago
JSON representation
programmatically copy remote Git repo into local filesystem
- Host: GitHub
- URL: https://github.com/adeshinao/rcopy
- Owner: adeshinaO
- License: mit
- Created: 2019-11-11T03:06:39.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-05-20T21:16:13.000Z (over 2 years ago)
- Last Synced: 2024-12-17T07:56:11.146Z (23 days ago)
- Language: Java
- Homepage:
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.com/abdulwahabO/rcopy.svg?branch=master)](https://travis-ci.com/abdulwahabO/rcopy)
### About
A Java library for copying the contents of remote git repository to a specified directory on the local filesystem.
Files and directories within the repository can excluded from copying by providing compiled regular expressions
patterns.### Usage
This is a Maven project that has to be built locally. I plan to publish it to Github's package repository in
the near future. Use `mvn clean install` to run all tests and install a JAR of the library in your local Maven
repository. Then add RCopy as a dependency in your project's POM.```xml
co.adeshina
rcopy
{version}
```To copy the contents of repository: Create a `CopyConfig`, use it to instantiate a `RepositoryCopyExecutor` and
execute it.```java
public class Copy {
public void start() throws RepositoryCopyException {
// Directory into which to copy the repos contents.
Path targetDir = Files.createDirectory("rcopy_dump");
CopyConfig copyConfig = new CopyConfig.Builder(username, repository, targetDir, GitHostingService.GITHUB)
.excludePatterns(Collections.emptyList()) // No file/directories excluded
.httpUserAgent("user-agent") // HTTP User-Agent string
.build();
// Create executor
RepositoryCopyExecutor executor = RepositoryCopyExecutor.get(copyConfig);
// Blocks until all eligible files are copied or an exception is thrown
RepositoryCopyLog log = executor.execute();
}
}
```### Motivation
This is the first step towards implementing a side project idea that's been in my head: A simple HTTP server that
serves files copied from a remote git repository. I may never get to build that server but writing this library has
been educative and fun.
### Tech* JDK 1.8
* JUnit 5 and Mockito 2
* GSON
* Okhttp3 [MockWebServer]()