Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Start work for webview

  • Loading branch information...
commit 1d114311b21533d1265e49aec9160ef1431f31b5 1 parent 455c0d3
@epeli authored
View
4 examples/longrunning/hello.txt
@@ -0,0 +1,4 @@
+
+
+hello
+
View
8 examples/longrunning/projectwatch.cfg
@@ -0,0 +1,8 @@
+[Long runnin command]
+watchdir = .
+glob = *.txt
+cmd = echo "this will take a long time" && sleep 5
+
+
+
+
View
2  lib/main.coffee
@@ -74,6 +74,7 @@ exports.run = ->
dirs = process.argv.splice(2)
dirs.push process.cwd() unless dirs.length
+ watchers = {}
console.log "Searching projectwatch.cfg files from #{ dirs }\n"
@@ -87,6 +88,7 @@ exports.run = ->
watcher = new Watcher name, path.dirname(filepath), settings
watcher.start()
watcher.runCMD()
+ watchers[name] = watcher
View
8,936 lib/web/clientscripts/jquery.js
8,936 additions, 0 deletions not shown
View
35 lib/web/clientscripts/main.coffee
@@ -0,0 +1,35 @@
+
+class JQEvenEmitter
+ constructor: -> @_jq = jQuery {}
+
+ on: -> @_jq.bind.apply @_jq, arguments
+ addListener: JQEvenEmitter::on
+ once: -> @_jq.one.apply @_jq, arguments
+ removeListener: -> @_jq.unbind.apply @_jq, arguments
+ removeAllListeners: JQEvenEmitter::removeListener
+ emit: -> @_jq.trigger.apply @_jq, arguments
+
+
+
+i = 0
+class Watcher extends JQEvenEmitter
+
+ constructor: ->
+ super
+ @i = i += 1
+ console.log "building"
+
+ @on "some", => @mymethod()
+
+ mymethod: ->
+ console.log "got some #{ @i }"
+
+
+
+
+w = new Watcher
+w.emit "some"
+
+w2 = new Watcher
+w2.emit "some"
+w2.emit "some"
View
43 lib/web/server.coffee
@@ -0,0 +1,43 @@
+
+
+express = require "express"
+nowjs = require("now")
+
+{ addCodeSharingTo } = require "express-share"
+app = express.createServer()
+addCodeSharingTo app
+everyone = nowjs.initialize app
+
+app.shareUrl "/nowjs/now.js"
+
+app.exec ->
+ now.renderOutput = (watcher) ->
+ console.log "got", watcher.name
+ textarea = $("##{ watcher.name }")
+ if textarea.size() is 0
+ textarea = $("<textarea>", id: "foo").appendTo("body")
+
+
+
+
+
+
+
+setTimeout ->
+ everyone.now.renderOutput name: "myproj:compass"
+,
+ 2000
+
+
+renderApp = (req, res) ->
+ res.render "index.jade", text: "hello jade"
+
+
+app.get "/", renderApp
+app.get "/:name", renderApp
+
+
+port = 8080
+
+app.listen port
+console.log "Listening on http://localhost:#{ port }/"
View
2  lib/web/views/index.jade
@@ -0,0 +1,2 @@
+
+h1= text
View
15 lib/web/views/layout.jade
@@ -0,0 +1,15 @@
+!!! 5
+html
+ head
+ title Watch
+ style
+ h1 {
+ color: red;
+ }
+ textarea {
+ width: 100%;
+ height: 200px;
+ }
+ !{renderScriptTags()}
+ body !{body}
+
View
3  package.json
@@ -15,5 +15,8 @@
, "findit": ""
, "iniparser": ""
, "gex": ""
+ , "express": ""
+ , "jade": ""
+ , "now": ""
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.