A project managing project

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

A project managing project

Post by BruceSteers »

Currently building an app to manage all my Gambas projects.
snapshot.png
What it does...
Given a folder containing any number of gambas project folders it runs through the folders finding any gambas projects '.project' file and gets some info about it, lists all the projects and shows their icons.

Allows for each project to set a different folder to compile the executable to and give an alternative name and runs gba3 to compile.
Finds the projects required gambas components and can make a minimum install script using apt (will add other distro installers)

Makes a gambas3 upgrade script to remove gambas 3.12 and upgrade to latest stable if your app needs it.

Opens the project in the gambas IDE

Locks version number

Todo..
I dunno , you tell me.
Am thinking of adding a TextEditor and a compile/run option. then i could use it like a minimal IDE (just for code not GUI building) that would not test run the app through the IDE but actually compile the exe and run it. (sometimes been a feature i wanted the IDE to do)

I've mostly made this app to account for having an alternative folder for the executable to go in and not have the .gambas extension, like My GForm app that also has a load of example scripts and snapshots that i don't want compiled in the exe so they are in another folder.

But it's got potential to be more i think.
Once i've fine tuned it I'll upload it here

any other suggestions / requests welcome :)
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: A project managing project

Post by BruceSteers »

I've made this...
GambasAppInstallMaker.zip
It's some code i've ripped out of this GambasTweak app.

It's basically a minimum requirement (dependency) installer for any gambas app.
it asks for your gambas project directory and reads the .project file in it and gets your apps required gambas components.
It then makes a simple bash script to ask to install the minimum required stuff in the project folder or another of your choosing.
searches for apt-get yum and dnf

the script is set up in a way that it passes the components required through the GetFormat() routine (this is in case we need to change the '-' separator to a '.' or something ie. gambas3-gb-form or gambas3.gb.form as i think some distros use a different way)

the app uses the '-' separator gambas3-gb-form syntax for apt, yum and dnf

PS, it's compiled on Gambas 3.15 , if your gambas is older you can just load it up and recompile.
Double click it , point it to your app source folder.

Any additional advice/upgrade on the output install script are welcomed (support for other os's, additional cool install code anyone might have) :)


Example output script...

Code: Select all

#!/usr/bin/env bash
# Instalation script generated by GambasMan

GetFormat() {

REQS="$1"

PKGR=$(which apt-get)
if [ "$PKGR" = "" ]; then
 PKGR=$(which yum)
 if [ "$PKGR" = "" ]; then
  PKGR=$(which dnf)
  if [ "$PKGR" = "" ]; then
  echo -n "Sorry cannot find your packager\nPress return to exit."
  exit
  fi
 fi
fi
}

GetFormat "gambas3-runtime gambas3-gb-image gambas3-gb-gui-qt gambas3-gb-form gambas3-gb-eval-highlight gambas3-gb-util gambas3-gb-form-editor gambas3-gb-settings"
sudo "$PKGR" install $REQS
echo -n 'All done, Press return to exit:'
read
exit
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Help with colour format please.

Post by BruceSteers »

Hi all.

Well the GambasTweak (renamed from GambasMan) app is about ready for upload.

It currently has (and is working)
The afore mentioned way to have a source and distro folder for your project and able to compile to any given name.
You can run app with args you might have set in the IDE (gives choices like the IDE of no args, your list, and edit args)
(Edit args is incomplete in that it does not save changes to the apps .project file yet, but you can edit and use changes)
The minimum install script maker (see my last post)
A text editor using the gambas TextEditor control with all the Highlighting (a few options selectable like wordwrap,string/bracket completion).
Lists the .class and .module files in the .src folder.
Lists the Functions / Subs lines and will jump to them on clicking
Saving files is enabled.

Had an issue getting the "Import TextEditor theme from Gambas IDE" to work but sussed it.

Will clean up the app and get it ready for upload soon :)

