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
```oorexx
/***************************************************************************
/***************************************************************************\
* Rexx Address Book *
* *
* A simple application for storing, maintaining, and browsing contact *
* information. *
* *
* Backend: Object Rexx with unix system, and sqlite extensions. *
* Backend: Object Rexx with unix, and sqlite extensions. *
* Frontend: Object Rexx with ncurses extensions. *
**************************************************************************/
\***************************************************************************/
```

View File

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

View File

@ -9,14 +9,14 @@
expose db
/* 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"
db = .ooSQLiteConnection~new(.dbPath)
db = .ooSQLiteConnection~new(.dbFile)
self~createTables
END
Else Do
Say "Initializing existing address book"
db = .ooSQLiteConnection~new(.dbPath,.ooSQLite~OPEN_READWRITE)
db = .ooSQLiteConnection~new(.dbFile,.ooSQLite~OPEN_READWRITE)
End
return

Binary file not shown.

View File

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