Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Apr 13, 2012
Eric Puidokas Allow Node arguments to be passed via '--node' flag 380dbd9
Showing with 50 additions and 17 deletions.
  1. +50 −17 source/bin/mojito
View
67 source/bin/mojito
@@ -1,17 +1,50 @@
-#!/usr/bin/env node
-/*
- * Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
- * Copyrights licensed under the New BSD License.
- * See the accompanying LICENSE file for terms.
- */
-var libpath, libmojito;
-try {
- // this is the normal location
- libmojito = require('mojito');
-}
-catch (e) {
- libpath = require('path'),
- // need to do this if mojito is installed via `npm link`
- libmojito = require(libpath.join(__dirname, '..', 'lib'));
-}
-libmojito.include('management/cli');
+#!/bin/bash
+#
+# Copyright (c) 2011-2012, Yahoo! Inc. All rights reserved.
+# Copyrights licensed under the New BSD License.
+# See the accompanying LICENSE file for terms.
+#
+
+# Separate Mojito's arguments from Node's arguments
+MOJITO_ARGS=""
+FOUND_NODE_ARGS=0
+for ARG in "$@"; do
+ if [ "$ARG" == "--node" ]; then
+ FOUND_NODE_ARGS=1
+ else
+ if [ $FOUND_NODE_ARGS -eq 1 ]; then
+ NODE_ARGS="$ARG"
+ FOUND_NODE_ARGS=0
+ else
+ ARG=`echo $(printf '%q' "$ARG")`
+ MOJITO_ARGS="$MOJITO_ARGS $ARG"
+ fi
+ fi
+done
+
+# Determine the location of this script
+# http://stackoverflow.com/a/179231
+pushd . > /dev/null
+SCRIPT_PATH="${BASH_SOURCE[0]}";
+if ([ -h "${SCRIPT_PATH}" ]) then
+ while([ -h "${SCRIPT_PATH}" ]) do cd `dirname "$SCRIPT_PATH"`; SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
+fi
+cd `dirname ${SCRIPT_PATH}` > /dev/null
+SCRIPT_PATH=`pwd`;
+popd > /dev/null
+
+# Run mojito from this script's location
+cd $SCRIPT_PATH
+node $NODE_ARGS -e "\
+\
+var libpath, libmojito;\
+try {\
+ libmojito = require('mojito');\
+}\
+catch (e) {\
+ libpath = require('path'),\
+ libmojito = require(libpath.join(__dirname, '..', 'lib'));\
+}\
+libmojito.include('management/cli');\
+\
+" NODE_COMMAND_BUG_WORKAROUND $MOJITO_ARGS

No commit comments for this range

Something went wrong with that request. Please try again.