Permalink
Browse files

init

  • Loading branch information...
0 parents commit 720752f1f9589a4d9f3b3f5c01a3079e5dd41684 @hans committed Sep 18, 2011
Showing with 450 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +3 −0 .gitmodules
  3. +1 −0 AUTHORS
  4. +40 −0 Cakefile
  5. +20 −0 LICENSE
  6. +1 −0 Procfile
  7. +49 −0 lib/app.js
  8. +19 −0 package.json
  9. +28 −0 public/app.css
  10. +1 −0 public/app.js
  11. BIN public/favicon.ico
  12. +1 −0 public/vendor/ace
  13. +48 −0 public/vendor/diff_match_patch.js
  14. +90 −0 readme.md
  15. +1 −0 server.js
  16. +11 −0 spec/app_spec.coffee
  17. +50 −0 src/app.coffee
  18. +1 −0 vendor/ace
  19. +63 −0 views/index.coffee
  20. +22 −0 views/layout.coffee
@@ -0,0 +1 @@
+node_modules
@@ -0,0 +1,3 @@
+[submodule "public/vendor/ace"]
+ path = public/vendor/ace
+ url = https://github.com/ajaxorg/ace.git
@@ -0,0 +1 @@
+Tom Wilson tom@jackhq.com http://www.jackhq.com
@@ -0,0 +1,40 @@
+fs = require 'fs'
+{print} = require 'sys'
+{spawn, exec} = require 'child_process'
+
+build = (watch, callback) ->
+ if typeof watch is 'function'
+ callback = watch
+ watch = false
+ options = ['-c', '-o', 'lib', 'src']
+ options.unshift '-w' if watch
+
+ coffee = spawn 'coffee', options
+ coffee.stdout.on 'data', (data) -> print data.toString()
+ coffee.stderr.on 'data', (data) -> print data.toString()
+ coffee.on 'exit', (status) -> callback?() if status is 0
+
+spec = (callback) ->
+ options = ['spec', '--coffee']
+ spec = spawn 'jasmine-node', options
+ spec.stdout.on 'data', (data) -> print data.toString()
+ spec.stderr.on 'data', (data) -> print data.toString()
+ spec.on 'exit', (status) -> callback?() if status is 0
+
+
+task 'docs', 'Generate annotated source code with Docco', ->
+ fs.readdir 'src', (err, contents) ->
+ files = ("src/#{file}" for file in contents when /\.coffee$/.test file)
+ docco = spawn 'docco', files
+ docco.stdout.on 'data', (data) -> print data.toString()
+ docco.stderr.on 'data', (data) -> print data.toString()
+ docco.on 'exit', (status) -> callback?() if status is 0
+
+task 'build', 'Compile CoffeeScript source files', ->
+ build()
+
+task 'watch', 'Recompile CoffeeScript source files when modified', ->
+ build true
+
+task 'spec', 'Run Jasmine-Node', ->
+ build -> spec -> console.log ":)"
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Tom Wilson
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
+web: node server.js
@@ -0,0 +1,49 @@
+(function() {
+ var ace_files, ace_modes, ace_themes, app, child_process, everyone, express, file, fs, nowjs, path, port, public_path, _i, _len;
+ express = require('express');
+ path = require('path');
+ fs = require('fs');
+ nowjs = require('now');
+ child_process = require('child_process');
+ port = process.env.PORT || 8000;
+ app = express.createServer();
+ console.log('===== Starting ACE Live on port ' + port + ' =====');
+ app.register('.coffee', require('coffeekup'));
+ app.set('view engine', 'coffee');
+ public_path = path.resolve(__dirname, '..', 'public');
+ app.use(express.static(public_path));
+ ace_files = fs.readdirSync(__dirname + '/../public/vendor/ace/build/src');
+ ace_modes = [];
+ ace_themes = [];
+ for (_i = 0, _len = ace_files.length; _i < _len; _i++) {
+ file = ace_files[_i];
+ if (file.indexOf('mode-') === 0) {
+ ace_modes.push(file.substring('mode-'.length, file.length - 3));
+ } else if (file.indexOf('theme-') === 0) {
+ ace_themes.push(file.substring('theme-'.length, file.length - 3));
+ }
+ }
+ child_process.exec('tput bold', function(error, bold, stderr) {
+ if (error == null) {
+ return child_process.exec('tput sgr0', function(error, normal, stderr) {
+ if (error == null) {
+ console.log(bold + 'Available modes: ' + normal + ace_modes.join(', '));
+ return console.log(bold + 'Available themes: ' + normal + ace_themes.join(', '));
+ }
+ });
+ }
+ });
+ app.get('/', function(request, response) {
+ return response.render('index', {
+ locals: {
+ ace_modes: ace_modes,
+ ace_themes: ace_themes
+ }
+ });
+ });
+ app.listen(port);
+ everyone = nowjs.initialize(app);
+ everyone.now.sendPatch = function(sender, patch_obj) {
+ return everyone.now.applyPatch(sender, patch_obj);
+ };
+}).call(this);
@@ -0,0 +1,19 @@
+{
+ "name": "express-coffee"
+ , "version": "v0.1.0"
+ , "private": true
+ ,"directories" : {
+ "lib" : "./lib",
+ "spec": "./spec"
+ }
+ , "dependencies": {
+ "express": "2.4.x"
+ , "coffeekup": "0.3.x"
+ }
+ , "devDependencies": {
+ "coffee-script": "1.1.x"
+ ,"jasmine-node": "1.x.x"
+ ,"request": "1.x.x"
+ }
+ , "engine": "node >= 0.4.11"
+}
@@ -0,0 +1,28 @@
+* {
+ margin: 0;
+ padding: 0;
+}
+
+body {
+ overflow: hidden;
+}
+
+#editor {
+ width: 90%;
+ height: 100%;
+}
+
+#toolbox {
+ position: absolute;
+ top: 0px;
+ right: 0px;
+
+ width: 10%;
+ height: 100%;
+
+ background: #fff;
+}
+
+#toolbox select {
+ width: 100%;
+}
@@ -0,0 +1 @@
+
Binary file not shown.
Submodule ace added at d6e395
Oops, something went wrong.

0 comments on commit 720752f

Please sign in to comment.