From 0588b0c7ebefbdaec24efa8cdaf56399b8e9d7e6 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Wed, 20 May 2015 10:20:10 -0700 Subject: [PATCH] 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 --- .gitignore | 2 +- atom.sh | 8 ++++---- build/Gruntfile.coffee | 20 ++++++++++---------- build/package.json | 4 ++-- build/tasks/build-task.coffee | 4 ++-- build/tasks/clean-task.coffee | 4 ++-- package.json | 2 +- script/bootstrap | 22 +++++++++++----------- script/clean | 6 +++--- src/atom.coffee | 2 +- src/browser/application-menu.coffee | 6 +++--- src/browser/application.coffee | 2 +- src/browser/atom-window.coffee | 2 +- src/browser/window-manager.coffee | 2 +- src/module-cache.coffee | 6 +++--- 15 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 962578505..17e41634f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ node_modules npm-debug.log debug.log /tags -/atom-shell/ +/electron/ docs/output docs/includes spec/fixtures/evil-files/ diff --git a/atom.sh b/atom.sh index 57bdb9bcc..d8c8bc92a 100755 --- a/atom.sh +++ b/atom.sh @@ -53,7 +53,7 @@ if [ $OS == 'Mac' ]; then exit 1 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 if [ -z "$ELECTRON_PATH" ]; then @@ -61,7 +61,7 @@ if [ $OS == 'Mac' ]; then exit 1 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 elif [ $OS == 'Linux' ]; then @@ -78,11 +78,11 @@ elif [ $OS == 'Linux' ]; then # Exit if Atom can't be found 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 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 fi diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 21d691b54..003d208ae 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -59,8 +59,8 @@ module.exports = (grunt) -> grunt.loadNpmTasks('grunt-contrib-less') grunt.loadNpmTasks('grunt-shell') grunt.loadNpmTasks('grunt-markdown') - grunt.loadNpmTasks('grunt-download-atom-shell') - grunt.loadNpmTasks('grunt-atom-shell-installer') + grunt.loadNpmTasks('grunt-download-electron') + grunt.loadNpmTasks('grunt-electron-installer') grunt.loadNpmTasks('grunt-peg') grunt.loadTasks('tasks') @@ -81,7 +81,7 @@ module.exports = (grunt) -> installDir = grunt.option('install-dir') 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') shellAppDir = path.join(buildDir, appName) @@ -274,11 +274,11 @@ module.exports = (grunt) -> _.extend(context, parsed.attributes) parsed.body - 'download-atom-shell': - version: packageJson.atomShellVersion - outputDir: 'atom-shell' - downloadDir: atomShellDownloadDir - rebuild: true # rebuild native modules after atom-shell is updated + 'download-electron': + version: packageJson.electronVersion + outputDir: 'electron' + downloadDir: electronDownloadDir + rebuild: true # rebuild native modules after electron is updated token: process.env.ATOM_ACCESS_TOKEN 'create-windows-installer': @@ -302,7 +302,7 @@ module.exports = (grunt) -> grunt.registerTask('test', ['shell:kill-atom', 'run-edgehill-specs']) 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('set-version', 'lint') 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' 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`. # See docs/build-instructions/linux.md # `sudo script/grunt install` diff --git a/build/package.json b/build/package.json index 5a44aebe9..5ff8b9f9a 100644 --- a/build/package.json +++ b/build/package.json @@ -15,7 +15,7 @@ "fs-plus": "2.x", "github-releases": "~0.2.0", "grunt": "~0.4.1", - "grunt-atom-shell-installer": "^0.29.0", + "grunt-electron-installer": "^0.31", "grunt-cli": "~0.1.9", "grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe", "grunt-coffeelint-cjsx": "^0.1", @@ -23,7 +23,7 @@ "grunt-contrib-csslint": "~0.1.2", "grunt-contrib-less": "~0.8.0", "grunt-cson": "0.14.0", - "grunt-download-atom-shell": "~0.14.0", + "grunt-download-electron": "~2.1", "grunt-lesslint": "0.13.0", "grunt-markdown": "^0.7.0", "grunt-peg": "~1.1.0", diff --git a/build/tasks/build-task.coffee b/build/tasks/build-task.coffee index af4e06cad..96a23d500 100644 --- a/build/tasks/build-task.coffee +++ b/build/tasks/build-task.coffee @@ -21,12 +21,12 @@ module.exports = (grunt) -> mkdir path.dirname(buildDir) 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'), path.join(shellAppDir, 'Contents', 'MacOS', 'Nylas')) rm path.join(shellAppDir, 'Contents', 'MacOS', 'Electron') else - cp 'atom-shell', shellAppDir, filter: /default_app/ + cp 'electron', shellAppDir, filter: /default_app/ cp path.join(shellAppDir, 'atom'), path.join(shellAppDir, 'nylas') rm path.join(shellAppDir, 'atom') diff --git a/build/tasks/clean-task.coffee b/build/tasks/clean-task.coffee index 97f0a9105..88624462e 100644 --- a/build/tasks/clean-task.coffee +++ b/build/tasks/clean-task.coffee @@ -10,8 +10,8 @@ module.exports = (grunt) -> rm grunt.config.get('atom.buildDir') rm require('../src/coffee-cache').cacheDir rm require('../src/less-compile-cache').cacheDir - rm path.join(tmpdir, 'atom-cached-atom-shells') - rm 'atom-shell' + rm path.join(tmpdir, 'atom-cached-electrons') + rm 'electron' grunt.registerTask 'clean', 'Delete all the build files', -> homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME'] diff --git a/package.json b/package.json index ac25dfc43..f80de83f7 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "bugs": { "url": "https://github.com/nylas/edgehill/issues" }, - "atomShellVersion": "0.26.0", + "electronVersion": "0.26.0", "dependencies": { "asar": "^0.5.0", "6to5-core": "^3.5", diff --git a/script/bootstrap b/script/bootstrap index e24277722..c98cec4cd 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -71,33 +71,33 @@ function bootstrap() { if (process.env.JANKY_SHA1 && process.platform === 'win32') 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 += " 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 += " Everything else needs to be compiled against Chromium with `apm`.\n\n" m1 += " $ "+buildInstallCommand+" "+printArgs(buildInstallOptions)+"\n" - m2 = "---> Installing apm\n" - m2 += " This installs apm via Nylas Mails `npm`\n" + m2 = "\n\n---> Installing apm\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 += " $ "+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" - m5 = "---> De-duping packages `apm clean`\n\n" + m5 = "\n\n---> De-duping packages `apm clean`\n\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" - m7 = "---> Getting latest Atom Shell\n\n" + m7 = "\n\n---> Getting latest Electron\n\n" var gruntCmd = "" - var downloadAtomShellCmd = gruntPath + " download-atom-shell --gruntfile build/Gruntfile.coffee" - m7 += " $ "+downloadAtomShellCmd + var downloadElectronCmd = gruntPath + " download-electron --gruntfile build/Gruntfile.coffee" + m7 += " $ "+downloadElectronCmd var commands = [ { @@ -128,7 +128,7 @@ function bootstrap() { options: semverOptions }, { - command: downloadAtomShellCmd, + command: downloadElectronCmd, message: m7 } ]; diff --git a/script/clean b/script/clean index b22e03391..d0ac1fa9d 100755 --- a/script/clean +++ b/script/clean @@ -19,14 +19,14 @@ var commands = [ [__dirname, '..', 'node_modules'], [__dirname, '..', 'build', 'node_modules'], [__dirname, '..', 'apm', 'node_modules'], - [__dirname, '..', 'atom-shell'], + [__dirname, '..', 'electron'], [home, '.nylas', '.node-gyp'], [home, '.nylas', 'storage'], [home, '.nylas', '.npm'], [home, '.nylas', 'compile-cache'], - [home, '.nylas', 'atom-shell'], + [home, '.nylas', 'electron'], [tmpdir, 'atom-build'], - [tmpdir, 'atom-cached-atom-shells'], + [tmpdir, 'atom-cached-electrons'], ]; var run = function() { var next = commands.shift(); diff --git a/src/atom.coffee b/src/atom.coffee index 5fef916bc..68d3339c5 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -524,7 +524,7 @@ class Atom extends Model @center() # 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}={}) -> width > 0 and height > 0 and x + width > 0 and y + height > 0 diff --git a/src/browser/application-menu.coffee b/src/browser/application-menu.coffee index 3c8b647ce..ebaedb362 100644 --- a/src/browser/application-menu.coffee +++ b/src/browser/application-menu.coffee @@ -55,7 +55,7 @@ class ApplicationMenu # 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. flattenMenuItems: (menu) -> @@ -130,12 +130,12 @@ class ApplicationMenu # 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. # keystrokesByCommand - An Object where the keys are commands and the values # 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) -> template.forEach (item) => item.metadata ?= {} diff --git a/src/browser/application.coffee b/src/browser/application.coffee index 4ccea9b9f..8b4dc7067 100644 --- a/src/browser/application.coffee +++ b/src/browser/application.coffee @@ -43,7 +43,7 @@ class Application # 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 - # 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. if (process.platform isnt 'win32' and not fs.existsSync socketPath) or options.test createApplication() diff --git a/src/browser/atom-window.coffee b/src/browser/atom-window.coffee index 35f612e80..8b7c93eba 100644 --- a/src/browser/atom-window.coffee +++ b/src/browser/atom-window.coffee @@ -177,7 +177,7 @@ class AtomWindow @setupContextMenu() 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 # else the app will crash on Windows. if process.platform is 'win32' diff --git a/src/browser/window-manager.coffee b/src/browser/window-manager.coffee index e35da6c92..201c1fc6b 100644 --- a/src/browser/window-manager.coffee +++ b/src/browser/window-manager.coffee @@ -160,7 +160,7 @@ class WindowManager # # Other non required options: # - 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 # diff --git a/src/module-cache.coffee b/src/module-cache.coffee index e9245cf40..867c30b98 100644 --- a/src/module-cache.coffee +++ b/src/module-cache.coffee @@ -200,14 +200,14 @@ registerBuiltins = (devMode) -> cache.builtins.atom = atomCoffeePath if fs.isFileSync(atomCoffeePath) 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'] for builtin in commonBuiltins 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'] for builtin in rendererBuiltins cache.builtins[builtin] = path.join(rendererRoot, "#{builtin}.js")