Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup

  • Loading branch information...
commit 5988ae801468af3e56c718eac3d262fca3546759 1 parent ca84f3e
Eric Schoffstall contra authored
Showing with 15 additions and 1,896 deletions.
  1. +3 −0  .gitignore
  2. +3 −0  .npmignore
  3. +9 −8 lib/npm.js
  4. +0 −19 lib/test.js
  5. +0 −20 node_modules/colors/MIT-LICENSE.txt
  6. +0 −30 node_modules/colors/ReadMe.md
  7. +0 −75 node_modules/colors/colors.js
  8. +0 −6 node_modules/colors/example.js
  9. +0 −14 node_modules/colors/package.json
  10. +0 −4 node_modules/iniparser/MakeFile
  11. +0 −41 node_modules/iniparser/README.md
  12. +0 −64 node_modules/iniparser/lib/node-iniparser.js
  13. +0 −10 node_modules/iniparser/package.json
  14. +0 −55 node_modules/nodester-api/node_modules/request/LICENSE
  15. +0 −191 node_modules/nodester-api/node_modules/request/README.md
  16. +0 −150 node_modules/nodester-api/node_modules/request/cookies.js
  17. +0 −447 node_modules/nodester-api/node_modules/request/main.js
  18. +0 −146 node_modules/nodester-api/node_modules/request/mimetypes.js
  19. +0 −14 node_modules/nodester-api/node_modules/request/package.json
  20. 0  node_modules/nodester-api/node_modules/request/test.js
  21. BIN  node_modules/nodester-api/node_modules/request/tests/googledoodle.png
  22. +0 −46 node_modules/nodester-api/node_modules/request/tests/server.js
  23. +0 −78 node_modules/nodester-api/node_modules/request/tests/test-body.js
  24. 0  node_modules/nodester-api/node_modules/request/tests/test-cookies.js
  25. +0 −30 node_modules/nodester-api/node_modules/request/tests/test-errors.js
  26. +0 −136 node_modules/nodester-api/node_modules/request/tests/test-pipes.js
  27. +0 −18 node_modules/nodester-api/node_modules/request/tests/test-put.js
  28. +0 −7 node_modules/nodester-api/node_modules/request/tests/test-ssl.js
  29. +0 −84 node_modules/nodester-api/node_modules/request/tests/test-timeout.js
  30. +0 −184 node_modules/nodester-api/nodester.js
  31. +0 −19 node_modules/nodester-api/package.json
3  .gitignore
View
@@ -0,0 +1,3 @@
+.DS_Store
+*.log
+node_modules
3  .npmignore
View
@@ -0,0 +1,3 @@
+.DS_Store
+*.log
+node_modules
17 lib/npm.js
View
@@ -8,8 +8,8 @@ var node = require('nodester-api').nodester,
module.exports = {
usage: function () {
- log.usage('In a configured app dir, <appname> is optional. (domain aliases appdomain)');
- log.usage('All arguments after install|update|uninstall will be sent to npm as packages.');
+ log.usage('In a configured app dir, <appname> is optional.');
+ log.usage('All arguments after install|update|uninstall or appname will be sent to npm as packages.');
log.usage('npm list - Lists the installed npm packages for this app.');
log.usage('npm install <appname> <packages> - Installs the list of specified packages to this app.');
log.usage('npm update <appname> <packages> - Update the list of specified packages to this app.');
@@ -25,15 +25,16 @@ module.exports = {
p = args.splice(1);
}
if (!p.length) {
- if (path.existsSync('package.json')){
+ if (exists('package.json')) {
log.info('grabbing dependencies from package.json...');
var depen = JSON.parse(fs.readFileSync('package.json')).dependencies;
if (!depen) {
- log.error('no packages to install!');
- }
- p = [];
- for (dependency in depen) {
- p.push(dependency);
+ log.error('no depedencies found!');
+ } else {
+ p = [];
+ for (dependency in depen) {
+ p.push(dependency);
+ }
}
} else {
log.error('no packages to install!');
19 lib/test.js
View
@@ -1,19 +0,0 @@
-var node = require('nodester-api').nodester,
- path = require('path'),
- fs = require('fs'),
- exists = path.existsSync,
- config = require('./config');
-
-if (exists('./package.json')){
- var p = [];
- console.log('grabbing dependencies from package.json...');
- var depen = JSON.parse(fs.readFileSync('package.json')).dependencies;
- if (!depen) {
- console.log('no packages to install!');
- }
- console.log(depen);
- for (dependency in depen) {
- p.push(dependency);
- }
- console.log(p);
-}
20 node_modules/colors/MIT-LICENSE.txt
View
@@ -1,20 +0,0 @@
-Copyright (c) 2010 Marak Squires http://github.com/marak/say.js/
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 node_modules/colors/ReadMe.md
View
@@ -1,30 +0,0 @@
-<h1>colors.js - get color and style in your node.js console like what</h1>
-
-<img src="http://i.imgur.com/goJdO.png" border = "0"/>
-
- var sys = require('sys');
- var colors = require('./colors');
-
- sys.puts('hello'.green); // outputs green text
- sys.puts('i like cake and pies'.underline.red) // outputs red underlined text
- sys.puts('inverse the color'.inverse); // inverses the color
- sys.puts('OMG Rainbows!'.rainbow); // rainbow (ignores spaces)
-
-<h2>colors and styles!</h2>
-- bold
-- italic
-- underline
-- inverse
-- yellow
-- cyan
-- white
-- magenta
-- green
-- red
-- grey
-- blue
-
-
-### Authors
-
-#### Alexis Sellier (cloudhead) , Marak Squires , Justin Campbell
75 node_modules/colors/colors.js
View
@@ -1,75 +0,0 @@
-/*
-colors.js
-
-Copyright (c) 2010 Alexis Sellier (cloudhead) , Marak Squires
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-*/
-
-// prototypes the string object to have additional method calls that add terminal colors
-['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'].forEach(function (style) {
- Object.defineProperty(String.prototype, style, {
- get: function () {
- return stylize(this, style);
- }
- });
-});
-
-// prototypes string with method "rainbow"
-// rainbow will apply a the color spectrum to a string, changing colors every letter
-Object.defineProperty(String.prototype, 'rainbow', {
- get: function () {
- var rainbowcolors = ['red','yellow','green','blue','magenta']; //RoY G BiV
- var exploded = this.split("");
- var i=0;
- exploded = exploded.map(function(letter) {
- if (letter==" ") {
- return letter;
- }
- else {
- return stylize(letter,rainbowcolors[i++ % rainbowcolors.length]);
- }
- });
- return exploded.join("");
- }
-});
-
-function stylize(str, style) {
- var styles = {
- //styles
- 'bold' : [1, 22],
- 'italic' : [3, 23],
- 'underline' : [4, 24],
- 'inverse' : [7, 27],
- //grayscale
- 'white' : [37, 39],
- 'grey' : [90, 39],
- 'black' : [90, 39],
- //colors
- 'blue' : [34, 39],
- 'cyan' : [36, 39],
- 'green' : [32, 39],
- 'magenta' : [35, 39],
- 'red' : [31, 39],
- 'yellow' : [33, 39]
- };
- return '\033[' + styles[style][0] + 'm' + str +
- '\033[' + styles[style][1] + 'm';
-};
6 node_modules/colors/example.js
View
@@ -1,6 +0,0 @@
-var sys = require('sys');
-var colors = require('./colors');
-
-sys.puts('Rainbows are fun!'.rainbow);
-sys.puts('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported
-sys.puts('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported
14 node_modules/colors/package.json
View
@@ -1,14 +0,0 @@
-{
- "name": "colors",
- "description": "get colors in your node.js console like what",
- "version": "0.3.0",
- "author": "Marak Squires",
- "repository": {
- "type": "git",
- "url": "http://github.com/Marak/colors.js.git"
- },
- "engine": [
- "node >=0.1.90"
- ],
- "main": "colors"
-}
4 node_modules/iniparser/MakeFile
View
@@ -1,4 +0,0 @@
-LIB_PREFIX = ~/.node_libraries
-install:
- echo 'Hello'
-.PHONY: install
41 node_modules/iniparser/README.md
View
@@ -1,41 +0,0 @@
-# Node .ini parser
-
-Simple .ini parser for node, supports sections
-
-To parse a .ini file async:
- var iniparser = require('iniparser');
- iniparser.parse('./config.ini', function(data){
- var version = data.version;
- });
-
-To parse a .ini file sync:
- var iniparser = require('iniparser');
- var config = iniparser.parseSync('./config.ini');
-
-## Installation
-npm:
- npm install iniparser
-## License
-
-(The MIT License)
-
-Copyright (c) 2009-2010 Jordy van Gelder &lt;jordyvangelder@gmail.com&gt;
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
64 node_modules/iniparser/lib/node-iniparser.js
View
@@ -1,64 +0,0 @@
-/*
- * get the file handler
- */
-var fs = require('fs');
-
-/*
- * define the possible values:
- * section: [section]
- * param: key=value
- * comment: ;this is a comment
- */
-var regex = {
- section: /^\s*\[\s*([^\]]*)\s*\]\s*$/,
- param: /^\s*(\w+)\s*=\s*(.*)\s*$/,
- comment: /^\s*;.*$/
-};
-
-/*
- * parses a .ini file
- * @param: {String} file, the location of the .ini file
- * @param: {Function} callback, the function that will be called when parsing is done
- * @return: none
- */
-module.exports.parse = function(file, callback){
- if(!callback){
- return;
- }
- fs.readFile(file, 'utf-8', function(err, data){
- if(err){
- callback(err);
- }else{
- callback(null, parse(data));
- }
- });
-};
-
-module.exports.parseSync = function(file){
- return parse(fs.readFileSync(file, 'utf-8'));
-};
-
-function parse(data){
- var value = {};
- var lines = data.split(/\r\n|\r|\n/);
- var section = null;
- lines.forEach(function(line){
- if(regex.comment.test(line)){
- return;
- }else if(regex.param.test(line)){
- var match = line.match(regex.param);
- if(section){
- value[section][match[1]] = match[2];
- }else{
- value[match[1]] = match[2];
- }
- }else if(regex.section.test(line)){
- var match = line.match(regex.section);
- value[match[1]] = {};
- section = match[1];
- }else if(line.length == 0 && section){
- section = null;
- };
- });
- return value;
-}
10 node_modules/iniparser/package.json
View
@@ -1,10 +0,0 @@
-{
- "name": "iniparser",
- "version": "1.0.1",
- "description": "a simple .ini parser",
- "author": "Jordy van Gelder <jordyvangelder@gmail.com>",
- "main": "./lib/node-iniparser",
- "directories": {
- "lib": "./lib"
- }
-}
55 node_modules/nodester-api/node_modules/request/LICENSE
View
@@ -1,55 +0,0 @@
-Apache License
-
-Version 2.0, January 2004
-
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
-
-"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of this License; and
-
-You must cause any modified files to carry prominent notices stating that You changed the files; and
-
-You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
-
-If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
191 node_modules/nodester-api/node_modules/request/README.md
View
@@ -1,191 +0,0 @@
-# Request -- Simplified HTTP request method
-
-## Install
-
-<pre>
- npm install request
-</pre>
-
-Or from source:
-
-<pre>
- git clone git://github.com/mikeal/request.git
- cd request
- npm link
-</pre>
-
-## Super simple to use
-
-Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default.
-
-```javascript
-var request = require('request');
-request('http://www.google.com', function (error, response, body) {
- if (!error && response.statusCode == 200) {
- sys.puts(body) // Print the google web page.
- }
-})
-```
-
-## Streaming
-
-You can stream any response to a file stream.
-
-```javascript
-request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png'))
-```
-
-You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers.
-
-```javascript
-fs.readStream('file.json').pipe(request.put('http://mysite.com/obj.json'))
-```
-
-Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers.
-
-```javascript
-request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png'))
-```
-
-Now let's get fancy.
-
-```javascript
-http.createServer(function (req, resp) {
- if (req.url === '/doodle.png') {
- if (req.method === 'PUT') {
- req.pipe(request.put('http://mysite.com/doodle.png'))
- } else if (req.method === 'GET' || req.method === 'HEAD') {
- request.get('http://mysite.com/doodle.png').pipe(resp)
- }
- }
-})
-```
-
-You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do:
-
-```javascript
-http.createServer(function (req, resp) {
- if (req.url === '/doodle.png') {
- var x = request('http://mysite.com/doodle.png')
- req.pipe(x)
- x.pipe(resp)
- }
-})
-```
-
-And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :)
-
-```javascript
-req.pipe(request('http://mysite.com/doodle.png')).pipe(resp)
-```
-
-Also, none of this new functionality conflicts with requests previous features, it just expands them.
-
-```javascript
-var r = request.defaults({'proxy':'http://localproxy.com'})
-
-http.createServer(function (req, resp) {
- if (req.url === '/doodle.png') {
- r.get('http://google.com/doodle.png').pipe(resp)
- }
-})
-```
-
-You can still use intermediate proxies, the requests will still follow HTTP forwards, etc.
-
-### request(options, callback)
-
-The first argument can be either a url or an options object. The only required option is uri, all others are optional.
-
-* `uri` || `url` - fully qualified uri or a parsed url object from url.parse()
-* `method` - http method, defaults to GET
-* `headers` - http headers, defaults to {}
-* `body` - entity body for POST and PUT requests. Must be buffer or string.
-* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header.
-* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below.
-* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.
-* `maxRedirects` - the maximum number of redirects to follow, defaults to 10.
-* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end".
-* `encoding` - Encoding to be used on response.setEncoding when buffering the response data.
-* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.
-* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.
-* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request
-* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri.
-
-The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body buffer.
-
-## Convenience methods
-
-There are also shorthand methods for different HTTP METHODs and some other conveniences.
-
-### request.defaults(options)
-
-This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it.
-
-### request.put
-
-Same as request() but defaults to `method: "PUT"`.
-
-```javascript
-request.put(url)
-```
-
-### request.post
-
-Same as request() but defaults to `method: "POST"`.
-
-```javascript
-request.post(url)
-```
-
-### request.head
-
-Same as request() but defaults to `method: "HEAD"`.
-
-```javascript
-request.head(url)
-```
-
-### request.del
-
-Same as request() but defaults to `method: "DELETE"`.
-
-```javascript
-request.del(url)
-```
-
-### request.get
-
-Alias to normal request method for uniformity.
-
-```javascript
-request.get(url)
-```
-
-
-## Examples:
-
-```javascript
- var request = require('request')
- , rand = Math.floor(Math.random()*100000000).toString()
- ;
- request(
- { method: 'PUT'
- , uri: 'http://mikeal.couchone.com/testjs/' + rand
- , multipart:
- [ { 'content-type': 'application/json'
- , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})
- }
- , { body: 'I am an attachment' }
- ]
- }
- , function (error, response, body) {
- if(response.statusCode == 201){
- console.log('document saved as: http://mikeal.couchone.com/testjs/'+ rand)
- } else {
- console.log('error: '+ response.statusCode)
- console.log(body)
- }
- }
- )
-```
150 node_modules/nodester-api/node_modules/request/cookies.js
View
@@ -1,150 +0,0 @@
-
-var cookie_str_splitter=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g
-
-function stringify (cookie) {
- var str=[cookie.name+"="+cookie.value];
- if(cookie.expiration_date !== Infinity) {
- str.push("expires="+(new Date(cookie.expiration_date)).toGMTString());
- }
- if(cookie.domain) {
- str.push("domain="+cookie.domain);
- }
- if(cookie.path) {
- str.push("path="+cookie.path);
- }
- if(cookie.secure) {
- str.push("secure");
- }
- if(cookie.noscript) {
- str.push("httponly");
- }
- return str.join("; ");
-}
-
-function Jar () {
- this.cookies = []
-}
-Jar.prototype.setCookies = function (cookieString) {
-
-}
-Jar.prototype.getHeader = function (host, path) {
-
-}
-Jar.prototype.getCookies = function (access_info) {
- var matches=[];
- for(var cookie_name in cookies) {
- var cookie=this.getCookie(cookie_name,access_info);
- if (cookie) {
- matches.push(cookie);
- }
- }
- matches.toString=function toString(){return matches.join(":");}
- return matches;
-}
-
-Jar.prototype.getCookie = function (host, path) {
- var cookies_list = self.cookies[cookie_name];
- for(var i=0;i<cookies_list.length;i++) {
- var cookie = cookies_list[i];
- if(cookie.expiration_date <= Date.now()) {
- if(cookies_list.length===0) {
- delete cookies[cookie.name]
- }
- continue;
- }
- if(cookie.matches(access_info)) {
- return cookie;
- }
- }
-}
-Jar.prototype.setCookie = function (){}
-Jar.prototype.parseCookie = function (str) {
- var cookies = str.split(cookie_str_splitter)
- , successful = []
- , self = this
- ;
- cookies.forEach(function (cookie) {
- self.parseCookie(cookie);
- })
-}
-
-Jar.prototype.parseCookie = function (str) {
- var parts = str.split(";")
- , pai r= parts[0].match(/([^=]+)=((?:.|\n)*)/)
- , key = pair[1]
- , value = pair[2]
- , cookie =
- { name: null
- , value: value
- , expiration_date: = Infinity
- , path: '/'
- , domain: null
- , secure: false
- , noscript: false
- }
- ;
-
- cookie.name = key;
- cookie.value = value;
-
- for(var i=1;i<parts.length;i++) {
- var pair = parts[i].match(/([^=]+)=((?:.|\n)*)/)
- , key = pair[1].trim().toLowerCase()
- , value = pair[2]
- ;
- switch(key) {
- case "httponly":
- cookie.noscript = true;
- break;
- case "expires":
- cookie.expiration_date = value
- ? Number(Date.parse(value))
- : Infinity;
- break;
- case "path":
- cookie.path = value
- ? value.trim()
- : "";
- break;
- case "domain":
- cookie.domain = value
- ? value.trim()
- : "";
- break;
- case "secure":
- cookie.secure = true;
- break
- }
- }
-
- if(cookie.name in this.cookies) {
- var cookies_list = this.cookies[cookie.name];
- for(var i=0;i<this.cookies_list.length;i++) {
- var collidable_cookie = cookies_list[i];
- if(collidable_cookie.collidesWith(cookie)) {
- if(remove) {
- cookies_list.splice(i,1);
- if(cookies_list.length===0) {
- delete this.cookies[cookie.name]
- }
- return false;
- }
- else {
- return cookies_list[i]=cookie;
- }
- }
- }
- if(remove) {
- return false;
- }
- cookies_list.push(cookie);
- return cookie;
- }
- else if(remove){
- return false;
- }
- else {
- return this.cookies[cookie.name]=[cookie];
- }
-
-}
447 node_modules/nodester-api/node_modules/request/main.js
View
@@ -1,447 +0,0 @@
-// Copyright 2010-2011 Mikeal Rogers
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-var http = require('http')
- , https = false
- , tls = false
- , url = require('url')
- , util = require('util')
- , stream = require('stream')
- , qs = require('querystring')
- , mimetypes = require('./mimetypes')
- ;
-
-try {
- https = require('https')
-} catch (e) {}
-
-try {
- tls = require('tls')
-} catch (e) {}
-
-function toBase64 (str) {
- return (new Buffer(str || "", "ascii")).toString("base64")
-}
-
-// Hacky fix for pre-0.4.4 https
-if (https && !https.Agent) {
- https.Agent = function (options) {
- http.Agent.call(this, options)
- }
- util.inherits(https.Agent, http.Agent)
- https.Agent.prototype._getConnection = function(host, port, cb) {
- var s = tls.connect(port, host, this.options, function() {
- // do other checks here?
- if (cb) cb()
- })
- return s
- }
-}
-
-function isReadStream (rs) {
- if (rs.readable && rs.path && rs.mode) {
- return true
- }
-}
-
-function copy (obj) {
- var o = {}
- for (i in obj) o[i] = obj[i]
- return o
-}
-
-var isUrl = /^https?:/
-
-var globalPool = {}
-
-function Request (options) {
- stream.Stream.call(this)
- this.readable = true
- this.writable = true
-
- if (typeof options === 'string') {
- options = {uri:options}
- }
-
- for (i in options) {
- this[i] = options[i]
- }
- if (!this.pool) this.pool = globalPool
- this.dests = []
- this.__isRequestRequest = true
-}
-util.inherits(Request, stream.Stream)
-Request.prototype.getAgent = function (host, port) {
- if (!this.pool[host+':'+port]) {
- this.pool[host+':'+port] = new this.httpModule.Agent({host:host, port:port})
- }
- return this.pool[host+':'+port]
-}
-Request.prototype.request = function () {
- var options = this
- if (options.url) {
- // People use this property instead all the time so why not just support it.
- options.uri = options.url
- delete options.url
- }
-
- if (!options.uri) {
- throw new Error("options.uri is a required argument")
- } else {
- if (typeof options.uri == "string") options.uri = url.parse(options.uri)
- }
- if (options.proxy) {
- if (typeof options.proxy == 'string') options.proxy = url.parse(options.proxy)
- }
-
- options._redirectsFollowed = options._redirectsFollowed || 0
- options.maxRedirects = (options.maxRedirects !== undefined) ? options.maxRedirects : 10
- options.followRedirect = (options.followRedirect !== undefined) ? options.followRedirect : true
-
- options.headers = options.headers ? copy(options.headers) : {}
-
- var setHost = false
- if (!options.headers.host) {
- options.headers.host = options.uri.hostname
- if (options.uri.port) {
- if ( !(options.uri.port === 80 && options.uri.protocol === 'http:') &&
- !(options.uri.port === 443 && options.uri.protocol === 'https:') )
- options.headers.host += (':'+options.uri.port)
- }
- setHost = true
- }
-
- if (!options.uri.pathname) {options.uri.pathname = '/'}
- if (!options.uri.port) {
- if (options.uri.protocol == 'http:') {options.uri.port = 80}
- else if (options.uri.protocol == 'https:') {options.uri.port = 443}
- }
-
- if (options.bodyStream || options.responseBodyStream) {
- console.error('options.bodyStream and options.responseBodyStream is deprecated. You should now send the request object to stream.pipe()')
- this.pipe(options.responseBodyStream || options.bodyStream)
- }
-
- if (options.proxy) {
- options.port = options.proxy.port
- options.host = options.proxy.hostname
- } else {
- options.port = options.uri.port
- options.host = options.uri.hostname
- }
-
- if (options.onResponse === true) {
- options.onResponse = options.callback
- delete options.callback
- }
-
- var clientErrorHandler = function (error) {
- if (setHost) delete options.headers.host
- options.emit('error', error)
- }
- if (options.onResponse) options.on('error', function (e) {options.onResponse(e)})
- if (options.callback) options.on('error', function (e) {options.callback(e)})
-
-
- if (options.uri.auth && !options.headers.authorization) {
- options.headers.authorization = "Basic " + toBase64(options.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
- }
- if (options.proxy && options.proxy.auth && !options.headers['proxy-authorization']) {
- options.headers.authorization = "Basic " + toBase64(options.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':'))
- }
-
- options.path = options.uri.href.replace(options.uri.protocol + '//' + options.uri.host, '')
- if (options.path.length === 0) options.path = '/'
-
- if (options.proxy) options.path = (options.uri.protocol + '//' + options.uri.host + options.path)
-
- if (options.json) {
- options.headers['content-type'] = 'application/json'
- if (typeof options.json === 'boolean') {
- if (typeof options.body === 'object') options.body = JSON.stringify(options.body)
- } else {
- options.body = JSON.stringify(options.json)
- }
-
- } else if (options.multipart) {
- options.body = ''
- options.headers['content-type'] = 'multipart/related;boundary="frontier"'
- if (!options.multipart.forEach) throw new Error('Argument error, options.multipart.')
-
- options.multipart.forEach(function (part) {
- var body = part.body
- if(!body) throw Error('Body attribute missing in multipart.')
- delete part.body
- options.body += '--frontier\r\n'
- Object.keys(part).forEach(function(key){
- options.body += key + ': ' + part[key] + '\r\n'
- })
- options.body += '\r\n' + body + '\r\n'
- })
- options.body += '--frontier--'
- }
-
- if (options.body) {
- if (!Buffer.isBuffer(options.body)) {
- options.body = new Buffer(options.body)
- }
- if (options.body.length) {
- options.headers['content-length'] = options.body.length
- } else {
- throw new Error('Argument error, options.body.')
- }
- }
-
- options.httpModule =
- {"http:":http, "https:":https}[options.proxy ? options.proxy.protocol : options.uri.protocol]
-
- if (!options.httpModule) throw new Error("Invalid protocol")
-
- if (options.pool === false) {
- options.agent = false
- } else {
- if (options.maxSockets) {
- // Don't use our pooling if node has the refactored client
- options.agent = options.httpModule.globalAgent || options.getAgent(options.host, options.port)
- options.agent.maxSockets = options.maxSockets
- }
- if (options.pool.maxSockets) {
- // Don't use our pooling if node has the refactored client
- options.agent = options.httpModule.globalAgent || options.getAgent(options.host, options.port)
- options.agent.maxSockets = options.pool.maxSockets
- }
- }
-
- options.start = function () {
- options._started = true
- options.method = options.method || 'GET'
-
- options.req = options.httpModule.request(options, function (response) {
- options.response = response
- response.request = options
- if (setHost) delete options.headers.host
- if (options.timeout && options.timeoutTimer) clearTimeout(options.timeoutTimer)
-
- if (response.statusCode >= 300 &&
- response.statusCode < 400 &&
- options.followRedirect &&
- options.method !== 'PUT' &&
- options.method !== 'POST' &&
- response.headers.location) {
- if (options._redirectsFollowed >= options.maxRedirects) {
- options.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop."))
- return
- }
- options._redirectsFollowed += 1
-
- if (!isUrl.test(response.headers.location)) {
- response.headers.location = url.resolve(options.uri.href, response.headers.location)
- }
- options.uri = response.headers.location
- delete options.req
- delete options.agent
- delete options._started
- if (options.headers) {
- delete options.headers.host
- }
- request(options, options.callback)
- return // Ignore the rest of the response
- } else {
- options._redirectsFollowed = 0
- // Be a good stream and emit end when the response is finished.
- // Hack to emit end on close because of a core bug that never fires end
- response.on('close', function () {
- if (!options._ended) options.response.emit('end')
- })
-
- if (options.encoding) {
- if (options.dests.length !== 0) {
- console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.")
- } else {
- response.setEncoding(options.encoding)
- }
- }
-
- options.dests.forEach(function (dest) {
- if (dest.headers) {
- dest.headers['content-type'] = response.headers['content-type']
- if (response.headers['content-length']) {
- dest.headers['content-length'] = response.headers['content-length']
- }
- }
- if (dest.setHeader) {
- for (i in response.headers) {
- dest.setHeader(i, response.headers[i])
- }
- dest.statusCode = response.statusCode
- }
- if (options.pipefilter) options.pipefilter(response, dest)
- })
-
- response.on("data", function (chunk) {options.emit("data", chunk)})
- response.on("end", function (chunk) {
- options._ended = true
- options.emit("end", chunk)
- })
- response.on("close", function () {options.emit("close")})
-
- if (options.onResponse) {
- options.onResponse(null, response)
- }
- if (options.callback) {
- var buffer = ''
- options.on("data", function (chunk) {
- buffer += chunk
- })
- options.on("end", function () {
- response.body = buffer
- if (options.json) {
- try {
- response.body = JSON.parse(response.body)
- } catch (e) {}
- }
- options.callback(null, response, response.body)
- })
- }
- }
- })
-
- if (options.timeout) {
- options.timeoutTimer = setTimeout(function() {
- options.req.abort()
- var e = new Error("ETIMEDOUT")
- e.code = "ETIMEDOUT"
- options.emit("error", e)
- }, options.timeout)
- }
-
- options.req.on('error', clientErrorHandler)
- }
-
- options.once('pipe', function (src) {
- if (options.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.")
- options.src = src
- if (isReadStream(src)) {
- if (!options.headers['content-type'] && !options.headers['Content-Type'])
- options.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1))
- } else {
- if (src.headers) {
- for (i in src.headers) {
- if (!options.headers[i]) {
- options.headers[i] = src.headers[i]
- }
- }
- }
- if (src.method && !options.method) {
- options.method = src.method
- }
- }
-
- options.on('pipe', function () {
- console.error("You have already piped to this stream. Pipeing twice is likely to break the request.")
- })
- })
-
- process.nextTick(function () {
- if (options.body) {
- options.write(options.body)
- options.end()
- } else if (options.requestBodyStream) {
- console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.")
- options.requestBodyStream.pipe(options)
- } else if (!options.src) {
- options.end()
- }
- options.ntick = true
- })
-}
-Request.prototype.pipe = function (dest) {
- if (this.response) throw new Error("You cannot pipe after the response event.")
- this.dests.push(dest)
- stream.Stream.prototype.pipe.call(this, dest)
- return dest
-}
-Request.prototype.write = function () {
- if (!this._started) this.start()
- if (!this.req) throw new Error("This request has been piped before http.request() was called.")
- this.req.write.apply(this.req, arguments)
-}
-Request.prototype.end = function () {
- if (!this._started) this.start()
- if (!this.req) throw new Error("This request has been piped before http.request() was called.")
- this.req.end.apply(this.req, arguments)
-}
-Request.prototype.pause = function () {
- if (!this.response) throw new Error("This request has been piped before http.request() was called.")
- this.response.pause.apply(this.response, arguments)
-}
-Request.prototype.resume = function () {
- if (!this.response) throw new Error("This request has been piped before http.request() was called.")
- this.response.resume.apply(this.response, arguments)
-}
-
-function request (options, callback) {
- if (typeof options === 'string') options = {uri:options}
- if (callback) options.callback = callback
- var r = new Request(options)
- r.request()
- return r
-}
-
-module.exports = request
-
-request.defaults = function (options) {
- var def = function (method) {
- var d = function (opts, callback) {
- if (typeof opts === 'string') opts = {uri:opts}
- for (i in options) {
- if (opts[i] === undefined) opts[i] = options[i]
- }
- return method(opts, callback)
- }
- return d
- }
- de = def(request)
- de.get = def(request.get)
- de.post = def(request.post)
- de.put = def(request.put)
- de.head = def(request.head)
- de.del = def(request.del)
- return de
-}
-
-request.get = request
-request.post = function (options, callback) {
- if (typeof options === 'string') options = {uri:options}
- options.method = 'POST'
- return request(options, callback)
-}
-request.put = function (options, callback) {
- if (typeof options === 'string') options = {uri:options}
- options.method = 'PUT'
- return request(options, callback)
-}
-request.head = function (options, callback) {
- if (typeof options === 'string') options = {uri:options}
- options.method = 'HEAD'
- if (options.body || options.requestBodyStream || options.json || options.multipart) {
- throw new Error("HTTP HEAD requests MUST NOT include a request body.")
- }
- return request(options, callback)
-}
-request.del = function (options, callback) {
- if (typeof options === 'string') options = {uri:options}
- options.method = 'DELETE'
- return request(options, callback)
-}
146 node_modules/nodester-api/node_modules/request/mimetypes.js
View
@@ -1,146 +0,0 @@
-// from http://github.com/felixge/node-paperboy
-exports.types = {
- "aiff":"audio/x-aiff",
- "arj":"application/x-arj-compressed",
- "asf":"video/x-ms-asf",
- "asx":"video/x-ms-asx",
- "au":"audio/ulaw",
- "avi":"video/x-msvideo",
- "bcpio":"application/x-bcpio",
- "ccad":"application/clariscad",
- "cod":"application/vnd.rim.cod",
- "com":"application/x-msdos-program",
- "cpio":"application/x-cpio",
- "cpt":"application/mac-compactpro",
- "csh":"application/x-csh",
- "css":"text/css",
- "deb":"application/x-debian-package",
- "dl":"video/dl",
- "doc":"application/msword",
- "drw":"application/drafting",
- "dvi":"application/x-dvi",
- "dwg":"application/acad",
- "dxf":"application/dxf",
- "dxr":"application/x-director",
- "etx":"text/x-setext",
- "ez":"application/andrew-inset",
- "fli":"video/x-fli",
- "flv":"video/x-flv",
- "gif":"image/gif",
- "gl":"video/gl",
- "gtar":"application/x-gtar",
- "gz":"application/x-gzip",
- "hdf":"application/x-hdf",
- "hqx":"application/mac-binhex40",
- "html":"text/html",
- "ice":"x-conference/x-cooltalk",
- "ico":"image/x-icon",
- "ief":"image/ief",
- "igs":"model/iges",
- "ips":"application/x-ipscript",
- "ipx":"application/x-ipix",
- "jad":"text/vnd.sun.j2me.app-descriptor",
- "jar":"application/java-archive",
- "jpeg":"image/jpeg",
- "jpg":"image/jpeg",
- "js":"text/javascript",
- "json":"application/json",
- "latex":"application/x-latex",
- "lsp":"application/x-lisp",
- "lzh":"application/octet-stream",
- "m":"text/plain",
- "m3u":"audio/x-mpegurl",
- "man":"application/x-troff-man",
- "me":"application/x-troff-me",
- "midi":"audio/midi",
- "mif":"application/x-mif",
- "mime":"www/mime",
- "movie":"video/x-sgi-movie",
- "mustache":"text/plain",
- "mp4":"video/mp4",
- "mpg":"video/mpeg",
- "mpga":"audio/mpeg",
- "ms":"application/x-troff-ms",
- "nc":"application/x-netcdf",
- "oda":"application/oda",
- "ogm":"application/ogg",
- "pbm":"image/x-portable-bitmap",
- "pdf":"application/pdf",
- "pgm":"image/x-portable-graymap",
- "pgn":"application/x-chess-pgn",
- "pgp":"application/pgp",
- "pm":"application/x-perl",
- "png":"image/png",
- "pnm":"image/x-portable-anymap",
- "ppm":"image/x-portable-pixmap",
- "ppz":"application/vnd.ms-powerpoint",
- "pre":"application/x-freelance",
- "prt":"application/pro_eng",
- "ps":"application/postscript",
- "qt":"video/quicktime",
- "ra":"audio/x-realaudio",
- "rar":"application/x-rar-compressed",
- "ras":"image/x-cmu-raster",
- "rgb":"image/x-rgb",
- "rm":"audio/x-pn-realaudio",
- "rpm":"audio/x-pn-realaudio-plugin",
- "rtf":"text/rtf",
- "rtx":"text/richtext",
- "scm":"application/x-lotusscreencam",
- "set":"application/set",
- "sgml":"text/sgml",
- "sh":"application/x-sh",
- "shar":"application/x-shar",
- "silo":"model/mesh",
- "sit":"application/x-stuffit",
- "skt":"application/x-koan",
- "smil":"application/smil",
- "snd":"audio/basic",
- "sol":"application/solids",
- "spl":"application/x-futuresplash",
- "src":"application/x-wais-source",
- "stl":"application/SLA",
- "stp":"application/STEP",
- "sv4cpio":"application/x-sv4cpio",
- "sv4crc":"application/x-sv4crc",
- "svg":"image/svg+xml",
- "swf":"application/x-shockwave-flash",
- "tar":"application/x-tar",
- "tcl":"application/x-tcl",
- "tex":"application/x-tex",
- "texinfo":"application/x-texinfo",
- "tgz":"application/x-tar-gz",
- "tiff":"image/tiff",
- "tr":"application/x-troff",
- "tsi":"audio/TSP-audio",
- "tsp":"application/dsptype",
- "tsv":"text/tab-separated-values",
- "unv":"application/i-deas",
- "ustar":"application/x-ustar",
- "vcd":"application/x-cdlink",
- "vda":"application/vda",
- "vivo":"video/vnd.vivo",
- "vrm":"x-world/x-vrml",
- "wav":"audio/x-wav",
- "wax":"audio/x-ms-wax",
- "wma":"audio/x-ms-wma",
- "wmv":"video/x-ms-wmv",
- "wmx":"video/x-ms-wmx",
- "wrl":"model/vrml",
- "wvx":"video/x-ms-wvx",
- "xbm":"image/x-xbitmap",
- "xlw":"application/vnd.ms-excel",
- "xml":"text/xml",
- "xpm":"image/x-xpixmap",
- "xwd":"image/x-xwindowdump",
- "xyz":"chemical/x-pdb",
- "zip":"application/zip",
-};
-
-exports.lookup = function(ext, defaultType) {
- defaultType = defaultType || 'application/octet-stream';
-
- return (ext in exports.types)
- ? exports.types[ext]
- : defaultType;
-};
14 node_modules/nodester-api/node_modules/request/package.json
View
@@ -1,14 +0,0 @@
-{ "name" : "request"
-, "description" : "Simplified HTTP request client."
-, "tags" : ["http", "simple", "util", "utility"]
-, "version" : "2.1.1"
-, "author" : "Mikeal Rogers <mikeal.rogers@gmail.com>"
-, "repository" :
- { "type" : "git"
- , "url" : "http://github.com/mikeal/request.git"
- }
-, "bugs" :
- { "web" : "http://github.com/mikeal/request/issues" }
-, "engines" : ["node >= 0.3.6"]
-, "main" : "./main"
-}
0  node_modules/nodester-api/node_modules/request/test.js
View
No changes.
BIN  node_modules/nodester-api/node_modules/request/tests/googledoodle.png
View
Deleted file not rendered
46 node_modules/nodester-api/node_modules/request/tests/server.js
View
@@ -1,46 +0,0 @@
-var http = require('http')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- ;
-
-exports.createServer = function (port) {
- port = port || 6767
- var s = http.createServer(function (req, resp) {
- s.emit(req.url, req, resp);
- })
- s.listen(port)
- s.url = 'http://localhost:'+port
- return s;
-}
-
-exports.createPostStream = function (text) {
- var postStream = new stream.Stream();
- postStream.writeable = true;
- postStream.readable = true;
- setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0);
- return postStream;
-}
-exports.createPostValidator = function (text) {
- var l = function (req, resp) {
- var r = '';
- req.on('data', function (chunk) {r += chunk})
- req.on('end', function () {
- if (r !== text) console.log(r, text);
- assert.equal(r, text)
- resp.writeHead(200, {'content-type':'text/plain'})
- resp.write('OK')
- resp.end()
- })
- }
- return l;
-}
-exports.createGetResponse = function (text, contentType) {
- var l = function (req, resp) {
- contentType = contentType || 'text/plain'
- resp.writeHead(200, {'content-type':contentType})
- resp.write(text)
- resp.end()
- }
- return l;
-}
78 node_modules/nodester-api/node_modules/request/tests/test-body.js
View
@@ -1,78 +0,0 @@
-var server = require('./server')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- , request = require('../main.js')
- ;
-
-var s = server.createServer();
-
-var tests =
- { testGet :
- { resp : server.createGetResponse("TESTING!")
- , expectBody: "TESTING!"
- }
- , testGetJSON :
- { resp : server.createGetResponse('{"test":true}', 'application/json')
- , json : true
- , expectBody: {"test":true}
- }
- , testPutString :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : "PUTTINGDATA"
- }
- , testPutBuffer :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , body : new Buffer("PUTTINGDATA")
- }
- , testPutStream :
- { resp : server.createPostValidator("PUTTINGDATA")
- , method : "PUT"
- , requestBodyStream : server.createPostStream("PUTTINGDATA")
- }
- , testPutJSON :
- { resp : server.createPostValidator(JSON.stringify({foo: 'bar'}))
- , method: "PUT"
- , json: {foo: 'bar'}
- }
- , testPutMultipart :
- { resp: server.createPostValidator(
- '--frontier\r\n' +
- 'content-type: text/html\r\n' +
- '\r\n' +
- '<html><body>Oh hi.</body></html>' +
- '\r\n--frontier\r\n\r\n' +
- 'Oh hi.' +
- '\r\n--frontier--'
- )
- , method: "PUT"
- , multipart:
- [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
- , {'body': 'Oh hi.'}
- ]
- }
- }
-
-var counter = 0;
-
-for (i in tests) {
- (function () {
- var test = tests[i];
- s.on('/'+i, test.resp);
- test.uri = s.url + '/' + i;
- request(test, function (err, resp, body) {
- if (err) throw err;
- if (test.expectBody) {
- assert.deepEqual(test.expectBody, body)
- }
- counter = counter - 1;
- if (counter === 0) {
- console.log(Object.keys(tests).length+" tests passed.")
- s.close();
- }
- })
- counter++;
- })()
-}
0  node_modules/nodester-api/node_modules/request/tests/test-cookies.js
View
No changes.
30 node_modules/nodester-api/node_modules/request/tests/test-errors.js
View
@@ -1,30 +0,0 @@
-var server = require('./server')
- , events = require('events')
- , assert = require('assert')
- , request = require('../main.js')
- ;
-
-var local = 'http://localhost:8888/asdf'
-
-try {
- request({uri:local, body:{}})
- assert.fail("Should have throw")
-} catch(e) {
- assert.equal(e.message, 'Argument error, options.body.')
-}
-
-try {
- request({uri:local, multipart: 'foo'})
- assert.fail("Should have throw")
-} catch(e) {
- assert.equal(e.message, 'Argument error, options.multipart.')
-}
-
-try {
- request({uri:local, multipart: [{}]})
- assert.fail("Should have throw")
-} catch(e) {
- assert.equal(e.message, 'Body attribute missing in multipart.')
-}
-
-console.log("All tests passed.")
136 node_modules/nodester-api/node_modules/request/tests/test-pipes.js
View
@@ -1,136 +0,0 @@
-var server = require('./server')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- , fs = require('fs')
- , request = require('../main.js')
- , path = require('path')
- ;
-
-var s = server.createServer(3453);
-
-passes = 0;
-
-var check = function () {
- if (passes === 7) {
- console.log('All tests passed.')
- setTimeout(function () {
- process.exit();
- }, 500)
- }
- if (passes > 7) throw new Error('Need to update for more failures')
-}
-
-// Test pipeing to a request object
-s.once('/push', server.createPostValidator("mydata"));
-
-var mydata = new stream.Stream();
-mydata.readable = true
-
-var r1 = request.put({url:'http://localhost:3453/push'}, function () {
- passes += 1;
- check();
-})
-mydata.pipe(r1)
-
-mydata.emit('data', 'mydata');
-mydata.emit('end');
-
-
-// Test pipeing from a request object.
-s.once('/pull', server.createGetResponse("mypulldata"));
-
-var mypulldata = new stream.Stream();
-mypulldata.writable = true
-
-request({url:'http://localhost:3453/pull'}).pipe(mypulldata)
-
-var d = '';
-
-mypulldata.write = function (chunk) {
- d += chunk;
-}
-mypulldata.end = function () {
- assert.equal(d, 'mypulldata');
- passes += 1
- check();
-};
-
-
-s.on('/cat', function (req, resp) {
- if (req.method === "GET") {
- resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4});
- resp.end('asdf')
- } else if (req.method === "PUT") {
- assert.equal(req.headers['content-type'], 'text/plain-test');
- assert.equal(req.headers['content-length'], 4)
- var validate = '';
-
- req.on('data', function (chunk) {validate += chunk})
- req.on('end', function () {
- resp.writeHead(201);
- resp.end();
- assert.equal(validate, 'asdf');
- passes += 1;
- check();
- })
- }
-})
-s.on('/pushjs', function (req, resp) {
- if (req.method === "PUT") {
- assert.equal(req.headers['content-type'], 'text/javascript');
- passes += 1;
- check();
- }
-})
-s.on('/catresp', function (req, resp) {
- request.get('http://localhost:3453/cat').pipe(resp)
-})
-s.on('/doodle', function (req, resp) {
- if (req.headers['x-oneline-proxy']) {
- resp.setHeader('x-oneline-proxy', 'yup')
- }
- resp.writeHead('200', {'content-type':'image/png'})
- fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp)
-})
-s.on('/onelineproxy', function (req, resp) {
- var x = request('http://localhost:3453/doodle')
- req.pipe(x)
- x.pipe(resp)
-})
-
-
-fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs'))
-
-request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat'))
-
-request.get('http://localhost:3453/catresp', function (e, resp, body) {
- assert.equal(resp.headers['content-type'], 'text/plain-test');
- assert.equal(resp.headers['content-length'], 4)
- passes += 1
- check();
-})
-
-var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png'))
-
-request.get('http://localhost:3453/doodle').pipe(doodleWrite)
-
-doodleWrite.on('close', function () {
- assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png')))
- passes += 1
- check()
-})
-
-process.on('exit', function () {
- fs.unlinkSync(path.join(__dirname, 'test.png'))
-})
-
-request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) {
- assert.equal(resp.headers['x-oneline-proxy'], 'yup')
- passes += 1
- check()
-})
-
-
-
-
18 node_modules/nodester-api/node_modules/request/tests/test-put.js
View
@@ -1,18 +0,0 @@
-// var http = require('http')
-// , request = require('../main')
-// ;
-//
-// var s = http.createServer(function (req, resp) {
-// resp.statusCode = 412
-// resp.end('hello')
-// })
-// s.listen(8000)
-//
-// request.put("http://localhost:8000", function (e,_,b){
-// console.log(e,b)
-// s.close()
-// })
-
-require('../main').put("http://testnano.iriscouch.com:80/test", function (e,_,b){
- console.log(e,b)
-})
7 node_modules/nodester-api/node_modules/request/tests/test-ssl.js
View
@@ -1,7 +0,0 @@
-var request = require("../main");
-
-request({'uri': 'https://encrypted.google.com/'}, function (err, res, body) {
- // util.debug(err);
- // console.dir(res)
- console.log('asdf')
-});
84 node_modules/nodester-api/node_modules/request/tests/test-timeout.js
View
@@ -1,84 +0,0 @@
-var server = require('./server')
- , events = require('events')
- , stream = require('stream')
- , assert = require('assert')
- , request = require('../main.js')
- ;
-
-var s = server.createServer();
-var expectedBody = "waited";
-var remainingTests = 5;
-
-// Request that waits for 200ms
-s.on('/timeout', function (req, resp) {
- setTimeout(function(){
- resp.writeHead(200, {'content-type':'text/plain'})
- resp.write(expectedBody)
- resp.end()
- }, 200);
-});
-
-// Scenario that should timeout
-var shouldTimeout = {
- url: s.url + "/timeout",
- timeout:100
-}
-
-request(shouldTimeout, function (err, resp, body) {
- assert.equal(err, "ETIMEDOUT");
- checkDone();
-})
-
-
-// Scenario that shouldn't timeout
-var shouldntTimeout = {
- url: s.url + "/timeout",
- timeout:300
-}
-
-request(shouldntTimeout, function (err, resp, body) {
- assert.equal(!err);
- assert.equal(expectedBody, body)
- checkDone();
-})
-
-// Scenario with no timeout set, so shouldn't timeout
-var noTimeout = {
- url: s.url + "/timeout"
-}
-
-request(noTimeout, function (err, resp, body) {
- assert.equal(!err);
- assert.equal(expectedBody, body)
- checkDone();
-})
-
-// Scenario with a negative timeout value, should be treated a zero or the minimum delay
-var negativeTimeout = {
- url: s.url + "/timeout",
- timeout:-1000
-}
-
-request(negativeTimeout, function (err, resp, body) {
- assert.equal(err, "ETIMEDOUT");
- checkDone();
-})
-
-// Scenario with a float timeout value, should be rounded by setTimeout anyway
-var floatTimeout = {
- url: s.url + "/timeout",
- timeout: 100.76
-}
-
-request(floatTimeout, function (err, resp, body) {
- assert.equal(err, "ETIMEDOUT");
- checkDone();
-})
-
-function checkDone() {
- if(--remainingTests == 0) {
- s.close();
- console.log("All tests passed.");
- }
-}
-
184 node_modules/nodester-api/nodester.js
View
@@ -1,184 +0,0 @@
-var request = require('request');
-var querystring = require('querystring');
-var fs = require('fs');
-var sys = require('sys');
-
-var headers = {'Content-Type': 'application/x-www-form-urlencoded'};
-var nodester = function (username, password, basehost, secure) {
- if (typeof basehost != 'undefined') this.basehost = basehost;
- else this.basehost = 'api.nodester.com';
- if (typeof secure != 'undefined' && secure == true) this.proto = 'https://';
- else this.proto = 'http://';
- this.username = username;
- this.password = password;
- if (typeof this.username != 'undefined' && typeof this.password != 'undefined' && this.username.length > 0 && this.password.length > 0) {
- var userbits = this.username + ":" + this.password + "@";
- } else {
- var userbits = "";
- }
- this.baseurl = this.proto + userbits + this.basehost + "/";
-};
-
-function process_response(cb, errfn) {
- return function(err, response, body) {
- var errCode = null;
- if (!err && response && response.statusCode >= 400) {
- errCode = response.statusCode;
- }
- var data = {};
- try {
- data = JSON.parse(body);
- } catch (e) {
- if (!err) err = { message: body };
- data = body;
- }
- if (errfn) {
- if (!err) err = errfn(data);
- } else {
- if (!err && data.status && !/^success/.exec(data.status)) err = { message: data.status }
- }
- if (errCode) {
- if (err) { err.code = errCode; err.message = '[HTTP ' + errCode + '] ' + err.message; }
- else err = { code: errCode, message: "HTTP Error " + errCode };
- }
- cb(err, data);
- }
-}
-
-nodester.prototype.request = function(method, path, body, cb) {
- request({
- uri: this.baseurl + path,
- method: method,
- body: querystring.stringify(body),
- headers: headers,
- proxy: process.env.http_proxy
- },
- process_response(cb)
- );
-}
-
-nodester.prototype.get = function(path, cb) { this.request('GET', path, null, cb); }
-nodester.prototype.post = function(path, body, cb) { this.request('POST', path, body, cb); }
-nodester.prototype.put = function(path, body, cb) { this.request('PUT', path, body, cb); }
-nodester.prototype.del = function(path, body, cb) { this.request('DELETE', path, body, cb); }
-
-nodester.prototype.coupon_request = function (email, cb) {
- this.post('coupon', { email: email }, cb)
-}
-
-nodester.prototype.user_create = function (user, pass, email, rsakey, coupon, cb) {
- fs.readFile(rsakey, 'ascii', function(err, rsadata) {
- if (err) cb(err, null);
- if (rsadata.length < 40) {
- cb({ message: "Error: Invalid SSH key file." });
- } else {
- this.post('user', { user: user, password: pass, email: email, coupon: coupon, rsakey: rsadata }, cb);
- }
- }.bind(this));
-};
-
-nodester.prototype.user_delete = function (user, cb) {
- this.del('user', { user: user }, cb);
-};
-
-nodester.prototype.user_setpass = function (newpass, cb) {
- this.put('user', { password: newpass }, cb);
-};
-
-nodester.prototype.user_setkey = function (rsakey, cb) {
- this.put('user', { rsakey: rsakey }, cb);
-};
-
-nodester.prototype.apps_list = function (cb) {
- this.get('apps', cb);
-};
-
-nodester.prototype.app_create = function (name, start, cb) {
- this.post('app', { appname: name, start: start }, cb);
-};
-
-nodester.prototype.status = function (cb) {
- this.get('status', cb);
-};
-
-/*
-nodester.prototype.app_set_start = function (name, start, cb) {
-
-};
-*/
-
-nodester.prototype.app_running = function (name, running, cb) {
- this.put('app', { appname: name, running: running }, cb);
-};
-
-nodester.prototype.app_start = function (name, cb) {
- this.app_running(name, "true", cb);
-};
-
-nodester.prototype.app_restart = function (name, cb) {
- this.app_running(name, "restart", cb);
-};
-
-nodester.prototype.app_stop = function (name, cb) {
- this.app_running(name, "false", cb);
-};
-
-nodester.prototype.app_delete = function (name, cb) {
- this.del('app', { appname: name }, cb);
-};
-
-nodester.prototype.app_gitreset = function (name, cb) {
- this.del('gitreset', { appname: name }, cb);
-};
-
-nodester.prototype.app_info = function (name, cb) {
- this.get('app/' + name, cb);
-};
-
-nodester.prototype.app_logs = function (name, cb) {
- this.get('applogs/' + name, cb);
-};
-
-nodester.prototype.appnpm_handler = function (name, package, action, cb) {
- this.post('appnpm', { appname: name, package: package, action: action }, cb);
-};
-
-nodester.prototype.appnpm_install = function (name, package, cb) {
- this.appnpm_handler(name, package, "install", cb);
-};
-
-nodester.prototype.appnpm_list = function (name, cb) {
- this.appnpm_handler(name, "", "list", cb);
-};
-
-nodester.prototype.appnpm_update = function (name, package, cb) {
- this.appnpm_handler(name, package, "update", cb);
-};
-
-nodester.prototype.appnpm_uninstall = function (name, package, cb) {
- this.appnpm_handler(name, package, "uninstall", cb);
-};
-
-/*
-nodester.prototype.appdomain_handler = function (name, domain, action, cb) {
- this.post('appdomains', { appname: name, action: action, domain: domain }, cb);
-};
-nodester.prototype.appdomain_delete = function (name, domain, cb) {
- this.appdomain_handler(name, domain, "delete", cb);
-};
-*/
-
-nodester.prototype.appdomain_add = function (name, domain, cb) {
- this.post('appdomains', { appname: name, domain: domain }, cb);
-};
-
-nodester.prototype.appdomain_delete = function (name, domain, cb) {
- this.del('appdomains', { appname: name, domain: domain }, cb);
-};
-
-
-nodester.prototype.appdomains = function(cb) {
- this.get('appdomains', cb);
-};
-
-exports.nodester = nodester;
19 node_modules/nodester-api/package.json
View
@@ -1,19 +0,0 @@
-{
- "name": "nodester-api",
- "description": "A module to allow interaction with the http://nodester.com/ platform.",
- "version": "0.1.9",
- "homepage": "http://nodester.com/",
- "repository": "git://github.com/nodester/nodester-api.git",
- "author": "Daniel Bartlett <dan@f-box.org> (http://danb-uk.net/)",
- "contributors": [
- "Dav Glass <davglass@gmail.com> @davglass",
- "Chris Matthieu <chris@matthieu.us>"
- ],
- "engines": {
- "node": "*"
- },
- "dependencies" : {
- "request": ">=1.9.1"
- },
- "main": "./nodester.js"
-}
Please sign in to comment.
Something went wrong with that request. Please try again.