Add config.userPackageDirPaths which includes dev packages in dev mode

This commit is contained in:
Kevin Sawicki & Nathan Sobo
2013-08-16 11:18:08 -07:00
parent 4c121bb084
commit 2f4555a16f
2 changed files with 15 additions and 20 deletions

View File

@@ -1,10 +1,10 @@
fs = require 'fs'
require 'window'
measure 'spec suite require time', ->
fs = require 'fs'
fsUtils = require 'fs-utils'
path = require 'path'
_ = require 'underscore'
require 'spec-helper'
requireSpecs = (directoryPath, specType) ->
@@ -19,20 +19,15 @@ measure 'spec suite require time', ->
requireSpecs(window.resourcePath)
setSpecType('core')
fixturesPackagesPath = fsUtils.resolveOnLoadPath('fixtures/packages')
packagePaths = atom.getAvailablePackageNames().map (packageName) -> atom.resolvePackagePath(packageName)
packagePaths = _.groupBy packagePaths, (packagePath) ->
if packagePath.indexOf("#{fixturesPackagesPath}#{path.sep}") is 0
'fixtures'
else if packagePath.indexOf("#{window.resourcePath}#{path.sep}") is 0
'bundled'
else
'user'
# Run bundled package specs
requireSpecs(packagePath) for packagePath in packagePaths.bundled
setSpecType('bundled')
if fsUtils.isDirectorySync(config.nodeModulesDirPath)
for packageName in fs.readdirSync(config.nodeModulesDirPath)
packagePath = path.join(config.nodeModulesDirPath, packageName)
requireSpecs(packagePath, 'bundled') if atom.isInternalPackage(packagePath)
setSpecType('bundled')
# Run user package specs
requireSpecs(packagePath) for packagePath in packagePaths.user
setSpecType('user')
for packageDirPath in config.userPackageDirPaths when fsUtils.isDirectorySync(packageDirPath)
for packageName in fs.readdirSync(packageDirPath)
requireSpecs(path.join(packageDirPath, packageName))
setSpecType('user')

View File

@@ -12,8 +12,8 @@ nodeModulesDirPath = path.join(resourcePath, "node_modules")
bundledThemesDirPath = path.join(resourcePath, "themes")
userThemesDirPath = path.join(configDirPath, "themes")
userPackagesDirPath = path.join(configDirPath, "packages")
packageDirPaths = [userPackagesDirPath]
packageDirPaths.unshift(path.join(configDirPath, "dev", "packages")) if atom.getLoadSettings().devMode
userPackageDirPaths = [userPackagesDirPath]
userPackageDirPaths.unshift(path.join(configDirPath, "dev", "packages")) if atom.getLoadSettings().devMode
userStoragePath = path.join(configDirPath, "storage")
# Public: Handles all of Atom's configuration details.
@@ -26,8 +26,8 @@ class Config
themeDirPaths: [userThemesDirPath, bundledThemesDirPath]
bundledPackageDirPaths: [nodeModulesDirPath]
nodeModulesDirPath: nodeModulesDirPath
packageDirPaths: packageDirPaths
userPackagesDirPath: userPackagesDirPath
packageDirPaths: _.clone(userPackageDirPaths)
userPackageDirPaths: userPackageDirPaths
userStoragePath: userStoragePath
lessSearchPaths: [path.join(resourcePath, 'static'), path.join(resourcePath, 'vendor')]
defaultSettings: null