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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1ce6d6761204f1c143e0a839dde422db8ca392b
4
- data.tar.gz: eacd17e6943a5cc50ededa792fdab117ca252ee9
3
+ metadata.gz: 5db38b6cc6c2e515d927ca854b3077f957dd28ac
4
+ data.tar.gz: 4c9ce71989511d990c82e4fb918f9f7cfe7369b1
5
5
  SHA512:
6
- metadata.gz: 2fec3ee661ca83218ae6fd38c0a7ad5246e7c20c504dcf64d5c24a98313a84ab16e38cbfd262f0f52b355287568355abe43e30c6888bde75165f2a18bd2952d9
7
- data.tar.gz: 8d1350417d0f836cb2935082d62e1f651c1c39b242a41df6622b236d4a4c3f4c65ec26257a741fb5d4b4bb63452229af4d6f697918a503d92f0d40085fedc1d9
6
+ metadata.gz: 65ae2ea14d83de5c54da9af169892d50f4c4f91a180a91db5a76bb246c67fed0e15f83b94a96d7a448240c1bb266a1c746dfb98441cbdf54a706669b33e0f3d7
7
+ data.tar.gz: c4f2d3cf61733b34dfc3e8a8662188aa2a604f855cba348085eb180b104a163b042a9f0988ac9affe7451b56a5b37b02c580461ffe426e4831e6c7c69edeffe0
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  .project
19
19
  node_modules
20
+ resources/js
data/CHANGELOG.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.2.0](https://github.com/adiwg/mdJson-schemas/tree/v2.2.0)
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
- const requireDirectory = require('require-directory');
1
+ 'use strict';
2
2
 
3
- module.exports = requireDirectory(module, './schema');
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;
@@ -1,6 +1,6 @@
1
1
  module ADIWG
2
2
  module MdjsonSchemas
3
3
  # Current schema version number
4
- VERSION = "2.3.0"
4
+ VERSION = "2.3.1"
5
5
  end
6
6
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdjson-schemas",
3
- "version": "2.3.0",
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
- "mocha": "^3.5.0"
41
- },
42
- "dependencies": {
43
- "require-directory": "^2.1.1"
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "schema.json#",
3
3
  "$schema": "http://json-schema.org/draft-04/schema#",
4
- "version": "2.3.0",
4
+ "version": "2.3.1",
5
5
  "description": "schema for ADIwg mdJSON metadata",
6
6
  "example": "../examples/mdJson.json",
7
7
  "type": "object",
@@ -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.0
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-08-31 00:00:00.000000000 Z
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.2
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