refactor(code): replace all instances of atom-shell and AtomShell and atomShell

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D1537
This commit is contained in:
Evan Morikawa 2015-05-20 10:20:10 -07:00
parent 80adb41d2e
commit 0588b0c7eb
15 changed files with 46 additions and 46 deletions

2
.gitignore vendored
View file

@ -9,7 +9,7 @@ node_modules
npm-debug.log npm-debug.log
debug.log debug.log
/tags /tags
/atom-shell/ /electron/
docs/output docs/output
docs/includes docs/includes
spec/fixtures/evil-files/ spec/fixtures/evil-files/

View file

@ -53,7 +53,7 @@ if [ $OS == 'Mac' ]; then
exit 1 exit 1
fi fi
ELECTRON_PATH=${ELECTRON_PATH:-$EDGEHILL_PATH/atom-shell} # Set ELECTRON_PATH unless it is already set ELECTRON_PATH=${ELECTRON_PATH:-$EDGEHILL_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
@ -61,7 +61,7 @@ if [ $OS == 'Mac' ]; then
exit 1 exit 1
fi fi
# We find the atom-shell executable inside of the atom-shell 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=$$ "$@" $EDGEHILL_PATH
elif [ $OS == 'Linux' ]; then elif [ $OS == 'Linux' ]; then
@ -78,11 +78,11 @@ elif [ $OS == 'Linux' ]; then
# 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 atom-shell. Be sure you have run script/grunt download-atom-shell first from $EDGEHILL_PATH" echo "Cannot locate electron. Be sure you have run script/grunt download-electron first from $EDGEHILL_PATH"
exit 1 exit 1
fi fi
# We find the electron executable inside of the atom-shell 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=$$ "$@" $EDGEHILL_PATH
fi fi

View file

@ -59,8 +59,8 @@ module.exports = (grunt) ->
grunt.loadNpmTasks('grunt-contrib-less') grunt.loadNpmTasks('grunt-contrib-less')
grunt.loadNpmTasks('grunt-shell') grunt.loadNpmTasks('grunt-shell')
grunt.loadNpmTasks('grunt-markdown') grunt.loadNpmTasks('grunt-markdown')
grunt.loadNpmTasks('grunt-download-atom-shell') grunt.loadNpmTasks('grunt-download-electron')
grunt.loadNpmTasks('grunt-atom-shell-installer') grunt.loadNpmTasks('grunt-electron-installer')
grunt.loadNpmTasks('grunt-peg') grunt.loadNpmTasks('grunt-peg')
grunt.loadTasks('tasks') grunt.loadTasks('tasks')
@ -81,7 +81,7 @@ module.exports = (grunt) ->
installDir = grunt.option('install-dir') installDir = grunt.option('install-dir')
home = if process.platform is 'win32' then process.env.USERPROFILE else process.env.HOME home = if process.platform is 'win32' then process.env.USERPROFILE else process.env.HOME
atomShellDownloadDir = path.join(home, '.nylas', 'atom-shell') electronDownloadDir = path.join(home, '.nylas', 'electron')
symbolsDir = path.join(buildDir, 'Atom.breakpad.syms') symbolsDir = path.join(buildDir, 'Atom.breakpad.syms')
shellAppDir = path.join(buildDir, appName) shellAppDir = path.join(buildDir, appName)
@ -274,11 +274,11 @@ module.exports = (grunt) ->
_.extend(context, parsed.attributes) _.extend(context, parsed.attributes)
parsed.body parsed.body
'download-atom-shell': 'download-electron':
version: packageJson.atomShellVersion version: packageJson.electronVersion
outputDir: 'atom-shell' outputDir: 'electron'
downloadDir: atomShellDownloadDir downloadDir: electronDownloadDir
rebuild: true # rebuild native modules after atom-shell is updated rebuild: true # rebuild native modules after electron is updated
token: process.env.ATOM_ACCESS_TOKEN token: process.env.ATOM_ACCESS_TOKEN
'create-windows-installer': 'create-windows-installer':
@ -302,7 +302,7 @@ module.exports = (grunt) ->
grunt.registerTask('test', ['shell:kill-atom', 'run-edgehill-specs']) grunt.registerTask('test', ['shell:kill-atom', 'run-edgehill-specs'])
grunt.registerTask('docs', ['build-docs', 'render-docs']) grunt.registerTask('docs', ['build-docs', 'render-docs'])
ciTasks = ['output-disk-space', 'download-atom-shell', 'build'] ciTasks = ['output-disk-space', 'download-electron', 'build']
ciTasks.push('dump-symbols') if process.platform isnt 'win32' ciTasks.push('dump-symbols') if process.platform isnt 'win32'
ciTasks.push('set-version', 'lint') ciTasks.push('set-version', 'lint')
ciTasks.push('mkdeb') if process.platform is 'linux' ciTasks.push('mkdeb') if process.platform is 'linux'
@ -313,7 +313,7 @@ module.exports = (grunt) ->
ciTasks.push('publish-edgehill-build') if process.platform is 'darwin' ciTasks.push('publish-edgehill-build') if process.platform is 'darwin'
grunt.registerTask('ci', ciTasks) grunt.registerTask('ci', ciTasks)
defaultTasks = ['download-atom-shell', 'build', 'set-version'] defaultTasks = ['download-electron', 'build', 'set-version']
# We don't run `install` on linux because you need to run `sudo`. # We don't run `install` on linux because you need to run `sudo`.
# See docs/build-instructions/linux.md # See docs/build-instructions/linux.md
# `sudo script/grunt install` # `sudo script/grunt install`

