initial commit
This commit is contained in:
commit
5c4e69f094
28
README.md
Normal file
28
README.md
Normal file
@ -0,0 +1,28 @@
|
||||
# APEX_test_application
|
||||
Testing version control for apex apps
|
||||
|
||||
## Setup
|
||||
ensure apex is installed at /usr/local/apex
|
||||
Ensure you have ojdbc6.jar at $ORACLE_HOME/jdbc/lib
|
||||
clone the project
|
||||
Create an empty app in apex to get an app id create a config file in ./scripts
|
||||
|
||||
## Makefile Commands
|
||||
##### make help
|
||||
Display this help text
|
||||
##### make todo
|
||||
Show all lines which contain TODO in the project
|
||||
##### make apex-to-file
|
||||
Turn your apex workspace project into a file directory suitable for version control tools
|
||||
##### make file-to-apex
|
||||
Import your file directory into apex as an apex application
|
||||
##### make uninstall-apex
|
||||
Uninstall your app from apex
|
||||
##### make create-new-app
|
||||
Used for creating an entirely new instance of the app, should only be used when creating a new app instance for a new team member or for reinstalling the app
|
||||
##### make new-config-file
|
||||
Creates a new config file
|
||||
##### make switch-config-file
|
||||
Switches which config file is being used
|
||||
##### make which-config-file
|
||||
Outputs the name of the config file currently being used
|
||||
61
scripts/apexupdate.sh
Executable file
61
scripts/apexupdate.sh
Executable file
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#Script for automatically exporting the apex application from APEX
|
||||
#
|
||||
# This script is designed to be run from the top level directory of your project and will break otherwise
|
||||
|
||||
if [ -z "$ORACLE_HOME" ]; then
|
||||
echo "Missing environment variable: ORACLE_HOME. Please add the path of your oracle installation to your environment variables under the variable name ORACLE_HOME"; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$APEX_HOME" ]; then
|
||||
echo "Missing environment variable: APEX_HOME. Please add the path of your apex installation to your environment variables under the variable name APEX_HOME. Note: You should be using APEX version 5 or above"; exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e $ORACLE_HOME/jdbc/lib/ojdbc6.jar ]; then
|
||||
echo "Missing ojdbc6.jar: please download from oracle and put in $ORACLE_HOME/jdbc/lib directory"; exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e $APEX_HOME/utilities/oracle/apex/APEXExport.class ]; then
|
||||
echo "Missing APEXExport class. Please ensure you are using Apex 5 or above and have the APEXExport and APEXExportSplitter classes are in the $APEX_HOME/utilities/oracle/apex/ directory"; exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e $APEX_HOME/utilities/oracle/apex/APEXExportSplitter.class ]; then
|
||||
echo "Missing APEXExportSplitter class. Please ensure you are using Apex 5 or above and have the APEXExport and APEXExportSplitter classes are in the $APEX_HOME/utilities/oracle/apex/ directory"; exit 1
|
||||
fi
|
||||
|
||||
source ./config/apexupdate.conf
|
||||
|
||||
export CLASSPATH=$APEX_HOME/utilities:$ORACLE_HOME/jdbc/lib/ojdbc6.jar
|
||||
|
||||
export_file=f$apexappid.sql
|
||||
|
||||
if [ -d apex/ ]; then
|
||||
rm -r apex/
|
||||
fi
|
||||
if [ -e $export_file ]; then
|
||||
rm $export_file
|
||||
fi
|
||||
|
||||
java oracle.apex.APEXExport -db $database_connection -user $username -password $password -applicationid $apexappid -skipExportDate -expOriginalIds #
|
||||
|
||||
if [ ! 0 -eq $? ]; then
|
||||
echo "Exit code #: $?. An error has occured while trying to use APEXExport. Please check that your database_connection, username, password, and apexappid variables are all set correctly."; exit 1
|
||||
fi
|
||||
|
||||
java oracle.apex.APEXExportSplitter $export_file
|
||||
|
||||
if [ ! 0 -eq $? ]; then
|
||||
echo "Exit code #: $?. An error has occured while trying to use APEXExportSplitter. Please check that your apexappid variable is set correctly and that the application exists in the workspace you are trying to export from"; exit 1
|
||||
fi
|
||||
|
||||
rm $export_file
|
||||
|
||||
mv f$apexappid apex #
|
||||
cd apex
|
||||
|
||||
# below line might have to be changed to say @/hom.... instead
|
||||
sed -e s!@application!@../../apex/application! < install.sql > ../non-apex/install/install_apex_components.sql
|
||||
|
||||
cd ..
|
||||
#then run reinstall database
|
||||
36
scripts/check_conf_file.sh
Executable file
36
scripts/check_conf_file.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script is designed to be run from the top level directory of your project and will break if called from anywhere else
|
||||
|
||||
if [ ! -h ./config/apexupdate.conf ]; then
|
||||
echo "Missing symbolic link: $PWD/config/apexupdate.conf"
|
||||
echo "Please use the command 'make switch-config-file' to create the symbolic link ./config/apexupdate.conf to your config file"
|
||||
echo "If you don't have a config file set up you can create one using 'make new-config-file'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Using the config file at: $(readlink config/apexupdate.conf)"
|
||||
|
||||
source ./config/apexupdate.conf
|
||||
|
||||
if [ -z "$apexappid" ]; then
|
||||
echo "Missing config: $apexappid apexappid"; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$workspace_name" ]; then
|
||||
echo "Missing config: $workspace_name workspace_name"; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$database_connection" ]; then
|
||||
echo "Missing config: $database_connection database_connection"; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$username" ]; then
|
||||
echo "Missing config: $username username"; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$password" ]; then
|
||||
echo "Missing config: $password password"; exit 1
|
||||
fi
|
||||
|
||||
echo "Config file looks good! Moving on to the next step..."
|
||||
10
scripts/generate_new_app_id.sql
Normal file
10
scripts/generate_new_app_id.sql
Normal file
@ -0,0 +1,10 @@
|
||||
spool ../../scripts/new_app_id.txt
|
||||
set serveroutput on
|
||||
set feedback off
|
||||
begin
|
||||
apex_application_install.generate_application_id;
|
||||
dbms_output.put_Line(apex_application_install.get_application_id);
|
||||
end;
|
||||
/
|
||||
spool off
|
||||
exit
|
||||
18
scripts/install_apex.sql
Normal file
18
scripts/install_apex.sql
Normal file
@ -0,0 +1,18 @@
|
||||
declare
|
||||
p_application_id NUMBER := '&1';
|
||||
p_workspace_name varchar2(255) := '&2';
|
||||
p_parsing_schema varchar2(255) := '&3';
|
||||
l_workspace_id NUMBER;
|
||||
begin
|
||||
apex_application_install.set_application_id ( p_application_id );
|
||||
apex_application_install.set_schema( p_parsing_schema );
|
||||
apex_application_install.set_application_alias( 'F' || p_application_id );
|
||||
l_workspace_id := apex_util.find_security_group_id (p_workspace => p_workspace_name);
|
||||
APEX_APPLICATION_INSTALL.SET_WORKSPACE_ID ( l_workspace_id );
|
||||
--apex_application_install.set_offset( p_offset_num );
|
||||
apex_application_install.generate_offset;
|
||||
end;
|
||||
/
|
||||
@install_apex_components
|
||||
/
|
||||
quit
|
||||
52
scripts/make-new-config-file.sh
Executable file
52
scripts/make-new-config-file.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script is designed to be called from the top level directory of your project and must be placed in the $PROJECT_HOME/scripts/ folder
|
||||
|
||||
echo "Creating new config file..."
|
||||
|
||||
#TODO make it so that the user is given the option to automatically switch to the new config file after creation
|
||||
|
||||
echo -n "Please enter your first name: "
|
||||
read name
|
||||
if [ -z $name ]; then
|
||||
echo "Please input a value for your name before pressing enter"; exit 1
|
||||
fi
|
||||
conf_file="$name.conf"
|
||||
if [ -e ./config/$conf_file ]; then
|
||||
echo "Sorry, the file ./scripts/$conf_file already exists. Either delete the existing file or choose a different name and try again."; exit 1
|
||||
fi
|
||||
|
||||
echo -n "Please enter the apexappid you would like to use. This should be chosen very carefully to avoid conflicts with other developers' app ids: "
|
||||
read apexappid
|
||||
|
||||
echo -n "Please enter the name of your workspace: "
|
||||
read workspace_name
|
||||
|
||||
echo -n "Please enter the parsing schema for the app you are using: "
|
||||
read parsing_schema
|
||||
|
||||
echo -n "Please enter your Apex database connection in the following format [Hostname:port/SID]: "
|
||||
read database_connection
|
||||
|
||||
echo -n "Please enter your username for the given database: "
|
||||
read username
|
||||
|
||||
echo -n "Please enter your password: "
|
||||
read password
|
||||
|
||||
if [ ! -d ./config/ ]; then
|
||||
mkdir config
|
||||
fi
|
||||
|
||||
echo "apexappid=$apexappid" > ./config/$conf_file
|
||||
echo "workspace_name=$workspace_name" >> ./config/$conf_file
|
||||
echo "database_connection=$database_connection" >> ./config/$conf_file
|
||||
echo "username=$username" >> ./config/$conf_file
|
||||
echo "password=$password" >> ./config/$conf_file
|
||||
echo "parsing_schema=$parsing_schema" >> ./config/$conf_file
|
||||
|
||||
echo "Config file successfully generated! It looks like this:"
|
||||
|
||||
cat ./config/$conf_file
|
||||
|
||||
echo "If anything looks wrong you can simply edit the file yourself at ./config/$conf_file"
|
||||
30
scripts/switch-config-file.sh
Executable file
30
scripts/switch-config-file.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This script is designed to be called from the top level directory of your project and to be placed in the ./scripts/ directory
|
||||
|
||||
echo "The availible config files are:"
|
||||
|
||||
ls ./config/ | sed s/apexupdate.conf// | grep -F .conf | sed s/.conf//
|
||||
|
||||
cd config
|
||||
|
||||
#TODO the user should not have to write .conf at the end of the input
|
||||
|
||||
echo -n "Please enter the config file you would like to use: "
|
||||
read username
|
||||
|
||||
conf_file="$username.conf"
|
||||
|
||||
if [ ! -e $conf_file ]; then
|
||||
echo "Sorry, the file ./scripts/$conf_file does not exist. Either create the file using make new-config-file or choose a pre-existing config file."; exit 1
|
||||
fi
|
||||
|
||||
if [ -e apexupdate.conf ]; then
|
||||
rm apexupdate.conf
|
||||
fi
|
||||
|
||||
ln -s $conf_file apexupdate.conf
|
||||
|
||||
cd ..
|
||||
|
||||
echo "./config/apexupdate.conf now points to ./config/$( readlink ./config/apexupdate.conf )"
|
||||
18
scripts/uninstall_apex.sql
Normal file
18
scripts/uninstall_apex.sql
Normal file
@ -0,0 +1,18 @@
|
||||
declare
|
||||
p_application_id NUMBER := '&1';
|
||||
p_workspace_name varchar2(255) := '&2';
|
||||
p_parsing_schema varchar2(255) := '&3';
|
||||
l_workspace_id NUMBER;
|
||||
begin
|
||||
apex_application_install.set_application_id ( p_application_id );
|
||||
l_workspace_id := apex_util.find_security_group_id (p_workspace => p_workspace_name );
|
||||
apex_application_install.set_schema( p_parsing_schema );
|
||||
APEX_APPLICATION_INSTALL.SET_WORKSPACE_ID ( l_workspace_id );
|
||||
end;
|
||||
/
|
||||
@../../apex/application/init.sql
|
||||
@../../apex/application/set_environment.sql
|
||||
@../../apex/application/delete_application.sql
|
||||
@../../apex/application/end_environment.sql
|
||||
/
|
||||
quit
|
||||
Loading…
x
Reference in New Issue
Block a user