ソースを参照

refactoring et nouveau nom ; table UsysRegInfo restaurée ; readme maj

olivier.massot 9 年 前
コミット
c97c38a399

+ 1 - 0
.gitignore

@@ -6,6 +6,7 @@ errors/
 *.accda
 *.old
 copy.cmd
+*.log
 
 #[ automatically added by VCS
 *.mdb

+ 0 - 150
CHANGELOG.md

@@ -1,150 +0,0 @@
-Change log
-==========
-Version 1.0.0 - 11 Mar 2015
-----------------------------
-jwbrookes:
-* Added support for Table Data Macros
-* Added support for Linked Tables (supports relative paths for linked files)
-* Added support for Print Variables in Reports (Page size and orientation) 
-* Added support for Relation for all types of table
-* LoadVCS warnings removed when no object delete is required
-* Removed elements from Report export that change constantly but don't affect import
-* Fixed query import bug (complex queries being rearranged on import)
-* Fixed missing constraints in table export
-
-prmills:
-* Added support for bit fields in table Import/Export
-* Added support for References without GUIDs
-* Export all table data with `INCLUDE_TABLES = "*"`
-
-Version 0.12.0 - 28 Jan 2015
-----------------------------
-jwbrookes:
-* Refactored AppCodeImportExport into several modules
-* Added VCS_Loader, a module to import multiple vba modules into a database 
-
-
-Version 0.11.1 - 14 Jan 2015
----------------------------
-jwbrookes:
-* Fixed bug in ExportTableDef function
-* Removed redundant DeleteFile function (had been left commented out in the module)
-
-
-Version 0.11 - 01 May 2014
--------------------------
-matonb:
-* Removed DeleteFile function and replaced calls to Kill with FileSystemObject.DeleteFile
-
-
-Version 0.10 - 09 Mar 2014
--------------------------
-matonb:
-* Added DoEvents in loops to avoid "Unresponsive" state.
-
-
-Version 0.9 - 15 Feb 2014
--------------------------
-matonb:
-*  Aggressive Sanitise, moved BaseInfo from "Block" regex to Line level.
-*  Changed line level skipping to include lines with deeper indendation the follow.
-  This catches split lines mostly found in BaseInfo exports.
-
-
-Version 0.8 - 14 Feb 2014
--------------------------
-matonb:
-*  Aggressive Sanitise now excludes "BaseInfo" lines.
-  These lines were seen to be randomly switching between being empty,
-  not present or containing SQL on an arbitary basis.
-
-
-Version 0.7 - 06 Jul 2013
--------------------------
-matonb:
-*  Replaced TempFile function.
-*  Temporary file names now generated via external MS libraries.
-*  Functions using TempFile updated to only call TempFile function once.
-   *  Temporary file path and name stored in tmepFileName variable.
-   *  Temporary files deleted when done.
-*  Changed db declaration in ImportProject to DAO.database.
-
-
-Version 0.6 - 06 Jul 2013
--------------------------
-
-matonb:
-
-*  AppcodeImportExport excluded from ExportAllSource
-*  Added ImportProject sub-routine,  
-   Deletes all forms, macros, modules and queries before calling ImportAllSource.  
-   By clearing out the existing objects, you know that your database only contains  
-   code from your version control database.  
-   Excludes *AppCodeImportExport*
-
-Version 0.5 - 29 May 2013
---------------------------
-
-matonb:
-
-*  All "exclusion" patterns are now matched by regex.
-*  Added StripPublishOption constant.  
-   If set to _True_ the following lines are also excluded from the export files
-  * dbByte "PublishToWeb" ="1"
-  * PublishOption =1
-*  Added DeleteFile(FileName) function  
-   The function tries to delete _FileName_ three (3) times before giving up.  
-   A delay of 100ms is introduced between delete attempts should the first fail.
-
-Version 0.4 - 19 Apr 2013
---------------------------
-
-matonb:
-
-*  Added dbLongBinary "DOL" to aggressive sanitize, these statements were
-   appearing in queries and being flagged by git as modified in files that
-   hadn't been touched by developers.
-
-Version 0.3.2 - 8 Apr 2013
---------------------------
-
-matonb:
-* 0.3.1 Patched - Serious Problem:  SanitizeTextFiles If logic removed all
-        lines containing "Begin".
-* 0.3.2 Replaced if block for skipping code sections in SanitizeTextFiles with
-        regular expression.
-
-Version 0.3 - 6 Apr 2013
-------------------------
-
-bkidwell:
-* Sanitize query exports.
-* Fixed SERIOUS TYPO in UCS2-to-UTF-8 conversion (wrong threshold for 2 byte versus 3 byte symbol in output stream).
-* AggressiveSanitize default True.
-
-matonb:
-* Added AggressiveSanitize constant, it's a number to allow for different levels in the future. ~~Default False.~~
-* Added Skipping for GUID & Namemap in aggressive sanitize mode.
-* ~~If AggressiveSanitize is on, also sanitize query exports.~~
-* Append Number of objects imported/exported to information lines in immediate window.
-* Updated readme (removed references to terminal window).
-* Close all open forms and reports when importing and exporting because you can't import an open form or report.
-
-Version 0.2 - 4 Apr 2013
-------------------------
-
-matonb:
-* Added dbLongBinary "DOL" to SkipList in SanitizeTextFiles.
-* Added Source directory check to ImportAllSource, pops up a message box if missing.
-* Only create source directories if there is something to export.
-
-bkidwell:
-* Removed external executable for converting UCS-2-little-endian to and from UTF-8; replaced with VB6 methods.
-* Added demo database to the repository.
-* Removed the need for a special "export_[name]" query to export and import a lookup table.
-* Added check to determine if Queries, Forms, etc. are exported from THIS database (depending on which version of Access created it) uses UCS-2-little-endian, or a legacy 8-bit Windows character set. Skip converting to/from UTF-8 if not using UCS-2, because the point of the conversion was to avoid writing 0x00 bytes in the text files and confuse diff/merge tools.
-
-Version 0.1 - 22 Oct 2012
--------------------------
-
-Initial release

