ATBTariffWebInterface/helloworld.lpr

57 lines
1.9 KiB
ObjectPascal

{%RunFlags MESSAGES+}
{$mode ObjFPC}{$H-}
program helloworld(output);
uses
TariffCalculator, CTypes, LazUtils, LazFileUtils, LazUtf8;
var
//TariffCalc: TariffCalculatorHandle;
CustomerRepo: array[0..100] of char;
LocalCustomerRepo: array[0..100] of char;
LocalBranchName: array[0..32] of char;
FileToCommit: array[0..128] of char;
CommitMessage: array[0..256] of char;
UserName: array[0..64] of char;
PassWord: array[0..64] of char;
begin
// TariffCalc := NewTariffCalculator;
// DeleteTariffCalculator(TariffCalc);
CustomerRepo := 'https://git.mimbach49.de/GerhardHoffmann/customer_999.git';
LocalCustomerRepo := 'C:\\tmp\\customer_999';
LocalBranchName := 'zg1/zone1';
FileToCommit := 'etc/psa_tariff/tariff01.json';
CommitMessage := 'TEST TEST';
UserName := 'GerhardHoffmann';
PassWord := 'ghlinux12345';
if not DirectoryExistsUTF8(ExpandFilenameUtf8(LocalCustomerRepo)) then
CreateDirUTF8(ExpandFilenameUtf8(LocalCustomerRepo));
if InitGitLibrary() > 0 then
Try
writeLn('initialized git library') ;
if not DirectoryExistsUTF8(ExpandFilenameUtf8(LocalCustomerRepo+'\\.git')) then
CloneRepository(CustomerRepo, LocalCustomerRepo);
if not CheckoutLocalBranch(LocalCustomerRepo, LocalBranchName) = 0 then
writeLn('cannot check out') ;
if not CommitFile(LocalCustomerRepo, LocalBranchName, FileToCommit, CommitMessage) = 0 then
writeLn('cannot commit') ;
if not PushLocalRepository(LocalCustomerRepo, LocalBranchName, UserName, PassWord) = 0 then
writeLn('cannot push') ;
Finally
if ShutdownGitLibrary() >= 0 then
writeLn('shutdown git library') ;
end
else
begin
writeLn('initializing git library FAILED') ;
Readln;
end;
end.