refactor(env): new NylasEnv global

Converted all references of global atom to NylasEnv

Temporary rename atom.io

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.io/temporaryAtomIoReplacement/g'

atom.config to NylasEnv.config

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.config/NylasEnv.config/g'

atom.packages -> NylasEnv.packages

atom.commands -> NylasEnv.commands atom.getLoadSettings

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.commands/NylasEnv.commands/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getLoadSettings/NylasEnv.getLoadSettings/g'

More common atom methods

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.styles/NylasEnv.styles/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.emitError/NylasEnv.emitError/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.inSpecMode/NylasEnv.inSpecMode/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.inDevMode/NylasEnv.inDevMode/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getWindowType/NylasEnv.getWindowType/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.displayWindow/NylasEnv.displayWindow/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.quit/NylasEnv.quit/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.close/NylasEnv.close/g'

More atom method changes

find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.keymaps/NylasEnv.keymaps/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.hide/NylasEnv.hide/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getCurrentWindow/NylasEnv.getCurrentWindow/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.menu/NylasEnv.menu/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getConfigDirPath/NylasEnv.getConfigDirPath/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.isMainWindow/NylasEnv.isMainWindow/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.finishUnload/NylasEnv.finishUnload/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.isWorkWindow/NylasEnv.isWorkWindow/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.showSaveDialog/NylasEnv.showSaveDialog/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.append/NylasEnv.append/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.confirm/NylasEnv.confirm/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.clipboard/NylasEnv.clipboard/g'
find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed
-i "" 's/atom.getVersion/NylasEnv.getVersion/g'

More atom renaming

Rename atom methods

More atom methods

Fix grunt config variable

Change atom.cmd to N1.cmd

Rename atom.coffee and atom.js to nylas-env.coffee nylas-env.js

Fix atom global reference in specs manually

Fix atom requires

Change engine from atom to nylas

got rid of global/nylas-env

rename to nylas-win-bootup

Fix onWindowPropsChanged to onWindowPropsReceived

fix nylas-workspace

atom-text-editor to nylas-theme-wrap

atom-text-editor -> nylas-theme-wrap

Replacing atom keyword

AtomWindow -> NylasWindow

Replace Atom -> N1

Rename atom items

nylas.asar -> atom.asar

Remove more atom references

Remove 6to5 references

Remove license exception for atom
This commit is contained in:
Evan Morikawa 2015-11-11 10:25:11 -08:00
parent 6b120b7bc3
commit 488dff0f90
310 changed files with 1244 additions and 1698 deletions
N1.sh
apm
build
docs
examples
N1-Composer-Templates
N1-Composer-Translate
N1-Filters
N1-Github-Contact-Card-Section
N1-Message-View-on-Github
N1-Personal-Level-Indicators
N1-Phishing-Detection
N1-Send-Availability
internal_packages

7
N1.sh
View file

@ -58,7 +58,7 @@ if [ $OS == 'Mac' ]; then
ELECTRON_PATH=${ELECTRON_PATH:-$N1_PATH/electron} # Set ELECTRON_PATH unless it is already set
# Exit if Atom can't be found
# Exit if Electron can't be found
if [ ! -d "$ELECTRON_PATH" ]; then
echo "Cannot locate electron. Be sure you have run script/bootstrap first from $N1_PATH"
exit 1
@ -79,7 +79,7 @@ elif [ $OS == 'Linux' ]; then
ELECTRON_PATH=${ELECTRON_PATH:-$N1_PATH/electron} # Set ELECTRON_PATH unless it is already set
# Exit if Atom can't be found
# Exit if Electron can't be found
if [ ! -d "$ELECTRON_PATH" ]; then
echo "Cannot locate electron. Be sure you have run script/bootstrap first from $N1_PATH"
exit 1
@ -90,13 +90,12 @@ elif [ $OS == 'Linux' ]; then
fi
# Exits this process when Atom is used as $EDITOR
on_die() {
exit 0
}
trap 'on_die' SIGQUIT SIGTERM
# If the wait flag is set, don't exit this process until Atom tells it to.
# If the wait flag is set, don't exit this process until Electron tells it to.
if [ $WAIT ]; then
while true; do
sleep 1

View file

@ -1,9 +1,9 @@
{
"name": "atom-bundled-apm",
"description": "Atom's bundled apm",
"name": "n1-bundled-apm",
"description": "N1's bundled apm",
"repository": {
"type": "git",
"url": "https://github.com/atom/atom.git"
"url": "https://github.com/nylas/n1"
},
"dependencies": {
"atom-package-manager": "1.1.1"

View file

@ -5,8 +5,8 @@ babelOptions = require '../static/babelrc'
# This is the main Gruntfile that manages building N1 distributions.
# The reason it's inisde of the build/ folder is so everything can be
# compiled against Node's v8 headers instead of Atom's v8 headers. All
# packages in the root-level node_modules are compiled against Atom's v8
# compiled against Node's v8 headers instead of Chrome's v8 headers. All
# packages in the root-level node_modules are compiled against Chrome's v8
# headers.
#
# Some useful grunt options are:
@ -195,7 +195,7 @@ module.exports = (grunt) ->
continue unless grunt.file.isFile(metadataPath)
{engines, theme} = grunt.file.readJSON(metadataPath)
if engines?.atom?
if engines?.nylas?
coffeeConfig.glob_to_multiple.src.push("#{directory}/**/*.coffee")
lessConfig.glob_to_multiple.src.push("#{directory}/**/*.less")
prebuildLessConfig.src.push("#{directory}/**/*.less") unless theme
@ -205,7 +205,7 @@ module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
atom: {appDir, appName, symbolsDir, buildDir, contentsDir, installDir, shellAppDir}
nylasGruntConfig: {appDir, appName, symbolsDir, buildDir, contentsDir, installDir, shellAppDir}
docsOutputDir: 'docs/output'
@ -350,7 +350,7 @@ module.exports = (grunt) ->
exe: 'nylas.exe'
shell:
'kill-atom':
'kill-n1':
command: killCommand
options:
stdout: false
@ -359,7 +359,7 @@ module.exports = (grunt) ->
grunt.registerTask('compile', ['coffee', 'cjsx', 'babel', 'prebuild-less', 'cson', 'peg'])
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint', 'nylaslint', 'eslint'])
grunt.registerTask('test', ['shell:kill-atom', 'run-edgehill-specs'])
grunt.registerTask('test', ['shell:kill-n1', 'run-edgehill-specs'])
grunt.registerTask('docs', ['build-docs', 'render-docs'])
ciTasks = ['output-disk-space', 'download-electron', 'build']

View file

@ -1,7 +1,7 @@
{
"extends": "airbnb",
"globals": {
"atom": false
"NylasEnv": false
},
"env": {
"browser": true,

View file

@ -1,50 +0,0 @@
# VERSION: 0.1
# DESCRIPTION: Create the atom editor in a container
# AUTHOR: Jessica Frazelle <jessie@docker.com>
# COMMENTS:
# This file describes how to build the atom editor
# in a container with all dependencies installed.
# Tested on Debian Jessie.
# USAGE:
# # Download atom Dockerfile
# wget https://raw.githubusercontent.com/atom/atom/master/Dockerfile
#
# # Build atom image
# docker build -t atom .
#
# docker run -v /tmp/.X11-unix:/tmp/.X11-unix \
# -e DISPLAY=unix$DISPLAY atom
#
DOCKER-VERSION 1.3
# Base docker image
FROM debian:jessie
MAINTAINER Jessica Frazelle <jessie@docker.com>
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
ca-certificates \
curl \
git \
libasound2 \
libgconf-2-4 \
libgnome-keyring-dev \
libgtk2.0-0 \
libnss3 \
libxtst6 \
--no-install-recommends
# install node
RUN curl -sL https://deb.nodesource.com/setup | bash -
RUN apt-get install -y nodejs
# clone atom
RUN git clone https://github.com/atom/atom /src
WORKDIR /src
RUN git fetch && git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
RUN script/build && script/grunt install
# Autorun atom
CMD /usr/local/bin/atom --foreground --log-file /var/log/atom.log && tail -f /var/log/atom.log

View file

@ -1,7 +1,7 @@
atom: arch-dependent-file-in-usr-share
atom: changelog-file-missing-in-native-package
atom: copyright-file-contains-full-apache-2-license
atom: copyright-should-refer-to-common-license-file-for-apache-2
atom: embedded-library
atom: package-installs-python-bytecode
atom: unstripped-binary-or-object
nylas: arch-dependent-file-in-usr-share
nylas: changelog-file-missing-in-native-package
nylas: copyright-file-contains-full-apache-2-license
nylas: copyright-should-refer-to-common-license-file-for-apache-2
nylas: embedded-library
nylas: package-installs-python-bytecode
nylas: unstripped-binary-or-object

View file

@ -18,5 +18,5 @@ FOR %%a IN (%*) DO (
IF "%EXPECT_OUTPUT%"=="YES" (
"%~dp0\..\..\nylas.exe" %*
) ELSE (
"%~dp0\..\app\apm\bin\node.exe" "%~dp0\atom.js" %*
"%~dp0\..\app\apm\bin\node.exe" "%~dp0\nylas-win-bootup.js" %*
)

View file

@ -18,5 +18,5 @@ done
if [ $EXPECT_OUTPUT ]; then
"$0/../../../nylas.exe" "$@"
else
"$0/../../app/apm/bin/node.exe" "$0/../atom.js" "$@"
"$0/../../app/apm/bin/node.exe" "$0/../nylas-win-bootup.js" "$@"
fi

View file

@ -1,9 +1,9 @@
var path = require('path');
var spawn = require('child_process').spawn;
var atomCommandPath = path.resolve(__dirname, '..', '..', 'nylas.exe');
var nylasCommandPath = path.resolve(__dirname, '..', '..', 'nylas.exe');
var arguments = process.argv.slice(2);
arguments.unshift('--executed-from', process.cwd());
var options = {detached: true, stdio: 'ignore'};
spawn(atomCommandPath, arguments, options);
process.exit(0);
spawn(nylasCommandPath, arguments, options);
irocess.exit(0);

View file

@ -3,7 +3,7 @@ path = require 'path'
_ = require 'underscore'
module.exports = (grunt) ->
{cp, isAtomPackage, mkdir, rm} = require('./task-helpers')(grunt)
{cp, isNylasPackage, mkdir, rm} = require('./task-helpers')(grunt)
escapeRegExp = (string) ->
if string
@ -12,9 +12,9 @@ module.exports = (grunt) ->
return ''
grunt.registerTask 'build', 'Build the application', ->
shellAppDir = grunt.config.get('atom.shellAppDir')
buildDir = grunt.config.get('atom.buildDir')
appDir = grunt.config.get('atom.appDir')
shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir')
buildDir = grunt.config.get('nylasGruntConfig.buildDir')
appDir = grunt.config.get('nylasGruntConfig.appDir')
rm shellAppDir
rm path.join(buildDir, 'installer')
@ -52,7 +52,7 @@ module.exports = (grunt) ->
for packageFolder in ['node_modules', 'internal_packages']
for child in fs.readdirSync(packageFolder)
directory = path.join(packageFolder, child)
if isAtomPackage(directory)
if isNylasPackage(directory)
packageDirectories.push(directory)
packageNames.push(child)
else
@ -181,9 +181,9 @@ module.exports = (grunt) ->
grunt.file.copy(sourcePath, path.resolve(appDir, '..', subDirectory, filename))
if process.platform is 'win32'
cp path.join('build', 'resources', 'win', 'atom.cmd'), path.join(shellAppDir, 'resources', 'cli', 'atom.cmd')
cp path.join('build', 'resources', 'win', 'N1.cmd'), path.join(shellAppDir, 'resources', 'cli', 'N1.cmd')
cp path.join('build', 'resources', 'win', 'N1.sh'), path.join(shellAppDir, 'resources', 'cli', 'N1.sh')
cp path.join('build', 'resources', 'win', 'atom.js'), path.join(shellAppDir, 'resources', 'cli', 'atom.js')
cp path.join('build', 'resources', 'win', 'nylas-win-bootup.js'), path.join(shellAppDir, 'resources', 'cli', 'nylas-win-bootup.js')
cp path.join('build', 'resources', 'win', 'apm.sh'), path.join(shellAppDir, 'resources', 'cli', 'apm.sh')
if process.platform is 'linux'

View file

@ -14,9 +14,6 @@ module.exports = (grunt) ->
console.error(err)
process.exit 1
for key of summary
delete summary[key] if key.match /^atom@/
if size(summary)
console.error "Found dependencies without permissive licenses:"
for name in keys(summary).sort()

View file

@ -7,15 +7,15 @@ module.exports = (grunt) ->
grunt.registerTask 'partial-clean', 'Delete some of the build files', ->
tmpdir = os.tmpdir()
rm grunt.config.get('atom.buildDir')
rm grunt.config.get('nylasGruntConfig.buildDir')
rm require('../src/coffee-cache').cacheDir
rm require('../src/less-compile-cache').cacheDir
rm path.join(tmpdir, 'atom-cached-electrons')
rm path.join(tmpdir, 'n1-cached-electrons')
rm 'electron'
grunt.registerTask 'clean', 'Delete all the build files', ->
homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
rm 'node_modules'
rm path.join(homeDir, '.atom', '.node-gyp')
rm path.join(homeDir, '.nylas', '.node-gyp')
grunt.task.run('partial-clean')

View file

@ -38,7 +38,7 @@ module.exports = (grunt) ->
switch process.platform
when 'darwin'
cmd = 'codesign'
args = ['--deep', '--force', '--verbose', '--sign', 'Developer ID Application: InboxApp, Inc.', grunt.config.get('atom.shellAppDir')]
args = ['--deep', '--force', '--verbose', '--sign', 'Developer ID Application: InboxApp, Inc.', grunt.config.get('nylasGruntConfig.shellAppDir')]
spawn {cmd, args}, (error) -> callback(error)
when 'win32'
# TODO: Don't do anything now, because we need a certificate pfx file
@ -46,12 +46,12 @@ module.exports = (grunt) ->
return callback()
spawn {cmd: 'taskkill', args: ['/F', '/IM', 'nylas.exe']}, ->
cmd = process.env.JANKY_SIGNTOOL ? 'signtool'
args = ['sign', path.join(grunt.config.get('atom.shellAppDir'), 'nylas.exe')]
args = ['sign', path.join(grunt.config.get('nylasGruntConfig.shellAppDir'), 'nylas.exe')]
spawn {cmd, args}, (error) ->
return callback(error) if error?
setupExePath = path.resolve(grunt.config.get('atom.buildDir'), 'installer', 'NylasSetup.exe')
setupExePath = path.resolve(grunt.config.get('nylasGruntConfig.buildDir'), 'installer', 'NylasSetup.exe')
if fs.isFileSync(setupExePath)
args = ['sign', setupExePath]
spawn {cmd, args}, (error) -> callback(error)

View file

@ -8,7 +8,7 @@ module.exports = (grunt) ->
{spawn, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', ->
appDir = fs.realpathSync(grunt.config.get('atom.appDir'))
appDir = fs.realpathSync(grunt.config.get('nylasGruntConfig.appDir'))
modulesDirectory = path.join(appDir, 'node_modules')
internalNylasPackagesDirectory = path.join(appDir, 'internal_packages')
@ -22,9 +22,9 @@ module.exports = (grunt) ->
metadataPath = path.join(moduleDirectory, 'package.json')
metadata = grunt.file.readJSON(metadataPath)
continue unless metadata?.engines?.atom?
continue unless metadata?.engines?.nylas?
moduleCache = metadata._atomModuleCache ? {}
moduleCache = metadata._nylasModuleCache ? {}
rm metadataPath
@ -57,6 +57,6 @@ module.exports = (grunt) ->
delete moduleCache.extensions[extension] if paths.length is 0
metadata = grunt.file.readJSON(path.join(appDir, 'package.json'))
metadata._atomPackages = packages
metadata._N1Packages = packages
grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata))

View file

@ -4,7 +4,7 @@ module.exports = (grunt) ->
{cp} = require('./task-helpers')(grunt)
grunt.registerTask 'copy-info-plist', 'Copy plist', ->
contentsDir = grunt.config.get('atom.contentsDir')
contentsDir = grunt.config.get('nylasGruntConfig.contentsDir')
plistPath = path.join(contentsDir, 'Info.plist')
helperPlistPath = path.join(contentsDir, 'Frameworks/Atom Helper.app/Contents/Info.plist')

View file

@ -144,7 +144,7 @@ module.exports = (grunt) ->
referenceSections[klass.section] = section
section.classes.push(klass)
preferredSectionOrdering = ['General', 'Component Kit', 'Models', 'Stores', 'Database', 'Drafts', 'Atom']
preferredSectionOrdering = ['General', 'Component Kit', 'Models', 'Stores', 'Database', 'Drafts', 'NylasEnv']
sorted = []
for key in preferredSectionOrdering
if referenceSections[key]

View file

@ -24,7 +24,7 @@ module.exports = (grunt) ->
grunt.registerTask 'dump-symbols', 'Dump symbols for native modules', ->
done = @async()
symbolsDir = grunt.config.get('atom.symbolsDir')
symbolsDir = grunt.config.get('nylasGruntConfig.symbolsDir')
rm symbolsDir
mkdir symbolsDir

View file

@ -17,7 +17,7 @@ module.exports = (grunt) ->
]
unpack = "{#{unpack.join(',')}}"
appDir = grunt.config.get('atom.appDir')
appDir = grunt.config.get('nylasGruntConfig.appDir')
unless fs.existsSync(appDir)
grunt.log.error 'The app has to be built before generating asar archive.'
return done(false)

View file

@ -17,7 +17,7 @@ module.exports = (grunt) ->
licenseText = getLicenseText(dependencyLicenses)
if mode is 'save'
targetPath = path.resolve(grunt.config.get('atom.appDir'), '..', 'LICENSE.md')
targetPath = path.resolve(grunt.config.get('nylasGruntConfig.appDir'), '..', 'LICENSE.md')
fs.writeFileSync(targetPath, licenseText)
else
console.log licenseText

View file

@ -4,7 +4,7 @@ ModuleCache = require '../../src/module-cache'
module.exports = (grunt) ->
grunt.registerTask 'generate-module-cache', 'Generate a module cache for all core modules and packages', ->
appDir = grunt.config.get('atom.appDir')
appDir = grunt.config.get('nylasGruntConfig.appDir')
{packageDependencies} = grunt.file.readJSON('package.json')
@ -15,7 +15,7 @@ module.exports = (grunt) ->
metadata = grunt.file.readJSON(path.join(appDir, 'package.json'))
metadata._atomModuleCache.folders.forEach (folder) ->
metadata._nylasModuleCache.folders.forEach (folder) ->
if '' in folder.paths
folder.paths = [
''
@ -25,13 +25,4 @@ module.exports = (grunt) ->
'static'
]
# Reactionary does not have an explicit react dependency
metadata._atomModuleCache.folders.push
paths: [
'node_modules/reactionary-atom-fork/lib'
]
dependencies: {
'react-atom-fork': metadata.dependencies['react-atom-fork']
}
grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata))

View file

@ -8,8 +8,8 @@ module.exports = (grunt) ->
{cp, mkdir, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'install', 'Install the built application', ->
installDir = grunt.config.get('atom.installDir')
shellAppDir = grunt.config.get('atom.shellAppDir')
installDir = grunt.config.get('nylasGruntConfig.installDir')
shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir')
if process.platform is 'win32'
runas ?= require 'runas'

View file

@ -9,7 +9,7 @@ module.exports = (grunt) ->
template = _.template(String(fs.readFileSync("#{filePath}.in")))
filled = template(data)
outputPath = path.join(grunt.config.get('atom.buildDir'), path.basename(filePath))
outputPath = path.join(grunt.config.get('nylasGruntConfig.buildDir'), path.basename(filePath))
grunt.file.write(outputPath, filled)
outputPath
@ -22,7 +22,7 @@ module.exports = (grunt) ->
grunt.registerTask 'mkdeb', 'Create debian package', ->
done = @async()
buildDir = grunt.config.get('atom.buildDir')
buildDir = grunt.config.get('nylasGruntConfig.buildDir')
if process.arch is 'ia32'
arch = 'i386'

View file

@ -6,11 +6,11 @@ Promise = require("bluebird")
module.exports = (grunt) ->
{spawn, rm} = require('./task-helpers')(grunt)
appName = -> grunt.config.get('atom.appName')
appName = -> grunt.config.get('nylasGruntConfig.appName')
dmgName = -> "#{appName().split('.')[0]}.dmg"
buildDir = -> grunt.config.get('atom.buildDir')
buildDir = -> grunt.config.get('nylasGruntConfig.buildDir')
dmgPath = -> path.join(buildDir(), dmgName())
appDir = -> path.join(buildDir(), grunt.config.get('atom.appName'))
appDir = -> path.join(buildDir(), grunt.config.get('nylasGruntConfig.appName'))
getDmgExecutable = ->
new Promise (resolve, reject) ->

View file

@ -9,7 +9,7 @@ module.exports = (grunt) ->
template = _.template(String(fs.readFileSync("#{filePath}.in")))
filled = template(data)
outputPath = path.join(grunt.config.get('atom.buildDir'), path.basename(filePath))
outputPath = path.join(grunt.config.get('nylasGruntConfig.buildDir'), path.basename(filePath))
grunt.file.write(outputPath, filled)
outputPath
@ -24,13 +24,13 @@ module.exports = (grunt) ->
return done("Unsupported arch #{process.arch}")
{name, version, description} = grunt.file.readJSON('package.json')
buildDir = grunt.config.get('atom.buildDir')
buildDir = grunt.config.get('nylasGruntConfig.buildDir')
rpmDir = path.join(buildDir, 'rpm')
rm rpmDir
mkdir rpmDir
installDir = grunt.config.get('atom.installDir')
installDir = grunt.config.get('nylasGruntConfig.installDir')
shareDir = path.join(installDir, 'share', 'nylas')
iconName = path.join(shareDir, 'resources', 'app', 'resources', 'nylas.png')

View file

@ -2,7 +2,7 @@ path = require 'path'
module.exports = (grunt) ->
grunt.registerTask 'output-build-filetypes', 'Log counts for each filetype in the built application', ->
shellAppDir = grunt.config.get('atom.shellAppDir')
shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir')
types = {}
grunt.file.recurse shellAppDir, (absolutePath, rootPath, relativePath, fileName) ->

View file

@ -2,7 +2,7 @@ path = require 'path'
module.exports = (grunt) ->
grunt.registerTask 'output-long-paths', 'Log long paths in the built application', ->
shellAppDir = grunt.config.get('atom.shellAppDir')
shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir')
longPaths = []
grunt.file.recurse shellAppDir, (absolutePath, rootPath, relativePath, fileName) ->

View file

@ -9,13 +9,12 @@ module.exports = (grunt) ->
['ui-light', 'ui-dark']
]
directory = path.join(grunt.config.get('atom.appDir'), 'less-compile-cache')
directory = path.join(grunt.config.get('nylasGruntConfig.appDir'), 'less-compile-cache')
for configuration in prebuiltConfigurations
importPaths = grunt.config.get('less.options.paths')
themeMains = []
for theme in configuration
# TODO Use AtomPackage class once it runs outside of an Atom context
themePath = path.resolve('node_modules', theme)
if fs.existsSync(themePath) is false
themePath = path.resolve('internal_packages', theme)

View file

@ -12,7 +12,7 @@ fullVersion = null
module.exports = (grunt) ->
{cp, spawn, rm} = require('./task-helpers')(grunt)
appName = -> grunt.config.get('atom.appName')
appName = -> grunt.config.get('nylasGruntConfig.appName')
dmgName = -> "#{appName().split('.')[0]}.dmg"
zipName = -> "#{appName().split('.')[0]}.zip"
winReleasesName = -> "RELEASES"
@ -21,7 +21,7 @@ module.exports = (grunt) ->
populateVersion = ->
new Promise (resolve, reject) ->
json = require(path.join(grunt.config.get('atom.appDir'), 'package.json'))
json = require(path.join(grunt.config.get('nylasGruntConfig.appDir'), 'package.json'))
cmd = 'git'
args = ['rev-parse', '--short', 'HEAD']
spawn {cmd, args}, (error, {stdout}={}, code) ->
@ -37,7 +37,7 @@ module.exports = (grunt) ->
runEmailIntegrationTest = ->
return Promise.resolve() unless process.platform is 'darwin'
buildDir = grunt.config.get('atom.buildDir')
buildDir = grunt.config.get('nylasGruntConfig.buildDir')
new Promise (resolve, reject) ->
appToRun = path.join(buildDir, appName())
scriptToRun = "./build/run-build-and-send-screenshot.scpt"
@ -88,7 +88,7 @@ module.exports = (grunt) ->
resolve(data)
uploadToS3 = (filename, key) ->
buildDir = grunt.config.get('atom.buildDir')
buildDir = grunt.config.get('nylasGruntConfig.buildDir')
filepath = path.join(buildDir, filename)
grunt.log.writeln ">> Uploading #{filename} to #{key}"
@ -98,7 +98,7 @@ module.exports = (grunt) ->
Promise.resolve(data)
uploadZipToS3 = (filenameToZip, key) ->
buildDir = grunt.config.get('atom.buildDir')
buildDir = grunt.config.get('nylasGruntConfig.buildDir')
buildZipFilename = "#{filenameToZip}.zip"
buildZipPath = path.join(buildDir, buildZipFilename)
@ -150,7 +150,7 @@ module.exports = (grunt) ->
uploadPromises.push uploadToS3("installer/"+winSetupName(), "#{fullVersion}/#{process.platform}/#{process.arch}/N1Setup.exe")
uploadPromises.push uploadToS3("installer/"+winNupkgName(), "#{fullVersion}/#{process.platform}/#{process.arch}/#{winNupkgName()}")
if process.platform is 'linux'
buildDir = grunt.config.get('atom.buildDir')
buildDir = grunt.config.get('nylasGruntConfig.buildDir')
files = fs.readdirSync(buildDir)
for file in files
if path.extname(file) is '.deb'

View file

@ -4,7 +4,7 @@ module.exports = (grunt) ->
grunt.registerTask 'set-exe-icon', 'Set icon of the exe', ->
done = @async()
shellAppDir = grunt.config.get('atom.shellAppDir')
shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir')
shellExePath = path.join(shellAppDir, 'nylas.exe')
iconPath = path.resolve('build', 'resources', 'win', 'nylas.ico')

View file

@ -8,7 +8,7 @@ module.exports = (grunt) ->
onBuildMachine = process.env.JANKY_SHA1 and process.env.JANKY_BRANCH is 'master'
onWindows = process.platform is 'win32'
inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git'))
{version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json'))
{version} = require(path.join(grunt.config.get('nylasGruntConfig.appDir'), 'package.json'))
if onBuildMachine or onWindows or not inRepository
callback(null, version)
else
@ -27,7 +27,7 @@ module.exports = (grunt) ->
done(error)
return
appDir = grunt.config.get('atom.appDir')
appDir = grunt.config.get('nylasGruntConfig.appDir')
# Replace version field of package.json.
packageJsonPath = path.join(appDir, 'package.json')
@ -38,11 +38,11 @@ module.exports = (grunt) ->
if process.platform is 'darwin'
cmd = 'script/set-version'
args = [grunt.config.get('atom.buildDir'), version]
args = [grunt.config.get('nylasGruntConfig.buildDir'), version]
spawn {cmd, args}, (error, result, code) -> done(error)
else if process.platform is 'win32'
shellAppDir = grunt.config.get('atom.shellAppDir')
shellAppDir = grunt.config.get('nylasGruntConfig.shellAppDir')
shellExePath = path.join(shellAppDir, 'nylas.exe')
strings =

View file

@ -8,7 +8,7 @@ request = require 'request'
concurrency = 2
module.exports = (grunt) ->
{isAtomPackage, spawn} = require('./task-helpers')(grunt)
{isNylasPackage, spawn} = require('./task-helpers')(grunt)
packageSpecQueue = null
@ -27,7 +27,7 @@ module.exports = (grunt) ->
grunt.log.error(stderr)
getAppPath = ->
contentsDir = grunt.config.get('atom.contentsDir')
contentsDir = grunt.config.get('nylasGruntConfig.contentsDir')
switch process.platform
when 'darwin'
path.join(contentsDir, 'MacOS', 'Edgehill')
@ -38,7 +38,7 @@ module.exports = (grunt) ->
runPackageSpecs = (callback) ->
failedPackages = []
rootDir = grunt.config.get('atom.shellAppDir')
rootDir = grunt.config.get('nylasGruntConfig.shellAppDir')
resourcePath = process.cwd()
appPath = getAppPath()
@ -76,7 +76,7 @@ module.exports = (grunt) ->
for packageDirectory in fs.readdirSync(modulesDirectory)
packagePath = path.join(modulesDirectory, packageDirectory)
continue unless grunt.file.isDir(path.join(packagePath, 'spec'))
continue unless isAtomPackage(packagePath)
continue unless isNylasPackage(packagePath)
packageSpecQueue.push(packagePath)
packageSpecQueue.concurrency = concurrency - 1
@ -123,7 +123,7 @@ module.exports = (grunt) ->
elapsedTime = Math.round((Date.now() - startTime) / 100) / 10
grunt.log.ok("Total spec time: #{elapsedTime}s using #{concurrency} cores")
failures = failedPackages
failures.push "atom core" if coreSpecFailed
failures.push "N1 core" if coreSpecFailed
grunt.log.error("[Error]".red + " #{failures.join(', ')} spec(s) failed") if failures.length > 0

View file

@ -60,9 +60,9 @@ module.exports = (grunt) ->
grunt.log.error results.stderr if exitCode != 0
callback(error, results, exitCode)
isAtomPackage: (packagePath) ->
isNylasPackage: (packagePath) ->
try
{engines} = grunt.file.readJSON(path.join(packagePath, 'package.json'))
engines?.atom?
engines?.nylas?
catch error
false

View file

@ -20,7 +20,7 @@ Each package is defined by a `package.json` file that includes its name, version
"description": "An example package for N1",
"license": "Proprietary",
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
"request": "^2.53"

View file

@ -65,10 +65,10 @@ This method can be used in the `describe`, `it`, `beforeEach` and `afterEach` fu
describe "when we open a file", ->
beforeEach ->
waitsForPromise ->
atom.workspace.open 'c.coffee'
NylasEnv.workspace.open 'c.coffee'
it "should be opened in an editor", ->
expect(atom.workspace.getActiveTextEditor().getPath()).toContain 'c.coffee'
expect(NylasEnv.workspace.getActiveTextEditor().getPath()).toContain 'c.coffee'
```
@ -79,15 +79,15 @@ describe "waiting for the packages to load", ->
beforeEach ->
waitsForPromise ->
atom.workspace.open('sample.js')
NylasEnv.workspace.open('sample.js')
waitsForPromise ->
atom.packages.activatePackage('tabs')
NylasEnv.packages.activatePackage('tabs')
waitsForPromise ->
atom.packages.activatePackage('tree-view')
NylasEnv.packages.activatePackage('tree-view')
it 'should have waited long enough', ->
expect(atom.packages.isPackageActive('tabs')).toBe true
expect(atom.packages.isPackageActive('tree-view')).toBe true
expect(NylasEnv.packages.isPackageActive('tabs')).toBe true
expect(NylasEnv.packages.isPackageActive('tree-view')).toBe true
```
#### Asynchronous functions with callbacks

View file

@ -6,7 +6,7 @@ import fs from 'fs';
class TemplateStore extends NylasStore {
init(templatesDir = path.join(atom.getConfigDirPath(), 'templates')) {
init(templatesDir = path.join(NylasEnv.getConfigDirPath(), 'templates')) {
this.items = this.items.bind(this);
this.templatesDirectory = this.templatesDirectory.bind(this);
this._setStoreDefaults = this._setStoreDefaults.bind(this);

View file

@ -11,7 +11,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
},

View file

@ -10,7 +10,7 @@
"license": "Proprietary",
"engines": {
"atom": "*"
"nylas": "*"
},
"repository": {
"type": "git",

View file

@ -16,7 +16,7 @@
#### Who?
The source is annotated for people who are familiar with React, but not familiar with APIs from either Atom or N1.
The source is annotated for people who are familiar with React, but not familiar with APIs from N1.
As such, we will not annotate any code that is specific for React, but we'll annotate code for everything else.

View file

@ -144,14 +144,14 @@ class FiltersStore extends NylasStore
# The filters are stored in the config.cson file.
_loadFilters: =>
atom.config.get('filters') ? []
NylasEnv.config.get('filters') ? []
# Rewrite the filters to the config.cson file.
_saveFilters: (filters) =>
filters = @_trimFilters filters
if @_validateFilters(filters)
atom.config.set 'filters', filters
NylasEnv.config.set 'filters', filters
else
throw new Error("invalid filters")

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "#"
"nylas": "#"
},
"dependencies": {
}

View file

@ -10,7 +10,7 @@
"license": "MIT",
"engines": {
"atom": "*"
"nylas": "*"
},
"repository": {
"type": "git",

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
"underscore": "^1.8.3"

View file

@ -7,7 +7,7 @@
"url": ""
},
"engines": {
"atom": ">=0.3.5"
"nylas": ">=0.3.5"
},
"description": "Enter a description of your package!",
"dependencies": [],

View file

@ -5,7 +5,7 @@
"description": "An example package for Nylas Mail that translates drafts into other languages using the Yandex API.",
"license": "Proprietary",
"engines": {
"atom": "*"
"nylas": "*"
},
"repository": {
"type": "git",

View file

@ -7,7 +7,7 @@
"url": ""
},
"engines": {
"atom": ">=0.3.5"
"nylas": ">=0.3.5"
},
"description": "Send calendar availabilities via email for easier appointment scheduling.",
"dependencies": {

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
}

View file

@ -4,7 +4,7 @@ AccountSidebarStore = require '../lib/account-sidebar-store'
describe "AccountSidebarStore", ->
describe "sections", ->
it "should return the correct output", ->
atom.testOrganizationUnit = 'folder'
NylasEnv.testOrganizationUnit = 'folder'
spyOn(CategoryStore, 'getStandardCategories').andCallFake ->
return [

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
},

View file

@ -6,6 +6,6 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
}
}

View file

@ -22,10 +22,10 @@ describe 'CategoryPicker', ->
CategoryStore._categoryCache = {}
afterEach ->
atom.testOrganizationUnit = null
NylasEnv.testOrganizationUnit = null
setupFor = (organizationUnit) ->
atom.testOrganizationUnit = organizationUnit
NylasEnv.testOrganizationUnit = organizationUnit
@categoryClass = if organizationUnit is "label" then Label else Folder
@inboxCategory = new @categoryClass(id: 'id-123', name: 'inbox', displayName: "INBOX")
@ -82,7 +82,7 @@ describe 'CategoryPicker', ->
beforeEach ->
setupForCreateNew.call @
afterEach -> atom.testOrganizationUnit = null
afterEach -> NylasEnv.testOrganizationUnit = null
it "is not visible when the search box is empty", ->
count = ReactTestUtils.scryRenderedDOMComponentsWithClass(@picker, 'category-create-new').length

View file

@ -3,7 +3,7 @@
class SignatureDraftStoreExtension extends DraftStoreExtension
@prepareNewDraft: (draft) ->
accountId = AccountStore.current().id
signature = atom.config.get("nylas.account-#{accountId}.signature")
signature = NylasEnv.config.get("nylas.account-#{accountId}.signature")
return unless signature
insertionPoint = draft.body.indexOf('<blockquote')

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"windowTypes": {
"default": true,

View file

@ -7,7 +7,7 @@ describe "SignatureDraftStoreExtension", ->
describe "when a signature is defined", ->
beforeEach ->
@signature = "<div id='signature'>This is my signature.</div>"
spyOn(atom.config, 'get').andCallFake =>
spyOn(NylasEnv.config, 'get').andCallFake =>
@signature
it "should insert the signature at the end of the message or before the first blockquote", ->
@ -25,7 +25,7 @@ describe "SignatureDraftStoreExtension", ->
describe "when a signature is not defined", ->
beforeEach ->
spyOn(atom.config, 'get').andCallFake ->
spyOn(NylasEnv.config, 'get').andCallFake ->
null
it "should not do anything", ->

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"windowTypes": {
"default": true,

View file

@ -15,10 +15,10 @@ class ComposerWithWindowProps extends React.Component
@containerRequired: false
constructor: (@props) ->
@state = atom.getWindowProps()
@state = NylasEnv.getWindowProps()
componentDidMount: ->
@unlisten = atom.onWindowPropsReceived (windowProps) =>
@unlisten = NylasEnv.onWindowPropsReceived (windowProps) =>
{errorMessage} = windowProps
@setState(windowProps)
if errorMessage
@ -53,15 +53,15 @@ module.exports =
ComponentRegistry.register ComposerView,
role: 'Composer'
if atom.isMainWindow()
atom.registerHotWindow
if NylasEnv.isMainWindow()
NylasEnv.registerHotWindow
windowType: 'composer'
replenishNum: 2
ComponentRegistry.register ComposeButton,
location: WorkspaceStore.Location.RootSidebar.Toolbar
else
atom.getCurrentWindow().setMinimumSize(480, 400)
NylasEnv.getCurrentWindow().setMinimumSize(480, 400)
WorkspaceStore.defineSheet 'Main', {root: true},
popout: ['Center']
@ -69,8 +69,8 @@ module.exports =
location: WorkspaceStore.Location.Center
deactivate: ->
if atom.isMainWindow()
atom.unregisterHotWindow('composer')
if NylasEnv.isMainWindow()
NylasEnv.unregisterHotWindow('composer')
ComponentRegistry.unregister(ComposerView)
ComponentRegistry.unregister(ComposeButton)
ComponentRegistry.unregister(ComposerWithWindowProps)

View file

@ -8,7 +8,7 @@
"scripts": {
},
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
},

View file

@ -390,7 +390,7 @@ describe "populated composer", ->
describe "When sending a message", ->
beforeEach ->
spyOn(atom, "isMainWindow").andReturn true
spyOn(NylasEnv, "isMainWindow").andReturn true
remote = require('remote')
@dialog = remote.require('dialog')
spyOn(remote, "getCurrentWindow")
@ -734,7 +734,7 @@ describe "when the DraftStore `isSending` isn't stubbed out", ->
it "doesn't send twice in the main window", ->
spyOn(Actions, "queueTask")
spyOn(Actions, "sendDraft").andCallThrough()
spyOn(atom, "isMainWindow").andReturn true
spyOn(NylasEnv, "isMainWindow").andReturn true
useFullDraft.call(@)
makeComposer.call(@)
@composer._sendDraft()

View file

@ -35,7 +35,7 @@ participant5 = new Contact
describe 'ParticipantsTextField', ->
beforeEach ->
spyOn(atom, "isMainWindow").andReturn true
spyOn(NylasEnv, "isMainWindow").andReturn true
@propChange = jasmine.createSpy('change')
@fieldName = 'to'

View file

@ -1,7 +1,4 @@
// The ui-variables file is provided by base themes provided by Atom.
//
// See https://github.com/atom/atom-dark-ui/blob/master/stylesheets/ui-variables.less
// for a full listing of what's available.
// The ui-variables file is provided by base themes provided by N1.
@import "ui-variables";
@import "ui-mixins";
@import "buttons";

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
}

View file

@ -32,7 +32,7 @@ class FeedbackButton extends React.Component
@setState(newMessages: true)
_onSendFeedback: =>
return if atom.inSpecMode()
return if NylasEnv.inSpecMode()
Screen = require('remote').require('screen')
qs = require 'querystring'
@ -46,10 +46,10 @@ class FeedbackButton extends React.Component
platform: process.platform
provider: account.displayProvider()
organizational_unit: account.organizationUnit
version: atom.getVersion()
version: NylasEnv.getVersion()
})
parentBounds = atom.getCurrentWindow().getBounds()
parentBounds = NylasEnv.getCurrentWindow().getBounds()
parentScreen = Screen.getDisplayMatching(parentBounds)
width = 376

