This is private B4J library written in Java which we use within our company to keep versions of our B4J code. Some of you may be familiar with tools like GitHub etc... to keep track of changes you made in your source code. This is a similar tool which keeps track of changes in the B4J source code and the layout files. It is for one developer, not for teams.
With adding some simple code to each project, every time we run (well not every time, only per version number + day of the year) a backup is taken.:
Methods in the library:
Initialize:
GetMyIP:
PushVersion:
MarkChanges:
GetVersions:
Our workflow:
1. Before we start working on a project, we do a 'first' push of the day' by just running the app and older versions (not currently DEPLOYED) are zipped.
2. Then we start making changes
3. With every run, some reports are made:
Such a report can also be made manually between versions.
4. At the end of the day, our backup software backups the whole folder K:\ONETWO_VC to our NAS. This is an example of how the folder structure looks like with one of our apps.
It is an alternative way of doing Version Control without having to use external tools like GitHub. It may not be suitable for everyone's situation, but in our small team, it works very well.
Alwaysbusy
With adding some simple code to each project, every time we run (well not every time, only per version number + day of the year) a backup is taken.:
B4X:
' in Globals
Private VERSIONNUMBER As String = "1.1.2"
' in AppStart
Dim VC As ABVersionController
' list of IP Address that are allow to do a push
VC.Initialize("K:\_ONETWO_VC", Array("192.168.19.143","192.168.86.150","172.23.176.1","192.168.112.1","192.168.19.123"))
' list of folders that should be excluded when making the backup
VC.PushVersion(VERSIONNUMBER, Array("_backups", "autobackups","b4xlibs","bin","logs", "b4xlibs_BANano"))
Methods in the library:
Initialize:
Initializes the Version Controller.
Set the Root Backup Folder. In this folder, all your projects will get a sub folder per application.
Within this sub folder, Version Controller will create sub folders for each push of VERSIONNUMBER + the day of the year.
You can pass an array of IP Addresses that will allow to do a push. This is useful so only your Development Computers will do a push,
and not your Production environments.
GetMyIP:
A helper method to find out what your current (Development) IP Address is
PushVersion:
Pushes a version for today to your Root Backup Path + App Name Folder.
If there is already one pushed with the same VERSIONNUMBER for today, it will not be overwritten!
This way, ABVersionController can also make a daily report of what has been changed.
Note 1: for the first push, no report is generated as nothing has been changed with your Development path (the one pushed).
If a file named LASTDEPLOYED.txt exists in the Root Backup Path + App Name Folder, an additional report will be generated
Marking the differences between your current Development Path and the last one you deployed to your Production environment (or release).
So after e.g. you send out a release, edit the LASTDEPLOYED.txt and enter the folder name you marked as a release.
This could be something like: 1.1.2.2024106
You can pass an array of folder names you do not want to push.
Note 2: versions that are not the of today AND not marked in your LASTDEPLOYED.txt file will be zipped.
Note 3: a file named PUSHFINISHED.TXT will be generated once the push is completely finished.
MarkChanges:
Generates a HTML file with the differences between two older versions.
Note: Can only be done between folders, NOT zipped files. You will have to unzip them manually to make a report!
Example:
VC.MarkChanges("1.1.2.2024106", "1.1.2.2024108", "MyReport.html")
GetVersions:
Returns a list of all the versions of an app in your Root Backup Path + App Name Folder
This includes both the zipped and unzipped versions.
Example:
Dim Versions As List = VC.GetVersions
For i = 0 To Versions.Size - 1
Log(Versions.Get(i))
Next
Example output:
1.0.0.202499.zip
1.1.0.202499.zip
1.1.1.2024102.zip
1.1.1.2024106.zip
1.1.2.2024106
1.1.2.2024107.zip
1.1.2.2024108
Our workflow:
1. Before we start working on a project, we do a 'first' push of the day' by just running the app and older versions (not currently DEPLOYED) are zipped.
2. Then we start making changes
3. With every run, some reports are made:
- one between our current development and this 'first push', this shows all the changes we made during the day
- one between another push which we marked as 'DEPLOYED', this shows all the changes we made since our last deployment.
Such a report can also be made manually between versions.
4. At the end of the day, our backup software backups the whole folder K:\ONETWO_VC to our NAS. This is an example of how the folder structure looks like with one of our apps.
It is an alternative way of doing Version Control without having to use external tools like GitHub. It may not be suitable for everyone's situation, but in our small team, it works very well.
Alwaysbusy
Last edited: