Remove unnecessary lines

This commit is contained in:
Ben Ogle
2013-10-18 17:41:32 -07:00
parent 9f753cd3b9
commit 0b74dfc67a
3 changed files with 5 additions and 16 deletions

View File

@@ -4,7 +4,7 @@ path = require 'path'
ThemeManager = require '../src/theme-manager'
AtomPackage = require '../src/atom-package'
describe "ThemeManager", ->
fdescribe "ThemeManager", ->
themeManager = null
beforeEach ->
@@ -74,7 +74,7 @@ describe "ThemeManager", ->
describe "when a theme fails to load", ->
it "logs a warning", ->
spyOn(console, 'warn')
expect(-> themeManager.activateTheme('a-theme-that-will-not-be-found')).toThrow()
expect(-> atom.packages.activatePackage('a-theme-that-will-not-be-found')).toThrow()
describe "requireStylesheet(path)", ->
it "synchronously loads css at the given path and installs a style tag for it in the head", ->

View File

@@ -90,9 +90,6 @@ class PackageManager
if @isPackageDisabled(name)
return console.warn("Tried to load disabled package '#{name}'")
pack = @getLoadedPackage(name)
return pack if pack
if packagePath = @resolvePackagePath(name)
return pack if pack = @getLoadedPackage(name)

View File

@@ -42,32 +42,24 @@ class ThemeManager
activateThemes: ->
# atom.config.observe runs the callback once, then on subsequent changes.
atom.config.observe 'core.themes', (themeNames) =>
@deactivateThemes()
@packageManager.deactivatePackages()
themeNames = [themeNames] unless _.isArray(themeNames)
# Reverse so the first (top) theme is loaded after the others. We want
# the first/top theme to override later themes in the stack.
themeNames = _.clone(themeNames).reverse()
@activateTheme(themeName) for themeName in themeNames
@packageManager.activatePackage(themeName) for themeName in themeNames
@loadUserStylesheet()
@reloadBaseStylesheets()
@emit('reloaded')
# Internal-only:
activateTheme: (themeName) ->
@packageManager.activatePackage(themeName)
# Internal-only:
deactivateThemes: ->
@removeStylesheet(@userStylesheetPath) if @userStylesheetPath?
@deactivateTheme(pack.name) for pack in @getActiveThemes()
@packageManager.deactivatePackage(pack.name) for pack in @getActiveThemes()
null
# Internal-only:
deactivateTheme: (themeName) ->
@packageManager.deactivatePackage(themeName)
# Public:
getImportPaths: ->
activeThemes = @getActiveThemes()