Add isActive() helper to Package

This commit is contained in:
Kevin Sawicki
2013-05-21 15:14:45 -07:00
parent e85e30c1f7
commit 76384747a1
2 changed files with 6 additions and 3 deletions

View File

@@ -22,3 +22,6 @@ class Package
constructor: (@path) ->
@name = basename(@path)
isActive: ->
atom.isPackageActive(@name)

View File

@@ -23,7 +23,7 @@ class TextMatePackage extends Package
@syntaxesPath = fsUtils.join(@path, "Syntaxes")
@grammars = []
@scopedProperties = []
@metadata = {@name, version: '0.0.0'}
@metadata = {@name, version: '-1'}
load: ({sync}={}) ->
if sync
@@ -75,7 +75,7 @@ class TextMatePackage extends Package
addGrammar: (grammar) ->
@grammars.push(grammar)
syntax.addGrammar(grammar) if atom.isPackageActive(@path)
syntax.addGrammar(grammar) if @isActive()
getGrammars: -> @grammars
@@ -110,7 +110,7 @@ class TextMatePackage extends Package
scopedProperties.push({selector, properties})
@scopedProperties = scopedProperties
if atom.isPackageActive(@path)
if @isActive()
for {selector, properties} in @scopedProperties
syntax.addProperties(@path, selector, properties)
@loadTextMatePreferenceObjects(preferenceObjects, done)