Simple version replacement script.

So you have written that new, must have program. Let us see it here.
Post Reply
User avatar
BruceSteers
Posts: 362
Joined: Thursday 23rd July 2020 5:20pm

Simple version replacement script.

Post by BruceSteers » Monday 15th February 2021 4:17pm

Simple version replacement script.

I quickly made this yesterday and it's working a treat.
SetVers.gbs.zip
(1.02 KiB) Downloaded 2 times
What it does...
when i select "Make executable" in gambas i have now set the "Run this command after" option to this...

gbs3 /media/bonus/SSDiskspace/git/SetVers.gbs '$(FILE)' 'Version "*"' README.md @VERSION

The SetVers.gbs script stays in /media/bonus/SSDiskspace/git/ and i'm using it in a few of my projects.
It's arguments are
SetVers.gbs <gambas exe path> <version search string> <files>

The only option i see is $(FILE) when making an exe so the first arg for SetVers.gbs is more for getting the programs directory than the name.

In my README.md file is the line..
## ScriptED Version "2.5.2"

my VERSION file just contains the version number. 2.5.2

after gambas makes the executable it then runs this script.
the script gets the program version number from the .project file and then replaces via the supplied pattern 'Version "*"' so all between the quotes is replaced. (could use brackets or any other text)
Because VERSION file argument begins with @ this just has the version number written to it without pattern matching. just the number written to a file.

So now i no longer have to keep updating my README version number.

I can supply any number of files as arguments.

you may find it useful too.
BruceS
Wishing well
Bruce

If at first you don't succeed , try it differently.

User avatar
BruceSteers
Posts: 362
Joined: Thursday 23rd July 2020 5:20pm

Re: Simple version replacement script.

Post by BruceSteers » Tuesday 16th February 2021 1:56pm

BruceSteers wrote:
Monday 15th February 2021 4:17pm
Simple version replacement script.

The only option i see is $(FILE) when making an exe so the first arg for SetVers.gbs is more for getting the programs directory than the name.

BruceS
Update:

The "Run command After" option now supports the following.. (on master branch)
https://gitlab.com/gambas/gambas/-/comm ... 9a10160ab8

$(FILE) exe file path
$(FOLDER) project folder path
$(VERSION) project version
$(NAME) project name
$(TITLE) project title.

so now i can remove the bit in the script that checks the .project file for version and just pass it at launch.

And should open up some more after-make functionality for others :)

You're welcome :)
Bruce
Wishing well
Bruce

If at first you don't succeed , try it differently.

Post Reply