Permalink
Browse files

Prefixing the server commands with 'bundle exec' if a Gemfile is present

  • Loading branch information...
1 parent 2e9374e commit ceeb2bef2eefa0b549da195b8c260407335c6a39 Simon COURTOIS committed Oct 18, 2011
Showing with 15 additions and 10 deletions.
  1. +15 −10 data/ruploy-base.sh
View
@@ -56,25 +56,30 @@ directory_option() {
esac
}
+# Returns the bundle exec prefix if it is needed
+bundler_prefix() {
+ [[ -e "$DIRECTORY/Gemfile" ]] && echo "bundle exec"
+}
+
# Starts the given server instance
ruploy_start() {
echo -n "Starting ${NAME}... "
- $SERVER start \
- $(directory_option) $DIRECTORY \
- --address $ADDRESS \
- --port $PORT \
- --environment $ENVIRONMENT \
- --user $USER \
- $(pidfile_option) $PIDFILE \
- $(logfile_option) $LOGFILE \
- $OPTIONS > /dev/null
+ $(bundler_prefix) $SERVER start \
+ $(directory_option) $DIRECTORY \
+ --address $ADDRESS \
+ --port $PORT \
+ --environment $ENVIRONMENT \
+ --user $USER \
+ $(pidfile_option) $PIDFILE \
+ $(logfile_option) $LOGFILE \
+ $OPTIONS > /dev/null
ok_ko
}
# Stops the given server instance
ruploy_stop() {
echo -n "Stopping ${NAME}... "
- $SERVER stop --pid-file $PIDFILE > /dev/null 2>&1
+ $(bundler_prefix) $SERVER stop --pid-file $PIDFILE > /dev/null 2>&1
ok_ko
}

0 comments on commit ceeb2be

Please sign in to comment.