cson(packages): Remove from specs, deprecate use for for menus, package.json files

This commit is contained in:
Ben Gotow 2016-04-24 20:31:53 -05:00
parent 16dd26c29e
commit 12bc0958ca
32 changed files with 53 additions and 92 deletions

View file

@ -1,12 +0,0 @@
'fileTypes': ['alittle']
'name': 'Alittle'
'scopeName': 'source.alittle'
'patterns': [
{
'captures':
'0':
'name': 'keyword.alittle'
'match': 'alittle'
}
]

View file

@ -1,12 +0,0 @@
'fileTypes': ['alot', 'foobizbang']
'name': 'Alot'
'scopeName': 'source.alot'
'patterns': [
{
'captures':
'0':
'name': 'keyword.alot'
'match': 'alot'
}
]

View file

@ -1,4 +0,0 @@
'name': 'test'
'scopeName': 'source.test'
'injectionSelector': 'comment'
'patterns': [{'include': 'source.sql'}]

View file

@ -1 +0,0 @@
keymaps: ["keymap-2", "keymap-1"]

View file

@ -0,0 +1,3 @@
{
"keymaps": ["keymap-2", "keymap-1"]
}

View file

@ -1 +0,0 @@
'main': 'main-module.coffee'

View file

@ -0,0 +1,3 @@
{
"main": "main-module.coffee"
}

View file

@ -1,8 +0,0 @@
'menu': [
{ 'label': 'Last' }
]
'context-menu':
'.test-1': [
{label: 'Menu item 1', command: 'command-1'}
]

View file

@ -0,0 +1,5 @@
{
"menu": [
{ "label": "Last" }
]
}

View file

@ -1,8 +0,0 @@
'menu': [
{ 'label': 'Second to Last' }
]
'context-menu':
'.test-1': [
{label: 'Menu item 2', command: 'command-2'}
]

View file

@ -0,0 +1,5 @@
{
"menu": [
{ "label": "Second to Last" }
]
}

View file

@ -1,4 +0,0 @@
'context-menu':
'.test-1': [
{label: 'Menu item 3', command: 'command-3'}
]

View file

@ -1 +0,0 @@
menus: ["menu-2", "menu-1"]

View file

@ -0,0 +1,3 @@
{
"menus": ["menu-2", "menu-1"]
}

View file

@ -1,8 +0,0 @@
'menu': [
{'label': 'Second to Last'}
]
'context-menu':
'.test-1': [
{label: 'Menu item 1', command: 'command-1'}
]

View file

@ -0,0 +1,5 @@
{
"menu": [
{ "label": "Last" }
]
}

View file

@ -1,8 +0,0 @@
'menu': [
{ 'label': 'Last' }
]
'context-menu':
'.test-1': [
{label: 'Menu item 2', command: 'command-2'}
]

View file

@ -0,0 +1,5 @@
{
"menu": [
{ "label": "Second to Last" }
]
}

View file

@ -1,8 +0,0 @@
'menu': [
{ 'label': 'Second to Last' }
]
'context-menu':
'.test-1': [
{label: 'Menu item 3', command: 'command-3'}
]

View file

@ -1 +0,0 @@
'main': 'main-module.coffee'

View file

@ -0,0 +1,3 @@
{
"main": "main-module.coffee"
}

View file

@ -1 +0,0 @@
'main': 'index.coffee'

View file

@ -0,0 +1,3 @@
{
"main": "index.coffee"
}

View file

@ -1,3 +0,0 @@
'.source.omg':
'editor':
'increaseIndentPattern': '^a'

View file

@ -1 +0,0 @@
styleSheets: ['2', '1']

View file

@ -0,0 +1,3 @@
{
"styleSheets": ["2", "1"]
}

View file

@ -1 +0,0 @@
styleSheets: ['2', '1']

View file

@ -0,0 +1,3 @@
{
"styleSheets": ["2", "1"]
}

View file

@ -1 +0,0 @@
"name": "perfect"

View file

@ -0,0 +1,3 @@
{
"name": "perfect"
}

View file

@ -267,8 +267,8 @@ describe "PackageManager", ->
runs ->
expect(NylasEnv.menu.template.length).toBe 2
expect(NylasEnv.menu.template[0].label).toBe "Second to Last"
expect(NylasEnv.menu.template[1].label).toBe "Last"
expect(NylasEnv.menu.template[1].label).toBe "Second to Last"
expect(NylasEnv.menu.template[0].label).toBe "Last"
describe "when the metadata contains a 'menus' manifest", ->
it "loads only the menus specified by the manifest, in the specified order", ->

View file

@ -2,7 +2,6 @@ path = require 'path'
_ = require 'underscore'
async = require 'async'
CSON = require 'season'
fs = require 'fs-plus'
EmitterMixin = require('emissary').Emitter
{Emitter, CompositeDisposable} = require 'event-kit'
@ -37,9 +36,10 @@ class Package
if @isBundledPackagePath(packagePath)
metadata = packagesCache[packageName]?.metadata
unless metadata?
if metadataPath = CSON.resolve(path.join(packagePath, 'package'))
metadataPath = fs.resolve(path.join(packagePath, 'package.json'))
if fs.existsSync(metadataPath)
try
metadata = CSON.readFileSync(metadataPath)
metadata = JSON.parse(fs.readFileSync(metadataPath))
catch error
throw error unless ignoreErrors
metadata ?= {}
@ -239,9 +239,9 @@ class Package
if @bundledPackage and packagesCache[@name]?
@menus = (["#{NylasEnv.packages.resourcePath}#{path.sep}#{menuPath}", menuObject] for menuPath, menuObject of packagesCache[@name].menus)
else
@menus = @getMenuPaths().map (menuPath) -> [menuPath, CSON.readFileSync(menuPath) ? {}]
@menus = @getMenuPaths().map (menuPath) -> [menuPath, JSON.parse(fs.readFileSync(menuPath)) ? {}]
catch e
console.error "Error reading keymaps for package '#{@name}': #{e.message}", e.stack
console.error "Error reading menus for package '#{@name}': #{e.message}", e.stack
getKeymapPaths: ->
keymapsDirPath = path.join(@path, 'keymaps')
@ -253,9 +253,9 @@ class Package
getMenuPaths: ->
menusDirPath = path.join(@path, 'menus')
if @metadata.menus
@metadata.menus.map (name) -> fs.resolve(menusDirPath, name, ['json', 'cson', ''])
@metadata.menus.map (name) -> fs.resolve(menusDirPath, name, ['json', ''])
else
fs.listSync(menusDirPath, ['cson', 'json'])
fs.listSync(menusDirPath, ['json'])
loadStylesheets: ->
@stylesheets = @getStylesheetPaths().map (stylesheetPath) ->