Permalink
Browse files

Replacing Rake with Make and adding in infrastructure for testing.

  • Loading branch information...
1 parent 8d28ad3 commit 8046b92636c0d319949750476df6549637e80740 @miksago miksago committed Nov 1, 2010
Showing with 55 additions and 83 deletions.
  1. +22 −0 Makefile
  2. +0 −73 Rakefile
  3. +0 −10 TODO.md
  4. +33 −0 tools/release.js
View
@@ -0,0 +1,22 @@
+release:
+ node tools/release.js
+
+publish: release
+ npm publish .
+
+test:
+ @echo "Running Simple Tests"
+ @find -f test/simple/test-*.js | xargs -n 1 -t node
+
+test-all: test
+ @echo "Running All Tests"
+ @find -f test/pummel/test-*.js | xargs -n 1 -t node
+
+benchmark:
+ @echo "Running Benchmarks"
+ @find -f benchmark/simple/*.js | xargs -n 1 -t node
+
+doc:
+ node tools/doctool/doctool.js
+
+.PHONY: release publish test test-all benchmark doc
View
@@ -1,73 +0,0 @@
-require 'rake'
-require 'rubygems'
-require 'json'
-
-puts "---"
-
-
-@version = `git describe`.match("v([0-9]+\.[0-9]+.\[0-9]+).*")[1]
-
-def to_node_json(obj)
- obj = obj.to_json
- # reformat it a bit
- obj.gsub!(/\"\}\]|\[\{|\}\,|\:\{|\:\[[^\{]|\{\"|\,\"|\:\{\"|\"\:|\"\}$/) {|s|
- case s
- when ",\""; "\n, \""
- when "{\""; "{ \""
- when ":{"; ":\n {"
- when ":["; ": [\n"
- when "},"; "}\n, "
- when "[{"; "[{ "
- when "\"}]"; "\" }]"
- when "\":"; "\": "
- when "\"}"; "\"\n}"
- else; s
- end
- }
- # finally clean up arrays.
- obj.gsub!(/(.+\[.+)\n\,/, '\1,').gsub(/\}$/, "\n}")
-end
-
-desc "Release a new version to various places."
-task :release => ['write:pkgspec', 'npm:publish'] do
- puts "Released!"
- puts ""
-end
-
-namespace :write do
- desc "Write the package.json file"
- task :pkgspec do
- package = {
- :name => "websocket-server",
- :version => @version,
- :author => "Micheil Smith <micheil@brandedcode.com>",
- :description => "A WebSocket Server for node.js, 90-100% spec compatible.",
- :main => "./lib/ws",
- :engines => { :node => ">=0.1.98-0" },
- :licenses => [{ :type => "MIT", :url => "./LICENSE.md" }],
- :repository => {
- :type => "git",
- :url => "http://github.com/miksago/node-websocket-server.git"
- },
- :bugs => {
- :web => "http://github.com/miksago/node-websocket-server/issues"
- }
- }
-
- puts "Making package.json"
- f = File.new("package.json", "w+")
- f.write(to_node_json(package))
- f.close
- puts "-> Done"
- end
-end
-
-namespace :npm do
- desc "Publish to NPM"
- task :publish do
- puts "Publishing to NPM"
- system("npm publish #{`pwd`}")
- system("npm tag websocket-server #{@version} latest")
- puts "-> Done"
- end
-end
View
10 TODO.md
@@ -1,10 +0,0 @@
-## NWS TODO ##
-
-* nothing
-
-## NWS Done ##
-
-* change `server` constructor to have externalServer as option, not argument
-* add `connection._req.headers` -> `connection.headers`
-* abstract `connection.storage` to use a standard API & events
-* add `manager.map` should have similar api to Array.map
View
@@ -0,0 +1,33 @@
+var fs = require("fs")
+ , cp = require("child_process")
+ , cwd = process.cwd;
+
+cp.exec("git describe", function(err, stdout, stderr) {
+ fs.writeFile("package.json", JSON.stringify({
+ version: stdout.match(/v([0-9]+\.[0-9]+\.[0-9]+)/)[1],
+ description: "A WebSocket Server for node.js, 90-100% spec compatible.",
+ repository: {
+ type: "git",
+ url: "http://github.com/miksago/node-websocket-server.git"
+ },
+ directories: {
+ doc: "./doc",
+ lib: "./lib/ws/"
+ },
+ main: "./lib/ws/server",
+ bugs: {
+ web: "http://github.com/miksago/node-websocket-server/issues"
+ },
+ author: "Micheil Smith <micheil@brandedcode.com>",
+ licenses: [
+ {
+ type: "MIT",
+ url: "./LICENSE.md"
+ }
+ ],
+ name: "websocket-server",
+ engines: {
+ node: ">=0.2.0-0"
+ }
+ }));
+});

0 comments on commit 8046b92

Please sign in to comment.