diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..94cdc6a --- /dev/null +++ b/Makefile @@ -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 diff --git a/Rakefile b/Rakefile deleted file mode 100644 index d79b8d4..0000000 --- a/Rakefile +++ /dev/null @@ -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 ", - :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 \ No newline at end of file diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 424a780..0000000 --- a/TODO.md +++ /dev/null @@ -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 diff --git a/tools/release.js b/tools/release.js new file mode 100644 index 0000000..21fc978 --- /dev/null +++ b/tools/release.js @@ -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 ", + licenses: [ + { + type: "MIT", + url: "./LICENSE.md" + } + ], + name: "websocket-server", + engines: { + node: ">=0.2.0-0" + } + })); +}); \ No newline at end of file