Remove name parameter from RootView.activatePackage

This commit is contained in:
Corey Johnson & Kevin Sawicki
2013-02-08 16:12:12 -08:00
parent ed0ced205b
commit c27489f608
3 changed files with 9 additions and 9 deletions

View File

@@ -155,13 +155,13 @@ describe "RootView", ->
it "absorbs exceptions that are thrown by the package module's serialize methods", ->
spyOn(console, 'error')
rootView.activatePackage "REMOVE THIS",
rootView.activatePackage
name: "bad-egg"
packageMain:
activate: ->
serialize: -> throw new Error("I'm broken")
rootView.activatePackage "REMOVE THIS",
rootView.activatePackage
name: "good-egg"
packageMain:
activate: ->
@@ -436,28 +436,28 @@ describe "RootView", ->
describe ".activatePackage(name, package)", ->
it "calls activate on the package", ->
rootView.activatePackage('REMOVE ME', pack)
rootView.activatePackage(pack)
expect(packageModule.activate).toHaveBeenCalledWith(undefined)
it "calls activate on the package module with its previous state", ->
rootView.activatePackage('REMOVE ME', pack)
rootView.activatePackage(pack)
packageModule.activate.reset()
newRootView = RootView.deserialize(rootView.serialize())
newRootView.activatePackage('REMOVE ME', pack)
newRootView.activatePackage(pack)
expect(packageModule.activate).toHaveBeenCalledWith("it worked")
newRootView.remove()
describe ".deactivatePackage(packageName)", ->
it "deactivates and removes the package module from the package module map", ->
rootView.activatePackage('REMOVE ME', pack)
rootView.activatePackage(pack)
spyOn(packageModule, "deactivate").andCallThrough()
rootView.deactivatePackages()
expect(packageModule.deactivate).toHaveBeenCalled()
expect(rootView.packages.length).toBe 0
it "is called when the rootView is deactivated to deactivate all packages", ->
rootView.activatePackage('package', pack)
rootView.activatePackage(pack)
spyOn(packageModule, "deactivate").andCallThrough()
rootView.deactivate()
expect(packageModule.deactivate).toHaveBeenCalled()

View File

@@ -65,7 +65,7 @@ class AtomPackage extends Package
if fs.isFile(mainPath)
@packageMain = require(mainPath)
config.setDefaults(@name, @packageMain.configDefaults)
rootView?.activatePackage(@name, this)
rootView?.activatePackage(this)
loadMetadata: ->
if metadataPath = fs.resolveExtension(fs.join(@path, 'package'), ['cson', 'json'])

View File

@@ -262,7 +262,7 @@ class RootView extends View
eachBuffer: (callback) ->
@project.eachBuffer(callback)
activatePackage: (name, pack) ->
activatePackage: (pack) ->
@packages.push(pack)
pack.packageMain.activate(@packageStates[pack.name])