Files
atom/src/app/package.coffee
Nathan Sobo 08a27cf93d Load grammars from TextMatePackage. Delete TextMateBundle.
TextMatePackage is only designed to load resources out of a TextMate
bundle. It's used only at load time, and from that point out we only
refer to our own global `syntax` data structure to access the data that
it loads.
2012-12-31 18:28:38 -06:00

25 lines
687 B
CoffeeScript

fs = require 'fs'
module.exports =
class Package
@load: (name) ->
AtomPackage = require 'atom-package'
TextMatePackage = require 'text-mate-package'
if TextMatePackage.testName(name)
new TextMatePackage(name).load()
else
new AtomPackage(name).load()
constructor: (@name) ->
@path = require.resolve(@name, verifyExistence: false)
throw new Error("No package found named '#{@name}'") unless @path
@path = fs.directory(@path) unless fs.isDirectory(@path)
load: ->
for grammar in @getGrammars()
syntax.addGrammar(grammar)
for { selector, properties } in @getScopedProperties()
syntax.addProperties(selector, properties)