Created
April 20, 2010 03:47
-
-
Save ready4god2513/372002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # THE PROBLEM HERE IS THAT WITHOUT HARD-CODING THE PATH | |
| # IT MAY HAVE SOME ISSUES. | |
| BASEPATH=$PWD | |
| # THE BASIC ACTIONS | |
| actions=( index new_one create edit update delete ) | |
| createController() | |
| { | |
| # WE REALLY ONLY WANT TO CREATE THIS DIRECTORY IF THERE IS A "/" IN "$1" | |
| mkdir "$BASEPATH/application/controllers/$1" | |
| echo "Creating the controller now" | |
| # ONLY CREATE THIS FILE IF IT DOES NOT ALREADY EXIST. | |
| # IF WE COULD PUT THE 7 BASIC ACTIONS IN, THAT WOULD BE AWESOME. | |
| > "$BASEPATH/application/controllers/$1.php" | |
| } | |
| createViews() | |
| { | |
| mkdir "$BASEPATH/application/views/$1" | |
| for action in ${actions[@]} | |
| do | |
| echo "Creating $1/$action" | |
| echo "<?php /* $1/$action */\n" > "$BASEPATH/application/views/$1/$action.php" | |
| done | |
| } | |
| createController $1 | |
| createViews $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment