goodguide-gibbon 0.11.4 → 0.11.6

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: 0bd09c258129158f9313c83ebda01eb248023591
4
- data.tar.gz: 7521749f7f88ea8d3d3b3be0208d77e210f6bac4
3
+ metadata.gz: c463daf5513770123e599b6683cbe8aaaa92ae92
4
+ data.tar.gz: 68130977344c86d2202ef88499acb92e6dae62c5
5
5
  SHA512:
6
- metadata.gz: d532921c46484f25d0f585e3bd9265b67a0429cb15e04f3a830a9c88e7afa82b0b17ed71c655b056a8425c88064ecc329109c50168431610a673c2c865c7cead
7
- data.tar.gz: 8c3114bae320cb7618a2968807d7a0ea17f0ef889f33c181ce9744f25b8270400b9278a714b6b5a7afb43fb710674eb320c4749e27e6ed59d45258be04ab4d7f
6
+ metadata.gz: acedc6b2b70372498fe808be6ea87f5fee3aada6b0c1436fb3595addaca18bd6a6400a404ee008b107e8e16d2a2428724d9fbea78321ef0f3413f084b4c23e83
7
+ data.tar.gz: f9598232f5bd223e45c1fe392ec016a0410cc614255dc02bdd16dc49bc95123c4aa1eea0a109d5cb55a0f7ec532bc3f7113b6edba331a3bee9e211100e4c3538
@@ -176,16 +176,18 @@ module GoodGuide
176
176
 
177
177
  class RuntimeError < StandardError; end
178
178
  class MissingData < RuntimeError
179
- attr_reader :query_type, :id, :annotations
180
- def initialize(type, id, annotations)
181
- @query_type, @id, @annotations = type, id, annotations
179
+ attr_reader :query_type, :id, :latest_annotation
180
+ attr_accessor :annotations
181
+ def initialize(type, id, latest_annotation)
182
+ @query_type, @id, @latest_annotation = type, id, latest_annotation
182
183
  end
183
184
 
184
185
  def equals(other)
185
186
  [
186
187
  query_type == other.query_type,
187
188
  id == other.id,
188
- annotations == other.annotations
189
+ annotations == other.annotations,
190
+ latest_annotation == other.latest_annotation
189
191
  ].all?
190
192
  end
191
193
 
@@ -194,21 +196,24 @@ module GoodGuide
194
196
  'status' => 'missing_data',
195
197
  'query_type' => query_type,
196
198
  'entity_id' => id,
199
+ 'latest_annotation' => latest_annotation,
197
200
  'annotations' => annotations,
198
201
  }
199
202
  end
200
203
  end
201
204
 
202
205
  class Failure < RuntimeError
203
- attr_reader :message
204
- def initialize(message)
206
+ attr_reader :message, :annotations
207
+ def initialize(message, annotations)
205
208
  @message = message
209
+ @annotations = annotations
206
210
  end
207
211
 
208
212
  def as_json(*)
209
213
  {
210
214
  'status' => 'failure',
211
215
  'message' => message,
216
+ 'annotations' => annotations
212
217
  }
213
218
  end
214
219
  end
@@ -268,10 +273,11 @@ module GoodGuide
268
273
 
269
274
  case error
270
275
  when String
271
- raise GoodGuide::Gibbon::Failure.new(error)
276
+ raise GoodGuide::Gibbon::Failure.new(error, values)
272
277
  when nil
273
278
  values
274
279
  else
280
+ error.annotations = values
275
281
  raise error
276
282
  end
277
283
  end
@@ -348,7 +354,6 @@ module GoodGuide
348
354
  include Util
349
355
  def perform_query(id, annotations)
350
356
  annotations = obj_to_ruby(annotations)
351
-
352
357
  query_type = annotations.delete('_query_type')
353
358
 
354
359
  # stash this data in case missing_data! is called
