forked from Memnarch/Delphinus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDN.Package.Github.pas
61 lines (50 loc) · 1.71 KB
/
DN.Package.Github.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
#########################################################
# Copyright by Alexander Benikowski #
# This unit is part of the Delphinus project hosted on #
# https://github.com/Memnarch/Delphinus #
#########################################################
}
unit DN.Package.Github;
interface
uses
Classes,
Types,
DN.Package;
type
TDNGitHubPackage = class;
TGetLicenseCallback = function(const APackage: TDNGithubPackage): string of object;
TDNGitHubPackage = class(TDNPackage)
private
FDefaultBranch: string;
FRepositoryName: string;
FLicenseFile: string;
FOnGetLicense: TGetLicenseCallback;
FLicenseLoaded: Boolean;
FRepositoryType: string;
FRepository: string;
FRepositoryUser: string;
protected
function GetLicenseText: string; override;
public
property DefaultBranch: string read FDefaultBranch write FDefaultBranch;
property RepositoryName: string read FRepositoryName write FRepositoryName;
property LicenseFile: string read FLicenseFile write FLicenseFile;
property RepositoryType: string read FRepositoryType write FRepositoryType;
property RepositoryUser: string read FRepositoryUser write FRepositoryUser;
property Repository: string read FRepository write FRepository;
property OnGetLicense: TGetLicenseCallback read FOnGetLicense write FOnGetLicense;
end;
implementation
{ TDNGitHubPackage }
{ TDNGitHubPackage }
function TDNGitHubPackage.GetLicenseText: string;
begin
if (not FLicenseLoaded) and Assigned(FOnGetLicense) then
begin
LicenseText := FOnGetLicense(Self);
FLicenseLoaded := True;
end;
Result := inherited;
end;
end.