diff --git a/options-home.json b/options-home.json index 290cefa..d9c0b23 100644 --- a/options-home.json +++ b/options-home.json @@ -1,7 +1,8 @@ { - "linkVC" : "http://molokoin.ru:3000/esoe/molokoin-client/archive/master.zip", + "zipLink" : "http://molokoin.ru:3000/esoe/molokoin-client/archive/master.zip", + "gitLink" : "http://molokoin.ru:3000/esoe/molokoin-client.git", + "gitLocalPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\repos", "downloadPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\zip", "zipPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\zip\\molokoin-client-master.zip", "unzipPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\unzip\\molokoin" - } \ No newline at end of file diff --git a/options-office.json b/options-office.json index bfbdb12..53a6605 100644 --- a/options-office.json +++ b/options-office.json @@ -1,5 +1,6 @@ { - "linkVC" : "http://molokoin.ru:3000/esoe/molokoin-client/archive/master.zip", + "zipLink" : "http://molokoin.ru:3000/esoe/molokoin-client/archive/master.zip", + "gitLink" : "http://molokoin.ru:3000/esoe/molokoin-client.git", "downloadPath" : "C:\\Users\\devuser\\Documents\\code\\sourceListener\\out\\zip", "zipPath" : "C:\\Users\\devuser\\Documents\\code\\sourceListener\\out\\zip\\molokoin-client-master.zip", "unzipPath" : "C:\\Users\\devuser\\Documents\\code\\sourceListener\\out\\unzip\\molokoin" diff --git a/out/repos b/out/repos new file mode 160000 index 0000000..60eda03 --- /dev/null +++ b/out/repos @@ -0,0 +1 @@ +Subproject commit 60eda0382753a60b183fec48f7372c956c7895ff diff --git a/out/unzip/molokoin/molokoin-client/css/style.css b/out/unzip/molokoin/molokoin-client/css/style.css deleted file mode 100644 index 50893ee..0000000 --- a/out/unzip/molokoin/molokoin-client/css/style.css +++ /dev/null @@ -1,45 +0,0 @@ -body { - font-family: Arial; - padding: 20px; - background: #f1f1f1; -} -div { - background-color: rgb(181, 122, 236); - padding: 5px; - margin: 5px; -} -.header{ - display: block; - padding: 30px; - font-size: 40px; - text-align: center; - background: rgb(181, 122, 236); - /*position: relative; top: 20px;*/ -} -.controls{ - /*position: relative; left: 20px;*/ - list-style: none; /* Отключение отображения маркеров. */ - width: 25%; /* Ширина меню. */ - float: left; - /*padding-left: 20px;*/ -} -.controls li { - margin: 5px; /* Отступ между блоками по высоте, необходимый для того чтобы пункты меню не сливались */ - font-family: Verdana, Arial, Helvetica, sans-serif; /* Тип шрифта пунктов меню */ - font-size: 14px; /* Размер текста меню */ -} -.controls li a{ - display: block; /* Изменение отображения на блочное для того, чтобы иметь возможность задать внутренние отступы. */ - padding: 4px 15px; /* Отступы внутри блоков. */ - background: #0db5b5; /* Цвет блоков меню. */ - color: #3f3f3f; /* Цвет текста в блоках меню. */ - text-decoration: none; /* Устранение подчёркивания ссылок. */ - position: relative; /* Это необходимо при использовании Internet Explorer 6 для того, чтобы ссылка по всей своей площади была «кликабельной». */ -} -.controls li a:hover { - background: #92d3d3; /* Цвет фона при наведении курсора мыши */ - color: #6b6b6b; /* Цвет текста при наведении курсора мыши */ -} -.mainframe{ - background-color: aliceblue; -} \ No newline at end of file diff --git a/out/unzip/molokoin/molokoin-client/index.html b/out/unzip/molokoin/molokoin-client/index.html deleted file mode 100644 index 744949d..0000000 --- a/out/unzip/molokoin/molokoin-client/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - molokoin.ru - - - -
- molokoin.ru/ добавить картинку и кнопку авторизации -
-
-
  • gitea
  • -
  • apache
  • -
  • moodle
  • -
  • adminvps
  • - -
    - - - \ No newline at end of file diff --git a/out/unzip/molokoin/molokoin-client/js/main.js b/out/unzip/molokoin/molokoin-client/js/main.js deleted file mode 100644 index 1a90dbd..0000000 --- a/out/unzip/molokoin/molokoin-client/js/main.js +++ /dev/null @@ -1 +0,0 @@ -console.log("qu") \ No newline at end of file diff --git a/out/zip/molokoin-client-master.zip b/out/zip/molokoin-client-master.zip deleted file mode 100644 index 61ce159..0000000 Binary files a/out/zip/molokoin-client-master.zip and /dev/null differ diff --git a/src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java b/src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java deleted file mode 100644 index 4a0b24c..0000000 --- a/src/main/java/ru/molokoin/sourceListener/ListRemoteRepository.java +++ /dev/null @@ -1,66 +0,0 @@ -package ru.molokoin.sourceListener; -/* - Copyright 2013, 2014 Dominik Stadler - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -import org.eclipse.jgit.api.Git; -import org.eclipse.jgit.api.errors.GitAPIException; -import org.eclipse.jgit.lib.Ref; - -import java.util.Collection; -import java.util.Map; - - -/** - * Simple snippet which shows how to list heads/tags of remote repositories without - * a local repository - * - * @author dominik.stadler at gmx.at - */ -public class ListRemoteRepository { - - private static final String REMOTE_URL = "http://molokoin.ru:3000/esoe/sourceListener.git"; - - public static void main(String[] args) throws GitAPIException { - // then clone - System.out.println("Listing remote repository: " + REMOTE_URL); - Collection refs = Git.lsRemoteRepository() - .setHeads(true) - .setTags(true) - .setRemote(REMOTE_URL) - .call(); - - for (Ref ref : refs) { - System.out.println("Ref>>>>>>>>: " + ref); - } - - final Map map = Git.lsRemoteRepository() - .setHeads(true) - .setTags(true) - .setRemote(REMOTE_URL) - .callAsMap(); - - System.out.println("As map"); - for (Map.Entry entry : map.entrySet()) { - System.out.println("Key: " + entry.getKey() + ", Ref: " + entry.getValue()); - } - - refs = Git.lsRemoteRepository() - .setRemote(REMOTE_URL) - .call(); - - System.out.println("All refs"); - for (Ref ref : refs) { - System.out.println(">>>>>Ref: " + ref.getStorage().name() + ">>>>>" + ref.getName()); - } - } -} \ No newline at end of file diff --git a/src/main/java/ru/molokoin/sourceListener/Options.java b/src/main/java/ru/molokoin/sourceListener/Options.java index 08b5b1c..f34a266 100644 --- a/src/main/java/ru/molokoin/sourceListener/Options.java +++ b/src/main/java/ru/molokoin/sourceListener/Options.java @@ -1,17 +1,31 @@ package ru.molokoin.sourceListener; public class Options { - private String linkVC; + private String zipLink; + private String gitLink; + private String gitLocalPath; private String downloadPath; private String zipPath; private String unzipPath; public Options(){} - public void setLinkVC(String linkVC) { - this.linkVC = linkVC; + public void setZipLink(String zipLink) { + this.zipLink = zipLink; } - public String getLinkVC() { - return linkVC; + public String getZipLink() { + return zipLink; + } + public void setGitLink(String gitLink) { + this.gitLink = gitLink; + } + public String getGitLink() { + return gitLink; + } + public void setGitLocalPath(String gitLocalPath) { + this.gitLocalPath = gitLocalPath; + } + public String getGitLocalPath() { + return gitLocalPath; } public void setDownloadPath(String downloadPath) { this.downloadPath = downloadPath; @@ -33,7 +47,9 @@ public class Options { } @Override public String toString() { - String s = "linkVC : " + getLinkVC() + "\n"; + String s = "zipLink : " + getZipLink() + "\n"; + s = s + "gitLink : " + getGitLink() + "\n"; + s = s + "gitLocalPath : " + getGitLocalPath() + "\n"; s = s + "downloadPath : " + getDownloadPath() + "\n"; s = s + "zipPath : " + getZipPath() + "\n"; s = s + "unzipPath : " + getUnzipPath() + "\n"; diff --git a/src/main/java/ru/molokoin/sourceListener/RepoCrafter.java b/src/main/java/ru/molokoin/sourceListener/RepoCrafter.java new file mode 100644 index 0000000..fc17eb4 --- /dev/null +++ b/src/main/java/ru/molokoin/sourceListener/RepoCrafter.java @@ -0,0 +1,57 @@ +package ru.molokoin.sourceListener; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; + +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.api.errors.InvalidRemoteException; +import org.eclipse.jgit.api.errors.TransportException; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.storage.file.FileRepositoryBuilder; +import org.eclipse.jgit.util.FileUtils; + + +public class RepoCrafter { + + public static Repository open() throws IOException { + FileRepositoryBuilder builder = new FileRepositoryBuilder(); + return builder + .readEnvironment() // scan environment GIT_* variables + .findGitDir() // scan up the file system tree + .build(); + } + + public static Repository create() throws IOException { + // prepare a new folder + File localPath = File.createTempFile("TestGitRepository", ""); + if(!localPath.delete()) { + throw new IOException("Could not delete temporary file " + localPath); + } + + // create the directory + Repository repository = FileRepositoryBuilder.create(new File(localPath, ".git")); + repository.create(); + + return repository; + } + public static Repository copy(String gitLink, File localPath) throws IOException, InvalidRemoteException, TransportException, GitAPIException{ + // prepare a new folder for the cloned repository + //File localPath = new File(locationPath); + if(!localPath.delete()) { + throw new IOException("Could not delete temporary file " + localPath); + } + + // then clone + System.out.println("Cloning from " + gitLink + " to " + localPath); + Git result = Git.cloneRepository() + .setURI(gitLink) + .setDirectory(localPath) + //.setProgressMonitor(new SimpleProgressMonitor()) + .call(); + // Note: the call() returns an opened repository already which needs to be closed to avoid file handle leaks! + System.out.println("Having repository: " + result.getRepository().getDirectory()); + return result.getRepository(); + } +} \ No newline at end of file diff --git a/target/classes/ru/molokoin/sourceListener/ListRemoteRepository.class b/target/classes/ru/molokoin/sourceListener/ListRemoteRepository.class deleted file mode 100644 index db80c91..0000000 Binary files a/target/classes/ru/molokoin/sourceListener/ListRemoteRepository.class and /dev/null differ diff --git a/target/classes/ru/molokoin/sourceListener/Options.class b/target/classes/ru/molokoin/sourceListener/Options.class index f400803..5a66e28 100644 Binary files a/target/classes/ru/molokoin/sourceListener/Options.class and b/target/classes/ru/molokoin/sourceListener/Options.class differ diff --git a/target/classes/ru/molokoin/sourceListener/RepoCrafter.class b/target/classes/ru/molokoin/sourceListener/RepoCrafter.class new file mode 100644 index 0000000..0f805e2 Binary files /dev/null and b/target/classes/ru/molokoin/sourceListener/RepoCrafter.class differ diff --git a/target/classes/ru/molokoin/sourceListener/SourceListener.class b/target/classes/ru/molokoin/sourceListener/SourceListener.class index 19a79c6..da05094 100644 Binary files a/target/classes/ru/molokoin/sourceListener/SourceListener.class and b/target/classes/ru/molokoin/sourceListener/SourceListener.class differ