diff --git a/.gitignore b/.gitignore index c516368..f9fbdbc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,7 @@ # Version Control Add-in Binaries # (This should be built from source and not committed to version control) *.mdb -*.accda -*.accdb +*.accd[aber] *.zip # Database lock files diff --git a/source/modules/GitHubTreeNodeTests.cls b/Tests/ACLibImportWizard/GitHubTreeNodeTests.cls similarity index 99% rename from source/modules/GitHubTreeNodeTests.cls rename to Tests/ACLibImportWizard/GitHubTreeNodeTests.cls index dd2a341..986844d 100644 --- a/source/modules/GitHubTreeNodeTests.cls +++ b/Tests/ACLibImportWizard/GitHubTreeNodeTests.cls @@ -1,4 +1,4 @@ -VERSION 1.0 CLASS +VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END diff --git a/source/forms/ACLibImportWizardForm.cls b/source/forms/ACLibImportWizardForm.cls index 6a934d8..1217013 100644 --- a/source/forms/ACLibImportWizardForm.cls +++ b/source/forms/ACLibImportWizardForm.cls @@ -22,7 +22,6 @@ Private Const APPFILE_PROPNAME_APPICON As String = "AppIcon" Private Const RepositorySource_GitHub As Long = 1 Private Const RepositorySource_LocalRepository As Long = 2 - Private Const TEMPDB_TABNAME As String = "tRepositoryFiles" Private Const TEMPDB_TABDDL As String = "create table " & TEMPDB_TABNAME & " (LocalRepositoryPath varchar(255) primary key, ObjectName varchar(255), Description memo)" Private m_TempDb As TempDbHandler @@ -172,7 +171,7 @@ On Error GoTo HandleErr Me.Repaint Set ACLibFileMngr = CurrentACLibFileManager - If Me.ogRepositorySource = 1 Then + If Me.ogRepositorySource = RepositorySource_GitHub Then Set m_ACLibFileManager = ACLibFileMngr Else ' Set m_ACLibFileManager = Nothing diff --git a/source/modules/ACLibFileManager.cls b/source/modules/ACLibFileManager.cls index f509693..afba0b0 100644 --- a/source/modules/ACLibFileManager.cls +++ b/source/modules/ACLibFileManager.cls @@ -48,6 +48,8 @@ Private Const SEARCHSTRING_CODELIB_BEGIN As String = "" Private Const SEARCHSTRING_CODELIB_END As String = "" Private Const SEARCHSTRING_FILE_BEGIN As String = "" Private Const SEARCHSTRING_FILE_END As String = "" +Private Const SEARCHSTRING_PACKAGE_BEGIN As String = "" +Private Const SEARCHSTRING_PACKAGE_END As String = "" Private Const SEARCHSTRING_LICENSE_BEGIN As String = "" Private Const SEARCHSTRING_LICENSE_END As String = "" Private Const SEARCHSTRING_DESCRIPTION_BEGIN As String = "" @@ -79,9 +81,10 @@ Private Const SEARCHSTRING_REPORTIDENTIFER As String = "Begin Report" Private Const MODULNAME_CONFIG_APPLICATION As String = "_config_Application" -Private Const REPOSTITORY_ROOT_CODE_APPLICATIONROOT As String = "%AppFolder%" Private Const REPOSTITORY_ROOT_CODE_WithoutCodeLibInfoExportFolder As String = "source" +Private Const REPOSTITORY_ROOT_CODE_APPLICATIONROOT As String = "%AppFolder%" Private Const REPOSTITORY_ROOT_CODE_PRIVATEROOT As String = "%PrivateRoot%" +Private Const REPOSTITORY_ROOT_CODE_GITHUBROOT As String = "%GitHub%" Private m_ImportFileCollection As Collection Private m_ReplacedFilesCollection As Collection @@ -184,11 +187,20 @@ End Sub Private Sub Dispose() On Error Resume Next + RemoveTempFiles Set m_ImportFileCollection = Nothing Set m_FSO = Nothing Set m_CurrentVbProject = Nothing End Sub +Private Sub RemoveTempFiles() + + If FileTools.DirExists(GitHubTempRepositoryPath) Then + CreateObject("Scripting.FileSystemObject").DeleteFolder GitHubTempRepositoryPath, True + End If + +End Sub + Public Property Let ExportAllToApplicationSourceFolder(ByVal NewValue As Boolean) m_ExportAllToApplicationSourceFolder = NewValue End Property @@ -309,8 +321,6 @@ Public Sub ImportRepositoryFile(ByVal RepositoryPath As String, _ PathString = GetRepositoryFullPath(RepositoryPath) - - Dim TempFile As Object Set TempFile = fso.GetFile(PathString) AddMissingFile TempFile, ImportMode @@ -642,7 +652,21 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String End If ReleativPath = Mid$(ReleativPath, Len(REPOSTITORY_ROOT_CODE_PRIVATEROOT) + 1) + ElseIf Left(ReleativPath, Len(REPOSTITORY_ROOT_CODE_GITHUBROOT)) = REPOSTITORY_ROOT_CODE_GITHUBROOT Then + ' %GITHUB%\owner\repo@branch\Path + ReleativPath = Replace(ReleativPath, "\", "/") + If Not DownLoadFromGitHub(ReleativPath, RepPath) Then + Err.Raise vbObjectError, "getRepositoryFullPath", "Download aus GitHub ist fehlgeschlagen" + Exit Function + End If + + If Len(RepPath) = 0 Then + Err.Raise vbObjectError, "getRepositoryFullPath", "Wert für lokales GitHub-Temp-Verzeichnis fehlt." + Exit Function + End If + Else + If m_ExportAllToApplicationSourceFolder Then RepPath = CurrentProject.Path & "\source\codelib\" Else @@ -654,7 +678,6 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String Exit Function End If - End If Do While Left$(ReleativPath, 1) = "\" @@ -671,6 +694,48 @@ Public Function GetRepositoryFullPath(ByVal ReleativPath As String) As String End Function +Private Function DownLoadFromGitHub(ByRef ReleativPath As String, ByRef RepPath As String) As Boolean +' %GITHUB%/owner/repo@branch/Path + + Dim FullFilePath As String + Dim GitHubDataCutPos As Long + Dim GitHubUrlDataString As String + Dim GitHubPath As String + Dim GitHubUrlData() As String + Dim RelativeFileUrl As String + + '%GITHUB%/owner/repo@branch/Path + GitHubPath = Mid(Replace(ReleativPath, "\", "/"), Len(REPOSTITORY_ROOT_CODE_GITHUBROOT) + 2) + GitHubDataCutPos = InStr(InStr(1, GitHubPath, "@") + 1, GitHubPath, "/") + GitHubUrlDataString = Left(GitHubPath, GitHubDataCutPos - 1) + RelativeFileUrl = Mid(GitHubPath, GitHubDataCutPos + 1) + GitHubUrlDataString = Replace(GitHubUrlDataString, "@", "/") + + GitHubUrlData = Split(GitHubUrlDataString, "/") + RepPath = GitHubTempRepositoryPath & "\" + ReleativPath = Replace(RelativeFileUrl, "/", "\") + FullFilePath = RepPath & ReleativPath + + If Not FileTools.FileExists(FullFilePath) Then + + With New ACLibGitHubImporter + .RepositoryOwner = GitHubUrlData(0) + .RepositoryName = GitHubUrlData(1) + .BranchName = GitHubUrlData(2) + CreateDirectoryIfMissing FileTools.PathFromFullFileName(FullFilePath) + .DownloadACLibFileFromWeb RelativeFileUrl, FullFilePath + End With + + End If + + DownLoadFromGitHub = True + +End Function + +Private Property Get GitHubTempRepositoryPath() As String + GitHubTempRepositoryPath = FileTools.TempPath & "ACLibTempRepo" +End Property + Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibImportMode, _ Optional ByVal ImportTestFiles As Boolean = False) @@ -726,6 +791,8 @@ Private Sub ImportFile(ByRef ImportFile As Object, ByRef ImportMode As CodeLibIm ImportAccessObject acForm, m_CLI, ImportFile, ImportMode Case CodeLibElementType.clet_Report ImportAccessObject acReport, m_CLI, ImportFile, ImportMode + Case CodeLibElementType.clet_Package + ' don't import package file Case Else ' eventuell Fehler auslösen? End Select @@ -1325,8 +1392,11 @@ Private Sub GetCodeLibInfoFromFile(ByRef CodeLibInf As CodeLibInfo, ByVal InputF 'Read CODELIB block CheckString = FindSubString(CheckString, SEARCHSTRING_CODELIB_BEGIN, SEARCHSTRING_CODELIB_END) If Len(CheckString) > 0 Then - GetCodeLibInfoRepositoryFile CodeLibInf, CheckString - GetCodeLibInfoRepositoryFileReplacement CodeLibInf, CheckString + GetCodeLibInfoPackage CodeLibInf, CheckString + If CodeLibInf.Type <> clet_Package Then + GetCodeLibInfoRepositoryFile CodeLibInf, CheckString + GetCodeLibInfoRepositoryFileReplacement CodeLibInf, CheckString + End If GetCodeLibInfoLicenseFile CodeLibInf, CheckString If FindDependency Then GetCodeLibInfoDependency CodeLibInf, CheckString GetCodeLibInfoReferences CodeLibInf, CheckString @@ -1337,6 +1407,15 @@ Private Sub GetCodeLibInfoFromFile(ByRef CodeLibInf As CodeLibInfo, ByVal InputF End Sub +Private Sub GetCodeLibInfoPackage(ByRef CodeLibInf As CodeLibInfo, ByRef SourceString As String) + Dim PackageName As String + PackageName = Trim(FindSubString(SourceString, SEARCHSTRING_PACKAGE_BEGIN, SEARCHSTRING_PACKAGE_END)) + If Len(PackageName) > 0 Then + CodeLibInf.Name = PackageName + CodeLibInf.Type = clet_Package + End If +End Sub + Private Sub GetCodeLibInfoRepositoryFile(ByRef CodeLibInf As CodeLibInfo, ByRef SourceString As String) CodeLibInf.RepositoryFile = Replace(FindSubString(SourceString, SEARCHSTRING_FILE_BEGIN, SEARCHSTRING_FILE_END), "\", "/") End Sub diff --git a/source/modules/AccUnit_Factory.bas b/source/modules/AccUnit_Factory.bas deleted file mode 100644 index bba943f..0000000 --- a/source/modules/AccUnit_Factory.bas +++ /dev/null @@ -1,98 +0,0 @@ -Attribute VB_Name = "AccUnit_Factory" -Option Compare Database -Option Explicit - -#Const USE_ACCUNIT_TYPELIB = 0 - -Private m_AccUnitLoaderFactory As Object -Private m_UseMatchResultCollector As Boolean - -Private Function AccUnitLoaderFactory() As Object - If m_AccUnitLoaderFactory Is Nothing Then - Set m_AccUnitLoaderFactory = Application.Run(GetAddInPath & "AccUnitLoader.GetAccUnitFactory") - If m_UseMatchResultCollector Then - m_AccUnitLoaderFactory.Init NewDebugPrintMatchResultCollector - End If - End If - Set AccUnitLoaderFactory = m_AccUnitLoaderFactory -End Function - -#If USE_ACCUNIT_TYPELIB Then -Private Property Get AccUnitFactory() As AccUnit.AccUnitFactory -#Else -Private Property Get AccUnitFactory() As Object -#End If - Set AccUnitFactory = AccUnitLoaderFactory.AccUnitFactory -End Property - -Private Function GetAddInPath() As String - GetAddInPath = Environ("appdata") & "\Microsoft\AddIns\" -End Function - -#If USE_ACCUNIT_TYPELIB Then -Public Property Get Assert() As AccUnit.Assert -#Else -Public Property Get Assert() As Object -#End If - Set Assert = AccUnitLoaderFactory.Assert -End Property - -#If USE_ACCUNIT_TYPELIB Then -Public Property Get Iz() As AccUnit.ConstraintBuilder -#Else -Public Property Get Iz() As Object -#End If - Set Iz = AccUnitLoaderFactory.ConstraintBuilder -End Property - -#If USE_ACCUNIT_TYPELIB Then -Public Property Get TestBuilder() As AccUnit.TestBuilder -#Else -Public Property Get TestBuilder() As Object -#End If - Set TestBuilder = AccUnitLoaderFactory.TestBuilder -End Property - -Public Function NewDebugPrintMatchResultCollector(Optional ByVal ShowPassedText As Boolean = False, Optional ByVal UseRaiseErrorForFailedMatch As Boolean = True) As Object - Set NewDebugPrintMatchResultCollector = AccUnitLoaderFactory.NewDebugPrintMatchResultCollector(ShowPassedText, UseRaiseErrorForFailedMatch) -End Function - -Public Function NewDebugPrintTestResultCollector() As Object - Set NewDebugPrintTestResultCollector = AccUnitLoaderFactory.NewDebugPrintTestResultCollector -End Function - -#If USE_ACCUNIT_TYPELIB Then -Public Property Get TestRunner() As AccUnit.TestRunner -#Else -Public Property Get TestRunner() As Object -#End If - If Not m_UseMatchResultCollector Then - m_UseMatchResultCollector = True - Set m_AccUnitLoaderFactory = Nothing - End If - Set TestRunner = AccUnitLoaderFactory.TestRunner -End Property - -#If USE_ACCUNIT_TYPELIB Then -Public Property Get TestSuite() As AccUnit.VBATestSuite -#Else -Public Property Get TestSuite() As Object -#End If - If m_UseMatchResultCollector Then - m_UseMatchResultCollector = False - Set m_AccUnitLoaderFactory = Nothing - End If - Set TestSuite = AccUnitLoaderFactory.DebugPrintTestSuite -End Property - -Public Sub RunTest(ByVal testClassInstance As Object, Optional ByVal MethodName As String = "*", Optional ByVal PrintSummary As Boolean = True, Optional ByVal TestResultCollector As Object) - If Not m_UseMatchResultCollector Then - m_UseMatchResultCollector = True - Set m_AccUnitLoaderFactory = Nothing - End If - AccUnitLoaderFactory.RunTest testClassInstance, MethodName, PrintSummary, TestResultCollector -End Sub - -Public Sub RunAllTests() - TestSuite.AddFromVBProject.Run -End Sub diff --git a/source/modules/AccUnit_TestClassFactory.bas b/source/modules/AccUnit_TestClassFactory.bas deleted file mode 100644 index 0ff7356..0000000 --- a/source/modules/AccUnit_TestClassFactory.bas +++ /dev/null @@ -1,8 +0,0 @@ -Attribute VB_Name = "AccUnit_TestClassFactory" -Option Compare Text -Option Explicit -Option Private Module - -Public Function AccUnitTestClassFactory_GitHubTreeNodeTests() As Object - Set AccUnitTestClassFactory_GitHubTreeNodeTests = New GitHubTreeNodeTests -End Function diff --git a/source/modules/WinApiShortcutMenu.cls b/source/modules/WinApiShortcutMenu.cls index d2c52a3..b3187f9 100644 --- a/source/modules/WinApiShortcutMenu.cls +++ b/source/modules/WinApiShortcutMenu.cls @@ -221,7 +221,7 @@ Private Declare Function TranslateMessage _ Private Declare Function GetWindowRect _ Lib "user32.dll" ( _ ByVal Hwnd As Long, _ - ByRef lpRect As RECT _ + ByRef lpRect As Rect _ ) As Long Private Declare Function SetMenuDefaultItem _ diff --git a/source/modules/_config_Application.bas b/source/modules/_config_Application.bas index eb08ce0..b72dc3e 100644 --- a/source/modules/_config_Application.bas +++ b/source/modules/_config_Application.bas @@ -13,7 +13,7 @@ Option Compare Database Option Explicit 'Versionsnummer -Private Const APPLICATION_VERSION As String = "1.3.3" +Private Const APPLICATION_VERSION As String = "1.4.0" #Const USE_CLASS_ApplicationHandler_AppFile = 1 #Const USE_CLASS_ApplicationHandler_DirTextbox = 1 diff --git a/source/modules/defGlobal_ACLibImportWizard.bas b/source/modules/defGlobal_ACLibImportWizard.bas index 05eef30..7745fc3 100644 --- a/source/modules/defGlobal_ACLibImportWizard.bas +++ b/source/modules/defGlobal_ACLibImportWizard.bas @@ -22,6 +22,7 @@ Public Enum CodeLibElementType 'angelehnt an Enum vbext_ComponentType clet_ClassModule = 2 ' = vbext_ComponentType.vbext_ct_ClassModule clet_Form = 101 ' = vbext_ComponentType.vbext_ct_Document + 1 clet_Report = 102 ' = vbext_ComponentType.vbext_ct_Document + 2 + clet_Package = 256 ' = Package (don't import file, only interpret codelib block) End Enum Public Enum CodeLibImportMode diff --git a/source/tables/L10n_Dict.xml b/source/tables/L10n_Dict.xml index 7c2c8e3..310c8dd 100644 --- a/source/tables/L10n_Dict.xml +++ b/source/tables/L10n_Dict.xml @@ -393,4 +393,14 @@ Marked entries can be removed from the list with {Del} key. ACLib Import Wizard: Incorrect start ACLib Import Wizard: Incorrect start + + 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'. + 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'. + + + DE + ACLib Import Wizard: Incorrect start + DE:ACLib Import Wizard: Incorrect start +