The Main Window..
Snapshot-Main.png
The Editor...
Snapshot-Editor.png
The Argument Editor..
Snapshot-ArgEdit.png
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: A project managing project

Post by BruceSteers »

Right here it is...

I'm using it myself already for handy things like..
If i've worked on an app in 3.15 and try to load it in a lesser version the IDE crashes if i've set a "CurrentArgument" because below 3.15 stored the current arg as an integer value (the list index) now in 3.15 the field stores the actual argument as an array causing a type mismatch on load.
This app handles that so if i''m on a system with less than 3.15 and i launch gambas IDE through this app it removes the CurrentArg setting (if it contains a "[" char) before loading.

Handy for quick edits , the TextEditor is handy but boy does the Gambas3 IDE make my typing lazy. lol , the way the IDE auto capitalises words and the auto-complete options are missed but it's good for quick edits.

The compile options 1st run "gbc3 -xa folderpath" to compile all files then gba3 -o "ExePath" to create the exe.

If you don't like how the TextEditor looks there's an option to use the theme from Gambas IDE

So run it , point it to a folder containing a bunch of gambas project folders to begin.


Todo..
Going to add options to the installer copying exe somewhere like "/usr/bin/" for example and for adding menu/desktop entries.
the "Upgrade gambas to latest" hasn't been done yet.
Make readme files, help etc.
Last edited by BruceSteers on Sunday 20th September 2020 7:07pm, edited 1 time in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: A project managing project

Post by BruceSteers »

Made some updates to this

a few changes to the GUI , added some options.
Snapshot-Main.png
Upgraded the Script install makers.
There's now 2 working types.

The gambas component installer.
This creates a script to install either 'gambas3' (complete) or only the components required by your app.
When selecting it asks for the dir to create the script in (defaults to distro dir).
The script will ask the user via the terminal to choose, defaults to minimum required.

The Application installer.
This creates a script to install/Copy the gambas executable file somewhere.
When selecting it asks for the dir to create the script in (defaults to distro dir) ,
Dir can Distro folder or as many as 2 directories inside the distro folder the exe is in.
Ie. DistroFolder/ or DistroFolder/Installers/ or DistroFolder/Scripts/Installers/
Default exe installation path is to the 'bin' directory bash is in. Ie. /usr/bin/ or /bin/
User has option to type a different dir or type 'b' to 'Browse' (if zenity exists)

Here's copies of the installer files made.. (i used the app to make it's own installer)
Gambas component installer...

Code: Select all

#!/usr/bin/env bash
# Gambas component Installer script for Gambas basic application 'GambasTweak.gambas'
# Script created by GambasTweak by Bruce Steers
# Must be run from terminal, will give option to install full Gambas3 or minimum components

# Function to check for installed package installer
GetPKGR() {
echo "Checking for installed packager apt, yum or dnf..."
PKGR=$(which apt-get)
if [ "$PKGR" = "" ]; then
 PKGR=$(which yum)
 if [ "$PKGR" = "" ]; then
  PKGR=$(which dnf)
  if [ "$PKGR" = "" ]; then
  echo -n "Sorry cannot find your package installer\nPress return to exit."
  read
  exit
  fi
 fi
fi

echo "found packager '$PKGR', for install okay."
}

# Function to ask user what type of install they want and start installing...
SelectInstall() {
echo "Install $AppName's minimum required gambas components or the complete Gambas3 package?"
echo -ne "Press return for minimum components (default) or type 'f' for full Gambas3\nor Ctrl-C to cancel: "
read REPLY
if [ "$REPLY" = "f" ]; then
 echo "Installing the complete Gambas3 developement package..."
 sudo "$PKGR" install gambas3
else
 echo "Installing minimum required Gambas3 components only for '$AppName'..."
 sudo "$PKGR" install $REQS
fi

echo "All finished, press return to exit."
read
exit
}

REQS=""
RT_Yes=$(which gbr3)
if [ -z "$RT_Yes" ]; then REQS=" gambas3-runtime"; fi

