Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppressing modules in "Updates" that are found in "My Updates" #230

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 59 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
Here are the steps to updating to a new version:

1. Create a fork at github
- See this [guide](https://www.dataschool.io/how-to-contribute-on-github/) for setting up and using a fork
- See this [guide](https://www.dataschool.io/how-to-contribute-on-github/) for setting up and using a fork.
- See [Forking / Testing](#forking-testing) for advice to do independent testing.
2. Make whatever changes are necessary.

*Steps 3 through 10 only apply if you intend to merge your changes immediately into the master repository for Thor. This can only happen if you have access to do so and you are sure that your changes do not need any further testing by others.*
**Steps 3 through 10 only apply if you intend to merge your changes immediately into the master repository for Thor. This can only happen if you have access to do so and you are sure that your changes do not need any further testing by others.**

*If you do not intend to merge into the master repository or are in any way unsure what this means, skip directly to step 11.*

---
#### If updating Thor.App
3. Edit _Installed Files\Source\ThorVersion.h_ and change the version constants.
1. Update the AvailableVersion property in _ThorUpdater\\_ThorVersionFile.txt_. Be certain that the value be identical to the value of the `ccThorInternalVERSION` constant in _ThorVersion.h_.
1. Update the version number and date at the top of _README.md_
1. Describe the changes in _Change Log.md_.
1. Update the version number and date at the top of _README.md_.
1. Describe the changes in _Change Log.md_, set the date on the footer to recent date.
1. Run FoxBin2Prg to create the text files in folder _Installed Files_
- `DO foxbin2prg.prg WITH 'BIN2PRG','*.*'`
1. Run _BuildThor.PRG_ in folder _"Installed Files\Source"_ to re-create the APP. You will need to this in an environment where Thor is no longer running:
1. Run _BuildThor.PRG_ in folder _"Installed Files\Source"_ to re-create the APP. You will need to do this in an environment where Thor is no longer running:
- `Cancel()`
- `Close All`
- `Clear All`
Expand All @@ -39,10 +40,59 @@ This applies to all updaters except those few (15 or so) where the version infor
---
### Finally
10. In folder _ThorUpdater_, right-click _CreateThorUpdate.ps1_ and select **Run with PowerShell** from the shortcut menu to re-create the installation zip files.
1. Commit
1. Push to your fork
1. Create a pull request
11. Commit
12. Push to your fork
13. Create a pull request

### Forking / Testing
If you consider to do an independent test of your fork (or run your fork for your needs), you might want to alter the repository or the branch of Thor or [ThorRepository](https://github.com/VFPX/Thorrepository).
Repository and branch determine the URL.

The URL to a file on github comes in a form `https://github.com/VFPX/Thor/blob/master/Docs/TWEeTs.md`,
where `VFPX/Thor` is a *repository* (Thor) and *project* (VFPX), and `master` is the *branch*.
DEFINES are used to access those in several files. Alter the DEFINES to your repository and branch.

#### Common helper project
To keep the files to target a change of URL together, there is an otherwise useless project: Thor_Help.pjx.
Compile this to force changes to the DEFINE into the code.

#### Redirect Thor
You might redirect the web access from the main repository. To do so alter in:
- installed files\source\thor.h
- updaters\updates\thor_update_thor.prg
```
#Define ccThor_URL 'VFPX/Thor'
#Define ccThor_Branch '/master'
```
**Note, the leading slash on `ccThor_Branch` is mandatory.**

The following files are touched by this DEFINES and must be compiled if the DEFINE is altered. Use the [helper project] (#common-helper-project) to compile.
- installed files\source\procs_for_thor\thor_proc_check_for_updates.prg
- installed files\thor\tools\procs\thor_proc_check_for_updates.prg
- installed files\thor\tools\thor_tool_thorchangelog.prg
- installed files\thor\tools\thor_tool_thorinternalframeworkhelp.prg
- installed files\thor\tools\thor_tool_thorinternalhelp.prg
- installed files\thor\tools\thor_tool_thorinternalrepositoryhomepage.prg
- installed files\thor\tools\thor_tool_thorinternaltweets.prg
- updaters\updates\thor_update_thor.prg
- installed files\source\thor_run.vcx
- installed files\source\thorformruntool.scx

#### Redirect ThorRepository
You might redirect the web access from the main repository. To do so alter in:
- installed files\source\thor.h
- updaters\updates\thor_update_thorrepository.prg
```
#Define ccThorRepository_URL 'VFPX/ThorRepository'
#Define ccThorRepository_Branch '/master'
```

**Note, the leading slash on `ccThorRepository` is mandatory.**

The following files are touched by this DEFINES and must be compiled if the DEFINE is altered. Use the [helper project] (#common-helper-project) to compile.
- updaters\updates\old_thor_update_thor_repository.prg
- installed files\source\thor_update_thor_repository_beta.prg
- updaters\updates\thor_update_thorrepository.prg

----
Last changed: _2023/01/21_ ![Picture](vfpxpoweredby_alternative.gif)
Last changed: _2023/12/01_ ![Picture](vfpxpoweredby_alternative.gif)
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ syntax: glob
*.SAVE
*.zip
*.ZIP

*code references files
*_ref.dbf
*_ref.cdx
*_ref.fpt
*_ref.db2
2 changes: 1 addition & 1 deletion Change Log.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,4 @@ Thor Production Release - Released 2011-09-03
## Contribution
See [contribution](./.github/CONTRIBUTING.md)

Last changed: _2023/01/20_ ![Picture](Docs/Images/vfpxpoweredby_alternative.gif)
Last changed: _2023/11/27_ ![Picture](Docs/Images/vfpxpoweredby_alternative.gif)
162 changes: 83 additions & 79 deletions Installed Files/Source/Procs_For_Thor/thor_proc_check_for_updates.prg
Original file line number Diff line number Diff line change
@@ -1,79 +1,83 @@
Local laFiles[1], lcToolFolder, lcUpdateFolder, llAutoRun, lnFileCount, lnI, lnReturn

*** DH 2021-12-28: changed URL from VFPXRepository to GitHub
#Define UpdaterURL 'https://raw.githubusercontent.com/VFPX/Thor/master/ThorUpdater/Updates.zip'

WritetoCFULog('Begin CFU - ' + Transform(Datetime()))

If Not Execscript (_Screen.cThorDispatcher, 'Thor_Proc_CheckInternetConnection')
Messagebox ('No Internet Connection Found!', 16, 'No Internet Connection', 0)
Return .F.
Endif

WritetoCFULog('Checking for updates to Thor', .T.)

If Execscript (_Screen.cThorDispatcher, 'Thor_Proc_DownloadAndInstallUpdates', .T.) >= 0

lcToolFolder = Execscript (_Screen.cThorDispatcher, 'Tool Folder=')
WritetoCFULog('Erasing Thor FXP files...')
EraseFXPFiles (lcToolFolder)
WritetoCFULog('Erasing Thor FXP files from Thor Procs folder...')
EraseFXPFiles (lcToolFolder + 'Procs')
WritetoCFULog('Erasing Thor FXP files from Thor MyTools folder...')
EraseFXPFiles (lcToolFolder + 'My Tools')

lcUpdateFolder = Addbs (lcToolFolder) + 'Updates\'
lnFileCount = Adir (laFiles, lcUpdateFolder + '*.PRG')
WritetoCFULog('Processing (' + transform(lnFileCount) + ') Thor updater programs...')

For lnI = 1 To lnFileCount
If Not Upper (laFiles[lnI, 1]) == Upper ('Thor_Update_Thor.PRG')
Erase (lcUpdateFolder + laFiles[lnI, 1])
Endif
Endfor
*** Download the zip of Updaters, and install them
lnReturn = Execscript (_Screen.cThorDispatcher ;
, 'Thor_Proc_DownloadAndExtractToPath' ;
, UpdaterURL + '?=' + Sys(2015) ;
, lcToolFolder ;
, .T. ;
, 'Updates')

*** Check if called from RunThor, meaning it is from AutoRun
llAutoRun = .F.
For lnI = 1 To Program (-1)
llAutoRun = llAutoRun Or 'RUNTHOR' $ Upper (Sys(16, lnI))
Endfor

WritetoCFULog('Checking for updates to all other apps', .T.)

Execscript (_Screen.cThorDispatcher, 'Thor_Proc_DownloadAndInstallUpdates', .F., llAutoRun)

Execscript (_Screen.cThorDispatcher, 'Run')

Endif

Execscript (_Screen.cThorDispatcher, 'Thor_Tool_ThorInternalThorNews', 'Check For Updates')

Wait Clear

Return


Procedure EraseFXPFiles (tcFolder)
Local lcFolder, lnCount, lnI, loException
lcFolder = Addbs (tcFolder)
lnCount = Adir (laFiles, lcFolder + '*.FXP')
For lnI = 1 To lnCount
Try
Erase (lcFolder + laFiles[lnI, 1])
Catch To loException

Endtry
Endfor
Endproc


Procedure WritetoCFULog(tcText, tlDivider)
Execscript (_Screen.cThorDispatcher, 'Thor_Proc_WritetoCFULog(', tcText, tlDivider)
EndProc
#Include ..\Thor.h
Local laFiles[1], lcToolFolder, lcUpdateFolder, llAutoRun, lnFileCount, lnI, lnReturn

*** DH 2021-12-28: changed URL from VFPXRepository to GitHub
*SF 20231130 Change fixed URL to #DEFINE
*#Define UpdaterURL 'https://raw.githubusercontent.com/VFPX/Thor/master/ThorUpdater/Updates.zip'
#Define UpdaterURL 'https://raw.githubusercontent.com/'+ccThor_URL+ccThor_Branch+'/ThorUpdater/Updates.zip'
*/SF 20231130 Change fixed URL to #DEFINE

WritetoCFULog('Begin CFU - ' + Transform(Datetime()))

If Not Execscript (_Screen.cThorDispatcher, 'Thor_Proc_CheckInternetConnection')
Messagebox ('No Internet Connection Found!', 16, 'No Internet Connection', 0)
Return .F.
Endif

WritetoCFULog('Checking for updates to Thor', .T.)

If Execscript (_Screen.cThorDispatcher, 'Thor_Proc_DownloadAndInstallUpdates', .T.) >= 0

lcToolFolder = Execscript (_Screen.cThorDispatcher, 'Tool Folder=')
WritetoCFULog('Erasing Thor FXP files...')
EraseFXPFiles (lcToolFolder)
WritetoCFULog('Erasing Thor FXP files from Thor Procs folder...')
EraseFXPFiles (lcToolFolder + 'Procs')
WritetoCFULog('Erasing Thor FXP files from Thor MyTools folder...')
EraseFXPFiles (lcToolFolder + 'My Tools')

lcUpdateFolder = Addbs (lcToolFolder) + 'Updates\'
lnFileCount = Adir (laFiles, lcUpdateFolder + '*.PRG')
WritetoCFULog('Processing (' + transform(lnFileCount) + ') Thor updater programs...')

For lnI = 1 To lnFileCount
If Not Upper (laFiles[lnI, 1]) == Upper ('Thor_Update_Thor.PRG')
Erase (lcUpdateFolder + laFiles[lnI, 1])
Endif
Endfor
*** Download the zip of Updaters, and install them
lnReturn = Execscript (_Screen.cThorDispatcher ;
, 'Thor_Proc_DownloadAndExtractToPath' ;
, UpdaterURL + '?=' + Sys(2015) ;
, lcToolFolder ;
, .T. ;
, 'Updates')

*** Check if called from RunThor, meaning it is from AutoRun
llAutoRun = .F.
For lnI = 1 To Program (-1)
llAutoRun = llAutoRun Or 'RUNTHOR' $ Upper (Sys(16, lnI))
Endfor

WritetoCFULog('Checking for updates to all other apps', .T.)

Execscript (_Screen.cThorDispatcher, 'Thor_Proc_DownloadAndInstallUpdates', .F., llAutoRun)

Execscript (_Screen.cThorDispatcher, 'Run')

Endif

Execscript (_Screen.cThorDispatcher, 'Thor_Tool_ThorInternalThorNews', 'Check For Updates')

Wait Clear

Return


Procedure EraseFXPFiles (tcFolder)
Local lcFolder, lnCount, lnI, loException
lcFolder = Addbs (tcFolder)
lnCount = Adir (laFiles, lcFolder + '*.FXP')
For lnI = 1 To lnCount
Try
Erase (lcFolder + laFiles[lnI, 1])
Catch To loException

Endtry
Endfor
Endproc


Procedure WritetoCFULog(tcText, tlDivider)
Execscript (_Screen.cThorDispatcher, 'Thor_Proc_WritetoCFULog(', tcText, tlDivider)
EndProc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ Procedure AddUpdateFolder (loUpdateList, tlIsThor, lcUpdateFolder, lcNeverUpdate
Loop
Endif

*SF 20231201 Ignore file in Updates, if identical named file is found in My Updates; #203
IF tcFromMyUpdates=='No' AND File (tcUpdateFolder + 'My Updates\' + laFiles[lnI, 1]) Then
Loop
ENDIF &&tcFromMyUpdates=='No' AND File (tcUpdateFolder + 'My Updates\' + laFiles[lnI, 1])
*SF 20231201 Ignore file in Updates, if identical named file is found in My Updates; #203

loResult = Execscript (_Screen.cThorDispatcher, 'Thor_Proc_GetUpdaterObject2')
loResult.File = lcFile
loResult.FromMyUpdates = tcFromMyUpdates
Expand Down
Loading