@@ -5752,6 +5752,12 @@ stdlib = Gibbon.stdlib = (function() {
5752
5752
  type: parse.type('empty? = [%] -> bool'),
5753
5753
  compile: isEmpty
5754
5754
  },
5755
+ missing: {
5756
+ type: parse.type('empty = % -> %a'),
5757
+ compile: function() {
5758
+ return Core.fail('missing');
5759
+ }
5760
+ },
5755
5761
  weight: {
5756
5762
  type: parse.type('weight [numeric : numeric] = % -> numeric'),
5757
5763
  compile: function(_, _arg) {
@@ -5869,7 +5875,7 @@ stdlib = Gibbon.stdlib = (function() {
5869
5875
  first: {
5870
5876
  type: parse.type('first = [%a] -> %a'),
5871
5877
  compile: function(list) {
5872
- return list.delist(ZERO);
5878
+ return Core.len(list).op2('===', ZERO).branch(Core.fail('first: empty list'), list.delist(ZERO));
5873
5879
  }
5874
5880
  },
5875
5881
  left: {
@@ -6199,7 +6205,7 @@ Gibbon.Dependency = Dependency = (function(_super) {
6199
6205
  Dependency.variants({
6200
6206
  query: ['entity', 'query', 'value'],
6201
6207
  lexical: ['key'],
6202
- failure: ['failure']
6208
+ failure: ['entity', 'query', 'failure']
6203
6209
  });
6204
6210
 
6205
6211
  Dependency.prototype.equals = function(other) {
@@ -6345,7 +6351,7 @@ Gibbon.CompiledCode = CompiledCode = (function() {
6345
6351
  };
6346
6352
  onFailure = function(err) {
6347
6353
  failures.set(key, err);
6348
- return fail(err);
6354
+ return fail(err, dependencies);
6349
6355
  };
6350
6356
  return _this.functionFor(key)(input, query, onFailure, onSuccess);
6351
6357
  };
@@ -6361,7 +6367,7 @@ Gibbon.CompiledCode = CompiledCode = (function() {
6361
6367
  out = client.performQuery(id, annotations, function(err, data) {
6362
6368
  var publicValue;
6363
6369
  if (err) {
6364
- pushDep(Dependency.failure(err));
6370
+ pushDep(Dependency.failure(id, annotations, err));
6365
6371
  if (isSynchronous) {
6366
6372
  return function() {
6367
6373
  return onFailure(err);
@@ -5689,6 +5689,12 @@ stdlib = Gibbon.stdlib = (function() {
5689
5689
  type: parse.type('empty? = [%] -> bool'),
5690
5690
  compile: isEmpty
5691
5691
  },
5692
+ missing: {
5693
+ type: parse.type('empty = % -> %a'),
5694
+ compile: function() {
5695
+ return Core.fail('missing');
5696
+ }
5697
+ },
5692
5698
  weight: {
5693
5699
  type: parse.type('weight [numeric : numeric] = % -> numeric'),
5694
5700
  compile: function(_, _arg) {
@@ -5806,7 +5812,7 @@ stdlib = Gibbon.stdlib = (function() {
5806
5812
  first: {
5807
5813
  type: parse.type('first = [%a] -> %a'),
5808
5814
  compile: function(list) {
5809
- return list.delist(ZERO);
5815
+ return Core.len(list).op2('===', ZERO).branch(Core.fail('first: empty list'), list.delist(ZERO));
5810
5816
  }
5811
5817
  },
5812
5818
  left: {
@@ -6136,7 +6142,7 @@ Gibbon.Dependency = Dependency = (function(_super) {
6136
6142
  Dependency.variants({
6137
6143
  query: ['entity', 'query', 'value'],
6138
6144
  lexical: ['key'],
6139
- failure: ['failure']
6145
+ failure: ['entity', 'query', 'failure']
6140
6146
  });
6141
6147
 
6142
6148
  Dependency.prototype.equals = function(other) {
@@ -6282,7 +6288,7 @@ Gibbon.CompiledCode = CompiledCode = (function() {
6282
6288
  };
6283
6289
  onFailure = function(err) {
6284
6290
  failures.set(key, err);
6285
- return fail(err);
6291
+ return fail(err, dependencies);
6286
6292
  };
6287
6293
  return _this.functionFor(key)(input, query, onFailure, onSuccess);
6288
6294
  };
@@ -6298,7 +6304,7 @@ Gibbon.CompiledCode = CompiledCode = (function() {
6298
6304
  out = client.performQuery(id, annotations, function(err, data) {
6299
6305
  var publicValue;
6300
6306
  if (err) {
6301
- pushDep(Dependency.failure(err));
6307
+ pushDep(Dependency.failure(id, annotations, err));
6302
6308
  if (isSynchronous) {
6303
6309
  return function() {
6304
6310
  return onFailure(err);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gibbon",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "A data language",
5
5
  "keywords": ["language"],
6
6
  "author": "Jay Adkisson <jjmadkisson at gmail dot com>",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goodguide-gibbon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Adkisson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-12 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Run and analyze gibbon code from ruby or a browser (via a ruby app).
14
14
  email:
@@ -19,35 +19,35 @@ extensions:
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - Gemfile
22
+ - ext/mkrf_conf.rb
22
23
  - goodguide-gibbon.gemspec
23
24
  - lib/goodguide/gibbon.rb
24
25
  - lib/goodguide/gibbon/version.rb
25
- - vendor/gibbon/package.json
26
- - vendor/gibbon/gibbon.browser.js
27
26
  - vendor/gibbon/gibbon.browser.dev.js
28
- - ext/mkrf_conf.rb
27
+ - vendor/gibbon/gibbon.browser.js
28
+ - vendor/gibbon/package.json
29
29
  homepage: http://github.com/GoodGuide/goodguide-gibbon
30
30
  licenses: []
31
31
  metadata: {}
32
- post_install_message:
32
+ post_install_message:
33
33
  rdoc_options: []
34
34
  require_paths:
35
35
  - lib
36
36
  required_ruby_version: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - '>='
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  requirements: []
47
47
  rubyforge_project: goodguide-gibbon
48
- rubygems_version: 2.1.9
49
- signing_key:
48
+ rubygems_version: 2.2.2
49
+ signing_key:
50
50
  specification_version: 4
51
51
  summary: Ruby bindings for the gibbon data language
52
52
  test_files: []
53
- has_rdoc:
53
+ has_rdoc: