Skip to content

Commit

Permalink
refactor(utils): switch to regular underscore
Browse files Browse the repository at this point in the history
Summary:
Fixes: T1334

remove final InboxApp references

move out all underscore-plus methods

Mass find and replace of underscore-plus

sed -i '' -- 's/underscore-plus/underscore/g' **/*.coffee
sed -i '' -- 's/underscore-plus/underscore/g' **/*.cjsx

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D1534
  • Loading branch information
emorikawa committed May 19, 2015
1 parent 3af6c45 commit 4619871
Show file tree
Hide file tree
Showing 222 changed files with 534 additions and 349 deletions.
4 changes: 2 additions & 2 deletions build/Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ os = require 'os'
# modules work under node v0.11.x.
require 'vm-compatibility-layer'

_ = require 'underscore-plus'
_ = require 'underscore'

packageJson = require '../package.json'

Expand Down Expand Up @@ -284,7 +284,7 @@ module.exports = (grunt) ->
'create-windows-installer':
appDirectory: shellAppDir
outputDirectory: path.join(buildDir, 'installer')
authors: 'InboxApp Inc.'
authors: 'Nylas'
loadingGif: path.resolve(__dirname, '..', 'resources', 'win', 'loading.gif')
iconUrl: 'https://raw.githubusercontent.com/atom/atom/master/resources/win/atom.ico'
setupIcon: path.resolve(__dirname, '..', 'resources', 'win', 'edgehill.ico')
Expand Down
3 changes: 2 additions & 1 deletion build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"s3": "^4.3",
"tello": "git+https://github.com/nylas/tello.git",
"temp": "~0.8.1",
"underscore-plus": "1.x",
"underscore": "^1.8",
"underscore.string": "^3.0",
"unzip": "~0.1.9",
"vm-compatibility-layer": "~0.1.0"
},
Expand Down
46 changes: 26 additions & 20 deletions build/tasks/build-task.coffee
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
_ = require 'underscore'

module.exports = (grunt) ->
{cp, isAtomPackage, mkdir, rm} = require('./task-helpers')(grunt)

escapeRegExp = (string) ->
if string
return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
else
return ''

grunt.registerTask 'build', 'Build the application', ->
shellAppDir = grunt.config.get('atom.shellAppDir')
buildDir = grunt.config.get('atom.buildDir')
Expand Down Expand Up @@ -108,37 +114,37 @@ module.exports = (grunt) ->
'.pairs'
'.travis.yml'
]
ignoredPaths = ignoredPaths.map (ignoredPath) -> _.escapeRegExp(ignoredPath)
ignoredPaths = ignoredPaths.map (ignoredPath) -> escapeRegExp(ignoredPath)

# Add .* to avoid matching hunspell_dictionaries.
ignoredPaths.push "#{_.escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell') + path.sep)}.*"
ignoredPaths.push "#{_.escapeRegExp(path.join('build', 'Release') + path.sep)}.*\\.pdb"
ignoredPaths.push "#{escapeRegExp(path.join('spellchecker', 'vendor', 'hunspell') + path.sep)}.*"
ignoredPaths.push "#{escapeRegExp(path.join('build', 'Release') + path.sep)}.*\\.pdb"

# Ignore *.cc and *.h files from native modules
ignoredPaths.push "#{_.escapeRegExp(path.join('ctags', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{_.escapeRegExp(path.join('git-utils', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{_.escapeRegExp(path.join('keytar', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{_.escapeRegExp(path.join('nslog', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{_.escapeRegExp(path.join('oniguruma', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{_.escapeRegExp(path.join('pathwatcher', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{_.escapeRegExp(path.join('runas', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{_.escapeRegExp(path.join('scrollbar-style', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{_.escapeRegExp(path.join('spellchecker', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('ctags', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('git-utils', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('keytar', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('nslog', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('oniguruma', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('pathwatcher', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('runas', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('scrollbar-style', 'src') + path.sep)}.*\\.(cc|h)*"
ignoredPaths.push "#{escapeRegExp(path.join('spellchecker', 'src') + path.sep)}.*\\.(cc|h)*"

# Ignore build files
ignoredPaths.push "#{_.escapeRegExp(path.sep)}binding\\.gyp$"
ignoredPaths.push "#{_.escapeRegExp(path.sep)}.+\\.target.mk$"
ignoredPaths.push "#{_.escapeRegExp(path.sep)}linker\\.lock$"
ignoredPaths.push "#{_.escapeRegExp(path.join('build', 'Release') + path.sep)}.+\\.node\\.dSYM"
ignoredPaths.push "#{escapeRegExp(path.sep)}binding\\.gyp$"
ignoredPaths.push "#{escapeRegExp(path.sep)}.+\\.target.mk$"
ignoredPaths.push "#{escapeRegExp(path.sep)}linker\\.lock$"
ignoredPaths.push "#{escapeRegExp(path.join('build', 'Release') + path.sep)}.+\\.node\\.dSYM"

