Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from maddox/forever
Forever
- Loading branch information
Showing
14 changed files
with
175 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
config/* | ||
log/* | ||
script/* | ||
.gitignore | ||
LICENCE | ||
package.json | ||
README.md |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"append": true, | ||
"watch": true, | ||
"script": "app.js" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"uid": "itunes-api", | ||
"append": true, | ||
"script": "app.js", | ||
"outFile": "log/logs.log", | ||
"errFile": "log/error.log" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.itunes-api</string> | ||
|
||
<key>EnvironmentVariables</key> | ||
<dict> | ||
<key>PATH</key> | ||
<string>/usr/local/bin/:$PATH</string> | ||
<key>NODE_ENV</key> | ||
<string>production</string> | ||
</dict> | ||
|
||
<key>Program</key> | ||
<string>script/server</string> | ||
|
||
<key>AbandonProcessGroup</key> | ||
<false/> | ||
|
||
<key>RunAtLoad</key> | ||
<true/> | ||
|
||
<key>KeepAlive</key> | ||
<dict> | ||
<key>SuccessfulExit</key> | ||
<false/> | ||
</dict> | ||
|
||
<key>WorkingDirectory</key> | ||
<string>%PATH%</string> | ||
|
||
<key>StandardErrorPath</key> | ||
<string>/Users/%USER%/Library/Logs/itunes-api.log</string> | ||
|
||
<key>StandardOutPath</key> | ||
<string>/Users/%USER%/Library/Logs/itunes-api.log</string> | ||
|
||
</dict> | ||
</plist> |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if ! test $(which forever) | ||
then | ||
echo | ||
echo "!!!!" | ||
echo "You don't have forever installed. You need to install it first." | ||
echo | ||
echo "Just install it with this command: " | ||
echo 'sudo npm install forever -g' | ||
echo | ||
exit 1 | ||
fi | ||
|
||
npm install | ||
|
||
echo "Finished setting up itunes-api! run it with script/server or install it with script/install." |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
echo "Installing itunes-api..." | ||
|
||
APP_PATH=`pwd` | ||
USER_NAME=`whoami` | ||
|
||
cp config/org.itunes-api.plist ~/Library/LaunchAgents/org.itunes-api.plist | ||
|
||
sed -i '' -e "s#%USER%#$USER_NAME#g" ~/Library/LaunchAgents/org.itunes-api.plist | ||
sed -i '' -e "s#%PATH%#$APP_PATH#g" ~/Library/LaunchAgents/org.itunes-api.plist | ||
|
||
launchctl load -w -F ~/Library/LaunchAgents/org.itunes-api.plist |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
script/uninstall | ||
script/install |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
#!/bin/sh | ||
|
||
test -z "$NODE_ENV" && | ||
export NODE_ENV='production' | ||
export NODE_ENV='development' | ||
|
||
npm run start | ||
if [ "$NODE_ENV" = "development" ]; then | ||
/usr/local/bin/forever -f config/forever/development.json | ||
else | ||
/usr/local/bin/forever start config/forever/production.json | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
echo "Uninstalling itunes-api..." | ||
forever stop itunes-api > /dev/null 2>&1 | ||
launchctl unload ~/Library/LaunchAgents/org.itunes-api.plist | ||
rm ~/Library/LaunchAgents/org.itunes-api.plist |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
echo "Updating from GitHub..." | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
git pull origin $BRANCH | ||
|
||
npm update | ||
|
||
script/restart |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Label</key> | ||
<string>org.itunes-api</string> | ||
|
||
<key>EnvironmentVariables</key> | ||
<dict> | ||
<key>PATH</key> | ||
<string>/usr/local/bin/:$PATH</string> | ||
<key>NODE_ENV</key> | ||
<string>production</string> | ||
</dict> | ||
|
||
<key>Program</key> | ||
<string>script/server</string> | ||
|
||
<key>AbandonProcessGroup</key> | ||
<false/> | ||
|
||
<key>RunAtLoad</key> | ||
<true/> | ||
|
||
<key>KeepAlive</key> | ||
<true/> | ||
|
||
<key>WorkingDirectory</key> | ||
<string>/Users/jmaddox/source/itunes</string> | ||
|
||
<key>StandardErrorPath</key> | ||
<string>/Users/jmaddox/Library/Logs/itunes-api.log</string> | ||
|
||
<key>StandardOutPath</key> | ||
<string>/Users/jmaddox/Library/Logs/itunes-api.log</string> | ||
|
||
</dict> | ||
</plist> |