Skip to content

Commit

Permalink
Add config.userPackageDirPaths which includes dev packages in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinnathan committed Aug 16, 2013
1 parent 4c121bb commit 2f4555a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
27 changes: 11 additions & 16 deletions spec/spec-suite.coffee
Original file line number Diff line number Diff line change
@@ -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) ->
Expand All @@ -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')
8 changes: 4 additions & 4 deletions src/app/config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 2f4555a

Please sign in to comment.