BIN
OpenAccess.zip


+ 6 - 2
README.md

@@ -1,8 +1,12 @@
-Based on: msaccess-vcs-integration
-[from [this page](https://github.com/timabell/msaccess-vcs-integration)
+Based on project: [msaccess-vcs-integration](https://github.com/timabell/msaccess-vcs-integration)
 
 ========================
 
+CREDITS
+---------
+This project use the code from: [msaccess-vcs-integration](https://github.com/timabell/msaccess-vcs-integration)
+Logo by [Freepik](http://www.freepik.com), from [Flaticon](http://www.flaticon.com) (licensed by [Creative Commons BY 3.0](http://creativecommons.org/licenses/by/3.0/))
+
 INSTALLATION
 ---------
 

+ 0 - 109
VCS.log

@@ -1,109 +0,0 @@
-**********************************
-04/11/2016 17:50:10 - make_sources - INFO - Optimizer: ask for confirmation
-04/11/2016 17:50:16 - make_sources - INFO - Updates sources date
-04/11/2016 17:50:16 - make_sources - INFO - Zip the app file
-04/11/2016 17:50:23 - zip_app_file - INFO - C:\APPLIS_PARC\VCS\vcs.accda zipped to C:\APPLIS_PARC\VCS\vcs.zip
-04/11/2016 17:50:23 - make_sources - INFO - Run VCS Export
-04/11/2016 17:50:23 - ExportAllSource - INFO - Begin 'Export all sources'
-04/11/2016 17:50:23 - ExportProperties - INFO - Try to export the properties of 'C:\APPLIS_PARC\VCS\vcs.accda' to 'C:\APPLIS_PARC\VCS\source\database.properties'
-04/11/2016 17:50:23 - ExportProperties - INFO - > 40 properties exported
-04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
-04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting queries...
-04/11/2016 17:50:23 - ExportAllSource - INFO - > 0 queries exported
-04/11/2016 17:50:23 - ExportAllSource - INFO - Sanitize queries...
-04/11/2016 17:50:23 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
-04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting forms...
-04/11/2016 17:50:23 - ExportAllSource - INFO - > 1 forms exported
-04/11/2016 17:50:23 - ExportAllSource - INFO - Sanitizing forms
-04/11/2016 17:50:23 - SanitizeTextFiles - INFO - > Files C:\APPLIS_PARC\VCS\source\forms\*.bas sanitized
-04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
-04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting reports...
-04/11/2016 17:50:23 - ExportAllSource - INFO - > 0 reports exported
-04/11/2016 17:50:23 - ExportAllSource - INFO - Sanitizing reports
-04/11/2016 17:50:23 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
-04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting macros...
-04/11/2016 17:50:23 - ExportAllSource - INFO - > 0 macros exported
-04/11/2016 17:50:23 - ExportAllSource - INFO - Sanitizing macros
-04/11/2016 17:50:23 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:50:23 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
-04/11/2016 17:50:23 - ExportAllSource - INFO - Exporting modules...
-04/11/2016 17:50:24 - ExportAllSource - INFO - > 19 modules exported
-04/11/2016 17:50:24 - ExportReferences - INFO - 5 references exported toC:\APPLIS_PARC\VCS\source\references.csv
-04/11/2016 17:50:24 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
-04/11/2016 17:50:24 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
-04/11/2016 17:50:24 - ClearTextFilesFromDir - INFO - Optimizer on: sub aborted
-04/11/2016 17:50:24 - ExportAllSource - INFO - Exporting tbldef...
-04/11/2016 17:50:24 - ExportAllSource - INFO - > 4 tbldef exported
-04/11/2016 17:50:24 - ExportAllSource - INFO - > 2 table's datas exported
-04/11/2016 17:50:24 - ExportAllSource - INFO - Export relations
-04/11/2016 17:50:24 - ExportAllSource - INFO - > 0 relations exported
-04/11/2016 17:50:24 - CleanDirs - INFO - Optimizer ON: cleans the directories from C:\APPLIS_PARC\VCS\source\
-04/11/2016 17:50:24 - ExportAllSource - INFO - Export done
-**********************************
-04/11/2016 17:51:29 - make_sources - INFO - Updates sources date
-04/11/2016 17:51:29 - make_sources - INFO - Zip the app file
-04/11/2016 17:51:30 - zip_app_file - INFO - C:\APPLIS_PARC\VCS\vcs.accda zipped to C:\APPLIS_PARC\VCS\vcs.zip
-04/11/2016 17:51:30 - make_sources - INFO - Run VCS Export
-04/11/2016 17:51:30 - ExportAllSource - INFO - Begin 'Export all sources'
-04/11/2016 17:51:30 - ExportProperties - INFO - Try to export the properties of 'C:\APPLIS_PARC\VCS\vcs.accda' to 'C:\APPLIS_PARC\VCS\source\database.properties'
-04/11/2016 17:51:30 - ExportProperties - INFO - > 40 properties exported
-04/11/2016 17:51:30 - ExportAllSource - INFO - Exporting queries...
-04/11/2016 17:51:30 - ExportAllSource - INFO - > 0 queries exported
-04/11/2016 17:51:30 - ExportAllSource - INFO - Sanitize queries...
-04/11/2016 17:51:30 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:51:30 - ExportAllSource - INFO - Exporting forms...
-04/11/2016 17:51:31 - ExportAllSource - INFO - > 1 forms exported
-04/11/2016 17:51:31 - ExportAllSource - INFO - Sanitizing forms
-04/11/2016 17:51:31 - SanitizeTextFiles - INFO - > Files C:\APPLIS_PARC\VCS\source\forms\*.bas sanitized
-04/11/2016 17:51:31 - ExportAllSource - INFO - Exporting reports...
-04/11/2016 17:51:31 - ExportAllSource - INFO - > 0 reports exported
-04/11/2016 17:51:31 - ExportAllSource - INFO - Sanitizing reports
-04/11/2016 17:51:31 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:51:31 - ExportAllSource - INFO - Exporting macros...
-04/11/2016 17:51:31 - ExportAllSource - INFO - > 0 macros exported
-04/11/2016 17:51:31 - ExportAllSource - INFO - Sanitizing macros
-04/11/2016 17:51:31 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:51:31 - ExportAllSource - INFO - Exporting modules...
-04/11/2016 17:51:32 - ExportAllSource - INFO - > 19 modules exported
-04/11/2016 17:51:32 - ExportReferences - INFO - 5 references exported toC:\APPLIS_PARC\VCS\source\references.csv
-04/11/2016 17:51:32 - ExportAllSource - INFO - Exporting tbldef...
-04/11/2016 17:51:32 - ExportAllSource - INFO - > 4 tbldef exported
-04/11/2016 17:51:32 - ExportAllSource - INFO - > 2 table's datas exported
-04/11/2016 17:51:32 - ExportAllSource - INFO - Export relations
-04/11/2016 17:51:32 - ExportAllSource - INFO - > 0 relations exported
-04/11/2016 17:51:32 - ExportAllSource - INFO - Export done
-**********************************
-04/11/2016 17:53:48 - make_sources - INFO - Updates sources date
-04/11/2016 17:53:48 - make_sources - INFO - Zip the app file
-04/11/2016 17:53:48 - zip_app_file - INFO - C:\APPLIS_PARC\VCS\vcs.accda zipped to C:\APPLIS_PARC\VCS\vcs.zip
-04/11/2016 17:53:48 - make_sources - INFO - Run VCS Export
-04/11/2016 17:53:48 - ExportAllSource - INFO - Begin 'Export all sources'
-04/11/2016 17:53:48 - ExportProperties - INFO - Try to export the properties of 'C:\APPLIS_PARC\VCS\vcs.accda' to 'C:\APPLIS_PARC\VCS\source\database.properties'
-04/11/2016 17:53:48 - ExportProperties - INFO - > 40 properties exported
-04/11/2016 17:53:48 - ExportAllSource - INFO - Exporting queries...
-04/11/2016 17:53:48 - ExportAllSource - INFO - > 0 queries exported
-04/11/2016 17:53:48 - ExportAllSource - INFO - Sanitize queries...
-04/11/2016 17:53:48 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:53:48 - ExportAllSource - INFO - Exporting forms...
-04/11/2016 17:53:49 - ExportAllSource - INFO - > 1 forms exported
-04/11/2016 17:53:49 - ExportAllSource - INFO - Sanitizing forms
-04/11/2016 17:53:50 - SanitizeTextFiles - INFO - > Files C:\APPLIS_PARC\VCS\source\forms\*.bas sanitized
-04/11/2016 17:53:50 - ExportAllSource - INFO - Exporting reports...
-04/11/2016 17:53:50 - ExportAllSource - INFO - > 0 reports exported
-04/11/2016 17:53:50 - ExportAllSource - INFO - Sanitizing reports
-04/11/2016 17:53:50 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:53:50 - ExportAllSource - INFO - Exporting macros...
-04/11/2016 17:53:50 - ExportAllSource - INFO - > 0 macros exported
-04/11/2016 17:53:50 - ExportAllSource - INFO - Sanitizing macros
-04/11/2016 17:53:50 - SanitizeTextFiles - INFO - > No file to sanitized
-04/11/2016 17:53:50 - ExportAllSource - INFO - Exporting modules...
-04/11/2016 17:53:50 - ExportAllSource - INFO - > 19 modules exported
-04/11/2016 17:53:50 - ExportReferences - INFO - 5 references exported toC:\APPLIS_PARC\VCS\source\references.csv
-04/11/2016 17:53:50 - ExportAllSource - INFO - Exporting tbldef...
-04/11/2016 17:53:50 - ExportAllSource - INFO - > 4 tbldef exported
-04/11/2016 17:53:50 - ExportAllSource - INFO - > 2 table's datas exported
-04/11/2016 17:53:50 - ExportAllSource - INFO - Export relations
-04/11/2016 17:53:51 - ExportAllSource - INFO - > 0 relations exported
-04/11/2016 17:53:51 - ExportAllSource - INFO - Export done

+ 0 - 2
copy.cmd

@@ -1,2 +0,0 @@
-copy vcs.accda C:\Users\olivier.massot\AppData\Roaming\Microsoft\AddIns\vcs.accda
-pause

+ 2 - 0
copy_to_addin_dir.cmd

@@ -0,0 +1,2 @@
+copy OpenAccess.accda %AppData%\Microsoft\AddIns\OpenAccess.accda
+pause

BIN
logo.png


+ 2 - 2
source/database.properties

@@ -33,8 +33,8 @@ Show Values in Non-Indexed	1	4
 Show Values in Remote	0	4
 Auto Compact	0	4
 NavPane Closed	0	4
-NavPane Width	215	4
+NavPane Width	204	4
 NavPane View By	0	4
 NavPane Sort By	1	4
-AppTitle	VCS-AddIn	10
+AppTitle	OpenAccess	10
 Property Sheet Label Width	2745	4

+ 15 - 15
source/forms/frm_vcs.bas → source/forms/frm_openaccess.bas

@@ -23,15 +23,15 @@ Begin Form
     Width =8163
     DatasheetFontHeight =11
     ItemSuffix =20
-    Left =-15975
-    Top =-1425
-    Right =-255
-    Bottom =10920
+    Left =3060
+    Top =2055
+    Right =13650
+    Bottom =10335
     DatasheetGridlinesColor =14806254
     RecSrcDt = Begin
         0x97e87bbff3d2e440
     End
-    Caption ="VCS"
+    Caption ="OpenAccess"
     DatasheetFontName ="Calibri"
     OnLoad ="[Event Procedure]"
     AllowDatasheetView =0
@@ -154,21 +154,21 @@ Begin Form
                     OverlapFlags =85
                     TextAlign =2
                     TextFontFamily =49
-                    Left =175
-                    Top =56
-                    Width =7840
-                    Height =334
+                    Left =165
+                    Top =60
+                    Width =7845
+                    Height =330
                     FontSize =12
                     FontWeight =700
                     BorderColor =8355711
                     ForeColor =8355711
                     Name ="lbl_title"
-                    Caption ="VCS - Version Control System For Access"
+                    Caption ="OpenAccess - Generate your Source Code"
                     FontName ="Consolas"
                     GridlineColor =10921638
-                    LayoutCachedLeft =175
-                    LayoutCachedTop =56
-                    LayoutCachedWidth =8015
+                    LayoutCachedLeft =165
+                    LayoutCachedTop =60
+                    LayoutCachedWidth =8010
                     LayoutCachedHeight =390
                     ThemeFontIndex =-1
                 End
@@ -376,9 +376,9 @@ Private Sub display_status(result As Variant)
             GoTo err
     End Select
     
-    MsgBox msg, vbInformation, "VCS"
+    MsgBox msg, vbInformation, "Open Access"
     
     Exit Sub
 err:
-    MsgBox msg & "> (unable to read the returned status)", vbExclamation, "VCS"
+    MsgBox msg & "> (unable to read the returned status)", vbExclamation, "Open Access"
 End Sub

+ 1 - 0
source/modules/OA_Controls.bas

@@ -0,0 +1 @@
+Option Compare Database

+ 7 - 1
source/modules/VCS_Log.bas → source/modules/OA_Log.bas

@@ -1,4 +1,6 @@
 Option Compare Database
+Option Explicit
+
 Dim log_file_path As String
 Dim debug_level As Boolean
 
@@ -23,7 +25,11 @@ Public Sub logger(ByVal origin As String, ByVal level As String, ByVal msg As St
 
     If Not Len(log_file_path) > 0 Then
     
-        log_file_path = CurrentProject.path & "\" & "VCS.log"
+        'log_file_path = CurrentProject.path & "\" & "openaccess.log"
+        
+        Call MkDirIfNotExist(Environ("AppData") & "\OpenAccess\")
+        
+        log_file_path = Environ("AppData") & "\OpenAccess\oa_" & Format(Now(), "yymmdd_hhMM") & ".log"
         Debug.Print log_file_path
         
         new_session = True

+ 7 - 64
source/modules/VCS_Main.bas → source/modules/OA_Main.bas

@@ -2,7 +2,7 @@ Option Compare Database
 
 '****
 '*
-'* Main methods for VCS add-in
+'* Main methods for OpenAccess add-in
 '*
 '****
 
@@ -11,13 +11,12 @@ Public Const opCancelled = 11
 Public Const opCompleted = 12
 
 '>> main function, called when addin is run
-Public Function vcsprompt()
+Public Function main()
 
-    DoCmd.OpenForm "frm_vcs"
+    DoCmd.OpenForm "frm_openaccess"
 
 End Function
 
-
 Public Function make_sources(Optional ByVal options As String = "") As Integer
 'exports the source-code of the app
 On Error GoTo err
@@ -31,7 +30,7 @@ Dim step As String
     
     ' backup of the sources date, in case of error
     Dim old_sources_date As Date
-    old_sources_date = vcs_param("sources_date", #1/1/1900#)
+    old_sources_date = oa_param("sources_date", #1/1/1900#)
     
     '*** If '-f' is not in the options: set the optimizer on
     If Not InStr(options, "-f") > 0 Then
@@ -42,13 +41,13 @@ Dim step As String
             msg = msg_list_to_export()
             logger "make_sources", "INFO", "Optimizer: ask for confirmation"
             If Not Len(msg) > 0 Then
-                msg = "** VCS OPTIMIZER **" & vbNewLine & ">> Nothing new to export" & vbNewLine & _
+                msg = "** O.A. OPTIMIZER **" & vbNewLine & ">> Nothing new to export" & vbNewLine & _
                             "Only the following will be exported:" & vbNewLine & _
                             " - included table data" & vbNewLine & _
                             " - relations" & vbNewLine & vbNewLine & _
                             "TIP: use 'makesources -f' to force a complete export (could be long)."
             Else
-                msg = "** VCS OPTIMIZER **" & vbNewLine & _
+                msg = "** O.A. OPTIMIZER **" & vbNewLine & _
                       ">> Following objects will be exported:" & vbNewLine & _
                       msg & vbNewLine & _
                       "> DATA: " & vbNewLine & get_include_tables() & vbNewLine & vbNewLine & _
@@ -87,7 +86,7 @@ Dim step As String
     make_sources = opCompleted
     Exit Function
 err:
-    Call update_vcs_param("sources_date", CStr(old_sources_date))
+    Call update_oa_param("sources_date", CStr(old_sources_date))
     logger "make_sources", "CRITICAL", "Unknown error at: " & step & " - " & err.Description
     Exit Function
 cancelOp:
@@ -148,62 +147,6 @@ cancelOp:
     Exit Function
 End Function
 
-Public Function config_git_repo()
-'configure the application GIT repository for VCS use
-    
-    'verify that it is a git repository
-    If Not is_git_repo() Then
-        MsgBox "Not a git repository, please use 'git init on this directory first"
-        Exit Function
-    End If
-    
-    ' complete the gitignore file
-    Call complete_gitignore
-
-End Function
-
-Public Function sync()
-'[experimental] complete command to synchronize this app with the distant master branch
-
-    'verify that it is a git repository
-    If Not is_git_repo() Then
-        MsgBox "Not a git repository, please use 'git init on this directory first"
-        Exit Function
-    End If
-
-    'Call make_sources
-
-    Call cmd("echo --ADD FILES-- & git add *" & "& timeout 2", vbNormalFocus)
-    
-    Dim msg As String
-    msg = InputBox("Commit message:", "VCS")
-    If Not Len(msg) > 0 Then GoTo err_msg
-    
-    Call cmd("echo --COMMIT-- & git commit -a -m " & Chr(34) & msg & Chr(34) & "& timeout 2", vbNormalFocus)
-    
-    Call cmd("echo --PULL-- & git pull origin master & pause", vbNormalFocus)
-    
-    Call update_from_sources
-    
-    Call cmd("echo --PUSH-- & git push origin master" & "& timeout 2", vbNormalFocus)
-
-Exit Function
-err_msg:
-    MsgBox "Invalid value", vbExclamation
-End Function
-
-
-Public Function get_include_tables()
-    get_include_tables = vcs_param("include_tables")
-End Function
-
-Public Function vcs_param(ByVal key As String, Optional ByVal default_value As String = "") As String
-    vcs_param = default_value
-    On Error GoTo err_vcs_table
-    vcs_param = DFirst("val", "ztbl_vcs", "[key]='" & key & "'")
-err_vcs_table:
-End Function
-
 
 Public Function zip_app_file() As Boolean
     On Error GoTo UnknownErr

+ 3 - 3
source/modules/VCS_Optimizer.bas → source/modules/OA_Optimizer.bas

@@ -3,7 +3,7 @@ Option Explicit
 
 '****
 '*
-'* Optimizer for VCS: only import/export objects which were updated since last import/export
+'* Optimizer for Open Access: only import/export objects which were updated since last import/export
 '*
 '****
 
@@ -151,7 +151,7 @@ End Function
 '*** sources_date is the date of the last export of the sources files
 Public Function get_sources_date() As Date
 ' get the registered sources date
-    get_sources_date = CDate(vcs_param("sources_date", "01/01/1900 00:00:00"))
+    get_sources_date = CDate(oa_param("sources_date", "01/01/1900 00:00:00"))
 
 End Function
 
@@ -161,7 +161,7 @@ Public Sub update_sources_date()
     
     new_val = CStr(Now)
     
-    Call update_vcs_param("sources_date", CStr(Now))
+    Call update_oa_param("sources_date", CStr(Now))
 
     logger "update_sources_date", "DEBUG", "Source's date updated to " & new_val
 End Sub

+ 1 - 12
source/modules/VCS_Properties.bas → source/modules/OA_Properties.bas

@@ -177,15 +177,4 @@ Public Function isReadOnly(prp As DAO.Property) As Boolean
 err:
     isReadOnly = True
     DAO.Rollback
-End Function
-
-Sub test()
-    Dim prp As Object
-    
-    For Each prp In CurrentDb.Properties
-        Call isReadOnly(prp)
-        'Debug.Print prp.name, isReadOnly(prp)
-    
-    Next prp
-    
-End Sub
+End Function

+ 0 - 0
source/modules/VCS_ShellUtilities.bas → source/modules/OA_Shell.bas


+ 169 - 0
source/modules/OA_Utils.bas

@@ -0,0 +1,169 @@
+Option Compare Database
+
+Public Function oa_tbl_exists() As Boolean
+' return True if the 'ztbl_openaccess' table exists
+On Error GoTo err
+    oa_tbl_exists = (CurrentDb.TableDefs("ztbl_openaccess").name = "ztbl_openaccess")
+Exit Function
+err:
+    If err.number = 3265 Then
+        oa_tbl_exists = False
+    Else
+        MsgBox "Error: " & err.Description, vbCritical
+    End If
+End Function
+
+
+Public Function update_oa_param(ByVal key As String, ByVal val As String)
+' create or update the parameter in ztbl_openaccess
+
+    If Not oa_tbl_exists() Then
+        Call create_oa_tbl
+    End If
+
+    If DCount("key", "ztbl_openaccess", "[key]='" & key & "'") = 1 Then
+        CurrentDb.execute "UPDATE ztbl_openaccess SET ztbl_openaccess.val = '" & val & "' " & _
+                            "WHERE (((ztbl_openaccess.key)='" & key & "'));"
+    Else
+        CurrentDb.execute "INSERT INTO ztbl_openaccess ( val, [key] ) " & _
+                           "SELECT '" & val & "' AS Expr1, '" & key & "' AS Expr2;"
+    End If
+
+End Function
+
+Public Function create_oa_tbl()
+'creates the 'ztbl_openaccess' table and hide it
+    CurrentDb.execute "SELECT 'include_tables' as key, 'ztbl_openaccess' as val INTO ztbl_openaccess;"
+    Application.SetHiddenAttribute acTable, "ztbl_openaccess", True
+End Function
+
+Public Function get_include_tables()
+    
+    get_include_tables = oa_param("include_tables")
+
+End Function
+
+Public Function oa_param(ByVal key As String, Optional ByVal default_value As String = "") As String
+    oa_param = default_value
+    On Error GoTo err_oa_table
+    oa_param = DFirst("val", "ztbl_oa", "[key]='" & key & "'")
+err_oa_table:
+End Function
+
+Public Function IsInArray(ByVal stringToBeFound As String, ByRef arr As Variant) As Boolean
+' returns True if the string is in the array
+    IsInArray = (UBound(Filter(arr, stringToBeFound)) > -1)
+End Function
+
+Public Function msys_type_filter(acType) As String
+'returns a sql filter string for the object type
+'NB: do not return system tables
+'NB2: here are the types in msysobjects table:
+'-32768 = Form
+'-32766 = Macro
+'-32764 = Report
+'32761 = Module
+'-32758  Users
+'-32757  Database Document
+'-32756  Data Access Pages
+'1   Table - Local Access Tables
+'2   Access Object - Database
+'3   Access Object - Containers
+'4   Table - Linked ODBC Tables
+'5   Queries
+'6   Table - Linked Access Tables
+'8   SubDataSheets
+
+    Select Case acType
+        Case acTable
+            msys_type_filter = "(([Type]=1 or [Type]=4 or [Type]=6) AND ([name] Not Like 'MSys*' AND [name] Not Like 'f_*_Data'))"
+        Case acQuery
+            msys_type_filter = "[Type]=5"
+        Case acForm
+            msys_type_filter = "[Type]=-32768"
+        Case acReport
+            msys_type_filter = "[Type]=-32764"
+        Case acModule
+            msys_type_filter = "[Type]=-32761"
+        Case acMacro
+            msys_type_filter = "[Type]=-32766"
+        Case Else
+            GoTo typerror
+    End Select
+
+Exit Function
+typerror:
+    MsgBox "typerror:" & acType & " is not a valid object type"
+    msys_type_filter = ""
+End Function
+
+Public Function remove_ext(ByVal filename As String) As String
+    ' removes the extension of a file name
+    If Not InStr(filename, ".") > 0 Then
+        remove_ext = filename
+        Exit Function
+    End If
+
+    Dim splitted_name As Variant
+    splitted_name = Split(filename, ".")
+
+    Dim i As Integer
+    remove_ext = ""
+    For i = 0 To (UBound(Split(filename, ".")) - 1)
+        If Len(remove_ext) > 0 Then remove_ext = remove_ext & "."
+        remove_ext = remove_ext & Split(filename, ".")(i)
+    Next i
+
+End Function
+
+Public Function complete_gitignore()
+' creates or complete the .gitignore file of the repo
+
+    Dim gitignore_path, str_existing_keys, str As String
+    
+    Dim keys() As String
+    keys = Split("*.accdb;*.laccdb;*.mdb;*.ldb;*.accde;*.mde;*.accda", ";")
+    
+    gitignore_path = CurrentProject.path & "\.gitignore"
+    
+    Dim fso As Object
+    Set fso = CreateObject("Scripting.FileSystemObject")
+    
+    Dim oFile As Object
+    If Not fso.FileExists(gitignore_path) Then
+        Set oFile = fso.CreateTextFile(gitignore_path)
+    Else
+        Set oFile = fso.OpenTextFile(gitignore_path, ForReading)
+        str_existing_keys = ""
+        
+        While Not oFile.AtEndOfStream
+            str = oFile.readline
+            If Len(str_existing_keys) = 0 Then
+                str_existing_keys = str
+            Else
+                str_existing_keys = str_existing_keys & ";" & str
+            End If
+        Wend
+        oFile.Close
+        
+        Dim existing_keys() As String
+        existing_keys = Split(str_existing_keys, ";")
+        
+        Set oFile = fso.OpenTextFile(gitignore_path, ForAppending)
+    End If
+    
+    oFile.WriteBlankLines (2)
+    oFile.WriteLine ("#[ automatically added by OpenAccess")
+    For Each key In keys
+        If Not IsInArray(key, existing_keys) Then
+            oFile.WriteLine key
+        End If
+    Next key
+    oFile.WriteLine "#]"
+    oFile.WriteBlankLines (2)
+    
+    oFile.Close
+    Set fso = Nothing
+    Set oFile = Nothing
+
+End Function

+ 0 - 76
source/modules/VCS_Controls.bas

@@ -1,76 +0,0 @@
-Option Compare Database
-
-'****
-'*
-'* VCS checks
-'*
-'****
-
-
-Sub diagnostic()
-    Dim obj As Object
-    Dim count As Integer
-    Dim td As TableDef
-    Dim qd As QueryDef
-    
-    Dim oFSO As Object
-    Set oFSO = CreateObject("Scripting.FileSystemObject")
-    Dim oFile As Object
-    Set oFile = oFSO.CreateTextFile("c:\applis_parc\ztest\diag_" & CurrentProject.name & ".txt", ForAppending)
-    
-    
-    oFile.WriteLine ("# tbl def")
-    count = 0
-    For Each td In CurrentDb.TableDefs
-        'Debug.Print td.Name
-        oFile.WriteLine td.name
-        count = count + 1
-    Next
-    Debug.Print "tbldef", count
-    
-    oFile.WriteLine ("# query def")
-    count = 0
-    For Each qd In CurrentDb.QueryDefs
-        'Debug.Print qd.Name
-        oFile.WriteLine qd.name
-        count = count + 1
-    Next
-    Debug.Print "queries", count
-    
-    oFile.WriteLine ("# reports")
-    count = 0
-    For Each obj In CurrentProject.AllReports()
-        'Debug.Print obj.Name
-        oFile.WriteLine obj.name
-        count = count + 1
-    Next
-    Debug.Print "reports", count
-    
-    oFile.WriteLine ("# forms")
-    count = 0
-    For Each obj In CurrentProject.AllForms()
-        'Debug.Print obj.Name
-        oFile.WriteLine obj.name
-        count = count + 1
-    Next
-    Debug.Print "forms", count
-    
-    oFile.WriteLine ("# macros")
-    count = 0
-    For Each obj In CurrentProject.AllMacros()
-        'Debug.Print obj.Name
-        oFile.WriteLine obj.name
-        count = count + 1
-    Next
-    Debug.Print "macros", count
-    
-    oFile.WriteLine ("# modules")
-    count = 0
-    For Each obj In CurrentProject.AllModules()
-        oFile.WriteLine obj.name
-        'Debug.Print obj.Name
-        count = count + 1
-    Next
-    Debug.Print "modules", count
-    
-End Sub

+ 0 - 66
source/modules/VCS_Git.bas

@@ -1,66 +0,0 @@
-Option Compare Database
-
-Public Function is_git_repo() As Boolean
-' returns True if current app dir is a git repository
-    is_git_repo = (dir(CurrentProject.path & "\.git\", vbDirectory) <> "")
-    
-End Function
-
-Public Function gitcmd(args)
-' run a git command on windows (eg: `gitcmd("add *")` )
-
-    Call cmd("echo -- " & args & " -- & git " & args & "& pause", vbNormalFocus)
-
-End Function
-
-Public Function complete_gitignore()
-' creates or complete the .gitignore file of the repo
-
-    Dim gitignore_path, str_existing_keys, str As String
-    
-    Dim keys() As String
-    keys = Split("*.accdb;*.laccdb;*.mdb;*.ldb;*.accde;*.mde;*.accda", ";")
-    
-    gitignore_path = CurrentProject.path & "\.gitignore"
-    
-    Dim fso As Object
-    Set fso = CreateObject("Scripting.FileSystemObject")
-    
-    Dim oFile As Object
-    If Not fso.FileExists(gitignore_path) Then
-        Set oFile = fso.CreateTextFile(gitignore_path)
-    Else
-        Set oFile = fso.OpenTextFile(gitignore_path, ForReading)
-        str_existing_keys = ""
-        
-        While Not oFile.AtEndOfStream
-            str = oFile.readline
-            If Len(str_existing_keys) = 0 Then
-                str_existing_keys = str
-            Else
-                str_existing_keys = str_existing_keys & ";" & str
-            End If
-        Wend
-        oFile.Close
-        
-        Dim existing_keys() As String
-        existing_keys = Split(str_existing_keys, ";")
-        
-        Set oFile = fso.OpenTextFile(gitignore_path, ForAppending)
-    End If
-    
-    oFile.WriteBlankLines (2)
-    oFile.WriteLine ("#[ automatically added by VCS")
-    For Each key In keys
-        If Not IsInArray(key, existing_keys) Then
-            oFile.WriteLine key
-        End If
-    Next key
-    oFile.WriteLine "#]"
-    oFile.WriteBlankLines (2)
-    
-    oFile.Close
-    Set fso = Nothing
-    Set oFile = Nothing
-
-End Function

+ 18 - 12
source/modules/VCS_ImportExport.bas

@@ -12,31 +12,37 @@ Private include_tables As String
 ' This is used in ImportAllSource
 Private Const DebugOutput As Boolean = False
 'this is used in ExportAllSource
-'Causes the VCS_ code to be exported
+'Causes the VCS_ and OA_ modules to be exported
 Private Const ArchiveMyself As Boolean = False
 
 
-'returns true if named module is NOT part of the VCS code
+'returns true if named module is NOT part of the VCS / OA code
 Private Function IsNotVCS(ByVal name As String) As Boolean
 
-    '*** ajout 12.10.16: si l'addin vcs est lancé depuis sa version dev
-    If CurrentProject.name = "vcs.accda" Then
+    '*** if OA addin is used from its developement version (OA exporting itself)
+    If CurrentProject.name = "openaccess.accda" Then
         IsNotVCS = True
         Exit Function
     End If
     '****
 
-    If name <> "VCS_ImportExport" And _
-      name <> "VCS_IE_Functions" And _
-      name <> "VCS_File" And _
+    If name <> "OA_Controls" And _
+      name <> "OA_Log" And _
+      name <> "OA_Main" And _
+      name <> "OA_Optimizer" And _
+      name <> "OA_Properties" And _
+      name <> "OA_Shell" And _
+      name <> "OA_Utils" And _
+      name <> "VCS_DataMacro" And _
       name <> "VCS_Dir" And _
-      name <> "VCS_String" And _
-      name <> "VCS_Loader" And _
-      name <> "VCS_Table" And _
+      name <> "VCS_File" And _
+      name <> "VCS_IE_Functions" And _
+      name <> "VCS_ImportExport" And _
       name <> "VCS_Reference" And _
-      name <> "VCS_DataMacro" And _
+      name <> "VCS_Relation" And _
       name <> "VCS_Report" And _
-      name <> "VCS_Relation" Then
+      name <> "VCS_String" And _
+      name <> "VCS_Table" Then
         IsNotVCS = True
     Else
         IsNotVCS = False

+ 0 - 74
source/modules/VCS_Loader.bas

@@ -1,74 +0,0 @@
-Option Compare Database
-
-Option Explicit
-
-Public Sub loadVCS(Optional ByVal SourceDirectory As String)
-    If SourceDirectory = vbNullString Then
-      SourceDirectory = CurrentProject.path & "\MSAccess-VCS\"
-    End If
-
-'check if directory exists! - SourceDirectory could be a file or not exist
-On Error GoTo Err_DirCheck
-    If ((GetAttr(SourceDirectory) And vbDirectory) = vbDirectory) Then
-        GoTo Fin_DirCheck
-    Else
-        'SourceDirectory is not a directory
-        err.Raise 60000, "loadVCS", "Source Directory specified is not a directory"
-    End If
-
-Err_DirCheck:
-    
-    If err.number = 53 Then 'SourceDirectory does not exist
-        Debug.Print err.number & " | " & "File/Directory not found"
-    Else
-        Debug.Print err.number & " | " & err.Description
-    End If
-    Exit Sub
-Fin_DirCheck:
-
-    'delete if modules already exist + provide warning of deletion?
-
-    On Error GoTo Err_DelHandler
-
-    Dim filename As String
-    'Use the list of files to import as the list to delete
-    filename = dir$(SourceDirectory & "*.bas")
-    Do Until Len(filename) = 0
-        'strip file type from file name
-        filename = Left$(filename, InStrRev(filename, ".bas") - 1)
-        DoCmd.DeleteObject acModule, filename
-        filename = dir$()
-    Loop
-
-    GoTo Fin_DelHandler
-    
-Err_DelHandler:
-    If err.number <> 7874 Then 'is not - can't find object
-        Debug.Print "WARNING (" & err.number & ") | " & err.Description
-    End If
-    Resume Next
-    
-Fin_DelHandler:
-    filename = vbNullString
-
-'import files from specific dir? or allow user to input their own dir?
-On Error GoTo Err_LoadHandler
-
-    filename = dir$(SourceDirectory & "*.bas")
-    Do Until Len(filename) = 0
-        'strip file type from file name
-        filename = Left$(filename, InStrRev(filename, ".bas") - 1)
-        Application.LoadFromText acModule, filename, SourceDirectory & filename & ".bas"
-        filename = dir$()
-    Loop
-
-    GoTo Fin_LoadHandler
-    
-Err_LoadHandler:
-    Debug.Print err.number & " | " & err.Description
-    Resume Next
-
-Fin_LoadHandler:
-    Debug.Print "Done"
-
-End Sub

+ 0 - 104
source/modules/VCS_Utilities.bas

@@ -1,104 +0,0 @@
-Option Compare Database
-
-Public Function vcs_tbl_exists()
-' return True if the 'ztbl_vcs' table exists
-On Error GoTo err
-    vcs_tbl_exists = (CurrentDb.TableDefs("ztbl_vcs").name = "ztbl_vcs")
-Exit Function
-err:
-    If err.number = 3265 Then
-        vcs_tbl_exists = False
-    Else
-        MsgBox "Error: " & err.Description, vbCritical
-    End If
-End Function
-
-
-Public Function update_vcs_param(ByVal key As String, ByVal val As String)
-' create or update the parameter in ztbl_vcs
-
-    If Not vcs_tbl_exists() Then
-        Call create_vcs_tbl
-    End If
-
-    If DCount("key", "ztbl_vcs", "[key]='" & key & "'") = 1 Then
-        CurrentDb.execute "UPDATE ztbl_vcs SET ztbl_vcs.val = '" & val & "' " & _
-                            "WHERE (((ztbl_vcs.key)='" & key & "'));"
-    Else
-        CurrentDb.execute "INSERT INTO ztbl_vcs ( val, [key] ) " & _
-                           "SELECT '" & val & "' AS Expr1, '" & key & "' AS Expr2;"
-    End If
-
-End Function
-
-Public Function create_vcs_tbl()
-'creates the 'ztbl_vcs' table and hide it
-    CurrentDb.execute "SELECT 'include_tables' as key, 'ztbl_vcs' as val INTO ztbl_vcs;"
-    Application.SetHiddenAttribute acTable, "ztbl_vcs", True
-End Function
-
-Public Function IsInArray(ByVal stringToBeFound As String, ByRef arr As Variant) As Boolean
-' returns True if the string is in the array
-    IsInArray = (UBound(Filter(arr, stringToBeFound)) > -1)
-End Function
-
-Public Function msys_type_filter(acType) As String
-'returns a sql filter string for the object type
-'NB: do not return system tables
-'NB2: here are the types in msysobjects table:
-'-32768 = Form
-'-32766 = Macro
-'-32764 = Report
-'32761 = Module
-'-32758  Users
-'-32757  Database Document
-'-32756  Data Access Pages
-'1   Table - Local Access Tables
-'2   Access Object - Database
-'3   Access Object - Containers
-'4   Table - Linked ODBC Tables
-'5   Queries
-'6   Table - Linked Access Tables
-'8   SubDataSheets
-
-    Select Case acType
-        Case acTable
-            msys_type_filter = "(([Type]=1 or [Type]=4 or [Type]=6) AND ([name] Not Like 'MSys*' AND [name] Not Like 'f_*_Data'))"
-        Case acQuery
-            msys_type_filter = "[Type]=5"
-        Case acForm
-            msys_type_filter = "[Type]=-32768"
-        Case acReport
-            msys_type_filter = "[Type]=-32764"
-        Case acModule
-            msys_type_filter = "[Type]=-32761"
-        Case acMacro
-            msys_type_filter = "[Type]=-32766"
-        Case Else
-            GoTo typerror
-    End Select
-
-Exit Function
-typerror:
-    MsgBox "typerror:" & acType & " is not a valid object type"
-    msys_type_filter = ""
-End Function
-
-Public Function remove_ext(ByVal filename As String) As String
-    ' removes the extension of a file name
-    If Not InStr(filename, ".") > 0 Then
-        remove_ext = filename
-        Exit Function
-    End If
-
-    Dim splitted_name As Variant
-    splitted_name = Split(filename, ".")
-
-    Dim i As Integer
-    remove_ext = ""
-    For i = 0 To (UBound(Split(filename, ".")) - 1)
-        If Len(remove_ext) > 0 Then remove_ext = remove_ext & "."
-        remove_ext = remove_ext & Split(filename, ".")(i)
-    Next i
-
-End Function

+ 0 - 4
source/tables/tbl_commands.txt

@@ -1,4 +0,0 @@
-cmd_name	function	description	order	with_args
-configure_git_repo	config_git_repo	Configure an existing Git repository to be used with VCS	3	Faux
-make_sources	make_sources	Makes the source-code files from the current project (-f to force a complete export)	1	Vrai
-update_from_sources	update_from_sources	Update the current project within the source-code files (-f to force a complete export)	2	Vrai

+ 0 - 3
source/tables/ztbl_vcs.txt

@@ -1,3 +0,0 @@
-key	val
-include_tables	ztbl_vcs,tbl_commands
-sources_date	04/11/2016 17:53:48

+ 0 - 7
source/tbldef/vcs_log.sql

@@ -1,7 +0,0 @@
-CREATE TABLE [vcs_log] (
-  [command] VARCHAR (255),
-  [dt] VARCHAR (255),
-  [origin] VARCHAR (255),
-  [level] VARCHAR (255),
-  [msg] VARCHAR (255)
-)

+ 1 - 1
source/tbldef/ztbl_vcs.sql → source/tbldef/ztbl_openaccess.sql

@@ -1,4 +1,4 @@
-CREATE TABLE [ztbl_vcs] (
+CREATE TABLE [ztbl_openaccess] (
   [key] VARCHAR (255),
   [val] VARCHAR (255)
 )

BIN
vcs.zip