manifest 0.1.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,39 +1,11 @@
1
1
  {
2
2
  "name": "manifest",
3
- "description": "Download all the things",
4
- "author": "Damon Oehlman <damon.oehlman@gmail.com>",
5
- "tags": [],
6
- "version": "0.1.4",
7
- "dependencies": {
8
- "async": "~0.9",
9
- "debug": "^1",
10
- "getit": "~0.4",
11
- "mkdirp": "~0.5"
12
- },
13
- "devDependencies": {
14
- "mocha": "^1",
15
- "rimraf": "^2"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git://github.com/DamonOehlman/manifest.git"
20
- },
21
- "bugs": {
22
- "url": "http://github.com/DamonOehlman/manifest/issues"
23
- },
24
- "scripts": {
25
- "test": "$(npm bin)/mocha --reporter spec",
26
- "gendocs": "gendocs > README.md"
27
- },
28
- "optionalDependencies": {},
3
+ "version": "2.0.0",
4
+ "description": "",
29
5
  "main": "index.js",
30
- "directories": {
31
- "example": "examples",
32
- "test": "test"
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
33
8
  },
34
- "keywords": [
35
- "manifest",
36
- "download"
37
- ],
38
- "license": "MIT"
39
- }
9
+ "author": "",
10
+ "license": "ISC"
11
+ }
package/readme.md ADDED
@@ -0,0 +1,3 @@
1
+ # Hello world
2
+
3
+ Thank you Damon :)
package/.npmignore DELETED
@@ -1,2 +0,0 @@
1
- .DS_Store
2
- node_modules
package/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: node_js
2
- node_js:
3
- - 0.6
4
- - 0.8
5
-
6
- notifications:
7
- email:
8
- - travis@sidelab.com
9
- irc: "irc.freenode.org#sidelab"
package/README.md DELETED
@@ -1,63 +0,0 @@
1
- # manifest
2
-
3
- 1. This has nothing to do with HTML5 cache-manifest / appcache
4
- 2. This is designed to make downloading multiple files from a remote
5
- web location (using [getit](https://github.com/DamonOehlman/getit)) via
6
- a simple manifest file, really bloody simple.
7
-
8
-
9
- [![NPM](https://nodei.co/npm/manifest.png)](https://nodei.co/npm/manifest/)
10
-
11
- [![Build Status](https://img.shields.io/travis/DamonOehlman/manifest.svg?branch=master)](https://travis-ci.org/DamonOehlman/manifest) [![stable](https://img.shields.io/badge/stability-stable-green.svg)](https://github.com/dominictarr/stability#stable) [![Dependency Status](https://david-dm.org/DamonOehlman/manifest.svg)](https://david-dm.org/DamonOehlman/manifest)
12
-
13
- ## Example Usage
14
-
15
- ```js
16
- var manifest = require('manifest');
17
-
18
- // download files from test.com
19
- // as specified in the manifest file "http://test.com/manifest"
20
- // to the current working directory
21
- manifest.download('http://test.com/', function(err) {
22
- // it's done
23
- });
24
- ```
25
-
26
- More documentation to come, in the meantime have a look at the
27
- test directory.
28
-
29
- ## Reference
30
-
31
- ### load(target, opts?, callback)
32
-
33
- Load a manifest from the specified location.
34
-
35
- ### download(target, opts?, callback)
36
-
37
- Download all the files specified in the manifest file from the specified
38
- location.
39
-
40
- ## License(s)
41
-
42
- ### MIT
43
-
44
- Copyright (c) 2014 Damon Oehlman <damon.oehlman@gmail.com>
45
-
46
- Permission is hereby granted, free of charge, to any person obtaining
47
- a copy of this software and associated documentation files (the
48
- 'Software'), to deal in the Software without restriction, including
49
- without limitation the rights to use, copy, modify, merge, publish,
50
- distribute, sublicense, and/or sell copies of the Software, and to
51
- permit persons to whom the Software is furnished to do so, subject to
52
- the following conditions:
53
-
54
- The above copyright notice and this permission notice shall be
55
- included in all copies or substantial portions of the Software.
56
-
57
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
58
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
59
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
60
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
61
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
62
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
63
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/docs.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "badges": {
3
- "nodeico": true,
4
- "travis": true,
5
- "stability": "stable",
6
- "david": true
7
- },
8
-
9
- "license": {}
10
- }
@@ -1,8 +0,0 @@
1
- var manifest = require('..');
2
-
3
- // download files from test.com
4
- // as specified in the manifest file "http://test.com/manifest"
5
- // to the current working directory
6
- manifest.download('http://test.com/', function(err) {
7
- // it's done
8
- });
package/index.js DELETED
@@ -1,102 +0,0 @@
1
- /* jshint node: true */
2
- 'use strict';
3
-
4
- var async = require('async');
5
- var debug = require('debug')('manifest');
6
- var getit = require('getit');
7
- var mkdirp = require('mkdirp');
8
- var path = require('path');
9
- var fs = require('fs');
10
- var reTrailingSlash = /\/$/;
11
-
12
- /**
13
- # manifest
14
-
15
- 1. This has nothing to do with HTML5 cache-manifest / appcache
16
- 2. This is designed to make downloading multiple files from a remote
17
- web location (using [getit](https://github.com/DamonOehlman/getit)) via
18
- a simple manifest file, really bloody simple.
19
-
20
- ## Example Usage
21
-
22
- <<< examples/simple.js
23
-
24
- More documentation to come, in the meantime have a look at the
25
- test directory.
26
-
27
- ## Reference
28
- **/
29
-
30
- /**
31
- ### load(target, opts?, callback)
32
-
33
- Load a manifest from the specified location.
34
-
35
- **/
36
- var load = exports.load = function(target, opts, callback) {
37
- var basePath = (target || '').replace(reTrailingSlash, '');
38
- var manifestFile;
39
-
40
- // remap args if required
41
- if (typeof opts == 'function') {
42
- callback = opts;
43
- opts = {};
44
- }
45
-
46
- // ensure we have opts
47
- opts = opts || {};
48
-
49
- // initialise the manifest file name
50
- manifestFile = basePath + '/' + (opts.manifest || 'manifest');
51
-
52
- // get the manifest from the specified target path
53
- debug('downloading manifest from: ' + manifestFile);
54
- getit(manifestFile, opts, function(err, data) {
55
- callback(err, (data || '').split('\n'), basePath);
56
- });
57
- };
58
-
59
- /**
60
- ### download(target, opts?, callback)
61
-
62
- Download all the files specified in the manifest file from the specified
63
- location.
64
-
65
- **/
66
- exports.download = function(target, opts, callback) {
67
- // remap args if required
68
- if (typeof opts == 'function') {
69
- callback = opts;
70
- opts = {};
71
- }
72
-
73
- // initialise defaults
74
- opts.path = opts.path || process.cwd();
75
-
76
- // load the manifest from the target location
77
- load(target, opts, function(err, items, basePath) {
78
- if (err) {
79
- return callback(err);
80
- }
81
-
82
- async.forEach(
83
- items,
84
- function(item, itemCallback) {
85
- var targetFile = path.resolve(opts.path, item);
86
-
87
- // ensure the directory for the file exists
88
- mkdirp(path.dirname(targetFile), function(err) {
89
- if (err) {
90
- return itemCallback(err);
91
- }
92
-
93
- // download the file to the target
94
- getit(basePath + '/' + item, opts)
95
- .pipe(fs.createWriteStream(targetFile))
96
- .on('close', itemCallback);
97
- });
98
- },
99
- callback
100
- );
101
- });
102
- };
package/test/local.js DELETED
@@ -1,27 +0,0 @@
1
- var manifest = require('../'),
2
- assert = require('assert'),
3
- path = require('path'),
4
- rimraf = require('rimraf'),
5
- testSrcPath = path.resolve(__dirname, 'mock'),
6
- testDstPath = path.resolve(__dirname, 'mockdist');
7
-
8
-
9
- describe('local manifest tests', function() {
10
- before(rimraf.bind(null, testDstPath));
11
-
12
- it('should be able to load a local manifest', function(done) {
13
- manifest.load(testSrcPath, function(err, data, basePath) {
14
- assert.equal(basePath, testSrcPath);
15
- assert(data.indexOf('css/test.css') >= 0);
16
- assert(data.indexOf('js/test.js') >= 0);
17
-
18
- done();
19
- });
20
- });
21
-
22
- it('should be able to move files from the source to the target', function(done) {
23
- manifest.download(testSrcPath, { path: testDstPath }, function(err, data) {
24
- done(err);
25
- });
26
- });
27
- });
@@ -1,3 +0,0 @@
1
- body {
2
- background: red;
3
- }
@@ -1 +0,0 @@
1
- var test = 1;
@@ -1,2 +0,0 @@
1
- css/test.css
2
- js/test.js
@@ -1,3 +0,0 @@
1
- body {
2
- background: red;
3
- }
@@ -1 +0,0 @@
1
- var test = 1;