View file

@ -15,7 +15,7 @@
"fs-plus": "2.x", "fs-plus": "2.x",
"github-releases": "~0.2.0", "github-releases": "~0.2.0",
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-atom-shell-installer": "^0.29.0", "grunt-electron-installer": "^0.31",
"grunt-cli": "~0.1.9", "grunt-cli": "~0.1.9",
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe", "grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe",
"grunt-coffeelint-cjsx": "^0.1", "grunt-coffeelint-cjsx": "^0.1",
@ -23,7 +23,7 @@
"grunt-contrib-csslint": "~0.1.2", "grunt-contrib-csslint": "~0.1.2",
"grunt-contrib-less": "~0.8.0", "grunt-contrib-less": "~0.8.0",
"grunt-cson": "0.14.0", "grunt-cson": "0.14.0",
"grunt-download-atom-shell": "~0.14.0", "grunt-download-electron": "~2.1",
"grunt-lesslint": "0.13.0", "grunt-lesslint": "0.13.0",
"grunt-markdown": "^0.7.0", "grunt-markdown": "^0.7.0",
"grunt-peg": "~1.1.0", "grunt-peg": "~1.1.0",

View file

@ -21,12 +21,12 @@ module.exports = (grunt) ->
mkdir path.dirname(buildDir) mkdir path.dirname(buildDir)
if process.platform is 'darwin' if process.platform is 'darwin'
cp 'atom-shell/Electron.app', shellAppDir, filter: /default_app/ cp 'electron/Electron.app', shellAppDir, filter: /default_app/
cp(path.join(shellAppDir, 'Contents', 'MacOS', 'Electron'), cp(path.join(shellAppDir, 'Contents', 'MacOS', 'Electron'),
path.join(shellAppDir, 'Contents', 'MacOS', 'Nylas')) path.join(shellAppDir, 'Contents', 'MacOS', 'Nylas'))
rm path.join(shellAppDir, 'Contents', 'MacOS', 'Electron') rm path.join(shellAppDir, 'Contents', 'MacOS', 'Electron')
else else
cp 'atom-shell', shellAppDir, filter: /default_app/ cp 'electron', shellAppDir, filter: /default_app/
cp path.join(shellAppDir, 'atom'), path.join(shellAppDir, 'nylas') cp path.join(shellAppDir, 'atom'), path.join(shellAppDir, 'nylas')
rm path.join(shellAppDir, 'atom') rm path.join(shellAppDir, 'atom')

View file

@ -10,8 +10,8 @@ module.exports = (grunt) ->
rm grunt.config.get('atom.buildDir') rm grunt.config.get('atom.buildDir')
rm require('../src/coffee-cache').cacheDir rm require('../src/coffee-cache').cacheDir
rm require('../src/less-compile-cache').cacheDir rm require('../src/less-compile-cache').cacheDir
rm path.join(tmpdir, 'atom-cached-atom-shells') rm path.join(tmpdir, 'atom-cached-electrons')
rm 'atom-shell' rm 'electron'
grunt.registerTask 'clean', 'Delete all the build files', -> grunt.registerTask 'clean', 'Delete all the build files', ->
homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME'] homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']

View file