View file

@ -3,7 +3,7 @@
"main": "./lib/main",
"version": "0.1.0",
"engines": {
"atom": "*"
"nylas": "*"
},
"description": "Intercom feeedback",
"dependencies": {

View file

@ -5,7 +5,7 @@
"main": "./lib/main",
"license": "Proprietary",
"engines": {
"atom": "*"
"nylas": "*"
},
"private": true
}

View file

@ -12,18 +12,18 @@ class AutoloadImagesStore extends NylasStore
@_whitelistEmails = {}
@_whitelistMessageIds = {}
@_whitelistEmailsPath = path.join(atom.getConfigDirPath(), 'autoload-images-whitelist.txt')
@_whitelistEmailsPath = path.join(NylasEnv.getConfigDirPath(), 'autoload-images-whitelist.txt')
@_loadWhitelist()
@listenTo AutoloadImagesActions.temporarilyEnableImages, @_onTemporarilyEnableImages
@listenTo AutoloadImagesActions.permanentlyEnableImages, @_onPermanentlyEnableImages
atom.config.observe 'core.reading.autoloadImages', =>
NylasEnv.config.observe 'core.reading.autoloadImages', =>
MessageBodyProcessor.resetCache()
shouldBlockImagesIn: (message) =>
return false if atom.config.get('core.reading.autoloadImages') is true
return false if NylasEnv.config.get('core.reading.autoloadImages') is true
return false if @_whitelistEmails[Utils.toEquivalentEmailForm(message.fromContact().email)]
return false if @_whitelistMessageIds[message.id]
return false unless ImagesRegexp.test(message.body)

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
"autolinker": "0.18.1"

