Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:okfn/dpm
Browse files Browse the repository at this point in the history
  • Loading branch information
rufuspollock committed Apr 22, 2016
2 parents 68ee3ea + a95399d commit 8024958
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/index.js
Expand Up @@ -178,6 +178,8 @@ Dpm.prototype.get = function(dpkgId, opts, callback) {

async.each(resources, function(r, cb) {
cb = once(cb);
if(r.data) return cb(null);

var resourceUrl = r.url ? r.url : spec.url.replace(/\/$/, '') + '/' + r.path;

self.logHttp('GET', resourceUrl);
Expand Down
14 changes: 14 additions & 0 deletions test/all.js
Expand Up @@ -48,6 +48,20 @@ describe('get', function() {
done();
});
});

it('should ignore data resource', function(done) {
var ours = new dpm({}, root);
var url = 'https://raw.githubusercontent.com/okfn/dpm/master/test/fixtures/datapackage-example-inline';
var dpjson = path.join(root, 'datapackages', 'datapackage-example-inline', 'datapackage.json');

ours.get(url, function(err) {
if (err) return done(err);

var dpkg = JSON.parse(fs.readFileSync(dpjson));
assert.equal(dpkg.name, 'datapackage-example-inline');
done();
});
});
});

describe('info', function() {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/datapackage-example-inline/README.md
@@ -0,0 +1 @@
This is a basic example of using an inline data element in a datapackage. Adapted from the documentation.
10 changes: 10 additions & 0 deletions test/fixtures/datapackage-example-inline/datapackage.json
@@ -0,0 +1,10 @@
{
"name" : "datapackage-example-inline",
"license" : "CC0",
"resources": [
{
"format": "csv",
"data": "A,B,C\n1,2,3\n4,5,6"
}
]
}

0 comments on commit 8024958

Please sign in to comment.