Commits

Damon Oehlman committed 29e3236

Update deps, regenerated docs

Comments (0)

Files changed (5)

 # node-manifest
 
 1. This has nothing to do with HTML5 cache-manifest / appcache
-2. This is designed to make downloading multiple files from a remote web location (using [getit](https://github.com/DamonOehlman/getit)) via a simple manifest file, really bloody simple.
+2. This is designed to make downloading multiple files from a remote
+   web location (using [getit](https://github.com/DamonOehlman/getit)) via
+   a simple manifest file, really bloody simple.
 
-## Installation
+
+[![NPM](https://nodei.co/npm/manifest.png)](https://nodei.co/npm/manifest/)
+
+[![Build Status](https://travis-ci.org/DamonOehlman/manifest.png?branch=master)](https://travis-ci.org/DamonOehlman/manifest)
+[![stable](http://hughsk.github.io/stability-badges/dist/stable.svg)](http://github.com/hughsk/stability-badges)
+
+## Example Usage
 
 ```
-npm install node-manifest
+ERROR: could not find: 
 ```
 
-## Example Usage
+More documentation to come, in the meantime have a look at the
+test directory.
 
-```js
-var manifest = require('manifest');
+## Reference
 
-// download files from test.com 
-// as specified in the manifest file "http://test.com/manifest"
-// to the current working directory
-manifest.download('http://test.com/', function(err) {
-    // it's done
-});
-```
+### load(target, opts?, callback)
+
+Load a manifest from the specified location.
+
+### download(target, opts?, callback)
+
+Download all the files specified in the manifest file from the specified
+location.
+
+## License(s)
+
+### MIT
+
+Copyright (c) 2013 Damon Oehlman <damon.oehlman@sidelab.com>
+
+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.
 
-More documentation to come, in the meantime have a look at the test directory.
+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.
+{
+  "badges": {
+    "nodeico": true,
+    "travis": true,
+    "stability": "stable"
+  },
+
+  "license": {}
+}

examples/simple.js

+  var manifest = require('..');
+
+  // download files from test.com 
+  // as specified in the manifest file "http://test.com/manifest"
+  // to the current working directory
+  manifest.download('http://test.com/', function(err) {
+      // it's done
+  });
-var async = require('async'),
-    debug = require('debug')('manifest'),
-    getit = require('getit'),
-    mkdirp = require('mkdirp'),
-    path = require('path'),
-    fs = require('fs'),
-    reTrailingSlash = /\/$/;
-    
-function load(target, opts, callback) {
-    var basePath = (target || '').replace(reTrailingSlash, ''),
-        manifestFile;
-    
-    // remap args if required
-    if (typeof opts == 'function') {
-        callback = opts;
-        opts = {};
-    }
-    
-    // ensure we have opts
-    opts = opts || {};
-    
-    // initialise the manifest file name
-    manifestFile = basePath + '/' + (opts.manifest || 'manifest');
-    
-    // get the manifest from the specified target path
-    debug('downloading manifest from: ' + manifestFile);
-    getit(manifestFile, opts, function(err, data) {
-        callback(err, (data || '').split('\n'), basePath);
-    });
-}
+/* jshint node: true */
+'use strict';
+
+var async = require('async');
+var debug = require('debug')('manifest');
+var getit = require('getit');
+var mkdirp = require('mkdirp');
+var path = require('path');
+var fs = require('fs');
+var reTrailingSlash = /\/$/;
+
+/**
+  # node-manifest
+
+  1. This has nothing to do with HTML5 cache-manifest / appcache
+  2. This is designed to make downloading multiple files from a remote
+     web location (using [getit](https://github.com/DamonOehlman/getit)) via
+     a simple manifest file, really bloody simple.
+
+  ## Example Usage
+
+  <<< examples/simple
 
+  More documentation to come, in the meantime have a look at the
+  test directory.
+
+  ## Reference
+**/
+
+/**
+  ### load(target, opts?, callback)
+
+  Load a manifest from the specified location.
+
+**/
+var load = exports.load = function(target, opts, callback) {
+  var basePath = (target || '').replace(reTrailingSlash, '');
+  var manifestFile;
+  
+  // remap args if required
+  if (typeof opts == 'function') {
+    callback = opts;
+    opts = {};
+  }
+  
+  // ensure we have opts
+  opts = opts || {};
+  
+  // initialise the manifest file name
+  manifestFile = basePath + '/' + (opts.manifest || 'manifest');
+  
+  // get the manifest from the specified target path
+  debug('downloading manifest from: ' + manifestFile);
+  getit(manifestFile, opts, function(err, data) {
+    callback(err, (data || '').split('\n'), basePath);
+  });
+};
+
+/**
+  ### download(target, opts?, callback)
+
+  Download all the files specified in the manifest file from the specified
+  location.
+  
+**/
 exports.download = function(target, opts, callback) {
-    // remap args if required
-    if (typeof opts == 'function') {
-        callback = opts;
-        opts = {};
+  // remap args if required
+  if (typeof opts == 'function') {
+    callback = opts;
+    opts = {};
+  }
+  
+  // initialise defaults
+  opts.path = opts.path || process.cwd();
+  
+  // load the manifest from the target location
+  load(target, opts, function(err, items, basePath) {
+    if (err) {
+      return callback(err);
     }
     
-    // initialise defaults
-    opts.path = opts.path || process.cwd();
-    
-    // load the manifest from the target location
-    load(target, opts, function(err, items, basePath) {
-        if (err) return callback(err);
-        
-        async.forEach(
-            items,
-            function(item, itemCallback) {
-                var targetFile = path.resolve(opts.path, item);
-
-                // ensure the directory for the file exists
-                mkdirp(path.dirname(targetFile), function(err) {
-                    if (err) return itemCallback(err);
-                    
-                    // download the file to the target
-                    getit(basePath + '/' + item, opts)
-                        .pipe(fs.createWriteStream(targetFile))
-                        .on('close', itemCallback);
-                });
-            },
-            callback
-        );
-    });
-};
+    async.forEach(
+      items,
+      function(item, itemCallback) {
+        var targetFile = path.resolve(opts.path, item);
 
-exports.load = load;
+        // ensure the directory for the file exists
+        mkdirp(path.dirname(targetFile), function(err) {
+          if (err) {
+            return itemCallback(err);
+          }
+          
+          // download the file to the target
+          getit(basePath + '/' + item, opts)
+            .pipe(fs.createWriteStream(targetFile))
+            .on('close', itemCallback);
+        });
+      },
+      callback
+    );
+  });
+};
   "author": "Damon Oehlman <damon.oehlman@sidelab.com>",
   "tags": [],
   "version": "0.1.0",
-  "engines": {
-    "node": ">= 0.4.x < 0.9.0"
-  },
   "dependencies": {
-    "async": "0.1.x",
+    "async": "~0.2.9",
     "debug": "*",
-    "getit": "0.2.x",
+    "getit": "~0.3.3",
     "mkdirp": "0.3.x"
   },
   "devDependencies": {
-    "mocha": "1.3.x",
+    "mocha": "1.12.x",
     "rimraf": "2.0.x"
   },
   "repository": {
     "url": "http://github.com/DamonOehlman/manifest/issues"
   },
   "scripts": {
-    "test": "./node_modules/.bin/mocha --reporter spec"
+    "test": "$(npm bin)/mocha --reporter spec",
+    "gendocs": "gendocs > README.md"
   },
   "contributors": [],
-  "optionalDependencies": {}
-}
+  "optionalDependencies": {},
+  "main": "index.js",
+  "directories": {
+    "example": "examples",
+    "test": "test"
+  },
+  "keywords": [
+    "manifest",
+    "download"
+  ],
+  "license": "MIT"
+}