View file

@ -40,7 +40,7 @@ class MessageControls extends React.Component
select: @_onForward
if @props.message.canReplyAll()
defaultReplyType = atom.config.get('core.sending.defaultReplyType')
defaultReplyType = NylasEnv.config.get('core.sending.defaultReplyType')
if defaultReplyType is 'reply-all'
return [replyAll, reply, forward]
else

View file

@ -238,7 +238,7 @@ class MessageList extends React.Component
# Returns either "reply" or "reply-all"
_replyType: =>
defaultReplyType = atom.config.get('core.sending.defaultReplyType')
defaultReplyType = NylasEnv.config.get('core.sending.defaultReplyType')
lastMsg = _.last(_.filter((@state.messages ? []), (m) -> not m.draft))
return 'reply' unless lastMsg

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
"autolinker": "0.18.1"

View file

@ -249,7 +249,7 @@ describe "MessageList", ->
expect(cs.length).toBe 1
it "prompts for a reply-all when there's more than one participant and the default is reply-all", ->
spyOn(atom.config, "get").andReturn "reply-all"
spyOn(NylasEnv.config, "get").andReturn "reply-all"
MessageStore._items = [m5, m3]
MessageStore._thread = test_thread
MessageStore.trigger()
@ -258,7 +258,7 @@ describe "MessageList", ->
expect(cs.length).toBe 1
it "prompts for a reply-all when there's more than one participant and the default is reply", ->
spyOn(atom.config, "get").andReturn "reply"
spyOn(NylasEnv.config, "get").andReturn "reply"
MessageStore._items = [m5, m3]
MessageStore._thread = test_thread
MessageStore.trigger()

