Browse Source

to server

home
esoe 2 years ago
parent
commit
c1c4476173
  1. 1
      options-home.json
  2. 2
      out/repos
  3. 4
      out/var/www/html/index.html
  4. BIN
      out/zip/molokoin-client-master.zip
  5. 46
      src/main/java/ru/molokoin/sourceListener/GitListener.java
  6. 2
      src/main/java/ru/molokoin/sourceListener/fs/ApacheService.java
  7. 8
      src/main/java/ru/molokoin/sourceListener/opt/Options.java
  8. BIN
      target/classes/ru/molokoin/sourceListener/GitListener.class
  9. BIN
      target/classes/ru/molokoin/sourceListener/fs/ApacheService.class
  10. BIN
      target/classes/ru/molokoin/sourceListener/opt/Options.class

1
options-home.json

@ -5,5 +5,6 @@
"downloadPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\zip", "downloadPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\zip",
"zipPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\zip\\molokoin-client-master.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", "unzipPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\unzip\\molokoin",
"sourcePath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\unzip\\molokoin\\molokoin-client",
"destinationPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\var\\www\\html" "destinationPath" : "C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\var\\www\\html"
} }

2
out/repos

@ -1 +1 @@
Subproject commit ab1d9fe840340945098569399bb6ec50d5daccc0 Subproject commit cd6a2c2e64ec4093db8a428c3e26c5aa09df1b79

4
out/var/www/html/index.html

@ -9,11 +9,13 @@
</head> </head>
<body> <body>
<div class="header"> <div class="header">
molokoin.ru molokoin.ru/ try 13
</div> </div>
<div class="controls01"> <div class="controls01">
<li><a href="http://molokoin.ru:3000/esoe">gitea</a></li> <li><a href="http://molokoin.ru:3000/esoe">gitea</a></li>
<li><a href="http://www.molokoin.ru:8080">apache</a></li> <li><a href="http://www.molokoin.ru:8080">apache</a></li>
<li><a href="http://www.molokoin.ru">projects</a></li>
<li><a href="http://www.molokoin.ru">muse</a></li>
</div> </div>
<script src="js/main.js"></script> <script src="js/main.js"></script>
</body> </body>

BIN
out/zip/molokoin-client-master.zip

Binary file not shown.

46
src/main/java/ru/molokoin/sourceListener/GitListener.java

@ -4,10 +4,14 @@ import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.Comparator;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Objects;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
@ -72,13 +76,13 @@ public class GitListener {
try { try {
NetService.download(opt.getZipLink(), opt.getDownloadPath()); NetService.download(opt.getZipLink(), opt.getDownloadPath());
extract(); extract();
move(); move(opt.getSourcePath(), opt.getDestinationPath());
} catch (IOException e) { } catch (IOException e) {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
} }
try { try {
Thread.sleep(2000); Thread.sleep(10000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
System.out.println("Проспал!!! Ошибка!!!"); System.out.println("Проспал!!! Ошибка!!!");
e.printStackTrace(); e.printStackTrace();
@ -132,13 +136,41 @@ public class GitListener {
} }
/** /**
* * перемещаем файлы из директории source в target
*/ */
public void move() throws IOException { public void move(String sourceString, String targetString) {
Path source = Path.of("C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\unzip\\molokoin\\molokoin-client"); Path source = Path.of(sourceString);
Path target = Path.of("C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\war\\www\\html"); Path target = Path.of(targetString);
System.out.println("Перемещение контента ... "); System.out.println("Перемещение контента ... ");
Files.move(source, target, StandardCopyOption.REPLACE_EXISTING); System.out.println("sourceString: " + sourceString);
System.out.println("targetString: " + targetString);
try {
//просмотр содержимого папки target
try (DirectoryStream<Path> files = Files.newDirectoryStream(target)) {
for (Path path : files){
System.out.println("Очистка пути: " + path);//вывод содержимого в консоль
//очистка папки
if(Files.isDirectory(path)){
deleteDirectory(path);
}else{
Files.delete(path);
}
}
}
Files.move(source, target, StandardCopyOption.REPLACE_EXISTING);
System.out.println("Метод move() успешно выполнен!!!!");
} catch (IOException e) {
System.err.println("Ошибка в методе move():" + e.getMessage());
System.err.println("out >>>>>>>>>>>" + e.getLocalizedMessage());
e.printStackTrace();
}
}
public static void deleteDirectory(Path directory) throws IOException {
Files.walk(directory)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
} }
public static void main(String[] args) throws InvalidRemoteException, TransportException, GitAPIException, IOException { public static void main(String[] args) throws InvalidRemoteException, TransportException, GitAPIException, IOException {

2
src/main/java/ru/molokoin/sourceListener/apache2/ApacheService.java → src/main/java/ru/molokoin/sourceListener/fs/ApacheService.java

@ -1,4 +1,4 @@
package ru.molokoin.sourceListener.apache2; package ru.molokoin.sourceListener.fs;
import java.io.IOException; import java.io.IOException;
import java.nio.file.DirectoryIteratorException; import java.nio.file.DirectoryIteratorException;

8
src/main/java/ru/molokoin/sourceListener/opt/Options.java

@ -7,6 +7,7 @@ public class Options {
private String downloadPath; private String downloadPath;
private String zipPath; private String zipPath;
private String unzipPath; private String unzipPath;
private String sourcePath;
private String destinationPath; private String destinationPath;
public Options(){} public Options(){}
@ -46,6 +47,12 @@ public class Options {
public String getZipPath() { public String getZipPath() {
return zipPath; return zipPath;
} }
public void setSourcePath(String sourcePath) {
this.sourcePath = sourcePath;
}
public String getSourcePath() {
return sourcePath;
}
public void setDestinationPath(String destinationPath) { public void setDestinationPath(String destinationPath) {
this.destinationPath = destinationPath; this.destinationPath = destinationPath;
} }
@ -60,6 +67,7 @@ public class Options {
s = s + "downloadPath : " + getDownloadPath() + "\n"; s = s + "downloadPath : " + getDownloadPath() + "\n";
s = s + "zipPath : " + getZipPath() + "\n"; s = s + "zipPath : " + getZipPath() + "\n";
s = s + "unzipPath : " + getUnzipPath() + "\n"; s = s + "unzipPath : " + getUnzipPath() + "\n";
s = s + "sourcePath : " + getSourcePath() + "\n";
s = s + "destinationPath : " + getDestinationPath() + "\n"; s = s + "destinationPath : " + getDestinationPath() + "\n";
return s; return s;
} }

BIN
target/classes/ru/molokoin/sourceListener/GitListener.class

Binary file not shown.

BIN
target/classes/ru/molokoin/sourceListener/apache2/ApacheService.class → target/classes/ru/molokoin/sourceListener/fs/ApacheService.class

Binary file not shown.

BIN
target/classes/ru/molokoin/sourceListener/opt/Options.class

Binary file not shown.
Loading…
Cancel
Save