Skip to content

Commit 636ac55

Browse files
committed
+ <use>%GitHub%/{owner}/{repro}@{branch}/path/to/codemodule</use>
1 parent 6cc5a27 commit 636ac55

File tree

5 files changed

+80
-8
lines changed

5 files changed

+80
-8
lines changed

source/forms/ACLibImportWizardForm.cls

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Private Const APPFILE_PROPNAME_APPICON As String = "AppIcon"
2222
Private Const RepositorySource_GitHub As Long = 1
2323
Private Const RepositorySource_LocalRepository As Long = 2
2424

25-
2625
Private Const TEMPDB_TABNAME As String = "tRepositoryFiles"
2726
Private Const TEMPDB_TABDDL As String = "create table " & TEMPDB_TABNAME & " (LocalRepositoryPath varchar(255) primary key, ObjectName varchar(255), Description memo)"
2827
Private m_TempDb As TempDbHandler
@@ -172,7 +171,7 @@ On Error GoTo HandleErr
172171
Me.Repaint
173172

174173
Set ACLibFileMngr = CurrentACLibFileManager
175-
If Me.ogRepositorySource = 1 Then
174+
If Me.ogRepositorySource = RepositorySource_GitHub Then
176175
Set m_ACLibFileManager = ACLibFileMngr
177176
Else '
178177
Set m_ACLibFileManager = Nothing

source/modules/ACLibFileManager.cls

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ Private Const SEARCHSTRING_REPORTIDENTIFER As String = "Begin Report"
7979

8080
Private Const MODULNAME_CONFIG_APPLICATION As String = "_config_Application"
8181

82-
Private Const REPOSTITORY_ROOT_CODE_APPLICATIONROOT As String = "%AppFolder%"
8382
Private Const REPOSTITORY_ROOT_CODE_WithoutCodeLibInfoExportFolder As String = "source"
83+
Private Const REPOSTITORY_ROOT_CODE_APPLICATIONROOT As String = "%AppFolder%"
8484
Private Const REPOSTITORY_ROOT_CODE_PRIVATEROOT As String = "%PrivateRoot%"
85+
Private Const REPOSTITORY_ROOT_CODE_GITHUBROOT As String = "%GitHub%"
8586

8687
Private m_ImportFileCollection As Collection
8788
Private m_ReplacedFilesCollection As Collection
@@ -184,11 +185,20 @@ End Sub
184185

185186
Private Sub Dispose()
186187
On Error Resume Next
188+
RemoveTempFiles
187189
Set m_ImportFileCollection = Nothing
188190
Set m_FSO = Nothing
189191
Set m_CurrentVbProject = Nothing
190192
End Sub
191193