# Hunspell dictionaries are only not needed on OS X.
if process.platform is 'darwin'
ignoredPaths.push path.join('spellchecker', 'vendor', 'hunspell_dictionaries')
ignoredPaths = ignoredPaths.map (ignoredPath) -> "(#{ignoredPath})"

testFolderPattern = new RegExp("#{_.escapeRegExp(path.sep)}te?sts?#{_.escapeRegExp(path.sep)}")
exampleFolderPattern = new RegExp("#{_.escapeRegExp(path.sep)}examples?#{_.escapeRegExp(path.sep)}")
benchmarkFolderPattern = new RegExp("#{_.escapeRegExp(path.sep)}benchmarks?#{_.escapeRegExp(path.sep)}")
testFolderPattern = new RegExp("#{escapeRegExp(path.sep)}te?sts?#{escapeRegExp(path.sep)}")
exampleFolderPattern = new RegExp("#{escapeRegExp(path.sep)}examples?#{escapeRegExp(path.sep)}")
benchmarkFolderPattern = new RegExp("#{escapeRegExp(path.sep)}benchmarks?#{escapeRegExp(path.sep)}")

nodeModulesFilter = new RegExp(ignoredPaths.join('|'))
filterNodeModule = (pathToCopy) ->
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/check-licenses-task.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = (grunt) ->
grunt.registerTask 'check-licenses', 'Report the licenses of all dependencies', ->
legalEagle = require 'legal-eagle'
{size, keys} = require 'underscore-plus'
{size, keys} = require 'underscore'
done = @async()

options =
Expand Down
11 changes: 7 additions & 4 deletions build/tasks/compile-packages-slug-task.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
path = require 'path'
CSON = require 'season'
fs = require 'fs-plus'
_ = require 'underscore-plus'
_ = require 'underscore'

module.exports = (grunt) ->
{spawn, rm} = require('./task-helpers')(grunt)
Expand All @@ -10,10 +10,10 @@ module.exports = (grunt) ->
appDir = fs.realpathSync(grunt.config.get('atom.appDir'))

modulesDirectory = path.join(appDir, 'node_modules')
internalInboxPackagesDirectory = path.join(appDir, 'internal_packages')
internalNylasPackagesDirectory = path.join(appDir, 'internal_packages')

modulesPaths = fs.listSync(modulesDirectory)
modulesPaths = modulesPaths.concat(fs.listSync(internalInboxPackagesDirectory))
modulesPaths = modulesPaths.concat(fs.listSync(internalNylasPackagesDirectory))
packages = {}

for moduleDirectory in modulesPaths
Expand All @@ -26,7 +26,10 @@ module.exports = (grunt) ->
moduleCache = metadata._atomModuleCache ? {}

rm metadataPath
_.remove(moduleCache.extensions?['.json'] ? [], 'package.json')

extensions = moduleCache.extensions?['.json'] ? []
i = extensions.indexOf('package.json')
if i >= 0 then extensions.splice(i, 1)

for property in ['_from', '_id', 'dist', 'readme', 'readmeFilename']
delete metadata[property]
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/docs-task.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cjsxtransform = require 'coffee-react-transform'
rimraf = require 'rimraf'

fs = require 'fs-plus'
_ = require 'underscore-plus'
_ = require 'underscore'

donna = require 'donna'
tello = require 'tello'
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/generate-license-task.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = (grunt) ->
done()

