adiwg-mdjson_schemas 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +4 -2
- data/index.js +13 -2
- data/lib/adiwg/mdjson_schemas/version.rb +1 -1
- data/package.json +12 -8
- data/schema/schema.json +1 -1
- data/scripts/prepublish.js +41 -0
- data/test/test.js +18 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5db38b6cc6c2e515d927ca854b3077f957dd28ac
|
4
|
+
data.tar.gz: 4c9ce71989511d990c82e4fb918f9f7cfe7369b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65ae2ea14d83de5c54da9af169892d50f4c4f91a180a91db5a76bb246c67fed0e15f83b94a96d7a448240c1bb266a1c746dfb98441cbdf54a706669b33e0f3d7
|
7
|
+
data.tar.gz: c4f2d3cf61733b34dfc3e8a8662188aa2a604f855cba348085eb180b104a163b042a9f0988ac9affe7451b56a5b37b02c580461ffe426e4831e6c7c69edeffe0
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v2.
|
3
|
+
## [v2.3.0](https://github.com/adiwg/mdJson-schemas/tree/v2.3.0) (2017-08-31)
|
4
|
+
[Full Changelog](https://github.com/adiwg/mdJson-schemas/compare/v2.2.0...v2.3.0)
|
4
5
|
|
6
|
+
## [v2.2.0](https://github.com/adiwg/mdJson-schemas/tree/v2.2.0) (2017-06-07)
|
5
7
|
[Full Changelog](https://github.com/adiwg/mdJson-schemas/compare/v2.1.2...v2.2.0)
|
6
8
|
|
7
9
|
**Implemented enhancements:**
|
@@ -63,4 +65,4 @@
|
|
63
65
|
- Fixed spatialRepresentation ([1833df8](https://github.com/adiwg/mdJson-schemas/commit/1833df80b9324dfbc5eb067821bde4a8011ccc08) )
|
64
66
|
|
65
67
|
|
66
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
68
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/index.js
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
-
|
1
|
+
'use strict';
|
2
2
|
|
3
|
-
|
3
|
+
const glob = require('glob');
|
4
|
+
const path = require('path');
|
5
|
+
const all = {};
|
6
|
+
|
7
|
+
glob.sync('./resources/js/!(schemas).js').forEach(function(file) {
|
8
|
+
const obj = require(path.resolve(file));
|
9
|
+
const name = path.basename(file, '.js');
|
10
|
+
|
11
|
+
all[name] = obj;
|
12
|
+
});
|
13
|
+
|
14
|
+
module.exports = exports = all;
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mdjson-schemas",
|
3
|
-
"version": "2.3.
|
3
|
+
"version": "2.3.1",
|
4
4
|
"description": "JSON schemas, examples, and templates for ADIwg metadata standards",
|
5
5
|
"main": "index.js",
|
6
6
|
"directories": {
|
@@ -9,11 +9,14 @@
|
|
9
9
|
"test": "test"
|
10
10
|
},
|
11
11
|
"scripts": {
|
12
|
-
"test": "mocha"
|
12
|
+
"test": "mocha",
|
13
|
+
"prepublish": "scripts/prepublish.js",
|
14
|
+
"pretest": "scripts/prepublish.js"
|
13
15
|
},
|
14
|
-
"files":[
|
16
|
+
"files": [
|
15
17
|
"examples",
|
16
|
-
"schema"
|
18
|
+
"schema",
|
19
|
+
"resources"
|
17
20
|
],
|
18
21
|
"repository": {
|
19
22
|
"type": "git",
|
@@ -37,9 +40,10 @@
|
|
37
40
|
"homepage": "https://github.com/adiwg/mdJson-schemas#readme",
|
38
41
|
"devDependencies": {
|
39
42
|
"ajv": "^5.2.2",
|
40
|
-
"
|
41
|
-
|
42
|
-
|
43
|
-
"
|
43
|
+
"buildify": "^0.4.0",
|
44
|
+
"glob": "^7.1.2",
|
45
|
+
"mkdirp": "^0.5.1",
|
46
|
+
"mocha": "^3.5.0",
|
47
|
+
"rimraf": "^2.6.1"
|
44
48
|
}
|
45
49
|
}
|
data/schema/schema.json
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
'use strict';
|
4
|
+
|
5
|
+
let fs = require('fs');
|
6
|
+
let buildify = require('buildify');
|
7
|
+
let rimraf = require('rimraf');
|
8
|
+
let mkdirp = require('mkdirp');
|
9
|
+
let all = require('../index.js');
|
10
|
+
let path = 'resources/js';
|
11
|
+
|
12
|
+
if(fs.existsSync(path)) {
|
13
|
+
rimraf.sync(path);
|
14
|
+
console.log('Removed existing resources/js files.');
|
15
|
+
}
|
16
|
+
mkdirp.sync(path);
|
17
|
+
|
18
|
+
console.log('Created resources/js');
|
19
|
+
|
20
|
+
let files = fs.readdirSync('schema');
|
21
|
+
|
22
|
+
for(let file of files) {
|
23
|
+
let name = path + '/' + file.split('.')[0] + '.js';
|
24
|
+
|
25
|
+
buildify()
|
26
|
+
.load('schema/' + file)
|
27
|
+
.perform(function(content) {
|
28
|
+
return 'module.exports = ' + content + ';';
|
29
|
+
})
|
30
|
+
.save(name);
|
31
|
+
//console.log('Created ' + name);
|
32
|
+
}
|
33
|
+
|
34
|
+
buildify()
|
35
|
+
.setContent(JSON.stringify(all))
|
36
|
+
.perform(function(content) {
|
37
|
+
return 'module.exports = ' + content + ';';
|
38
|
+
})
|
39
|
+
.save(path + '/' +'schemas.js');
|
40
|
+
|
41
|
+
process.exit();
|
data/test/test.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
1
3
|
const assert = require('assert');
|
2
4
|
const fs = require('fs');
|
3
5
|
const Schemas = require('../index.js');
|
6
|
+
const SchemasFile = require('../resources/js/schemas.js');
|
4
7
|
const schemaFolder = '../schema/';
|
5
8
|
|
6
9
|
describe('Test schemas:', function() {
|
@@ -44,6 +47,21 @@ describe('Test schemas:', function() {
|
|
44
47
|
ajv.validate('schema', data);
|
45
48
|
assert.equal(ajv.errors, null);
|
46
49
|
});
|
50
|
+
|
51
|
+
it('should load all schemas from schemas.js file', function() {
|
52
|
+
ajv.removeSchema();
|
53
|
+
|
54
|
+
Object.keys(SchemasFile).forEach(function(key) {
|
55
|
+
let val = SchemasFile[key];
|
56
|
+
|
57
|
+
ajv.addSchema(val, key);
|
58
|
+
});
|
59
|
+
});
|
60
|
+
|
61
|
+
it('should validate example again', function() {
|
62
|
+
ajv.validate('schema', data);
|
63
|
+
assert.equal(ajv.errors, null);
|
64
|
+
});
|
47
65
|
});
|
48
66
|
|
49
67
|
});
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adiwg-mdjson_schemas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Bradley, Stan Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- schema/usage.json
|
233
233
|
- schema/vectorRepresentation.json
|
234
234
|
- schema/verticalExtent.json
|
235
|
+
- scripts/prepublish.js
|
235
236
|
- test/draft-04.json
|
236
237
|
- test/helper.rb
|
237
238
|
- test/tc_additionalDocumentation.rb
|
@@ -331,7 +332,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
332
|
version: '0'
|
332
333
|
requirements: []
|
333
334
|
rubyforge_project:
|
334
|
-
rubygems_version: 2.5
|
335
|
+
rubygems_version: 2.4.5
|
335
336
|
signing_key:
|
336
337
|
specification_version: 4
|
337
338
|
summary: JSON schemas for the ADIwg metadata standard
|