apex-source-control
Scripts for bringing Oracle Application Express applications into version control, any version control tool may be used. Scripts are designed to work with Linux and OSX (Will not work on Windows). These scripts were designed using [this paper] (http://www.rwijk.nl/AboutOracle/psdua.pdf) as reference. If you have questions about workflow or any other concepts you should look for answers there first.
Setup
Required files and environment variables
For these scripts to work you need the APEXExport.class and APEXExportSplitter.class which come with [APEX] (http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html) as well as [ojdbc6.jar] (http://www.oracle.com/technetwork/apps-tech/jdbc-112010-090769.html) which comes with Oracle database. Note: you don't need to have oracle or apex installed locally, you just need the aforementioned files and a particular dir structure.
If you've extracted APEX then you need to set the APEX_HOME variable using:
export APEX_HOME=/path/to/apex
where path/to/apex is the directory where you extracted APEX. You'll probably want to add this to your bash profile.
The scripts will look for the required .class files in $APEX_HOME/utilities/oracle/apex/ so if you're only using the .class files set up the directory structure accordingly.
If you have a local installation of Oracle database your ORACLE_HOME variable should already be set so just need to ensure that you have the ojdbc6.jar file at $ORACLE_HOME/jdbc/lib/ojdbc6.jar. Otherwise, if you only have the ojdbc6.jar file, make a directory somewhere, set the relevant environment variable using
export ORACLE_HOME=/path/to/your/dir
and put ojdbc6.jar at $ORACLE_HOME/jdbc/lib/ojdbc6.jar as mentioned before. Again you'll want to add the above line to your bash profile.
Setting up required scripts
Grabbing the export file
Splitting the export file
Importing into Apex
npm scripts Commands
npm run apex-to-file
Turn your apex workspace project into a file directory suitable for version control tools
npm run file-to-apex
Import your file directory into apex as an apex application. This command will only work with a $PROJECT_HOME/apex/ dir which was generated by APEXExportSplitter
npm run uninstall-apex
Uninstall your app from apex
npm run create-new-app
Currently not an availible command, may be added in the future.
npm run new-conf-file
Creates a new config file using user input. NOTE: As of right now you must run 'npm run switch-conf-file' command to change to the new config file after creating a new one
npm run switch-conf-file
Switches which config file is being used
npm run read-conf-file
Outputs the name and contents of the config file currently being used
###Workflow TODO write workflow section
###Config File Explained May later add this section explaining each of the config parameters
###Known Issues
Deleting a page will always win merges
To Reproduce:
- Have two developers working on different versions of an app (i.e. working on different features to be added).
- Developer 1 deletes a page in the app and pushes to the project's repo.
- Developer 2 merges developer 1's changes and decides to keep the deleted page in the merge.
- When developer 2 reinstalls the app into apex the page will still be deleted.
Why it occurs:
Since a page was deleted, it's removed from the install.sql script generated by apex. When git sees the merge of the two developers, only one has changed the install.sql script so it automatically applies those changes to the merge meaning the page is no longer called during install so it's never created in your apex application.
How to avoid:
Be extremely cautious when deleting pages and consult with your teammates first
How to fix:
If you do end up accidently deleting a page then you will have to manually re-add the install lines to the install.sql