View file

@ -5,7 +5,7 @@
"main": "./lib/main",
"license": "Proprietary",
"engines": {
"atom": "*"
"nylas": "*"
},
"private": true
}

View file

@ -13,7 +13,7 @@ module.exports =
return unless @services.available()
# We shouldn't ask if they've already said No
return if atom.config.get(NOTIF_SETTINGS_KEY) is true
return if NylasEnv.config.get(NOTIF_SETTINGS_KEY) is true
@services.isRegisteredForURLScheme 'mailto', (registered) =>
# Prompt them to make Nylas their default client
@ -46,4 +46,4 @@ module.exports =
console.log(err) if err
if action.id is NOTIF_ACTION_NO
atom.config.set(NOTIF_SETTINGS_KEY, true)
NylasEnv.config.set(NOTIF_SETTINGS_KEY, true)

View file

@ -5,6 +5,6 @@
"description": "Displays a notification asking the user to make N1 their default mailto handler",
"license": "Proprietary",
"engines": {
"atom": "*"
"nylas": "*"
}
}

View file

@ -9,16 +9,16 @@ module.exports =
updater = remote.getGlobal('application').autoUpdateManager
@_unlisten = Actions.notificationActionTaken.listen(@_onNotificationActionTaken, @)
configVersion = atom.config.get("lastVersion")
currentVersion = atom.getVersion()
configVersion = NylasEnv.config.get("lastVersion")
currentVersion = NylasEnv.getVersion()
if configVersion and configVersion isnt currentVersion
atom.config.set("lastVersion", currentVersion)
NylasEnv.config.set("lastVersion", currentVersion)
@displayThanksNotification()
if updater.getState() is 'update-available'
@displayNotification(updater.releaseVersion)
atom.onUpdateAvailable ({releaseVersion, releaseNotes} = {}) =>
NylasEnv.onUpdateAvailable ({releaseVersion, releaseNotes} = {}) =>
@displayNotification(releaseVersion)
displayThanksNotification: ->

