Project Setup on a Mac with NetBeans

When developing for Customer Portal, it's very handy to have your IDE handle moving files automatically to the server for rapid testing. Here's how to setup NetBeans on a Mac, along with a simple WebDAV mounting script that helps if you have multiple RightNow projects.

Basically, we'll be mounting the remote site filesystem as a local drive over WebDAV. Then we'll configure NetBeans to push our project files to this mounted filesystem whenever a file is saved, so any changes are uploaded automatically. Note that if you are working with a large team, this could cause problems with concurrency and file overwriting. There's not much we can do about this, but until Oracle RightNow implements a decent version control system on the server, this is the cleanest project workflow I've found to date.

  1. Download and install either the PHP or full version of NetBeans
  2. Here's a bash script I use to keep track of my concurrent projects. It will mount each project URL at a consistent directory location. Before working on any project you can type "mntdav [project name]" to mount the directory, and when you're done type "mntdav -u [project name]" to unmount it easily.

    #!/bin/bash

    SETUP_LOG="mntdav.log"
    TOOL_NAME="mntdav"
    HELP_HEADER="\n#########################\n# 45 North Toolkit #\n#########################\n"
    ACTION="mount"
    PROFILE=""

    profiles ()
    {
    case $PROFILE in

    # List all your projects here
    "project1") profile_action $ACTION https://project1.url/dav/ /Volumes/project1/
    ;;
    "project2") profile_action $ACTION https://project2.url/dav/ /Volumes/project2/
    ;;
    *) help_profile
    exit
    ;;
    esac
    }

    help ()
    {
    echo -e "$HELP_HEADER\nUsage:\n\t$TOOL_NAME [-u] [profile]"
    echo -e "\n[profile] is the name of a stored profile"
    echo -e "-u to unmounts a mounted profile\n"
    }

    help_action ()
    {
    echo -e "$HELP_HEADER"
    echo -e "Invalid profile action\n"
    }

    help_profile ()
    {
    echo -e "$HELP_HEADER"
    echo -e "Invalid profile name\n"
    }

    profile_action ()
    {
    case $1 in

    "mount") mkdir $3
    mount_webdav -si $2 $3
    echo -e "Mounted directory listing:"
    ls $3
    ;;
    "unmount") umount $3
    rm -r $3
    ;;
    *) help_action
    exit
    ;;
    esac
    }

    if [ "$1" = "-u" ]
    then
    if [ $# -lt 2 ]
    then
    help
    exit
    fi
    ACTION="unmount"
    PROFILE=$2
    else
    if [ $# -lt 1 ]
    then
    help
    exit
    fi
    PROFILE=$1
    fi

    profiles

  3. I always keep my project files in a repo, either on bitbucket, github, or on an internal network server if security is of paramount concern. Depending on the type of work, my high-level directory structure may look something like this:
    • site (all CP site files)
      • cp (or 'euf' if you're on less than CP3)
    • sources (image and documentation source files)
    • tutorials (client tutorial documents)
    • documents (technical and functional documentation)
    • exports (custom object, report, and workspace exports)
    • addins (add-in source code)
  4. Now, we want to setup our NetBeans project to push the CP files up to the site automatically, so for NetBeans 7.3 create a new PHP project with existing sources:
  5. Ensure that you point your project directory to either the 'euf' or 'cp' directory. This is important, as we need to make sure that the correct directory structure will be synced automatically.
  6. At this point, open up a terminal window and type "mntdav [project name]" if you are using the helper script in step 2. On the next NetBeans project setup screen, check the box to copy project files, and copy to the mounted directory's euf subfolder. Again, ensure you are pointing to the euf subfolder, so that the filesystems will be aligned.

Now, you should be setup so that any changes to your source files in NetBeans will automatically be pushed up to the remote Customer Portal filesystem.

Zircon - This is a contributing Drupal Theme
Design by WeebPal.