getLicenseText = (dependencyLicenses) ->
{keys} = require 'underscore-plus'
{keys} = require 'underscore'
text = """
#{fs.readFileSync('LICENSE.md', 'utf8')}
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/install-task.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
path = require 'path'
_ = require 'underscore-plus'
_ = require 'underscore'
fs = require 'fs-plus'
runas = null
temp = require 'temp'
Expand Down
4 changes: 2 additions & 2 deletions build/tasks/mkdeb-task.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
_ = require 'underscore'

module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
Expand Down Expand Up @@ -33,7 +33,7 @@ module.exports = (grunt) ->

{name, version, description} = grunt.file.readJSON('package.json')
section = 'devel'
maintainer = 'InboxApp <edgehill@nylas.com>'
maintainer = 'Nylas <edgehill@nylas.com>'
installDir = '/usr'
iconName = 'edgehill'
getInstalledSize buildDir, (error, installedSize) ->
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/mkdmg-task.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
_ = require 'underscore'
Promise = require("bluebird")

module.exports = (grunt) ->
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/mkrpm-task.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
_ = require 'underscore'

module.exports = (grunt) ->
{spawn, rm, mkdir} = require('./task-helpers')(grunt)
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/publish-build-task.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
child_process = require 'child_process'
path = require 'path'

_ = require 'underscore-plus'
_ = require 'underscore'
async = require 'async'
fs = require 'fs-plus'
GitHub = require 'github-releases'
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/publish-edgehill-build-task.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_ = require 'underscore-plus'
_ = require 'underscore'
s3 = require 's3'
fs = require 'fs'
path = require 'path'
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/spec-task.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fs = require 'fs'
path = require 'path'

_ = require 'underscore-plus'
_ = require 'underscore'
async = require 'async'
request = require 'request'

Expand Down
2 changes: 1 addition & 1 deletion dot-nylas/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Config, Saved State, & defaults
These are the default Inbox configs
These are the default Nylas configs
2 changes: 1 addition & 1 deletion exports/nylas-component-kit.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# All Inbox Globals go here.
# Publically exposed Nylas UI Components

{FormItem,
GeneratedForm,
Expand Down
2 changes: 1 addition & 1 deletion exports/nylas-exports.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Exports =
EdgehillAPI: require '../src/flux/edgehill-api'

# Testing
InboxTestUtils: require '../spec-nylas/test_utils'
NylasTestUtils: require '../spec-nylas/test_utils'

# Component Registry
ComponentRegistry: require '../src/component-registry'
Expand Down
20 changes: 0 additions & 20 deletions internal_packages/account-sidebar/LICENSE.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
React = require 'react'
_ = require 'underscore-plus'
_ = require 'underscore'
classNames = require 'classnames'
{Actions, Utils, WorkspaceStore} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Reflux = require 'reflux'
_ = require 'underscore-plus'
_ = require 'underscore'
{DatabaseStore,
NamespaceStore,
WorkspaceStore,
Expand Down
20 changes: 0 additions & 20 deletions internal_packages/calendar-bar/LICENSE.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Reflux = require 'reflux'
_ = require 'underscore-plus'
_ = require 'underscore'
{DatabaseStore,
NamespaceStore,
Actions,
Expand Down
1 change: 0 additions & 1 deletion internal_packages/composer/LICENSE.md

This file was deleted.

2 changes: 1 addition & 1 deletion internal_packages/composer/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "composer",
"version": "0.0.0",
"authors": [
"InboxApp"
"Nylas"
],
"moduleType": [
"amd"
Expand Down
2 changes: 1 addition & 1 deletion internal_packages/composer/lib/composer-view.cjsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
React = require 'react'
_ = require 'underscore-plus'
_ = require 'underscore'

{Utils,
Actions,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_ = require 'underscore-plus'
_ = require 'underscore'
React = require 'react'
classNames = require 'classnames'
sanitizeHtml = require 'sanitize-html'
Expand Down
2 changes: 1 addition & 1 deletion internal_packages/composer/lib/floating-toolbar.cjsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_ = require 'underscore-plus'
_ = require 'underscore'
React = require 'react/addons'
classNames = require 'classnames'
{CompositeDisposable} = require 'event-kit'
Expand Down
2 changes: 1 addition & 1 deletion internal_packages/composer/lib/main.cjsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_ = require 'underscore-plus'
_ = require 'underscore'
React = require 'react'

{NamespaceStore,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
React = require 'react'
_ = require 'underscore-plus'
_ = require 'underscore'

{Contact,
Utils,
Expand Down
2 changes: 1 addition & 1 deletion internal_packages/composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "composer",
"version": "0.1.0",
"main": "./lib/main",
"description": "Inbox Composer Component",
"description": "Nylas Composer Component",
"license": "Proprietary",
"private": true,
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# the contenteditable (such as selection, tooltip, quoting, etc) see the
# related test files.
#
_ = require "underscore-plus"
_ = require "underscore"
React = require "react/addons"
ReactTestUtils = React.addons.TestUtils
ContenteditableComponent = require "../lib/contenteditable-component",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# For a test of the basic component itself see
# contenteditable-component-spec.cjsx
#
_ = require "underscore-plus"
_ = require "underscore"
React = require "react/addons"
ReactTestUtils = React.addons.TestUtils
ContenteditableComponent = require "../lib/contenteditable-component",
Expand Down
Loading

0 comments on commit 4619871

Please sign in to comment.