View file

@ -5,6 +5,6 @@
"description": "Displays a notification when an update is available",
"license": "Proprietary",
"engines": {
"atom": "*"
"nylas": "*"
}
}

View file

@ -41,9 +41,9 @@ describe "NotificationUpdateAvailable", ->
expect(@package.displayNotification).not.toHaveBeenCalled()
it "should listen for `window:update-available`", ->
spyOn(atom, 'onUpdateAvailable').andCallThrough()
spyOn(NylasEnv, 'onUpdateAvailable').andCallThrough()
@package.activate()
expect(atom.onUpdateAvailable).toHaveBeenCalled()
expect(NylasEnv.onUpdateAvailable).toHaveBeenCalled()
describe "displayNotification", ->
beforeEach ->

View file

@ -57,7 +57,7 @@ class NotificationStickyBar extends React.Component
@
# It's important that every React class explicitly stops listening to
# atom events before it unmounts. Thank you event-kit
# N1 events before it unmounts. Thank you event-kit
# This can be fixed via a Reflux mixin
componentWillUnmount: =>
@_unlistener() if @_unlistener

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
}

View file

@ -79,7 +79,7 @@ class AccountChoosePage extends React.Component
# server.
provider.encryptionKey = crypto.randomBytes(24)
provider.encryptionIv = crypto.randomBytes(16)
code = atom.config.get('invitationCode') || ''
code = NylasEnv.config.get('invitationCode') || ''
state = [provider.clientKey,@_base64url(provider.encryptionKey),@_base64url(provider.encryptionIv),code].join(',')
googleUrl = url.format({

View file

@ -241,7 +241,7 @@ class AccountSettingsPage extends React.Component
pass: ''
sendImmediately: true
.then (json) =>
invite_code = atom.config.get('invitationCode')
invite_code = NylasEnv.config.get('invitationCode')
json.invite_code = invite_code
json.email = data.email
@ -259,7 +259,7 @@ class AccountSettingsPage extends React.Component
try
OnboardingActions.accountJSONReceived(json)
catch e
atom.emitError(e)
NylasEnv.emitError(e)
@setState
tryingToAuthenticate: false
errorMessage: "Sorry, something went wrong on the Nylas server. Please try again. If you're still having issues, contact us at support@nylas.com."

View file

@ -10,7 +10,7 @@ RunningPackageInstalls = 0
class InstallButton extends React.Component
constructor: (@props) ->
@state =
installed: atom.packages.resolvePackagePath(@props.package.name)?
installed: NylasEnv.packages.resolvePackagePath(@props.package.name)?
installing: false
render: =>
@ -25,12 +25,12 @@ class InstallButton extends React.Component
return unless @props.package.path
RunningPackageInstalls += 1
@setState(installing: true)
atom.packages.installPackageFromPath @props.package.path, (err) =>
NylasEnv.packages.installPackageFromPath @props.package.path, (err) =>
RunningPackageInstalls -= 1
@props.onPackageInstaled()
@setState({
installing: false
installed: atom.packages.resolvePackagePath(@props.package.name)?
installed: NylasEnv.packages.resolvePackagePath(@props.package.name)?
})
class InitialPackagesPage extends React.Component

View file

@ -6,7 +6,7 @@ NylasStore = require 'nylas-store'
class InitialPackagesStore extends NylasStore
constructor: ->
@starterPackages = []
{resourcePath} = atom.getLoadSettings()
{resourcePath} = NylasEnv.getLoadSettings()
if resourcePath.indexOf('app.asar') != -1
@starterPackagesPath = path.join(resourcePath,'..', 'app.asar.unpacked', 'examples')

View file

@ -31,7 +31,7 @@ class InitialPreferencesOptions extends React.Component
@_loadTemplates()
_loadTemplates: =>
templatesDir = path.join(atom.getLoadSettings().resourcePath, 'keymaps', 'templates')
templatesDir = path.join(NylasEnv.getLoadSettings().resourcePath, 'keymaps', 'templates')
fs.readdir templatesDir, (err, files) =>
return unless files and files instanceof Array
templates = files.filter (filename) =>

View file

@ -6,7 +6,7 @@ module.exports =
activate: (@state) ->
# This package does nothing in other windows
return unless atom.getWindowType() is 'onboarding'
return unless NylasEnv.getWindowType() is 'onboarding'
WorkspaceStore.defineSheet 'Main', {root: true},
list: ['Center']

View file

@ -4,14 +4,14 @@ NylasStore = require 'nylas-store'
class NylasApiEnvironmentStore extends NylasStore
constructor: ->
@listenTo Actions.changeAPIEnvironment, @_setEnvironment
@_setEnvironment('production') unless atom.config.get('env')
@_setEnvironment('production') unless NylasEnv.config.get('env')
getEnvironment: ->
atom.config.get('env')
NylasEnv.config.get('env')
_setEnvironment: (env) ->
throw new Error("Environment #{env} is not allowed") unless env in ['development', 'experimental', 'staging', 'production']
atom.config.set('env', env)
NylasEnv.config.set('env', env)
@trigger()
module.exports = new NylasApiEnvironmentStore()

View file

@ -6,14 +6,14 @@ NylasStore = require 'nylas-store'
ipc = require 'ipc'
url = require 'url'
return unless atom.getWindowType() is "onboarding"
return unless NylasEnv.getWindowType() is "onboarding"
class PageRouterStore extends NylasStore
constructor: ->
atom.onWindowPropsReceived @_onWindowPropsChanged
NylasEnv.onWindowPropsReceived @_onWindowPropsChanged
@_page = atom.getWindowProps().page ? ''
@_pageData = atom.getWindowProps().pageData ? {}
@_page = NylasEnv.getWindowProps().page ? ''
@_pageData = NylasEnv.getWindowProps().pageData ? {}
@_pageStack = [{page: @_page, pageData: @_pageData}]
@_checkTokenAuthStatus()
@ -27,7 +27,7 @@ class PageRouterStore extends NylasStore
isFirstAccount = AccountStore.items().length is 0
AccountStore.addAccountFromJSON(json)
ipc.send('new-account-added')
atom.displayWindow()
NylasEnv.displayWindow()
if isFirstAccount
@_onMoveToPage('initial-preferences', {account: json})
else
@ -61,9 +61,9 @@ class PageRouterStore extends NylasStore
_onCloseWindow: ->
isFirstAccount = AccountStore.items().length is 0
if isFirstAccount
atom.quit()
NylasEnv.quit()
else
atom.close()
NylasEnv.close()
_checkTokenAuthStatus: ->
@_tokenAuthEnabled = "unknown"

View file

@ -33,14 +33,14 @@ class PageRouter extends React.Component
_initializeWindowSize: =>
return if @_unmounted
{width, height} = React.findDOMNode(@refs.activePage).getBoundingClientRect()
atom.setSize(width, height)
atom.center()
atom.show()
NylasEnv.setSize(width, height)
NylasEnv.center()
NylasEnv.show()
_updateWindowSize: =>
return if @_unmounted
{width, height} = React.findDOMNode(@refs.activePage).getBoundingClientRect()
atom.setSizeAnimated(width, height)
NylasEnv.setSizeAnimated(width, height)
_onStateChanged: =>
@setState(@_getStateFromStore())

View file

@ -4,12 +4,12 @@ nodeRequest = require 'request'
class TokenAuthAPI
constructor: ->
atom.config.onDidChange('env', @_onConfigChanged)
NylasEnv.config.onDidChange('env', @_onConfigChanged)
@_onConfigChanged()
@
_onConfigChanged: =>
env = atom.config.get('env')
env = NylasEnv.config.get('env')
if env is 'development'
@APIRoot = "http://localhost:6001"
else if env in ['experimental', 'staging']
@ -18,7 +18,7 @@ class TokenAuthAPI
@APIRoot = "https://invite.nylas.com"
request: (options={}) ->
return if atom.getLoadSettings().isSpec
return if NylasEnv.getLoadSettings().isSpec
options.method ?= 'GET'
options.url ?= "#{@APIRoot}#{options.path}" if options.path
options.body ?= {} unless options.formData

View file

@ -138,7 +138,7 @@ class TokenAuthPage extends React.Component
returnsModel: false
timeout: 30000
success: (json) =>
atom.config.set("invitationCode", @state.token)
NylasEnv.config.set("invitationCode", @state.token)
OnboardingActions.moveToPage("account-choose")
error: (err) =>
_.delay =>

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
"async": "^0.9"

View file

@ -4,29 +4,29 @@ storeConstructor = NylasApiEnvironmentStore.constructor
describe "NylasApiEnvironmentStore", ->
beforeEach ->
spyOn(atom.config, "set")
spyOn(NylasEnv.config, "set")
it "doesn't set if it alreayd exists", ->
spyOn(atom.config, "get").andReturn "staging"
spyOn(NylasEnv.config, "get").andReturn "staging"
store = new storeConstructor()
expect(atom.config.set).not.toHaveBeenCalled()
expect(NylasEnv.config.set).not.toHaveBeenCalled()
it "initializes with the correct default in dev mode", ->
spyOn(atom, "inDevMode").andReturn true
spyOn(atom.config, "get").andReturn undefined
spyOn(NylasEnv, "inDevMode").andReturn true
spyOn(NylasEnv.config, "get").andReturn undefined
store = new storeConstructor()
expect(atom.config.set).toHaveBeenCalledWith("env", "production")
expect(NylasEnv.config.set).toHaveBeenCalledWith("env", "production")
it "initializes with the correct default in production", ->
spyOn(atom, "inDevMode").andReturn false
spyOn(atom.config, "get").andReturn undefined
spyOn(NylasEnv, "inDevMode").andReturn false
spyOn(NylasEnv.config, "get").andReturn undefined
store = new storeConstructor()
expect(atom.config.set).toHaveBeenCalledWith("env", "production")
expect(NylasEnv.config.set).toHaveBeenCalledWith("env", "production")
describe "when setting the environment", ->
it "sets from the desired action", ->
Actions.changeAPIEnvironment("staging")
expect(atom.config.set).toHaveBeenCalledWith("env", "staging")
expect(NylasEnv.config.set).toHaveBeenCalledWith("env", "staging")
it "throws if the env is invalid", ->
expect( -> Actions.changeAPIEnvironment("bad")).toThrow()

View file

@ -25,10 +25,10 @@ PackagesStore = Reflux.createStore
@listenTo PluginsActions.refreshFeaturedPackages, @_refreshFeatured
@listenTo PluginsActions.refreshInstalledPackages, @_refreshInstalled
atom.commands.add 'body',
NylasEnv.commands.add 'body',
'application:create-package': => @_onCreatePackage()
atom.commands.add 'body',
NylasEnv.commands.add 'body',
'application:install-package': => @_onInstallPackage()
@listenTo PluginsActions.createPackage, @_onCreatePackage
@ -37,7 +37,7 @@ PackagesStore = Reflux.createStore
@listenTo PluginsActions.setInstalledSearchValue, @_onInstalledSearchChange
@listenTo PluginsActions.showPackage, (pkg) =>
dir = atom.packages.resolvePackagePath(pkg.name)
dir = NylasEnv.packages.resolvePackagePath(pkg.name)
shell.showItemInFolder(dir) if dir
@listenTo PluginsActions.installPackage, (pkg) =>
@ -48,25 +48,25 @@ PackagesStore = Reflux.createStore
delete @_installing[pkg.name]
@_displayMessage("Sorry, an error occurred", err.toString())
else
if atom.packages.isPackageDisabled(pkg.name)
atom.packages.enablePackage(pkg.name)
if NylasEnv.packages.isPackageDisabled(pkg.name)
NylasEnv.packages.enablePackage(pkg.name)
@_onPackagesChanged()
@listenTo PluginsActions.uninstallPackage, (pkg) =>
if atom.packages.isPackageLoaded(pkg.name)
atom.packages.disablePackage(pkg.name)
atom.packages.unloadPackage(pkg.name)
if NylasEnv.packages.isPackageLoaded(pkg.name)
NylasEnv.packages.disablePackage(pkg.name)
NylasEnv.packages.unloadPackage(pkg.name)
@_apm.uninstall pkg, (err) =>
@_displayMessage("Sorry, an error occurred", err.toString()) if err
@_onPackagesChanged()
@listenTo PluginsActions.enablePackage, (pkg) ->
if atom.packages.isPackageDisabled(pkg.name)
atom.packages.enablePackage(pkg.name)
if NylasEnv.packages.isPackageDisabled(pkg.name)
NylasEnv.packages.enablePackage(pkg.name)
@listenTo PluginsActions.disablePackage, (pkg) ->
unless atom.packages.isPackageDisabled(pkg.name)
atom.packages.disablePackage(pkg.name)
unless NylasEnv.packages.isPackageDisabled(pkg.name)
NylasEnv.packages.disablePackage(pkg.name)
@_hasPrepared = false
@ -93,10 +93,10 @@ PackagesStore = Reflux.createStore
_prepareIfFresh: ->
return if @_hasPrepared
atom.packages.onDidActivatePackage(=> @_onPackagesChangedDebounced())
atom.packages.onDidDeactivatePackage(=> @_onPackagesChangedDebounced())
atom.packages.onDidLoadPackage(=> @_onPackagesChangedDebounced())
atom.packages.onDidUnloadPackage(=> @_onPackagesChangedDebounced())
NylasEnv.packages.onDidActivatePackage(=> @_onPackagesChangedDebounced())
NylasEnv.packages.onDidDeactivatePackage(=> @_onPackagesChangedDebounced())
NylasEnv.packages.onDidLoadPackage(=> @_onPackagesChangedDebounced())
NylasEnv.packages.onDidUnloadPackage(=> @_onPackagesChangedDebounced())
@_onPackagesChanged()
@_hasPrepared = true
@ -162,7 +162,7 @@ PackagesStore = Reflux.createStore
@_apm.update(pkg, pkg.newerVersion)
_onInstallPackage: ->
{resourcePath} = atom.getLoadSettings()
{resourcePath} = NylasEnv.getLoadSettings()
if resourcePath.indexOf('app.asar') != -1
starterPackagesPath = path.join(resourcePath,'..', 'app.asar.unpacked', 'examples')
else
@ -174,7 +174,7 @@ PackagesStore = Reflux.createStore
properties: ['openDirectory']
, (filenames) =>
return if not filenames or filenames.length is 0
atom.packages.installPackageFromPath filenames[0], (err, packageTargetDir) =>
NylasEnv.packages.installPackageFromPath filenames[0], (err, packageTargetDir) =>
return if err
packageName = path.basename(filenames[0])
msg = "#{packageName} has been installed and enabled. No need to \
@ -185,7 +185,7 @@ PackagesStore = Reflux.createStore
shell.showItemInFolder(packageTargetDir)
_onCreatePackage: ->
if not atom.inDevMode()
if not NylasEnv.inDevMode()
btn = dialog.showMessageBox
type: 'warning'
message: "Run with debug flags?"
@ -198,7 +198,7 @@ PackagesStore = Reflux.createStore
ipc.send('command', 'application:toggle-dev')
return
packagesDir = path.join(atom.getConfigDirPath(), 'dev', 'packages')
packagesDir = path.join(NylasEnv.getConfigDirPath(), 'dev', 'packages')
fs.makeTreeSync(packagesDir)
dialog.showSaveDialog
@ -214,7 +214,7 @@ PackagesStore = Reflux.createStore
return @_displayMessage('Invalid package location', 'Sorry, you must
create packages in the packages folder.')
if atom.packages.resolvePackagePath(packageName)
if NylasEnv.packages.resolvePackagePath(packageName)
return @_displayMessage('Invalid package name', 'Sorry, you must
give your package a unqiue name.')
@ -225,7 +225,7 @@ PackagesStore = Reflux.createStore
fs.mkdir packageDir, (err) =>
return @_displayMessage('Could not create package', err.toString()) if err
{resourcePath} = atom.getLoadSettings()
{resourcePath} = NylasEnv.getLoadSettings()
packageTemplatePath = path.join(resourcePath, 'static', 'package-template')
packageJSON =
name: packageName
@ -235,7 +235,7 @@ PackagesStore = Reflux.createStore
type: 'git'
url: ''
engines:
atom: ">=#{atom.getVersion()}"
nylas: ">=#{NylasEnv.getVersion()}"
description: "Enter a description of your package!"
dependencies: {}
license: "MIT"
@ -244,8 +244,8 @@ PackagesStore = Reflux.createStore
fs.writeFileSync(path.join(packageDir, 'package.json'), JSON.stringify(packageJSON, null, 2))
shell.showItemInFolder(packageDir)
_.defer ->
atom.packages.enablePackage(packageDir)
atom.packages.activatePackage(packageName)
NylasEnv.packages.enablePackage(packageDir)
NylasEnv.packages.activatePackage(packageName)
_onGlobalSearchChange: (val) ->
# Clear previous search results data if this is a new
@ -261,7 +261,7 @@ PackagesStore = Reflux.createStore
installedNames = _.flatten(_.values(@_installed)).map (pkg) -> pkg.name
_.flatten(_.values(pkgs)).forEach (pkg) =>
pkg.enabled = !atom.packages.isPackageDisabled(pkg.name)
pkg.enabled = !NylasEnv.packages.isPackageDisabled(pkg.name)
pkg.installed = pkg.name in installedNames
pkg.installing = @_installing[pkg.name]?
pkg.newerVersionAvailable = @_newerVersions[pkg.name]?

View file

@ -17,7 +17,7 @@ class TabInstalled extends React.Component
if @state.search.length > 0
searchEmpty = "No matching packages."
if atom.inDevMode()
if NylasEnv.inDevMode()
devPackages = @state.packages.dev
devEmpty = <span>
You don't have any packages installed in ~/.nylas/dev/packages.

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
"moment": "^2.8"

View file

@ -25,14 +25,14 @@ class PreferencesKeymaps extends React.Component
@_loadTemplates()
componentDidMount: =>
@_disposable = atom.keymaps.onDidReloadKeymap =>
@_disposable = NylasEnv.keymaps.onDidReloadKeymap =>
@setState(bindings: @_getStateFromKeymaps())
componentWillUnmount: =>
@_disposable.dispose()
_loadTemplates: =>
templatesDir = path.join(atom.getLoadSettings().resourcePath, 'keymaps', 'templates')
templatesDir = path.join(NylasEnv.getLoadSettings().resourcePath, 'keymaps', 'templates')
fs.readdir templatesDir, (err, files) =>
return unless files and files instanceof Array
templates = files.filter (filename) =>
@ -44,7 +44,7 @@ class PreferencesKeymaps extends React.Component
_getStateFromKeymaps: =>
bindings = {}
for [command, label] in DisplayedKeybindings
bindings[command] = atom.keymaps.findKeyBindings(command: command, target: document.body) || []
bindings[command] = NylasEnv.keymaps.findKeyBindings(command: command, target: document.body) || []
bindings
render: =>
@ -97,7 +97,7 @@ class PreferencesKeymaps extends React.Component
return keystrokes.replace(/-/gi,'').replace(/cmd/gi, '⌘').replace(/alt/gi, '⌥').replace(/shift/gi, '⇧').replace(/ctrl/gi, '^').toUpperCase()
_onShowUserKeymaps: =>
keymapsFile = atom.keymaps.getUserKeymapPath()
keymapsFile = NylasEnv.keymaps.getUserKeymapPath()
if !fs.existsSync(keymapsFile)
fs.writeSync(fs.openSync(keymapsFile, 'w'), '')
require('shell').showItemInFolder(keymapsFile)

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
}

View file

@ -22,7 +22,7 @@ class SearchBar extends React.Component
@setState(focused: false) if @state.focused
# It's important that every React class explicitly stops listening to
# atom events before it unmounts. Thank you event-kit
# N1 events before it unmounts. Thank you event-kit
# This can be fixed via a Reflux mixin
componentWillUnmount: =>
usub() for usub in @usub

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
}

View file

@ -8,7 +8,7 @@ SearchSuggestionStore = require '../lib/search-suggestion-store'
describe 'SearchBar', ->
beforeEach ->
spyOn(atom, "isMainWindow").andReturn true
spyOn(NylasEnv, "isMainWindow").andReturn true
@searchBar = ReactTestUtils.renderIntoDocument(<SearchBar />)
input = ReactTestUtils.findRenderedDOMComponentWithTag(@searchBar, "input")
@input = React.findDOMNode(input)

View file

@ -6,7 +6,7 @@
"license": "Proprietary",
"private": true,
"engines": {
"atom": "*"
"nylas": "*"
},
"dependencies": {
}

View file

@ -13,8 +13,8 @@ const onSystemTrayToggle = (showSystemTray)=> {
};
export function activate() {
unsubConfig = atom.config.onDidChange('core.showSystemTray', onSystemTrayToggle).dispose;
if (atom.config.get('core.showSystemTray')) {
unsubConfig = NylasEnv.config.onDidChange('core.showSystemTray', onSystemTrayToggle).dispose;
if (NylasEnv.config.get('core.showSystemTray')) {
systemTray = new SystemTray(platform);
}
}

Some files were not shown because too many files have changed in this diff Show more