goodguide-gibbon 0.3.1 → 0.3.2

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.
@@ -1,7 +1,7 @@
1
1
  module GoodGuide
2
2
  module Gibbon
3
3
  def self.version
4
- '0.3.1'
4
+ '0.3.2'
5
5
  end
6
6
  end
7
7
  end
@@ -157,9 +157,9 @@ module GoodGuide
157
157
  end
158
158
 
159
159
  class RuntimeClient < AbstractClient
160
- def perform_query(id, annotations)
160
+ def perform_query(id, annotations, v)
161
161
  query = get_query(annotations[:_query_type])
162
- instance_exec(id, annotations, &query)
162
+ instance_exec(id, annotations, v, &query)
163
163
  end
164
164
 
165
165
  def to_js
@@ -1890,6 +1890,9 @@ analyze = Gibbon.analyze = (function() {
1890
1890
  },
1891
1891
  func: function(name, args) {
1892
1892
  var arg, ast, func, i, input, scope, _i, _len, _results;
1893
+ if (!stdlib.hasOwnProperty(name)) {
1894
+ throw new Error("no such function " + name);
1895
+ }
1893
1896
  func = stdlib[name];
1894
1897
  ast = func.type;
1895
1898
  scope = new Hash;
@@ -2609,9 +2612,6 @@ Promise = (function() {
2609
2612
  };
2610
2613
 
2611
2614
  Promise.unit = function(e) {
2612
- if (!(e instanceof Gibbon.Value)) {
2613
- throw new Error('only make thunks of Value for now');
2614
- }
2615
2615
  return new Promise(function(_, f) {
2616
2616
  return f(e, []);
2617
2617
  });
@@ -2756,13 +2756,13 @@ eval_ = Gibbon["eval"] = (function() {
2756
2756
  return input.then(function(entity) {
2757
2757
  var _this = this;
2758
2758
  return new Promise(function(fail, cc) {
2759
- return client.performQuery(entity.id, annotations, function(err, val) {
2759
+ return client.performQuery(entity.id, annotations, Gibbon.Value, function(err, val) {
2760
2760
  var dependency;
2761
2761
  if (err) {
2762
2762
  return fail(err);
2763
2763
  }
2764
2764
  dependency = Dependency.query(entity, flow.head);
2765
- return Value.fromJSON(val).promise().depends([dependency]).force(fail, cc);
2765
+ return val.promise().depends([dependency]).force(fail, cc);
2766
2766
  });
2767
2767
  });
2768
2768
  });
@@ -2827,10 +2827,8 @@ eval_ = Gibbon["eval"] = (function() {
2827
2827
  }
2828
2828
  });
2829
2829
  };
2830
- return new Promise(function(fail, cc) {
2831
- return Promise.combine(resultThunks.values()).force(fail, function(_, deps) {
2832
- return cc(results, deps);
2833
- });
2830
+ return Promise.combine(resultThunks.values()).map(function() {
2831
+ return results;
2834
2832
  });
2835
2833
  };
2836
2834
  return function(semantics, table, id, client, finish) {
@@ -2876,7 +2874,7 @@ Gibbon.jsonConsumer = (function() {
2876
2874
  }
2877
2875
  });
2878
2876
  };
2879
- getValue = function(id, annotations, callback) {
2877
+ getValue = function(id, annotations, v, callback) {
2880
2878
  var entity, values;
2881
2879
  if (!tables.hasOwnProperty(annotations.table)) {
2882
2880
  return callback(new Error("no such type " + annotations.table));
@@ -2889,7 +2887,7 @@ Gibbon.jsonConsumer = (function() {
2889
2887
  if (!entity.hasOwnProperty(annotations.name)) {
2890
2888
  return callback(null, null);
2891
2889
  }
2892
- return callback(null, entity[annotations.name]);
2890
+ return callback(null, v.fromJSON(entity[annotations.name]));
2893
2891
  };
2894
2892
  lists = tables._lists || {};
2895
2893
  analyzeList = function(id, listName, t, callback) {
@@ -2919,8 +2917,8 @@ Gibbon.jsonConsumer = (function() {
2919
2917
  return callback(new Error("unknown query `" + query.type + "'"));
2920
2918
  }
2921
2919
  },
2922
- performQuery: function(id, annotations, callback) {
2923
- return getValue(id, annotations, callback);
2920
+ performQuery: function(id, annotations, v, callback) {
2921
+ return getValue(id, annotations, v, callback);
2924
2922
  }
2925
2923
  };
2926
2924
  };
@@ -1884,6 +1884,9 @@ analyze = Gibbon.analyze = (function() {
1884
1884
  },
1885
1885
  func: function(name, args) {
1886
1886
  var arg, ast, func, i, input, scope, _i, _len, _results;
1887
+ if (!stdlib.hasOwnProperty(name)) {
1888
+ throw new Error("no such function " + name);
1889
+ }
1887
1890
  func = stdlib[name];
1888
1891
  ast = func.type;
1889
1892
  scope = new Hash;
@@ -2581,9 +2584,6 @@ Promise = (function() {
2581
2584
  };
2582
2585
 
2583
2586
  Promise.unit = function(e) {
2584
- if (!(e instanceof Gibbon.Value)) {
2585
- throw new Error('only make thunks of Value for now');
2586
- }
2587
2587
  return new Promise(function(_, f) {
2588
2588
  return f(e, []);
2589
2589
  });
@@ -2728,13 +2728,13 @@ eval_ = Gibbon["eval"] = (function() {
2728
2728
  return input.then(function(entity) {
2729
2729
  var _this = this;
2730
2730
  return new Promise(function(fail, cc) {
2731
- return client.performQuery(entity.id, annotations, function(err, val) {
2731
+ return client.performQuery(entity.id, annotations, Gibbon.Value, function(err, val) {
2732
2732
  var dependency;
2733
2733
  if (err) {
2734
2734
  return fail(err);
2735
2735
  }
2736
2736
  dependency = Dependency.query(entity, flow.head);
2737
- return Value.fromJSON(val).promise().depends([dependency]).force(fail, cc);
2737
+ return val.promise().depends([dependency]).force(fail, cc);
2738
2738
  });
2739
2739
  });
2740
2740
  });
@@ -2799,10 +2799,8 @@ eval_ = Gibbon["eval"] = (function() {
2799
2799
  }
2800
2800
  });
2801
2801
  };
2802
- return new Promise(function(fail, cc) {
2803
- return Promise.combine(resultThunks.values()).force(fail, function(_, deps) {
2804
- return cc(results, deps);
2805
- });
2802
+ return Promise.combine(resultThunks.values()).map(function() {
2803
+ return results;
2806
2804
  });
2807
2805
  };
2808
2806
  return function(semantics, table, id, client, finish) {
@@ -2848,7 +2846,7 @@ Gibbon.jsonConsumer = (function() {
2848
2846
  }
2849
2847
  });
2850
2848
  };
2851
- getValue = function(id, annotations, callback) {
2849
+ getValue = function(id, annotations, v, callback) {
2852
2850
  var entity, values;
2853
2851
  if (!tables.hasOwnProperty(annotations.table)) {
2854
2852
  return callback(new Error("no such type " + annotations.table));
@@ -2861,7 +2859,7 @@ Gibbon.jsonConsumer = (function() {
2861
2859
  if (!entity.hasOwnProperty(annotations.name)) {
2862
2860
  return callback(null, null);
2863
2861
  }
2864
- return callback(null, entity[annotations.name]);
2862
+ return callback(null, v.fromJSON(entity[annotations.name]));
2865
2863
  };
2866
2864
  lists = tables._lists || {};
2867
2865
  analyzeList = function(id, listName, t, callback) {
@@ -2891,8 +2889,8 @@ Gibbon.jsonConsumer = (function() {
2891
2889
  return callback(new Error("unknown query `" + query.type + "'"));
2892
2890
  }
2893
2891
  },
2894
- performQuery: function(id, annotations, callback) {
2895
- return getValue(id, annotations, callback);
2892
+ performQuery: function(id, annotations, v, callback) {
2893
+ return getValue(id, annotations, v, callback);
2896
2894
  }
2897
2895
  };
2898
2896
  };
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goodguide-gibbon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-30 00:00:00.000000000 Z
12
+ date: 2013-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ type: :runtime
15
16
  name: therubyracer
16
- version_requirements: !ruby/object:Gem::Requirement
17
- none: false
17
+ prerelease: false
18
+ requirement: !ruby/object:Gem::Requirement
18
19
  requirements:
19
20
  - - ! '>='
20
21
  - !ruby/object:Gem::Version
21
22
  version: '0'
22
- requirement: !ruby/object:Gem::Requirement
23
23
  none: false
24
+ version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
26
  - - ! '>='
26
27
  - !ruby/object:Gem::Version
27
28
  version: '0'
28
- type: :runtime
29
- prerelease: false
29
+ none: false
30
30
  description: Run and analyze gibbon code from ruby or a browser (via a ruby app).
31
31
  email:
32
32
  - jjmadkisson@gmail.com
@@ -48,23 +48,17 @@ rdoc_options: []
48
48
  require_paths:
49
49
  - lib
50
50
  required_ruby_version: !ruby/object:Gem::Requirement
51
- none: false
52
51
  requirements:
53
52
  - - ! '>='
54
53
  - !ruby/object:Gem::Version
55
54
  version: '0'
56
- hash: -2075265121022310565
57
- segments:
58
- - 0
59
- required_rubygems_version: !ruby/object:Gem::Requirement
60
55
  none: false
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
57
  requirements:
62
58
  - - ! '>='
63
59
  - !ruby/object:Gem::Version
64
60
  version: '0'
65
- hash: -2075265121022310565
66
- segments:
67
- - 0
61
+ none: false
68
62
  requirements: []
69
63
  rubyforge_project: goodguide-gibbon
70
64
  rubygems_version: 1.8.23
@@ -72,3 +66,4 @@ signing_key:
72
66
  specification_version: 3
73
67
  summary: Ruby bindings for the gibbon data language
74
68
  test_files: []
69
+ has_rdoc: