Rename AtomPackage.packageMain to .mainModule

This commit is contained in:
Nathan Sobo
2013-03-11 15:28:28 -06:00
parent 50b61f3a00
commit bf7fc39434
9 changed files with 21 additions and 21 deletions

View File

@@ -6,7 +6,7 @@ $ = require 'jquery'
module.exports =
class AtomPackage extends Package
metadata: null
packageMain: null
mainModule: null
deferActivation: false
load: ->
@@ -48,17 +48,17 @@ class AtomPackage extends Package
else
try
if @requirePackageMain()
config.setDefaults(@name, @packageMain.configDefaults)
config.setDefaults(@name, @mainModule.configDefaults)
atom.activateAtomPackage(this)
catch e
console.warn "Failed to activate package named '#{@name}'", e.stack
requirePackageMain: ->
return @packageMain if @packageMain
return @mainModule if @mainModule
mainPath = @path
mainPath = fs.join(mainPath, @metadata.main) if @metadata.main
mainPath = require.resolve(mainPath)
@packageMain = require(mainPath) if fs.isFile(mainPath)
@mainModule = require(mainPath) if fs.isFile(mainPath)
registerDeferredDeserializers: ->
for deserializerName in @metadata.deferredDeserializers ? []

View File

@@ -24,10 +24,10 @@ _.extend atom,
activateAtomPackage: (pack) ->
@activatedAtomPackages.push(pack)
pack.packageMain.activate(@atomPackageStates[pack.name] ? {})
pack.mainModule.activate(@atomPackageStates[pack.name] ? {})
deactivateAtomPackages: ->
pack.packageMain.deactivate?() for pack in @activatedAtomPackages
pack.mainModule.deactivate?() for pack in @activatedAtomPackages
@activatedAtomPackages = []
serializeAtomPackages: ->
@@ -35,7 +35,7 @@ _.extend atom,
for pack in @loadedPackages
if pack in @activatedAtomPackages
try
packageStates[pack.name] = pack.packageMain.serialize?()
packageStates[pack.name] = pack.mainModule.serialize?()
catch e
console?.error("Exception serializing '#{pack.name}' package's module\n", e.stack)
else