ATBTariffWebInterface/helloworld.lpr

57 lines
1.9 KiB
ObjectPascal
Raw Normal View History

2024-03-12 09:43:57 +01:00
{%RunFlags MESSAGES+}
{$mode ObjFPC}{$H-}
program helloworld(output);
uses
2024-03-13 16:08:30 +01:00
TariffCalculator, CTypes, LazUtils, LazFileUtils, LazUtf8;
2024-03-12 09:43:57 +01:00
var
2024-03-13 16:08:30 +01:00
//TariffCalc: TariffCalculatorHandle;
2024-03-12 09:43:57 +01:00
CustomerRepo: array[0..100] of char;
LocalCustomerRepo: array[0..100] of char;
2024-03-13 16:08:30 +01:00
LocalBranchName: array[0..32] of char;
FileToCommit: array[0..128] of char;
CommitMessage: array[0..256] of char;
2024-03-14 15:05:01 +01:00
UserName: array[0..64] of char;
PassWord: array[0..64] of char;
2024-03-12 09:43:57 +01:00
begin
// TariffCalc := NewTariffCalculator;
// DeleteTariffCalculator(TariffCalc);
2024-03-13 16:08:30 +01:00
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';
2024-03-14 15:05:01 +01:00
UserName := 'GerhardHoffmann';
PassWord := 'ghlinux12345';
2024-03-13 16:08:30 +01:00
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
2024-03-14 15:05:01 +01:00
writeLn('cannot commit') ;
if not PushLocalRepository(LocalCustomerRepo, LocalBranchName, UserName, PassWord) = 0 then
writeLn('cannot push') ;
2024-03-13 16:08:30 +01:00
Finally
if ShutdownGitLibrary() >= 0 then
writeLn('shutdown git library') ;
2024-03-12 09:43:57 +01:00
end
else
begin
2024-03-13 16:08:30 +01:00
writeLn('initializing git library FAILED') ;
2024-03-12 09:43:57 +01:00
Readln;
end;
end.