fix environment variables

This commit is contained in:
Greg Gauthier 2025-05-05 17:40:49 +01:00
parent 858e5bb9e8
commit a8284d580a
5 changed files with 27 additions and 21 deletions

View File

@ -1,14 +1,14 @@
# Rexx Address Book # Rexx Address Book
```oorexx ```oorexx
/*************************************************************************** /***************************************************************************\
* Rexx Address Book * * Rexx Address Book *
* * * *
* A simple application for storing, maintaining, and browsing contact * * A simple application for storing, maintaining, and browsing contact *
* information. * * information. *
* * * *
* Backend: Object Rexx with unix system, and sqlite extensions. * * Backend: Object Rexx with unix, and sqlite extensions. *
* Frontend: Object Rexx with ncurses extensions. * * Frontend: Object Rexx with ncurses extensions. *
**************************************************************************/ \***************************************************************************/
``` ```

View File

@ -58,6 +58,7 @@ Exit
.environment~projectRoot = .home||"/Projects/rexx-address-book" .environment~projectRoot = .home||"/Projects/rexx-address-book"
.environment~pkgPath = .projectRoot||"/app" .environment~pkgPath = .projectRoot||"/app"
.environment~dbPath = .projectRoot||"/db" .environment~dbPath = .projectRoot||"/db"
.environment~dbFile = .dbPath||"/contacts.sqlite"
.environment["REXX_PATH"] = .projectRoot||";"||.pkgPath||";"||.dbPath||";" .environment["REXX_PATH"] = .projectRoot||";"||.pkgPath||";"||.dbPath||";"

View File

@ -9,14 +9,14 @@
expose db expose db
/* Create database directory if it doesn't exist */ /* Create database directory if it doesn't exist */
if SysFileExists(.dbPath) == .false then DO if SysFileExists(.dbFile) == .false then DO
SAY "Initializing new address book" SAY "Initializing new address book"
db = .ooSQLiteConnection~new(.dbPath) db = .ooSQLiteConnection~new(.dbFile)
self~createTables self~createTables
END END
Else Do Else Do
Say "Initializing existing address book" Say "Initializing existing address book"
db = .ooSQLiteConnection~new(.dbPath,.ooSQLite~OPEN_READWRITE) db = .ooSQLiteConnection~new(.dbFile,.ooSQLite~OPEN_READWRITE)
End End
return return

Binary file not shown.

View File

@ -8,11 +8,7 @@
***************************************************************************/ ***************************************************************************/
/* Setup environment */ /* Setup environment */
.local~home = SysGetpwnam("gmgauthier", "d") call setEnv
.local~projectRoot = .home||"/Projects/rexx-address-book"
.local~appPkg = .projectRoot||"/app"
.local~dbPath = .projectRoot||"/db/test_contacts.sqlite" /* Use a test database */
tests = .TestSuite~new() tests = .TestSuite~new()
@ -36,11 +32,20 @@ tests~tearDown
exit 0 exit 0
::ROUTINE setEnv
.environment~home = SysGetpwnam("gmgauthier", "d")
.environment~projectRoot = .home||"/Projects/rexx-address-book"
.environment~pkgPath = .projectRoot||"/app"
.environment~dbPath = .projectRoot||"/db"
.environment~dbFile = .dbPath||"/test_contacts.sqlite"
.environment["REXX_PATH"] = .projectRoot||";"||.pkgPath||";"||.dbPath||";"
::requires 'app/appdb.cls' ::requires 'app/appdb.cls'
::requires 'app/utils.rex'
::requires 'ooSQLite.cls' ::requires 'ooSQLite.cls'
::requires "rxunixsys" LIBRARY ::requires "rxunixsys" LIBRARY
::requires 'ncurses.cls' ::requires 'ncurses.cls'
::requires 'app/utils.rex'
::CLASS TestSuite ::CLASS TestSuite
@ -49,11 +54,11 @@ exit 0
::METHOD setUp ::METHOD setUp
expose db contactDict expose db contactDict
if SysFileExists(.dbPath) then do if SysFileExists(.dbFile) then do
call SysFileDelete .dbPath call SysFileDelete .dbFile
say "Deleted existing test database." say "Deleted existing test database."
end end
say "Initializing test database at:" .dbPath say "Initializing test database at:" .dbFile
db = .AddressBookDB~new() db = .AddressBookDB~new()
self~setupFixtureData() self~setupFixtureData()