Create a gist now

Instantly share code, notes, and snippets.

@mattfelsen /setup.sh
Last active Aug 29, 2015

What would you like to do?
Local Projects openFrameworks New Project Setup
#!/bin/bash
#
# NOTE: The openFrameworks folder structure (particularly with regard to the projectGenerator)
# has changed since this script was written, so this will probably not work!
# (The parts about creating a new project toward the end, at least.)
#
#
# usage:
#
# ./setup.sh <project-name> <git-remote-url>
#
# examples:
#
# For a GitHub-hosted project:
# ./setup.sh ProjectName https://github.com/local-projects/ProjectName.git
#
# For an Assembla-hosted project:
# ./setup.sh ProjectName git@git.assembla.com:project-name.repo-name.git
#
# TODO
# need to do some checking on $1 and $2 to see if they're empty, whether
# $1 is a URL and we're already inside the project dir, etc.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#
# project folder setup
#
# create the project folder, move in
mkdir $1
cd $1
# make the folder structure
mkdir Apps
mkdir Configs
mkdir Deployment
mkdir Deployment/Scripts
mkdir Documentation
mkdir ExternalAddons
mkdir Scripts
mkdir Sketches
# create stubs for scripts
touch build.command
touch Scripts/start.command
touch Scripts/stop.command
# create stub for readme
touch README.md
#
# git repo setup
#
# make a repo
git init
# add origin remote to point at new project repo
git remote add origin $2
#
# openFrameworks setup
#
# add as submodule
git submodule add https://github.com/local-projects/openFrameworks.git
# switch to the stable branch
# this corresponds to the latest release
cd openFrameworks
git checkout stable
# add the official OF repo as a remote
# so changes can be synced
git remote add upstream https://github.com/openframeworks/openFrameworks.git
# stage the submodule's commit to the stable branch instead of master
cd ..
git add openFrameworks
#
# openFrameworks projectGenerator
#
# build the projectGenerator
cd openFrameworks/apps/devApps/projectGenerator/
xcodebuild
# set the projectGenerator OF root to our newly cloned OF repo
echo $DIR/$1/openFrameworks > ~/.ofprojectgenerator/config
# create the first app for the new project
./bin/emptyExample.app/Contents/MacOS/emptyExample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment