vulcan 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/bin/vulcan +1 -1
  2. data/lib/vulcan/cli.rb +7 -2
  3. data/lib/vulcan/version.rb +1 -1
  4. data/server/node_modules/connect-form/node_modules/formidable/Readme.md +13 -2
  5. data/server/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js +19 -7
  6. data/server/node_modules/connect-form/node_modules/formidable/lib/multipart_parser.js +12 -1
  7. data/server/node_modules/connect-form/node_modules/formidable/package.json +1 -1
  8. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/file/plain.txt +1 -0
  9. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http +13 -0
  10. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -10
  11. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -9
  12. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/js/no-filename.js +3 -0
  13. data/server/node_modules/connect-form/node_modules/formidable/test/legacy/simple/test-multipart-parser.js +1 -1
  14. data/server/node_modules/express/History.md +13 -1
  15. data/server/node_modules/express/bin/express +5 -4
  16. data/server/node_modules/express/lib/express.js +1 -1
  17. data/server/node_modules/express/lib/request.js +14 -2
  18. data/server/node_modules/express/lib/response.js +3 -2
  19. data/server/node_modules/express/lib/utils.js +13 -0
  20. data/server/node_modules/express/lib/view/view.js +2 -1
  21. data/server/node_modules/express/node_modules/mime/mime.js +3 -3
  22. data/server/node_modules/express/node_modules/mime/package.json +21 -10
  23. data/server/node_modules/express/node_modules/mime/test.js +2 -3
  24. data/server/node_modules/express/node_modules/mime/{mime.types → types/mime.types} +0 -0
  25. data/server/node_modules/express/node_modules/mime/{node.types → types/node.types} +17 -0
  26. data/server/node_modules/express/node_modules/mkdirp/LICENSE +21 -0
  27. data/server/node_modules/express/node_modules/mkdirp/README.markdown +21 -0
  28. data/server/node_modules/express/node_modules/mkdirp/examples/pow.js +6 -0
  29. data/server/node_modules/express/node_modules/mkdirp/examples/pow.js.orig +6 -0
  30. data/server/node_modules/express/node_modules/mkdirp/examples/pow.js.rej +19 -0
  31. data/server/node_modules/express/node_modules/mkdirp/index.js +20 -0
  32. data/server/node_modules/express/node_modules/mkdirp/package.json +23 -0
  33. data/server/node_modules/express/node_modules/mkdirp/test/mkdirp.js +28 -0
  34. data/server/node_modules/express/node_modules/mkdirp/test/race.js +41 -0
  35. data/server/node_modules/express/node_modules/mkdirp/test/rel.js +32 -0
  36. data/server/node_modules/express/package.json +4 -3
  37. data/server/node_modules/express/testing/index.js +17 -0
  38. data/server/node_modules/express/testing/views/users.jade +1 -0
  39. data/server/web.js +49 -52
  40. metadata +25 -11
  41. data/server/node_modules/express/node_modules/mime/index.js +0 -1
data/bin/vulcan CHANGED
@@ -3,7 +3,7 @@
3
3
  require "net/http/post/multipart"
4
4
  require "tmpdir"
5
5
  require "uri"
6
- require "vulcan/cli"
6
+ require File.expand_path("#{File.dirname(__FILE__)}/../lib/vulcan/cli")
7
7
 
8
8
  Vulcan::CLI.start
9
9
 
data/lib/vulcan/cli.rb CHANGED
@@ -10,7 +10,7 @@ require "yaml"
10
10
  class Vulcan::CLI < Thor
11
11
 
12
12
  desc "build", <<-DESC
13
- build a piece of software for the heroku cloud using COMMANd as a build command
13
+ build a piece of software for the heroku cloud using COMMAND as a build command
14
14
  if no COMMAND is specified, a sensible default will be chosen for you
15
15
 
16
16
  DESC
@@ -94,7 +94,7 @@ update the build server
94
94
  DESC
95
95
 
96
96
  def update
97
- error "no apyet, create first" unless config[:app]
97
+ error "no app yet, create first" unless config[:app]
98
98
 
99
99
  FileUtils.mkdir_p File.expand_path("~/.heroku/plugins/heroku-credentials")
100
100
 
@@ -106,6 +106,11 @@ update the build server
106
106
  end
107
107
  end
108
108
  class Heroku::Command::Credentials < Heroku::Command::Base
109
+
110
+ # credentials
111
+ #
112
+ # list your api key
113
+ #
109
114
  def index
110
115
  puts Heroku::Auth.api_key
111
116
  end
@@ -1,5 +1,5 @@
1
1
  module Vulcan
2
2
 
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
 
5
5
  end
@@ -20,6 +20,15 @@ a big variety of clients and is considered production-ready.
20
20
 
