window loads plugins. prepping for plugin refactor

This commit is contained in:
Corey Johnson 2011-09-20 16:50:54 -07:00
parent 5abe161f7d
commit 4cb47ab96f
3 changed files with 21 additions and 22 deletions

View File

@ -1,24 +1,20 @@
_ = require 'underscore'
Window = require 'window'
Plugins = require 'plugins'
module.exports =
class App
@windows: []
@root: OSX.NSBundle.mainBundle.resourcePath
@activeWindow: null
@setup: ->
@setActiveWindow new Window controller : WindowController
@setActiveWindow new Window
controller : WindowController
path : localStorage.lastOpenedPath
# Move this someone more approriate
if localStorage.lastOpenedPath
@activeWindow.open localStorage.lastOpenedPath
Plugins.load()
@activeWindow.document.ace._emit "loaded"
@activeWindow.loadPlugins()
@setActiveWindow: (window) ->
@activeWindow = window

View File

@ -1,12 +0,0 @@
$ = require 'jquery'
_ = require 'underscore'
File = require 'fs'
exports.load = ->
App = require 'app'
_.map File.list(App.root + "/plugins"), (plugin) ->
require plugin
_.map File.list("~/.atomicity/"), (path) ->
require path

View File

@ -1,4 +1,7 @@
$ = require 'jquery'
_ = require 'underscore'
File = require 'fs'
Chrome = require 'chrome'
Pane = require 'pane'
@ -26,10 +29,22 @@ class Window
for shortcut, method of @keymap()
bindKey @, shortcut, method
@nswindow = @controller?.window
loadPlugins: ->
Editor = require 'editor'
@document = new Editor
@nswindow = @controller?.window
@open @path if @path?
App = require 'app'
_.map File.list(App.root + "/plugins"), (plugin) ->
require plugin
_.map File.list("~/.atomicity/"), (path) ->
require path
@document.ace._emit "loaded"
addPane: ({position, html}) ->
verticalDiv = $('#app-vertical')