194+
Private Sub RemoveTempFiles()
195+
196+
If FileTools.DirExists(GitHubTempRepositoryPath) Then
197+
CreateObject("Scripting.FileSystemObject").DeleteFolder GitHubTempRepositoryPath, True
198+
End If
199+
200+
End Sub
201+
192202
Public Property Let ExportAllToApplicationSourceFolder(ByVal NewValue As Boolean)
193203
m_ExportAllToApplicationSourceFolder = NewValue
194204
End Property
@@ -309,8 +319,6 @@ Public Sub ImportRepositoryFile(ByVal RepositoryPath As String, _
309319

310320
PathString = GetRepositoryFullPath(RepositoryPath)
311321

312-
313-
314322
Dim TempFile As Object
315323
Set TempFile = fso.GetFile(PathString)
316324
AddMissingFile TempFile, ImportMode
@@ -642,7 +650,21 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String
642650
End If
643651
ReleativPath = Mid$(ReleativPath, Len(REPOSTITORY_ROOT_CODE_PRIVATEROOT) + 1)
644652

653+
ElseIf Left(ReleativPath, Len(REPOSTITORY_ROOT_CODE_GITHUBROOT)) = REPOSTITORY_ROOT_CODE_GITHUBROOT Then
654+
' %GITHUB%\owner\repo@branch\Path
655+
ReleativPath = Replace(ReleativPath, "\", "/")
656+
If Not DownLoadFromGitHub(ReleativPath, RepPath) Then
657+
Err.Raise vbObjectError, "getRepositoryFullPath", "Download aus GitHub ist fehlgeschlagen"
658+
Exit Function
659+
End If
660+
661+
If Len(RepPath) = 0 Then
662+
Err.Raise vbObjectError, "getRepositoryFullPath", "Wert für lokales GitHub-Temp-Verzeichnis fehlt."
663+
Exit Function
664+
End If
665+
645666
Else
667+
646668
If m_ExportAllToApplicationSourceFolder Then
647669
RepPath = CurrentProject.Path & "\source\codelib\"
648670
Else
@@ -654,7 +676,6 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String
654676
Exit Function
655677
End If
656678

657-
658679
End If
659680

660681
Do While Left$(ReleativPath, 1) = "\"
@@ -671,6 +692,48 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String
671692

672693
End Function
673694

695+
Private Function DownLoadFromGitHub(ByVal ReleativPath As String, ByRef RepPath As String) As Boolean
696+
' %GITHUB%/owner/repo@branch/Path
697+
698+
Dim FullFilePath As String
699+
Dim GitHubDataCutPos As Long
700+
Dim GitHubUrlDataString As String
701+
Dim GitHubPath As String
702+
Dim GitHubUrlData() As String
703+
Dim RelativeFileUrl As String
704+
705+
'%GITHUB%/owner/repo@branch/Path
706+
GitHubPath = Mid(Replace(ReleativPath, "\", "/"), Len(REPOSTITORY_ROOT_CODE_GITHUBROOT) + 2)
707+
GitHubDataCutPos = InStr(InStr(1, GitHubPath, "@") + 1, GitHubPath, "/")
708+
GitHubUrlDataString = Left(GitHubPath, GitHubDataCutPos - 1)
709+
RelativeFileUrl = Mid(GitHubPath, GitHubDataCutPos + 1)
710+
GitHubUrlDataString = Replace(GitHubUrlDataString, "@", "/")
711+
712+
GitHubUrlData = Split(GitHubUrlDataString, "/")
713+
RepPath = GitHubTempRepositoryPath & "\"
714+
ReleativPath = Replace(RelativeFileUrl, "/", "\")
715+
FullFilePath = RepPath & ReleativPath
716+
717+
If Not FileTools.FileExists(FullFilePath) Then
718+
719+
With New ACLibGitHubImporter
720+
.RepositoryOwner = GitHubUrlData(0)
721+
.RepositoryName = GitHubUrlData(1)
722+
.BranchName = GitHubUrlData(2)
723+
CreateDirectoryIfMissing FileTools.PathFromFullFileName(FullFilePath)
724+
.DownloadACLibFileFromWeb RelativeFileUrl, FullFilePath
725+
End With
726+
727+
End If
728+
729+
DownLoadFromGitHub = True
730+
731+
End Function
732+
733+
Private Property Get GitHubTempRepositoryPath() As String
734+
GitHubTempRepositoryPath = FileTools.TempPath & "ACLibTempRepo"
735+
End Property
736+
674737
Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibImportMode, _
675738
Optional ByVal ImportTestFiles As Boolean = False)
676739

source/modules/WinApiShortcutMenu.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Private Declare Function TranslateMessage _
221221
Private Declare Function GetWindowRect _
222222
Lib "user32.dll" ( _
223223
ByVal Hwnd As Long, _
224-
ByRef lpRect As RECT _
224+
ByRef lpRect As Rect _
225225
) As Long
226226

227227
Private Declare Function SetMenuDefaultItem _

source/modules/_config_Application.bas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Option Compare Database
1313
Option Explicit
1414

1515
'Versionsnummer
16-
Private Const APPLICATION_VERSION As String = "1.3.3"
16+
Private Const APPLICATION_VERSION As String = "1.4.0"
1717

1818
#Const USE_CLASS_ApplicationHandler_AppFile = 1
1919
#Const USE_CLASS_ApplicationHandler_DirTextbox = 1

source/tables/L10n_Dict.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,4 +393,14 @@ Marked entries can be removed from the list with {Del} key.</LngText>
393393
<KeyText>ACLib Import Wizard: Incorrect start</KeyText>
394394
<LngText>ACLib Import Wizard: Incorrect start</LngText>
395395
</L10n_Dict>
396+
<L10n_Dict>
397+
<LangCode>DE</LangCode>
398+
<KeyText>The add-in must be installed into the Access add-in directory using the add-in manager. Afterwards it has to be started via the menu entry 'ACLib Import Wizard'.</KeyText>
399+
<LngText>DE:The add-in must be installed into the Access add-in directory using the add-in manager. Afterwards it has to be started via the menu entry 'ACLib Import Wizard'.</LngText>
400+
</L10n_Dict>
401+
<L10n_Dict>
402+
<LangCode>DE</LangCode>
403+
<KeyText>ACLib Import Wizard: Incorrect start</KeyText>
404+
<LngText>DE:ACLib Import Wizard: Incorrect start</LngText>
405+
</L10n_Dict>
396406
</dataroot>

0 commit comments

Comments
 (0)