|
|
@ -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 { |
|
|
|