refactor(n1): Update N1.sh to use N1_PATH instead of EDGEHILL_PATH

This commit is contained in:
Evan Morikawa 2015-10-02 11:50:42 -07:00
parent f6ef8a8b0c
commit 6d14e36e71
3 changed files with 18 additions and 15 deletions

23
N1.sh Normal file → Executable file
View file

@ -47,43 +47,46 @@ if [ $REDIRECT_STDERR ]; then
exec 2> /dev/null exec 2> /dev/null
fi fi
N1_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
export N1_PATH
if [ $OS == 'Mac' ]; then if [ $OS == 'Mac' ]; then
if [ -z "$EDGEHILL_PATH" ]; then if [ -z "$N1_PATH" ]; then
echo "Set the EDGEHILL_PATH environment variable to the absolute location of the main edgehill folder." echo "Set the N1_PATH environment variable to the absolute location of the main edgehill folder."
exit 1 exit 1
fi fi
ELECTRON_PATH=${ELECTRON_PATH:-$EDGEHILL_PATH/electron} # Set ELECTRON_PATH unless it is already set ELECTRON_PATH=${ELECTRON_PATH:-$N1_PATH/electron} # Set ELECTRON_PATH unless it is already set
# Exit if Atom can't be found # Exit if Atom can't be found
if [ -z "$ELECTRON_PATH" ]; then if [ -z "$ELECTRON_PATH" ]; then
echo "Cannot locate electron. Be sure you have run script/grunt download-electron first from $EDGEHILL_PATH" echo "Cannot locate electron. Be sure you have run script/grunt download-electron first from $N1_PATH"
exit 1 exit 1
fi fi
# We find the electron executable inside of the electron directory. # We find the electron executable inside of the electron directory.
$ELECTRON_PATH/Electron.app/Contents/MacOS/Electron --executed-from="$(pwd)" --pid=$$ "$@" $EDGEHILL_PATH $ELECTRON_PATH/Electron.app/Contents/MacOS/Electron --executed-from="$(pwd)" --pid=$$ "$@" $N1_PATH
elif [ $OS == 'Linux' ]; then elif [ $OS == 'Linux' ]; then
DOT_INBOX_DIR="$HOME/.nylas" DOT_INBOX_DIR="$HOME/.nylas"
mkdir -p "$DOT_INBOX_DIR" mkdir -p "$DOT_INBOX_DIR"
if [ -z "$EDGEHILL_PATH" ]; then if [ -z "$N1_PATH" ]; then
echo "Set the EDGEHILL_PATH environment variable to the absolute location of the main edgehill folder." echo "Set the N1_PATH environment variable to the absolute location of the main edgehill folder."
exit 1 exit 1
fi fi
ELECTRON_PATH=${ELECTRON_PATH:-$EDGEHILL_PATH/electron} # Set ELECTRON_PATH unless it is already set ELECTRON_PATH=${ELECTRON_PATH:-$N1_PATH/electron} # Set ELECTRON_PATH unless it is already set
# Exit if Atom can't be found # Exit if Atom can't be found
if [ -z "$ELECTRON_PATH" ]; then if [ -z "$ELECTRON_PATH" ]; then
echo "Cannot locate electron. Be sure you have run script/grunt download-electron first from $EDGEHILL_PATH" echo "Cannot locate electron. Be sure you have run script/grunt download-electron first from $N1_PATH"
exit 1 exit 1
fi fi
# We find the electron executable inside of the electron directory. # We find the electron executable inside of the electron directory.
$ELECTRON_PATH/electron --executed-from="$(pwd)" --pid=$$ "$@" $EDGEHILL_PATH $ELECTRON_PATH/electron --executed-from="$(pwd)" --pid=$$ "$@" $N1_PATH
fi fi

View file

@ -52,7 +52,7 @@ start = ->
Application.open(args) Application.open(args)
console.log("App load time: #{Date.now() - global.shellStartTime}ms") unless args.test console.log("App load time: #{Date.now() - global.shellStartTime}ms") unless args.test
global.devResourcePath = process.env.EDGEHILL_PATH ? process.cwd() global.devResourcePath = process.env.N1_PATH ? process.cwd()
# Normalize to make sure drive letter case is consistent on Windows # Normalize to make sure drive letter case is consistent on Windows
global.devResourcePath = path.normalize(global.devResourcePath) if global.devResourcePath global.devResourcePath = path.normalize(global.devResourcePath) if global.devResourcePath
@ -90,8 +90,8 @@ parseCommandLine = ->
opened or a new window if it hasn't. opened or a new window if it hasn't.
Environment Variables: Environment Variables:
EDGEHILL_PATH The path from which Atom loads source code in dev mode. N1_PATH The path from which Atom loads source code in dev mode.
Defaults to `cwd`. Defaults to `cwd`.
""" """
options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.') options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.')
options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.') options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.')

View file

@ -63,7 +63,7 @@
}); });
}; };
global.devResourcePath = (ref = process.env.EDGEHILL_PATH) != null ? ref : process.cwd(); global.devResourcePath = (ref = process.env.N1_PATH) != null ? ref : process.cwd();
if (global.devResourcePath) { if (global.devResourcePath) {
global.devResourcePath = path.normalize(global.devResourcePath); global.devResourcePath = path.normalize(global.devResourcePath);
@ -103,7 +103,7 @@
var args, devMode, executedFrom, logFile, newWindow, options, packageDirectoryPath, packageManifest, packageManifestPath, pathsToOpen, pidToKillWhenClosed, resourcePath, safeMode, specDirectory, specFilePattern, specsOnCommandLine, test, version; var args, devMode, executedFrom, logFile, newWindow, options, packageDirectoryPath, packageManifest, packageManifestPath, pathsToOpen, pidToKillWhenClosed, resourcePath, safeMode, specDirectory, specFilePattern, specsOnCommandLine, test, version;
version = app.getVersion(); version = app.getVersion();
options = optimist(process.argv.slice(1)); options = optimist(process.argv.slice(1));
options.usage("Atom Editor v" + version + "\n\nUsage: atom [options] [path ...]\n\nOne or more paths to files or folders to open may be specified.\n\nFile paths will open in the current window.\n\nFolder paths will open in an existing window if that folder has already been\nopened or a new window if it hasn't.\n\nEnvironment Variables:\nEDGEHILL_PATH The path from which Atom loads source code in dev mode.\n Defaults to `cwd`."); options.usage("Atom Editor v" + version + "\n\nUsage: atom [options] [path ...]\n\nOne or more paths to files or folders to open may be specified.\n\nFile paths will open in the current window.\n\nFolder paths will open in an existing window if that folder has already been\nopened or a new window if it hasn't.\n\nEnvironment Variables:\nN1_PATH The path from which Atom loads source code in dev mode.\n Defaults to `cwd`.");
options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.'); options.alias('d', 'dev').boolean('d').describe('d', 'Run in development mode.');
options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.'); options.alias('f', 'foreground').boolean('f').describe('f', 'Keep the browser process in the foreground.');
options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.'); options.alias('h', 'help').boolean('h').describe('h', 'Print this usage message.');