Browse Source

qqserver

master
esoe 2 years ago
parent
commit
b21dc2b98b
  1. 3
      .vscode/settings.json
  2. 3
      options-main.json
  3. 5
      pom.xml
  4. 19
      src/main/java/ru/molokoin/sourceListener/GitListener.java
  5. BIN
      target/classes/ru/molokoin/sourceListener/GitListener.class

3
.vscode/settings.json vendored

@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}

3
options-main.json

@ -4,5 +4,6 @@
"gitLocalPath" : "/home/esoe/Documents/repos-listen/molokoin/repo", "gitLocalPath" : "/home/esoe/Documents/repos-listen/molokoin/repo",
"downloadPath" : "/home/esoe/Documents/repos-listen/molokoin/downloads", "downloadPath" : "/home/esoe/Documents/repos-listen/molokoin/downloads",
"zipPath" : "/home/esoe/Documents/repos-listen/molokoin/downloads/molokoin-client-master.zip", "zipPath" : "/home/esoe/Documents/repos-listen/molokoin/downloads/molokoin-client-master.zip",
"unzipPath" : "/var/www/html" "unzipPath" : "/home/esoe/Documents/repos-listen/molokoin/unzip/",
"destinationPath" : "/home/esoe/Documents/repos-listen/molokoin/var/www/html"
} }

5
pom.xml

@ -34,6 +34,11 @@
<artifactId>org.eclipse.jgit</artifactId> <artifactId>org.eclipse.jgit</artifactId>
<version>6.3.0.202209071007-r</version> <version>6.3.0.202209071007-r</version>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

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

@ -20,6 +20,7 @@ import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRemoteException; import org.eclipse.jgit.api.errors.InvalidRemoteException;
import org.eclipse.jgit.api.errors.NoHeadException; import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.api.errors.TransportException; import org.eclipse.jgit.api.errors.TransportException;
import org.eclipse.jgit.util.FileUtils;
import com.fasterxml.jackson.core.exc.StreamReadException; import com.fasterxml.jackson.core.exc.StreamReadException;
import com.fasterxml.jackson.databind.DatabindException; import com.fasterxml.jackson.databind.DatabindException;
@ -31,7 +32,7 @@ import ru.molokoin.sourceListener.opt.Options;
public class GitListener { public class GitListener {
public Options opt; public Options opt;
public String optionsPath = "options-home.json"; public String optionsPath = "options-main.json";
public GitListener(){ public GitListener(){
try { try {
@ -76,11 +77,11 @@ public class GitListener {
extract(); extract();
move(); move();
} catch (IOException e) { } catch (IOException e) {
System.out.println(e.getMessage()); System.out.println("Ошибка move(): " + 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();
@ -137,10 +138,16 @@ public class GitListener {
* *
*/ */
public void move() throws IOException { public void move() throws IOException {
Path source = Path.of("C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\unzip\\molokoin\\molokoin-client"); Path source = Path.of("/home/esoe/Documents/repos-listen/molokoin/unzip/molokoin-client");
Path target = Path.of("C:\\Users\\Strannik\\Documents\\esoe\\code\\sourceListener\\out\\war\\www\\html"); Path target = Path.of(opt.getDestinationPath());
//освобождение target
System.out.println("освобождение target ...");
FileUtils.delete(target.toFile());
//перемещение контента
System.out.println("Перемещение контента ... "); System.out.println("Перемещение контента ... ");
Files.move(source, target, StandardCopyOption.REPLACE_EXISTING); Files.move(source, target, StandardCopyOption.ATOMIC_MOVE);
System.out.println("Перемещение контента завершено. ");
} }
public static void main(String[] args) throws InvalidRemoteException, TransportException, GitAPIException, IOException { public static void main(String[] args) throws InvalidRemoteException, TransportException, GitAPIException, IOException {

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

Binary file not shown.
Loading…
Cancel
Save