Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tanepiper committed Apr 11, 2011
0 parents commit bee5e61
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.settings.xml
*.gz
25 changes: 25 additions & 0 deletions ___livecoffee.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<a:application xmlns:a="http://ajax.org/2005/aml">
<a:tab id="tabLivecoffee" skin="docktab" visible="false">
<a:page id="livecoffeeView" caption="Live Coffee">
<a:codeeditor id="coffeeCode"
flex = "1"
realtime = "true"
border = "0"
model = "{require('ext/settings/settings').model}"
value = "[auto/console/input]"
softtabs = "[{require('ext/settings/settings').model}::editors/code/@softtabs]"
tabsize = "[{require('ext/settings/settings').model}::editors/code/@tabsize]"
scrollspeed = "[{require('ext/settings/settings').model}::editors/code/@scrollspeed]"
theme = "[{require('ext/settings/settings').model}::editors/code/@theme]"
selectstyle = "[{require('ext/settings/settings').model}::editors/code/@selectstyle]"
activeline = "[{require('ext/settings/settings').model}::editors/code/@activeline]"
showinvisibles = "[{require('ext/settings/settings').model}::editors/code/@showinvisibles]"
showprintmargin = "false"
printmargincolumn = "0" />

<a:statusbar id="coffeeStatus">
<a:section id="coffeeStatusOutput"></a:section>
</a:statusbar>
</a:page>
</a:tab>
</a:application>
11 changes: 11 additions & 0 deletions coffeescript.js

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions livecoffee.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
define((require, exports, module) ->
ide = require 'core/ide'
ext = require 'core/ext'
util = require 'core/util'
editors = require 'ext/editors/editors'

markup = require 'text!ext/livecoffee/livecoffee.xml'
CoffeeScript = require 'ext/livecoffee/coffeescript'

return ext.register 'ext/livecoffee/livecoffee',
name: 'Live CoffeeScript'
dev: 'Tane Piper'
type: ext.GENERAL
alone: yes
markup: markup

commands:
"livecoffee": hint: "Compile the current coffeescript document"

hotitems : {}

nodes: []

compile: () ->
editor = editors.currentEditor
doc = editor.getDocument()
value = doc.getValue()

compiledJS = ''
try
compiledJS = CoffeeScript.compile value, bare: on
@coffeeCode.setValue compiledJS
return
catch exp
util.alert exp.message
return

hook: () ->
@nodes.push ide.mnuEdit.appendChild new apf.item
caption: 'View CoffeeScript Output'
onclick: () =>
ext.initExtension @
@coffeeOutput.show()
return

@hotitems["compile"] = [@nodes[0]]
return

init: (amlNode) ->
@coffeeStatusOutput = coffeeStatusOutput
@coffeeCode = coffeeCode
@coffeeOutput = coffeeOutput
return

enable : () ->
@nodes.each (item) ->
item.enable()
return
return

disable: () ->
@nodes.each (item) ->
item.disable()
return
return

destroy : () ->
@nodes.each (item) ->
item.destroy true, true
return

@nodes = [];
@coffeeOutput.destroy true, true
return
)
73 changes: 73 additions & 0 deletions livecoffee.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions livecoffee.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<a:application xmlns:a="http://ajax.org/2005/aml">
<a:window
id = "coffeeOutput"
title = "CoffeeScript Output"
center = "true"
modal = "false"
buttons = "close"
kbclose = "true"
width = "800"
height = "500">
<a:codeeditor
id="coffeeCode"
flex="1"
realtime="true"
border="0"
showprintmargin="false"
printmargincolumn="0"
width="780"
height="400" />
<a:divider />
<a:hbox pack="end" padding="5" edge="10 10 5 10">
<a:button class="ui-btn-green" default="2" caption="View JS" onclick = "require('ext/livecoffee/livecoffee').compile();"/>
<a:button onclick="coffeeOutput.hide()">Done</a:button>
</a:hbox>
<a:divider />
<a:statusbar id="coffeeStatus">
<a:section id="coffeeStatusOutput" />
</a:statusbar>
</a:window>
</a:application>

0 comments on commit bee5e61

Please sign in to comment.