Skip to content
Browse files

tidier name and regexp url route generation

  • Loading branch information...
1 parent 6692385 commit 5cfebe886ba3bab27849fb9b2840692207070ced @joshbuddy committed Sep 10, 2011
View
210 js/npm-debug.log
@@ -0,0 +1,210 @@
+info it worked if it ends with ok
+verbose cli [ 'node', '/usr/local/bin/npm', 'publish' ]
+info using npm@1.0.6
+info using node@v0.4.7
+verbose config file /Users/joshbuddy/.npmrc
+verbose config file /usr/local/etc/npmrc
+verbose publish [ '.' ]
+silly testEngine { name: 'http_router',
+silly testEngine description: 'URL routing and generation in js',
+silly testEngine author: { name: 'Joshua Hull', email: 'joshbuddy@gmail.com' },
+silly testEngine version: '0.9.2',
+silly testEngine directories: { lib: './lib/http_router' },
+silly testEngine main: 'lib/http_router',
+silly testEngine dependencies: {},
+silly testEngine devDependencies: {},
+silly testEngine _id: 'http_router@0.9.2',
+silly testEngine engines: { node: '*' },
+silly testEngine _engineSupported: true,
+silly testEngine _npmVersion: '1.0.6',
+silly testEngine _nodeVersion: 'v0.4.7',
+silly testEngine _defaultsLoaded: true }
+verbose caching package.json
+verbose loadDefaults http_router@0.9.2
+verbose pack /Users/joshbuddy/Development/http_router/js /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/tmp.tgz
+silly testEngine { name: 'http_router',
+silly testEngine description: 'URL routing and generation in js',
+silly testEngine author: { name: 'Joshua Hull', email: 'joshbuddy@gmail.com' },
+silly testEngine version: '0.9.2',
+silly testEngine directories: { lib: './lib/http_router' },
+silly testEngine main: 'lib/http_router',
+silly testEngine dependencies: {},
+silly testEngine devDependencies: {},
+silly testEngine _id: 'http_router@0.9.2',
+silly testEngine engines: { node: '*' },
+silly testEngine _engineSupported: true,
+silly testEngine _npmVersion: '1.0.6',
+silly testEngine _nodeVersion: 'v0.4.7',
+silly testEngine _defaultsLoaded: true,
+silly testEngine path: '/Users/joshbuddy/Development/http_router/js' }
+verbose caching /Users/joshbuddy/Development/http_router/js/package.json
+verbose loadDefaults http_router@0.9.2
+verbose mkdir done: /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559 755
+verbose mkdir'ed /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559
+verbose tar about to write tar and gzip it.
+silly tar args [ '-cvf',
+silly tar args '-',
+silly tar args 'js/package.json',
+silly tar args 'js/lib/http_router.coffee',
+silly tar args 'js/lib/http_router.js',
+silly tar args 'js/test/test.coffee',
+silly tar args 'js/test/test.js' ]
+verbose success tar -cvf - <file list elided>
+verbose success gzip "--stdout"
+verbose mkdir done: /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm 755
+verbose unpack_ uid, gid [ undefined, undefined ]
+verbose unpackTarget /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/package
+silly gunzTarPerm modes [ '755', '644' ]
+verbose success gzip "--decompress" "--stdout" "/var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/tmp.tgz"
+verbose success tar "-mvxpf" "-" "--no-same-owner" "-C" "/var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm"
+silly asyncMap in gTP /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js/
+silly asyncMap in gTP /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js/package.json
+silly asyncMap in gTP /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js/lib/
+silly asyncMap in gTP /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js/lib/http_router.coffee
+silly asyncMap in gTP /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js/lib/http_router.js
+silly asyncMap in gTP /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js/test/
+silly asyncMap in gTP /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js/test/test.coffee
+silly asyncMap in gTP /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js/test/test.js
+verbose gunzed /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js
+verbose rm'ed /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/package
+verbose renamed [ '/var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/___package.npm/js',
+verbose renamed '/var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/package' ]
+silly testEngine { name: 'http_router',
+silly testEngine description: 'URL routing and generation in js',
+silly testEngine author: { name: 'Joshua Hull', email: 'joshbuddy@gmail.com' },
+silly testEngine version: '0.9.2',
+silly testEngine directories: { lib: './lib/http_router' },
+silly testEngine main: 'lib/http_router',
+silly testEngine dependencies: {},
+silly testEngine devDependencies: {},
+silly testEngine _id: 'http_router@0.9.2',
+silly testEngine engines: { node: '*' },
+silly testEngine _engineSupported: true,
+silly testEngine _npmVersion: '1.0.6',
+silly testEngine _nodeVersion: 'v0.4.7',
+silly testEngine _defaultsLoaded: true,
+silly testEngine path: '/var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/package' }
+verbose caching /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/package/package.json
+verbose loadDefaults http_router@0.9.2
+verbose tarball contents [ 'package' ]
+verbose from cache /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/package/package.json
+verbose pack /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/package /Users/joshbuddy/.npm/http_router/0.9.2/package.tgz
+verbose from cache /var/folders/bz/bzU9XnCYHVeexFYRgWt+CE+++TQ/-Tmp-/npm-1311529466761/1311529466761-0.7874559857882559/contents/package/package.json
+verbose mkdir done: /Users/joshbuddy/.npm/http_router/0.9.2 755
+verbose mkdir'ed /Users/joshbuddy/.npm/http_router/0.9.2
+verbose tar about to write tar and gzip it.
+silly tar args [ '-cvf',
+silly tar args '-',
+silly tar args 'package/package.json',
+silly tar args 'package/lib/http_router.coffee',
+silly tar args 'package/lib/http_router.js',
+silly tar args 'package/test/test.coffee',
+silly tar args 'package/test/test.js' ]
+verbose success tar -cvf - <file list elided>
+verbose success gzip "--stdout"
+verbose mkdir done: /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm 755
+verbose unpack_ uid, gid [ undefined, undefined ]
+verbose unpackTarget /Users/joshbuddy/.npm/http_router/0.9.2/package
+silly gunzTarPerm modes [ '755', '644' ]
+verbose success gzip "--decompress" "--stdout" "/Users/joshbuddy/.npm/http_router/0.9.2/package.tgz"
+verbose success tar "-mvxpf" "-" "--no-same-owner" "-C" "/Users/joshbuddy/.npm/http_router/0.9.2/___package.npm"
+silly asyncMap in gTP /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package/
+silly asyncMap in gTP /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package/package.json
+silly asyncMap in gTP /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package/lib/
+silly asyncMap in gTP /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package/lib/http_router.coffee
+silly asyncMap in gTP /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package/lib/http_router.js
+silly asyncMap in gTP /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package/test/
+silly asyncMap in gTP /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package/test/test.coffee
+silly asyncMap in gTP /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package/test/test.js
+verbose gunzed /Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package
+verbose rm'ed /Users/joshbuddy/.npm/http_router/0.9.2/package
+verbose renamed [ '/Users/joshbuddy/.npm/http_router/0.9.2/___package.npm/package',
+verbose renamed '/Users/joshbuddy/.npm/http_router/0.9.2/package' ]
+silly testEngine { name: 'http_router',
+silly testEngine description: 'URL routing and generation in js',
+silly testEngine author: { name: 'Joshua Hull', email: 'joshbuddy@gmail.com' },
+silly testEngine version: '0.9.2',
+silly testEngine directories: { lib: './lib/http_router' },
+silly testEngine main: 'lib/http_router',
+silly testEngine dependencies: {},
+silly testEngine devDependencies: {},
+silly testEngine _id: 'http_router@0.9.2',
+silly testEngine engines: { node: '*' },
+silly testEngine _engineSupported: true,
+silly testEngine _npmVersion: '1.0.6',
+silly testEngine _nodeVersion: 'v0.4.7',
+silly testEngine _defaultsLoaded: true,
+silly testEngine dist:
+silly testEngine { shasum: 'd89c3c13a0b10b2f0ce07134b5ce8c2b0db65ed4',
+silly testEngine tarball: 'http://registry.npmjs.org/http_router/-/http_router-0.9.2.tgz' },
+silly testEngine scripts: {} }
+verbose caching /Users/joshbuddy/.npm/http_router/0.9.2/package/package.json
+verbose loadDefaults http_router@0.9.2
+silly updated sha bytes 10411
+info shasum d89c3c13a0b10b2f0ce07134b5ce8c2b0db65ed4
+info shasum /Users/joshbuddy/.npm/http_router/0.9.2/package.tgz
+verbose from cache /Users/joshbuddy/.npm/http_router/0.9.2/package/package.json
+verbose chmod /Users/joshbuddy/.npm/http_router/0.9.2/package.json 644
+verbose chmod /Users/joshbuddy/.npm/http_router/0.9.2/package.tgz 644
+silly publish { name: 'http_router',
+silly publish description: 'URL routing and generation in js',
+silly publish author: { name: 'Joshua Hull', email: 'joshbuddy@gmail.com' },
+silly publish version: '0.9.2',
+silly publish directories: { lib: './lib/http_router' },
+silly publish main: 'lib/http_router',
+silly publish dependencies: {},
+silly publish devDependencies: {},
+silly publish _id: 'http_router@0.9.2',
+silly publish engines: { node: '*' },
+silly publish _engineSupported: true,
+silly publish _npmVersion: '1.0.6',
+silly publish _nodeVersion: 'v0.4.7',
+silly publish _defaultsLoaded: true,
+silly publish dist:
+silly publish { shasum: 'd89c3c13a0b10b2f0ce07134b5ce8c2b0db65ed4',
+silly publish tarball: 'http://registry.npmjs.org/http_router/-/http_router-0.9.2.tgz' },
+silly publish scripts: {} }
+info prepublish http_router@0.9.2
+verbose PUT http_router
+verbose raw, before any munging http_router
+verbose url resolving [ 'http://registry.npmjs.org/', './http_router' ]
+verbose url resolved http://registry.npmjs.org/http_router
+verbose url parsed { protocol: 'http:',
+verbose url parsed slashes: true,
+verbose url parsed host: 'registry.npmjs.org',
+verbose url parsed hostname: 'registry.npmjs.org',
+verbose url parsed href: 'http://registry.npmjs.org/http_router',
+verbose url parsed pathname: '/http_router' }
+WARN Sending authorization over insecure channel.
+silly writing json { _id: 'http_router',
+silly writing json name: 'http_router',
+silly writing json description: 'URL routing and generation in js',
+silly writing json 'dist-tags': {},
+silly writing json versions: {},
+silly writing json maintainers: [ { name: 'joshbuddy', email: 'joshbuddy@gmail.com' } ] }
+verbose response http://registry.npmjs.org/http_router
+silly chunk {"error":"conflict","reason":"Document update conflict."}
+silly chunk
+verbose GET http_router
+verbose raw, before any munging http_router
+verbose url resolving [ 'http://registry.npmjs.org/', './http_router' ]
+verbose url resolved http://registry.npmjs.org/http_router
+verbose url parsed { protocol: 'http:',
+verbose url parsed slashes: true,
+verbose url parsed host: 'registry.npmjs.org',
+verbose url parsed hostname: 'registry.npmjs.org',
+verbose url parsed href: 'http://registry.npmjs.org/http_router',
+verbose url parsed pathname: '/http_router' }
+verbose response http://registry.npmjs.org/http_router
+silly chunk {"_id":"http_router","_rev":"23-ad52b58b6bfc96d6d4e8215e0c31b294","name":"http_router","description":"URL routing and generation in js","dist-tags":{"latest":"0.9.2"},"versions":{"0.9.0":{"name":"http_router","description":"URL routing and generation in js","author":{"name":"Joshua Hull","email":"joshbuddy@gmail.com"},"version":"0.9.0","directories":{"lib":"./lib/http_router"},"main":"lib/http_router","dependencies":{},"devDependencies":{},"_id":"http_router@0.9.0","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"9fec2c3763689191e1861f889cb79eedbc1ed4ec","tarball":"http://registry.npmjs.org/http_router/-/http_router-0.9.0.tgz"},"scripts":{}},"0.9.1":{"name":"http_router","description":"URL routing and generation in js","author":{"name":"Joshua Hull","email":"joshbuddy@gmail.com"},"version":"0.9.1","directories":{"lib":"./lib/http_router"},"main":"lib/http_router","dependencies":{},"devDependencies":{},"_id":"http_router@0.9.1","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"f803dd9d7b2e998601d532490b38d514fd879c5a","tarball":"http://registry.npmjs.org/http_router/-/http_
+silly chunk router-0.9.1.tgz"},"scripts":{}},"0.9.2":{"name":"http_router","description":"URL routing and generation in js","author":{"name":"Joshua Hull","email":"joshbuddy@gmail.com"},"version":"0.9.2","directories":{"lib":"./lib/http_router"},"main":"lib/http_router","dependencies":{},"devDependencies":{},"_id":"http_router@0.9.2","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.7","_defaultsLoaded":true,"dist":{"shasum":"4946afd390d9d98b7feb7825e124951596327062","tarball":"http://registry.npmjs.org/http_router/-/http_router-0.9.2.tgz"},"scripts":{}}},"maintainers":[{"name":"joshbuddy","email":"joshbuddy@gmail.com"}],"time":{"0.9.0":"2011-07-16T20:07:56.831Z","0.9.1":"2011-07-23T03:49:04.843Z","0.9.2":"2011-07-24T17:43:50.936Z"},"author":{"name":"Joshua Hull","email":"joshbuddy@gmail.com"}}
+info Already published http_router@0.9.2
+verbose uploading bin dists []
+ERR! publish fail Cannot publish over existing version.
+ERR! publish fail Bump the 'version' field, set the --force flag, or
+ERR! publish fail npm unpublish 'http_router@0.9.2'
+ERR! publish fail and try again
+ERR!
+ERR! System Darwin 10.8.0
+ERR! command "node" "/usr/local/bin/npm" "publish"
+verbose exit [ 1, true ]
View
1 lib/http_router.rb
@@ -8,6 +8,7 @@
require 'http_router/response'
require 'http_router/route'
require 'http_router/route_proxy'
+require 'http_router/regex_route_generation'
require 'http_router/rack'
require 'http_router/util'
View
9 lib/http_router/node/root.rb
@@ -74,14 +74,7 @@ def add_route(route)
when Regexp
param_names = path.respond_to?(:names) ? path.names.map(&:to_sym) : []
Util.add_path_generation(route, route, route.path_for_generation, path) if route.path_for_generation
- route.instance_eval do
- def url_with_params(*a)
- url_args_processing(a) do |args, options|
- respond_to?(:raw_url) or raise InvalidRouteException
- raw_url(args, options)
- end
- end
- end
+ route.instance_eval "extend RegexRouteGeneration", __FILE__, __LINE__
add_non_path_to_tree(route, add_free_match(path), path, param_names)
else
param_names = []
View
10 lib/http_router/regex_route_generation.rb
@@ -0,0 +1,10 @@
+class HttpRouter
+ module RegexRouteGeneration
+ def url_with_params(*a)
+ url_args_processing(a) do |args, options|
+ respond_to?(:raw_url) or raise InvalidRouteException
+ raw_url(args, options)
+ end
+ end
+ end
+end
View
10 lib/http_router/route.rb
@@ -50,11 +50,6 @@ def add_request_method(methods)
end
end
- def url(*args)
- result, extra_params = url_with_params(*args)
- append_querystring(result, extra_params)
- end
-
def clone(new_router)
r = super()
r.dest = (begin; dest.clone; rescue; dest; end)
@@ -91,6 +86,11 @@ def name=(name)
@router.named_routes[name] << self
end
+ def url(*args)
+ result, extra_params = url_with_params(*args)
+ append_querystring(result, extra_params)
+ end
+
private
def url_with_params(*a)
url_args_processing(a) do |args, options|
View
4 lib/http_router/route_proxy.rb
@@ -16,6 +16,10 @@ def method_missing(name, *args, &blk)
end
end
+ def name(name = nil)
+ name ? route.name = name : route.name
+ end
+
def process_opts(opts)
if opts[:conditions]
opts.merge!(opts[:conditions])

0 comments on commit 5cfebe8

Please sign in to comment.
Something went wrong with that request. Please try again.