AppName="GambasTweak.gambas"
REQS="gambas3-gb-image gambas3-gb-gtk gambas3-gb-form gambas3-gb-eval-highlight gambas3-gb-util gambas3-gb-form-editor gambas3-gb-settings$REQS"
GetPKGR
SelectInstall

# Script end
Application installer...

Code: Select all

#!/usr/bin/env bash
# Installer script for Gambas basic application 'GambasTweak.gambas'
# Script created by GambasTweak by Bruce Steers
# Must be run from terminal, Defaults to 'bin' directory, will give option to type or browse (if zenity exists) a different dir

# Ask for install dir and copy the executable there.
CopyApplication() {

ZEN=$(which zenity)
SDIR=$(which bash); SDIR=${SDIR%/*}

echo "Install $AppName..."
echo "Press return to install to $SDIR or type a new path now (without trailing /)"
if [ ! -z "$ZEN" ]; then echo "Or type 'b' to open a path chooser to browse"; fi
echo -n "Or press Ctrl-C to cancel: "
read REPLY
if [ "${REPLY,,}" = "b" ]; then
REPLY=$(zenity --file-selection --title="Select Install Dir for AppName" --filename="/usr/bin/$AppName" --directory)
  if [ -z "$REPLY" ]; then
  echo -n "User Cancelled, press return to quit. "
  read
  exit
  fi
fi

if [ -z "$REPLY" ]; then REPLY="$SDIR"; fi

RunCopy "$REPLY"

echo -n "All finished, press return to exit."
read
exit
}

# Run the copy command using sudo if root owns the directory
RunCopy() {
OWNER=$(ls -ld "$1"|grep drw|awk {'print $3'})
echo "Copying '$AppPath$AppName' to '$1/$AppName'"
if [ "$OWNER" = "root" ]; then
sudo cp "$AppPath$AppName" "$1/"
else
cp "$AppPath$AppName" "$1/"
fi
}


AppName="GambasTweak.gambas"
AppPath="./"

CopyApplication

# Script end
Bruce
Last edited by BruceSteers on Friday 25th September 2020 4:39pm, edited 1 time in total.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: A project managing project

Post by BruceSteers »

Been working on this a bit.
Re-evaluated the compile options as it wasn't working quite right.
Now it works splendidly win an options button to set many flags :)


I wrote a ReadMe for it so here's the details in full ..
GambasTweak by Bruce Steers.

What is it?
A Gambas3 project manager with some usefull features.

Main features.
Select the parent folder containing your gambas project folders and it reads through all your projects
getting the app icons and listing them into a convenient list.

Selecting a project displays some info about the project including it's gambas component requirements.

Maintain a distribution and source folder.
(This was main the reason i made the program to begin with)
As Gambas includes ANY files in the source folder into the compiled executable it's best
to have ONLY the required source files in the source folder.
Any other files you may want to include with your distribution Ie. help texts, snapshot images,
examples, etc would need to be in a different folder that you would put the gambas executable in
after compilation.
GambasTweak Lets you Have a "Distro" folder for your project and has options for copying the compiled
executable to there.

Other features...
Text editor.
A text editor to "quick edit" your source code , Uses the same TextEditor control the Gambas IDE uses and has
an "Import Theme from Gambas IDE" option so it will look exactly like the Gambas IDE editor with all the
same text highlighting. It lacks any of the many other features of the IDE like auto-complete/fill and is
just simply a text editor but is good for quick edits when "tweaking" your programs. It lists all the
Function/Sub calls in a list and jumps to the line on click.

Compile options.
GambasTweak can compile your source using gbc3 and gba3.
It compiles the AppName.gambas file in the source dir then copies it to the distro folder (if you have one).
Compilation options are settable and saved for each project individually.
Options (gbc3 args) include...
-x Executable mode. (define the 'Exec' preprocessor constant and remove assertions)
-a Compile All. Compile all sources in project
-w Show Warnings. Display any warning messages.
-g Add Debugging info. Add info to better debug your program if needed.
-p Make controls public. Makes objects visible to all forms in the project.
-m Make modules public. Makes modules visible to all forms.
Also...
PCODE 3.8 compatibility. Applies the GB_PCODE_VERSION=3.8 Environment variable.
Note/Warning.
Setting PCODE version to 3.8 allows your project to run on any version of Gambas >=3.8 without complaining about
a bytecode mismatch and telling you to upgrade Gambas to the version your program was compiled on. The downside
to this is if you have used any features/code only found in the new versions then your app will probably run but
crash at some point. If you've not used any new bytecode features then it will be okay so use this wisely.

Gambas IDE launcher,
Opens your project in the Gambas IDE for when you need more than a quick text editor.

Open Source / Distro Dir ,
Opens your file manager in the selected dir for convenience.
(uses xdg-open but any file manager can be set)

Run App and Argument Editor.
Your app can be launched from GambasTweak with arguments as you can in the IDE.

Edit the IDE argument list.
GambasTweak reads in your projects argument list that you have set in the IDE.
If you use GambasTweak to edit the arguments it then saves it's own version to it's own save file and will
use that list each time. Hovering over the "Run" button will show a tooltip letting you know if the arg list
is from the IDE or GambasTweak. To revert back to the IDE arglist simply select "clear args" from the menu.
GambasTweak does not edit/effect the IDE's args list in any way.

In fact the ONLY 1 change GambasTweak might make to your .project settings is if you try to load a Gambas 3.15
project into a lesser version Gambas IDE, it will crash if you don't remove the "CurrentArgument" setting as it's
variable type has changed from an Integer to an Array, So GambasTweak will remove the "CurrentArg" setting if
a 3.15 project is being loaded but the OS's Gambas is less than 3.15.

Script makers...
There are 2 working bash script creators for installing your project.
One is for the gambas-runtime and your apps gambas components and will create a shell script that asks the
user if they want to install either the complete Gambas3 package or just the components required by your app.

The other script is for installing your app. this creates a script that asks the user for the install directory
then installs/copies the App there. Defaults to the '/bin' or '/usr/bin' dir but user can choose another location.

Bruce
If at first you don't succeed , try doing something differently.
BruceS
User avatar
tincho
Posts: 57
Joined: Wednesday 10th July 2019 1:12pm

Re: A project managing project

Post by tincho »

Hi Bruce.
Interesting this project. A few months ago I did something similar [1] but I left it for lack of time and also uses texteditor.
Download your code hoping to have some time and take a look.
Greetings.
[1] https://forum.gambas.one/viewtopic.php?f=4&t=852
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: A project managing project

Post by BruceSteers »

tincho wrote: Wednesday 18th November 2020 12:04am Hi Bruce.
Interesting this project. A few months ago I did something similar [1] but I left it for lack of time and also uses texteditor.
Download your code hoping to have some time and take a look.
Greetings.
[1] https://forum.gambas.one/viewtopic.php?f=4&t=852
Hi Tincho
aah I like you have not really done much more to this project as no time.

This project was mostly made for the sole purpose of having a Distribution directory as well as a source directory, the distribution dir being free to add whatever files you want to it and not have gambas pack them up into the exe at compile.

Making the text editor was just because i could i guess, handy for quick edits but far more functionality in the Gambas IDE.

But it's a base , feel free to rip what code you want from it to enhance your own project (or vice versa)

Not sure how it changed since the last upload?
I added some handling for it to modify a .project file if trying to load a 3.15 project into 3.14 or lesser to stop gambas erasing my test args lists..
Possibly did some other stuff too.
I should probably put it on git to track changes but like i say it's a bit of a stale project at present.
Busy working on my other text editor that i'm just about to upload :)

Thank you , hope it helps :)
Bruce
If at first you don't succeed , try doing something differently.
BruceS
Post Reply