21
21
  ## Changelog
22
22
 
23
+ ### v1.0.5
24
+
25
+ * Support filename="" in multipart parts
26
+ * Explain unexpected end() errors in parser better
27
+
28
+ ### v1.0.4
29
+
30
+ * Detect a good default tmp directory regardless of plattform. (#88)
31
+
23
32
  ### v1.0.3
24
33
 
25
34
  * Fix problems with utf8 characters (#84) / semicolons in filenames (#58)
@@ -142,9 +151,11 @@ Creates a new incoming form.
142
151
 
143
152
  The encoding to use for incoming form fields.
144
153
 
145
- #### incomingForm.uploadDir = '/tmp'
154
+ #### incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()
146
155
 
147
- The directory for placing file uploads in. You can later on move them using `fs.rename()`.
156
+ The directory for placing file uploads in. You can later on move them using
157
+ `fs.rename()`. The default directoy is picked at module load time depending on
158
+ the first existing directory from those listed above.
148
159
 
149
160
  #### incomingForm.keepExtensions = false
150
161
 
@@ -1,5 +1,6 @@
1
1
  if (global.GENTLY) require = GENTLY.hijack(require);
2
2
 
3
+ var fs = require('fs');
3
4
  var util = require('./util'),
4
5
  path = require('path'),
5
6
  File = require('./file'),
@@ -17,7 +18,7 @@ function IncomingForm() {
17
18
 
18
19
  this.maxFieldsSize = 2 * 1024 * 1024;
19
20
  this.keepExtensions = false;
20
- this.uploadDir = '/tmp';
21
+ this.uploadDir = IncomingForm.UPLOAD_DIR;
21
22
  this.encoding = 'utf-8';
22
23
  this.headers = null;
23
24
  this.type = null;
@@ -32,6 +33,20 @@ function IncomingForm() {
32
33
  util.inherits(IncomingForm, EventEmitter);
33
34
  exports.IncomingForm = IncomingForm;
34
35
 
36
+ IncomingForm.UPLOAD_DIR = (function() {
37
+ var dirs = [process.env.TMP, '/tmp', process.cwd()];
38
+ for (var i = 0; i < dirs.length; i++) {
39
+ var dir = dirs[i];
40
+ var isDirectory = false;
41
+
42
+ try {
43
+ isDirectory = fs.statSync(dir).isDirectory();
44
+ } catch (e) {}
45
+
46
+ if (isDirectory) return dir;
47
+ }
48
+ })();
49
+
35
50
  IncomingForm.prototype.parse = function(req, cb) {
36
51
  this.pause = function() {
37
52
  try {
@@ -147,7 +162,7 @@ IncomingForm.prototype.onPart = function(part) {
147
162
  IncomingForm.prototype.handlePart = function(part) {
148
163
  var self = this;
149
164
 
150
- if (!part.filename) {
165
+ if (part.filename === undefined) {
151
166
  var value = ''
152
167
  , decoder = new StringDecoder(this.encoding);
153
168
 
@@ -278,10 +293,7 @@ IncomingForm.prototype._initMultipart = function(boundary) {
278
293
  part.name = m[1];
279
294
  }
280
295
 
281
- var filename = self._fileName(headerValue);
282
- if (filename) {
283
- part.filename = filename;
284
- }
296
+ part.filename = self._fileName(headerValue);
285
297
  } else if (headerField == 'content-type') {
286
298
  part.mime = headerValue;
287
299
  }
@@ -311,7 +323,7 @@ IncomingForm.prototype._initMultipart = function(boundary) {
311
323
  };
312
324
 
313
325
  IncomingForm.prototype._fileName = function(headerValue) {
314
- var m = headerValue.match(/filename="(.+?)"($|; )/i)
326
+ var m = headerValue.match(/filename="(.*?)"($|; )/i)
315
327
  if (!m) return;
316
328
 
317
329
  var filename = m[1].substr(m[1].lastIndexOf('\\') + 1);
@@ -49,6 +49,13 @@ function MultipartParser() {
49
49
  };
50
50
  exports.MultipartParser = MultipartParser;
51
51
 
52
+ MultipartParser.stateToString = function(stateNumber) {
53
+ for (var state in S) {
54
+ var number = S[state];
55
+ if (number === stateNumber) return state;
56
+ }
57
+ };
58
+
52
59
  MultipartParser.prototype.initWithBoundary = function(str) {
53
60
  this.boundary = new Buffer(str.length+4);
54
61
  this.boundary.write('\r\n--', 'ascii', 0);
@@ -296,6 +303,10 @@ MultipartParser.prototype.write = function(buffer) {
296
303
 
297
304
  MultipartParser.prototype.end = function() {
298
305
  if (this.state != S.END) {
299
- return new Error('MultipartParser.end(): stream ended unexpectedly');
306
+ return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain());
300
307
  }
301
308
  };
309
+
310
+ MultipartParser.prototype.explain = function() {
311
+ return 'state = ' + MultipartParser.stateToString(this.state);
312
+ };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "formidable",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "dependencies": {},
5
5
  "devDependencies": {
6
6
  "gently": "0.8.0",
@@ -0,0 +1,13 @@
1
+ POST /upload HTTP/1.1
2
+ Host: localhost:8080
3
+ Content-Type: multipart/form-data; boundary=----WebKitFormBoundarytyE4wkKlZ5CQJVTG
4
+ Content-Length: 1000
5
+
6
+ ------WebKitFormBoundarytyE4wkKlZ5CQJVTG
7
+ Content-Disposition: form-data; name="upload"; filename=""
8
+ Content-Type: text/plain
9
+
10
+ I am a plain text file
11
+
12
+ ------WebKitFormBoundarytyE4wkKlZ5CQJVTG--
13
+
@@ -24,13 +24,3 @@ Content-Type: text/plain
24
24
  I am a text file with a funky name!
25
25
 
26
26
  ------WebKitFormBoundarytyE4wkKlZ5CQJVTG--
27
- GET /favicon.ico HTTP/1.1
28
- Host: localhost:8080
29
- Connection: keep-alive
30
- Accept: */*
31
- User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1
32
- Accept-Encoding: gzip,deflate,sdch
33
- Accept-Language: en-US,en;q=0.8
34
- Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
35
- Cookie: jqCookieJar_tablesorter=%7B%22showListTable%22%3A%5B%5B5%2C1%5D%2C%5B1%2C0%5D%5D%7D
36
-
@@ -22,12 +22,3 @@ Content-Type: text/plain
22
22
 
23
23
 
24
24
  ------WebKitFormBoundaryEvqBNplR3ByrwQPa--
25
- GET /favicon.ico HTTP/1.1
26
- Host: 192.168.56.1:8080
27
- Connection: keep-alive
28
- Accept: */*
29
- User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30
30
- Accept-Encoding: gzip,deflate,sdch
31
- Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
32
- Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
33
-
@@ -0,0 +1,3 @@
1
+ module.exports['generic.http'] = [
2
+ {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'},
3
+ ];
@@ -40,7 +40,7 @@ test(function parserError() {
40
40
 
41
41
  test(function end() {
42
42
  (function testError() {
43
- assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly');
43
+ assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain());
44
44
  })();
45
45
 
46
46
  (function testRegular() {
@@ -1,4 +1,15 @@
1
1
 
2
+ 2.4.7 / 2011-10-05
3
+ ==================
4
+
5
+ * Added mkdirp to express(1). Closes #795
6
+ * Added simple _json-config_ example
7
+ * Added shorthand for the parsed request's pathname via `req.path`
8
+ * Changed connect dep to 1.7.x to fix npm issue...
9
+ * Fixed `res.redirect()` __HEAD__ support. [reported by xerox]
10
+ * Fixed `req.flash()`, only escape args
11
+ * Fixed absolute path checking on windows. Closes #829 [reported by andrewpmckenzie]
12
+
2
13
  2.4.6 / 2011-08-22
3
14
  ==================
4
15
 
@@ -9,7 +20,8 @@
9
20
 
10
21
  * Added support for routes to handle errors. Closes #809
11
22
  * Added `app.routes.all()`. Closes #803
12
- * Added "basepath" setting to work in conjunction with reverse proxies etc. * Refactored `Route` to use a single array of callbacks
23
+ * Added "basepath" setting to work in conjunction with reverse proxies etc.
24
+ * Refactored `Route` to use a single array of callbacks
13
25
  * Added support for multiple callbacks for `app.param()`. Closes #801
14
26
  Closes #805
15
27
  * Changed: removed .call(self) for route callbacks
@@ -5,13 +5,14 @@
5
5
  */
6
6
 
7
7
  var fs = require('fs')
8
- , exec = require('child_process').exec;
8
+ , exec = require('child_process').exec
9
+ , mkdirp = require('mkdirp');
9
10
 
10
11
  /**
11
12
  * Framework version.
12
13
  */
13
14
 
14
- var version = '2.4.6';
15
+ var version = '2.4.7';
15
16
 
16
17
  /**
17
18
  * Add session support.
@@ -398,9 +399,9 @@ function prompt(msg, fn) {
398
399
  */
399
400
 
400
401
  function mkdir(path, fn) {
401
- exec('mkdir -p ' + path, function(err){
402
+ mkdirp(path, 0755, function(err){
402
403
  if (err) throw err;
403
- console.log(' \x1b[36mcreate\x1b[0m : ' + path);
404
+ console.log(' \033[36mcreate\033[0m : ' + path);
404
405
  fn && fn();
405
406
  });
406
407
  }
@@ -28,7 +28,7 @@ var exports = module.exports = connect.middleware;
28
28
  * Framework version.
29
29
  */
30
30
 
31
- exports.version = '2.4.6';
31
+ exports.version = '2.4.7';
32
32
 
33
33
  /**
34
34
  * Shortcut for `new Server(...)`.
@@ -12,6 +12,7 @@
12
12
  var http = require('http')
13
13
  , req = http.IncomingMessage.prototype
14
14
  , utils = require('./utils')
15
+ , parse = require('url').parse
15
16
  , mime = require('mime');
16
17
 
17
18
  /**
@@ -87,6 +88,17 @@ req.get = function(field, param){
87
88
  return RegExp.$1 || RegExp.$2;
88
89
  };
89
90
 
91
+ /**
92
+ * Short-hand for `require('url').parse(req.url).pathname`.
93
+ *
94
+ * @return {String}
95
+ * @api public
96
+ */
97
+
98
+ req.__defineGetter__('path', function(){
99
+ return parse(this.url).pathname;
100
+ });
101
+
90
102
  /**
91
103
  * Check if the _Accept_ header is present, and includes the given `type`.
92
104
  *
@@ -217,10 +229,10 @@ req.flash = function(type, msg){
217
229
  , args = arguments
218
230
  , formatters = this.app.flashFormatters || {};
219
231
  formatters.__proto__ = flashFormatters;
220
- msg = utils.miniMarkdown(utils.escape(msg));
232
+ msg = utils.miniMarkdown(msg);
221
233
  msg = msg.replace(/%([a-zA-Z])/g, function(_, format){
222
234
  var formatter = formatters[format];
223
- if (formatter) return formatter(args[i++]);
235
+ if (formatter) return formatter(utils.escape(args[i++]));
224
236
  });
225
237
  return (msgs[type] = msgs[type] || []).push(msg);
226
238
  } else if (type) {
@@ -105,7 +105,7 @@ res.send = function(body, headers, status){
105
105
 
106
106
  // respond
107
107
  this.statusCode = status;
108
- this.end('HEAD' == this.req.method ? undefined : body);
108
+ this.end('HEAD' == this.req.method ? null : body);
109
109
  return this;
110
110
  };
111
111
 
@@ -376,6 +376,7 @@ res.redirect = function(url, status){
376
376
  , req = this.req
377
377
  , base = app.set('basepath') || app.route
378
378
  , status = status || 302
379
+ , head = 'HEAD' == req.method
379
380
  , body;
380
381
 
381
382
  // Setup redirect map
@@ -418,7 +419,7 @@ res.redirect = function(url, status){
418
419
  // Respond
419
420
  this.statusCode = status;
420
421
  this.header('Location', url);
421
- this.end(body);
422
+ this.end(head ? null : body);
422
423
  };
423
424
 
424
425
  /**
@@ -5,6 +5,19 @@
5
5
  * MIT Licensed
6
6
  */
7
7
 
8
+ /**
9
+ * Check if `path` looks absolute.
10
+ *
11
+ * @param {String} path
12
+ * @return {Boolean}
13
+ * @api private
14
+ */
15
+
16
+ exports.isAbsolute = function(path){
17
+ if ('/' == path[0]) return true;
18
+ if (':' == path[1] && '\\' == path[2]) return true;
19
+ };
20
+
8
21
  /**
9
22
  * Merge object `b` with `a` giving precedence to
10
23
  * values in object `a`.
@@ -10,6 +10,7 @@
10
10
  */
11
11
 
12
12
  var path = require('path')
13
+ , utils = require('../utils')
13
14
  , extname = path.extname
14
15
  , dirname = path.dirname
15
16
  , basename = path.basename
@@ -99,7 +100,7 @@ View.prototype.resolvePath = function(){
99
100
  // Implicit engine
100
101
  if (!~this.basename.indexOf('.')) path += this.extension;
101
102
  // Absolute
102
- if ('/' == path[0]) return path;
103
+ if (utils.isAbsolute(path)) return path;
103
104
  // Relative to parent
104
105
  if (this.relative && this.parent) return this.parent.dirname + '/' + path;
105
106
  // Relative to root
@@ -83,10 +83,10 @@ var mime = module.exports = {
83
83
 
84
84
  // Load our local copy of
85
85
  // http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
86
- mime.load(path.join(__dirname, 'mime.types'));
86
+ mime.load(path.join(__dirname, 'types/mime.types'));
87
87
 
88
- // Overlay enhancements we've had requests for (and that seem to make sense)
89
- mime.load(path.join(__dirname, 'node.types'));
88
+ // Overlay enhancements submitted by the node.js community
89
+ mime.load(path.join(__dirname, 'types/node.types'));
90
90
 
91
91
  // Set the default type
92
92
  mime.default_type = mime.types.bin;
@@ -1,11 +1,22 @@
1
- { "name" : "mime"
2
- , "description" : "A comprehensive library for mime-type mapping"
3
- , "url" : "http://github.com/bentomas/node-mime"
4
- , "keywords" : ["util", "mime"]
5
- , "author" : "Benjamin Thomas <benjamin@benjaminthomas.org>"
6
- , "contributors" : []
7
- , "dependencies" : []
8
- , "lib" : "."
9
- , "main" : "mime.js"
10
- , "version" : "1.2.3"
1
+ {
2
+ "author": {
3
+ "name": "Robert Kieffer",
4
+ "url": "http://github.com/broofa",
5
+ "email": "robert@broofa.com"
6
+ },
7
+ "contributors": [
8
+ {
9
+ "name": "Benjamin Thomas",
10
+ "url": "http://github.com/bentomas",
11
+ "email": "benjamin@benjaminthomas.org"
12
+ }
13
+ ],
14
+ "dependencies": {},
15
+ "description": "A comprehensive library for mime-type mapping",
16
+ "devDependencies": {"async_testing": ""},
17
+ "keywords": ["util", "mime"],
18
+ "main": "mime.js",
19
+ "name": "mime",
20
+ "repository": {"url": "http://github.com/bentomas/node-mime", "type": "git"},
21
+ "version": "1.2.4"
11
22
  }
@@ -1,8 +1,7 @@
1
1
  /**
2
- * Requires the async_testing module, which we're not bothering to ship as part
3
- * of this module.
2
+ * Requires the async_testing module
4
3
  *
5
- * "npm install async_testing"
4
+ * Usage: node test.js
6
5
  */
7
6
  var mime = require('./mime');
8
7
  exports["test mime lookup"] = function(test) {
@@ -1,3 +1,20 @@
1
+ # What: Google Chrome Extension
2
+ # Why: To allow apps to (work) be served with the right content type header.
3
+ # http://codereview.chromium.org/2830017
4
+ # Added by: niftylettuce
5
+ application/x-chrome-extension crx
6
+
7
+ # What: OTF Message Silencer
8
+ # Why: To silence the "Resource interpreted as font but transferred with MIME
9
+ # type font/otf" message that occurs in Google Chrome
10
+ # Added by: niftylettuce
11
+ font/opentype otf
12
+
13
+ # What: HTC support
14
+ # Why: To properly render .htc files such as CSS3PIE
15
+ # Added by: niftylettuce
16
+ text/x-component htc
17
+
1
18
  # What: HTML5 application cache manifest
2
19
  # Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps
3
20
  # per https://developer.mozilla.org/en/offline_resources_in_firefox
@@ -0,0 +1,21 @@
1
+ Copyright 2010 James Halliday (mail@substack.net)
2
+
3
+ This project is free software released under the MIT/X11 license:
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ mkdirp
2
+ ======
3
+
4
+ Like `mkdir -p`, but in node.js!
5
+
6
+ Example
7
+ =======
8
+
9
+ pow.js
10
+ ------
11
+ var mkdirp = require('mkdirp');
12
+
13
+ mkdirp('/tmp/foo/bar/baz', 0755, function (err) {
14
+ if (err) console.error(err)
15
+ else console.log('pow!')
16
+ });
17
+
18
+ Output
19
+ pow!
20
+
21
+ And now /tmp/foo/bar/baz exists, huzzah!
@@ -0,0 +1,6 @@
1
+ var mkdirp = require('mkdirp');
2
+
3
+ mkdirp('/tmp/foo/bar/baz', 0755, function (err) {
4
+ if (err) console.error(err)
5
+ else console.log('pow!')
6
+ });
@@ -0,0 +1,6 @@
1
+ var mkdirp = require('mkdirp');
2
+
3
+ mkdirp('/tmp/foo/bar/baz', 0755, function (err) {
4
+ if (err) console.error(err)
5
+ else console.log('pow!')
6
+ });
@@ -0,0 +1,19 @@
1
+ --- examples/pow.js
2
+ +++ examples/pow.js
3
+ @@ -1,6 +1,15 @@
4
+ -var mkdirp = require('mkdirp').mkdirp;
5
+ +var mkdirp = require('../').mkdirp,
6
+ + mkdirpSync = require('../').mkdirpSync;
7
+
8
+ mkdirp('/tmp/foo/bar/baz', 0755, function (err) {
9
+ if (err) console.error(err)
10
+ else console.log('pow!')
11
+ });
12
+ +
13
+ +try {
14
+ + mkdirpSync('/tmp/bar/foo/baz', 0755);
15
+ + console.log('double pow!');
16
+ +}
17
+ +catch (ex) {
18
+ + console.log(ex);
19
+ +}
@@ -0,0 +1,20 @@
1
+ var path = require('path');
2
+ var fs = require('fs');
3
+
4
+ var exports = module.exports = function mkdirP (p, mode, f) {
5
+ var cb = f || function () {};
6
+ p = path.resolve(p);
7
+
8
+ var ps = path.normalize(p).split('/');
9
+ path.exists(p, function (exists) {
10
+ if (exists) cb(null);
11
+ else mkdirP(ps.slice(0,-1).join('/'), mode, function (err) {
12
+ if (err && err.code !== 'EEXIST') cb(err)
13
+ else fs.mkdir(p, mode, function (err) {
14
+ if (err && err.code !== 'EEXIST') cb(err)
15
+ else cb()
16
+ });
17
+ });
18
+ });
19
+ };
20
+ exports.mkdirp = exports.mkdirP = module.exports;
@@ -0,0 +1,23 @@
1
+ {
2
+ "name" : "mkdirp",
3
+ "description" : "Recursively mkdir, like `mkdir -p`",
4
+ "version" : "0.0.7",
5
+ "author" : "James Halliday <mail@substack.net> (http://substack.net)",
6
+ "main" : "./index",
7
+ "keywords" : [
8
+ "mkdir",
9
+ "directory"
10
+ ],
11
+ "repository" : {
12
+ "type" : "git",
13
+ "url" : "http://github.com/substack/node-mkdirp.git"
14
+ },
15
+ "scripts" : {
16
+ "test" : "node node_modules/tap/bin/tap.js test/*.js"
17
+ },
18
+ "devDependencies" : {
19
+ "tap" : "0.0.x"
20
+ },
21
+ "license" : "MIT/X11",
22
+ "engines": { "node": "*" }
23
+ }
@@ -0,0 +1,28 @@
1
+ var mkdirp = require('../');
2
+ var path = require('path');
3
+ var fs = require('fs');
4
+ var test = require('tap').test;
5
+
6
+ test('woo', function (t) {
7
+ t.plan(2);
8
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
9
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
10
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
11
+
12
+ var file = '/tmp/' + [x,y,z].join('/');
13
+
14
+ mkdirp(file, 0755, function (err) {
15
+ if (err) t.fail(err);
16
+ else path.exists(file, function (ex) {
17
+ if (!ex) t.fail('file not created')
18
+ else fs.stat(file, function (err, stat) {
19
+ if (err) t.fail(err)
20
+ else {
21
+ t.equal(stat.mode & 0777, 0755);
22
+ t.ok(stat.isDirectory(), 'target not a directory');
23
+ t.end();
24
+ }
25
+ })
26
+ })
27
+ });
28
+ });
@@ -0,0 +1,41 @@
1
+ var mkdirp = require('../').mkdirp;
2
+ var path = require('path');
3
+ var fs = require('fs');
4
+ var test = require('tap').test;
5
+
6
+ test('race', function (t) {
7
+ t.plan(4);
8
+ var ps = [ '', 'tmp' ];
9
+
10
+ for (var i = 0; i < 25; i++) {
11
+ var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
12
+ ps.push(dir);
13
+ }
14
+ var file = ps.join('/');
15
+
16
+ var res = 2;
17
+ mk(file, function () {
18
+ if (--res === 0) t.end();
19
+ });
20
+
21
+ mk(file, function () {
22
+ if (--res === 0) t.end();
23
+ });
24
+
25
+ function mk (file, cb) {
26
+ mkdirp(file, 0755, function (err) {
27
+ if (err) t.fail(err);
28
+ else path.exists(file, function (ex) {
29
+ if (!ex) t.fail('file not created')
30
+ else fs.stat(file, function (err, stat) {
31
+ if (err) t.fail(err)
32
+ else {
33
+ t.equal(stat.mode & 0777, 0755);
34
+ t.ok(stat.isDirectory(), 'target not a directory');
35
+ if (cb) cb();
36
+ }
37
+ })
38
+ })
39
+ });
40
+ }
41
+ });
@@ -0,0 +1,32 @@
1
+ var mkdirp = require('../');
2
+ var path = require('path');
3
+ var fs = require('fs');
4
+ var test = require('tap').test;
5
+
6
+ test('rel', function (t) {
7
+ t.plan(2);
8
+ var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
9
+ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
10
+ var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
11
+
12
+ var cwd = process.cwd();
13
+ process.chdir('/tmp');
14
+
15
+ var file = [x,y,z].join('/');
16
+
17
+ mkdirp(file, 0755, function (err) {
18
+ if (err) t.fail(err);
19
+ else path.exists(file, function (ex) {
20
+ if (!ex) t.fail('file not created')
21
+ else fs.stat(file, function (err, stat) {
22
+ if (err) t.fail(err)
23
+ else {
24
+ process.chdir(cwd);
25
+ t.equal(stat.mode & 0777, 0755);
26
+ t.ok(stat.isDirectory(), 'target not a directory');
27
+ t.end();
28
+ }
29
+ })
30
+ })
31
+ });
32
+ });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "express",
3
3
  "description": "Sinatra inspired web development framework",
4
- "version": "2.4.6",
4
+ "version": "2.4.7",
5
5
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
6
6
  "contributors": [
7
7
  { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },
@@ -10,9 +10,10 @@
10
10
  { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }
11
11
  ],
12
12
  "dependencies": {
13
- "connect": ">= 1.5.2 < 2.0.0",
13
+ "connect": "1.7.x",
14
14
  "mime": ">= 0.0.1",
15
- "qs": ">= 0.3.1"
15
+ "qs": ">= 0.3.1",
16
+ "mkdirp": "0.0.7"
16
17
  },
17
18
  "devDependencies": {
18
19
  "connect-form": "0.2.1",
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * Module dependencies.
4
+ */
5
+
6
+ var express = require('../')
7
+ , crypto = require('crypto');
8
+
9
+ var app = express.createServer();
10
+
11
+ app.get('/', function(req, res){
12
+ res.set({ foo: 'bar', bar: 'baz' });
13
+ res.set('X-API-Key', 'foobarbaz');
14
+ res.send('ok');
15
+ });
16
+
17
+ app.listen(3000);
data/server/web.js CHANGED
@@ -34,62 +34,59 @@ app.post('/make', function(request, response, next) {
34
34
  // form handler
35
35
  request.form.complete(function(err, fields, files) {
36
36
 
37
- // if there's an error
38
- if (err) {
39
-
40
- // pass through to the next handler
41
- next(err);
37
+ // if there's an error, pass through to the next handler
38
+ if (err) { return next(err); }
42
39
 
40
+ // match on the shared secret
41
+ if (fields.secret != process.env.SECRET) {
42
+ response.write('invalid secret');
43
+ response.send(500);
43
44
  } else {
44
45
 
45
- // match on the shared secret
46
- if (fields.secret != process.env.SECRET) {
47
- response.write('invalid secret');
48
- response.send(500);
49
- } else {
50
-
51
- var id = uuid();
52
- var command = fields.command;
53
- var prefix = fields.prefix;
54
-
55
- // create a couchdb documents for this build
56
- var doc = db.save(id, { command:command, prefix:prefix }, function(err, doc) {
57
-
58
- // save the input tarball as an attachment
59
- db.saveAttachment(
60
- doc.id,
61
- doc.rev,
62
- 'input',
63
- 'application/octet-stream',
64
- fs.createReadStream(files.code.path),
65
- function(err, data) {
66
-
67
- // spawn bin/make with this build id
68
- var ls = spawner.spawn('bin/make ' + id, function(err) {
69
- response.write('could not spawn: ' + err);
70
- response.send(500);
71
- });
72
-
73
- ls.on('error', function(error) {
74
- response.write('error: ' + err);
75
- response.send(500);
76
- });
77
-
78
- ls.on('data', function(data) {
79
- response.write(data);
80
- });
81
-
82
- ls.on('exit', function(code) {
83
- response.end();
84
- });
85
- }
86
- );
87
-
88
- // return the build id as a header
89
- response.header('X-Make-Id', id);
90
- });
91
- }
46
+ var id = uuid();
47
+ var command = fields.command;
48
+ var prefix = fields.prefix;
49
+
50
+ // create a couchdb documents for this build
51
+ db.save(id, { command:command, prefix:prefix }, function(err, doc) {
52
+ if (err) { return next(err); }
53
+
54
+ // save the input tarball as an attachment
55
+ db.saveAttachment(
56
+ doc.id,
57
+ doc.rev,
58
+ 'input',
59
+ 'application/octet-stream',
60
+ fs.createReadStream(files.code.path),
61
+ function(err, data) {
62
+ if (err) { return next(err); }
63
+
64
+ // spawn bin/make with this build id
65
+ var ls = spawner.spawn('bin/make ' + id, function(err) {
66
+ response.write('could not spawn: ' + err);
67
+ response.send(500);
68
+ });
69
+
70
+ ls.on('error', function(error) {
71
+ response.write('error: ' + err);
72
+ response.send(500);
73
+ });
74
+
75
+ ls.on('data', function(data) {
76
+ response.write(data);
77
+ });
78
+
79
+ ls.on('exit', function(code) {
80
+ response.end();
81
+ });
82
+ }
83
+ );
84
+
85
+ // return the build id as a header
86
+ response.header('X-Make-Id', id);
87
+ });
92
88
  }
89
+
93
90
  });
94
91
  }
95
92
  });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vulcan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-24 00:00:00.000000000 Z
12
+ date: 2011-12-09 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multipart-post
16
- requirement: &70260058252980 !ruby/object:Gem::Requirement
16
+ requirement: &70327900819780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.1.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70260058252980
24
+ version_requirements: *70327900819780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rest-client
27
- requirement: &70260058252160 !ruby/object:Gem::Requirement
27
+ requirement: &70327900819280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.7
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70260058252160
35
+ version_requirements: *70327900819280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: thor
38
- requirement: &70260058251500 !ruby/object:Gem::Requirement
38
+ requirement: &70327900818820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.14.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70260058251500
46
+ version_requirements: *70327900818820
47
47
  description: Build software in the cloud
48
48
  email: ddollar@gmail.com
49
49
  executables:
@@ -82,6 +82,8 @@ files:
82
82
  - server/node_modules/connect-form/node_modules/formidable/test/fast/test-incoming-form.js
83
83
  - ! 'server/node_modules/connect-form/node_modules/formidable/test/fixture/file/:
84
84
  \ ? % * | " < > . ☃ ; '' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt'
85
+ - server/node_modules/connect-form/node_modules/formidable/test/fixture/file/plain.txt
86
+ - server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http
85
87
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md
86
88
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http
87
89
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http
@@ -90,6 +92,7 @@ files:
90
92
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http
91
93
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http
92
94
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http
95
+ - server/node_modules/connect-form/node_modules/formidable/test/fixture/js/no-filename.js
93
96
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/js/special-chars-in-filename.js
94
97
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/multi_video.upload
95
98
  - server/node_modules/connect-form/node_modules/formidable/test/fixture/multipart.js
@@ -454,14 +457,23 @@ files:
454
457
  - server/node_modules/express/node_modules/connect/LICENSE
455
458
  - server/node_modules/express/node_modules/connect/package.json
456
459
  - server/node_modules/express/node_modules/connect/test.js
457
- - server/node_modules/express/node_modules/mime/index.js
458
460
  - server/node_modules/express/node_modules/mime/LICENSE
459
461
  - server/node_modules/express/node_modules/mime/mime.js
460
- - server/node_modules/express/node_modules/mime/mime.types
461
- - server/node_modules/express/node_modules/mime/node.types
462
462
  - server/node_modules/express/node_modules/mime/package.json
463
463
  - server/node_modules/express/node_modules/mime/README.md
464
464
  - server/node_modules/express/node_modules/mime/test.js
465
+ - server/node_modules/express/node_modules/mime/types/mime.types
466
+ - server/node_modules/express/node_modules/mime/types/node.types
467
+ - server/node_modules/express/node_modules/mkdirp/examples/pow.js
468
+ - server/node_modules/express/node_modules/mkdirp/examples/pow.js.orig
469
+ - server/node_modules/express/node_modules/mkdirp/examples/pow.js.rej
470
+ - server/node_modules/express/node_modules/mkdirp/index.js
471
+ - server/node_modules/express/node_modules/mkdirp/LICENSE
472
+ - server/node_modules/express/node_modules/mkdirp/package.json
473
+ - server/node_modules/express/node_modules/mkdirp/README.markdown
474
+ - server/node_modules/express/node_modules/mkdirp/test/mkdirp.js
475
+ - server/node_modules/express/node_modules/mkdirp/test/race.js
476
+ - server/node_modules/express/node_modules/mkdirp/test/rel.js
465
477
  - server/node_modules/express/node_modules/qs/benchmark.js
466
478
  - server/node_modules/express/node_modules/qs/examples.js
467
479
  - server/node_modules/express/node_modules/qs/History.md
@@ -502,6 +514,8 @@ files:
502
514
  - server/node_modules/express/node_modules/qs/test/stringify.test.js
503
515
  - server/node_modules/express/package.json
504
516
  - server/node_modules/express/Readme.md
517
+ - server/node_modules/express/testing/index.js
518
+ - server/node_modules/express/testing/views/users.jade
505
519
  - server/node_modules/knox/History.md
506
520
  - server/node_modules/knox/index.html
507
521
  - server/node_modules/knox/index.js
@@ -1 +0,0 @@
1
- module.exports = require('./mime');