@ -11,7 +11,7 @@
"bugs": { "bugs": {
"url": "https://github.com/nylas/edgehill/issues" "url": "https://github.com/nylas/edgehill/issues"
}, },
"atomShellVersion": "0.26.0", "electronVersion": "0.26.0",
"dependencies": { "dependencies": {
"asar": "^0.5.0", "asar": "^0.5.0",
"6to5-core": "^3.5", "6to5-core": "^3.5",

View file

@ -71,33 +71,33 @@ function bootstrap() {
if (process.env.JANKY_SHA1 && process.platform === 'win32') if (process.env.JANKY_SHA1 && process.platform === 'win32')
apmInstallCommand += ' --arch=ia32'; apmInstallCommand += ' --arch=ia32';
m1 = "---> Installing Nylas Mail build tools\n" m1 = "\n---> Installing Nylas Mail build tools\n"
m1 += " This goes inside the `build` folder and runs `npm install`\n" m1 += " This goes inside the `build` folder and runs `npm install`\n"
m1 += " It will use the system `npm` to bootstrap our own Nylas Mail npm.\n" m1 += " It will use the system `npm` to bootstrap our own Nylas Mail npm.\n"
m1 += " Our build tools (like Grunt) need to be compiled against Node via `npm`.\n" m1 += " Our build tools (like Grunt) need to be compiled against Node via `npm`.\n"
m1 += " Everything else needs to be compiled against Chromium with `apm`.\n\n" m1 += " Everything else needs to be compiled against Chromium with `apm`.\n\n"
m1 += " $ "+buildInstallCommand+" "+printArgs(buildInstallOptions)+"\n" m1 += " $ "+buildInstallCommand+" "+printArgs(buildInstallOptions)+"\n"
m2 = "---> Installing apm\n" m2 = "\n\n---> Installing apm\n"
m2 += " This installs apm via Nylas Mails `npm`\n" m2 += " This installs apm via Nylas Mail's `npm`\n"
m2 += " We use this local apm copy to install all Nylas Mail dependencies & packages\n\n" m2 += " We use this local apm copy to install all Nylas Mail dependencies & packages\n\n"
m2 += " $ "+apmInstallCommand+" "+printArgs(apmInstallOptions)+"\n" m2 += " $ "+apmInstallCommand+" "+printArgs(apmInstallOptions)+"\n"
m3 = "---> Cleaning apm via `apm clean`\n" m3 = "\n\n---> Cleaning apm via `apm clean`\n"
m4 = "---> Installing Nylas Mail dependencies & packages via `apm install`\n\n" m4 = "\n\n---> Installing Nylas Mail dependencies & packages via `apm install`\n\n"
m4 += " $ "+moduleInstallCommand+"\n" m4 += " $ "+moduleInstallCommand+"\n"
m5 = "---> De-duping packages `apm clean`\n\n" m5 = "\n\n---> De-duping packages `apm clean`\n\n"
m5 += " $ apm "+packagesToDedupe.join(' ')+"\n" m5 += " $ apm "+packagesToDedupe.join(' ')+"\n"
m6 = "---> Request version `apm clean`\n\n" m6 = "\n\n---> Request version `apm clean`\n\n"
m6 += " $ apm request semver "+printArgs(semverOptions)+"\n" m6 += " $ apm request semver "+printArgs(semverOptions)+"\n"
m7 = "---> Getting latest Atom Shell\n\n" m7 = "\n\n---> Getting latest Electron\n\n"
var gruntCmd = "" var gruntCmd = ""
var downloadAtomShellCmd = gruntPath + " download-atom-shell --gruntfile build/Gruntfile.coffee" var downloadElectronCmd = gruntPath + " download-electron --gruntfile build/Gruntfile.coffee"
m7 += " $ "+downloadAtomShellCmd m7 += " $ "+downloadElectronCmd
var commands = [ var commands = [
{ {
@ -128,7 +128,7 @@ function bootstrap() {
options: semverOptions options: semverOptions
}, },
{ {
command: downloadAtomShellCmd, command: downloadElectronCmd,
message: m7 message: m7
} }
]; ];

View file

@ -19,14 +19,14 @@ var commands = [
[__dirname, '..', 'node_modules'], [__dirname, '..', 'node_modules'],
[__dirname, '..', 'build', 'node_modules'], [__dirname, '..', 'build', 'node_modules'],
[__dirname, '..', 'apm', 'node_modules'], [__dirname, '..', 'apm', 'node_modules'],
[__dirname, '..', 'atom-shell'], [__dirname, '..', 'electron'],
[home, '.nylas', '.node-gyp'], [home, '.nylas', '.node-gyp'],
[home, '.nylas', 'storage'], [home, '.nylas', 'storage'],
[home, '.nylas', '.npm'], [home, '.nylas', '.npm'],
[home, '.nylas', 'compile-cache'], [home, '.nylas', 'compile-cache'],
[home, '.nylas', 'atom-shell'], [home, '.nylas', 'electron'],
[tmpdir, 'atom-build'], [tmpdir, 'atom-build'],
[tmpdir, 'atom-cached-atom-shells'], [tmpdir, 'atom-cached-electrons'],
]; ];
var run = function() { var run = function() {
var next = commands.shift(); var next = commands.shift();

View file

@ -524,7 +524,7 @@ class Atom extends Model
@center() @center()
# Returns true if the dimensions are useable, false if they should be ignored. # Returns true if the dimensions are useable, false if they should be ignored.
# Work around for https://github.com/atom/atom-shell/issues/473 # Work around for https://github.com/atom/electron/issues/473
isValidDimensions: ({x, y, width, height}={}) -> isValidDimensions: ({x, y, width, height}={}) ->
width > 0 and height > 0 and x + width > 0 and y + height > 0 width > 0 and height > 0 and x + width > 0 and y + height > 0

View file

@ -55,7 +55,7 @@ class ApplicationMenu
# Flattens the given menu and submenu items into an single Array. # Flattens the given menu and submenu items into an single Array.
# #
# menu - A complete menu configuration object for atom-shell's menu API. # menu - A complete menu configuration object for electron's menu API.
# #
# Returns an Array of native menu items. # Returns an Array of native menu items.
flattenMenuItems: (menu) -> flattenMenuItems: (menu) ->
@ -130,12 +130,12 @@ class ApplicationMenu
# Combines a menu template with the appropriate keystroke. # Combines a menu template with the appropriate keystroke.
# #
# template - An Object conforming to atom-shell's menu api but lacking # template - An Object conforming to electron's menu api but lacking
# accelerator and click properties. # accelerator and click properties.
# keystrokesByCommand - An Object where the keys are commands and the values # keystrokesByCommand - An Object where the keys are commands and the values
# are Arrays containing the keystroke. # are Arrays containing the keystroke.
# #
# Returns a complete menu configuration object for atom-shell's menu API. # Returns a complete menu configuration object for electron's menu API.
translateTemplate: (template, keystrokesByCommand) -> translateTemplate: (template, keystrokesByCommand) ->
template.forEach (item) => template.forEach (item) =>
item.metadata ?= {} item.metadata ?= {}

View file

@ -43,7 +43,7 @@ class Application
# FIXME: Sometimes when socketPath doesn't exist, net.connect would strangely # FIXME: Sometimes when socketPath doesn't exist, net.connect would strangely
# take a few seconds to trigger 'error' event, it could be a bug of node # take a few seconds to trigger 'error' event, it could be a bug of node
# or atom-shell, before it's fixed we check the existence of socketPath to # or electron, before it's fixed we check the existence of socketPath to
# speedup startup. # speedup startup.
if (process.platform isnt 'win32' and not fs.existsSync socketPath) or options.test if (process.platform isnt 'win32' and not fs.existsSync socketPath) or options.test
createApplication() createApplication()

View file

@ -177,7 +177,7 @@ class AtomWindow
@setupContextMenu() @setupContextMenu()
if @isSpec if @isSpec
# Workaround for https://github.com/atom/atom-shell/issues/380 # Workaround for https://github.com/atom/electron/issues/380
# Don't focus the window when it is being blurred during close or # Don't focus the window when it is being blurred during close or
# else the app will crash on Windows. # else the app will crash on Windows.
if process.platform is 'win32' if process.platform is 'win32'

View file

@ -160,7 +160,7 @@ class WindowManager
# #
# Other non required options: # Other non required options:
# - All of the options of BrowserWindow # - All of the options of BrowserWindow
# https://github.com/atom/atom-shell/blob/master/docs/api/browser-window.md#new-browserwindowoptions # https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions
# #
# Returns a new AtomWindow # Returns a new AtomWindow
# #

View file

@ -200,14 +200,14 @@ registerBuiltins = (devMode) ->
cache.builtins.atom = atomCoffeePath if fs.isFileSync(atomCoffeePath) cache.builtins.atom = atomCoffeePath if fs.isFileSync(atomCoffeePath)
cache.builtins.atom ?= path.join(cache.resourcePath, 'exports', 'atom.js') cache.builtins.atom ?= path.join(cache.resourcePath, 'exports', 'atom.js')
atomShellRoot = path.join(process.resourcesPath, 'atom.asar') electronRoot = path.join(process.resourcesPath, 'atom.asar')
commonRoot = path.join(atomShellRoot, 'common', 'api', 'lib') commonRoot = path.join(electronRoot, 'common', 'api', 'lib')
commonBuiltins = ['callbacks-registry', 'clipboard', 'crash-reporter', 'screen', 'shell'] commonBuiltins = ['callbacks-registry', 'clipboard', 'crash-reporter', 'screen', 'shell']
for builtin in commonBuiltins for builtin in commonBuiltins
cache.builtins[builtin] = path.join(commonRoot, "#{builtin}.js") cache.builtins[builtin] = path.join(commonRoot, "#{builtin}.js")
rendererRoot = path.join(atomShellRoot, 'renderer', 'api', 'lib') rendererRoot = path.join(electronRoot, 'renderer', 'api', 'lib')
rendererBuiltins = ['ipc', 'remote'] rendererBuiltins = ['ipc', 'remote']
for builtin in rendererBuiltins for builtin in rendererBuiltins
cache.builtins[builtin] = path.join(rendererRoot, "#{builtin}.js") cache.builtins[builtin] = path.join(rendererRoot, "#{builtin}.js")