goodguide-gibbon 0.14.0 → 0.14.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8b34db5c0525825c475f7d18109f8ffc5518e53
4
- data.tar.gz: 9db9f664a974da99e90ad45855d9d42b91656a1d
3
+ metadata.gz: 68b9d67850eefaf6beb8331b64d608743564a410
4
+ data.tar.gz: c570344632c7b9733db5debd4a77b5a4b1bb1c1e
5
5
  SHA512:
6
- metadata.gz: 271a7ede66936d1e02e5eaf6852f8c78948fc4b989d6c4bc377ee1c34bde960ccbb16253db765e8e51595c1434639d0c1392181df31a137f05d6ca6ee55ef683
7
- data.tar.gz: bf95e7975d0abec0c15131733ec04a38471f7c05d505d2aac0631081f774c65601d9efee3dd8de2f6d4caa26c87252c0033ce482e1ae4f332f0849f63d1533a0
6
+ metadata.gz: ec7c7635932a1cf02446cd449812fff7093ead9f3e97a18681edb8d0246192b71bd4ff8265fb6f2e7cafe36be602b5d995fd513930420b77ccb7b948f151892f
7
+ data.tar.gz: dd413b4032913bf99b45a42862bf761c197c2a6d82727a83692b1dabaee81adf0bc0c187e35bb5d0aa768041e1ae32fe0526740c78a788cdd2da4f3e11384f69
data/Gemfile CHANGED
@@ -16,3 +16,5 @@ platforms :jruby do
16
16
  end
17
17
 
18
18
  gem 'rake'
19
+
20
+ gem 'sinatra'
@@ -340,6 +340,23 @@ module GoodGuide
340
340
  raise StaticError.new(*a)
341
341
  end
342
342
 
343
+ # Define custom queries to be made avaialble in Gibbon clients.
344
+ # Note: DO NOT use `return` within these blocks. Because they're not
345
+ # functions, this results in a `LocalJumpError` (in MRI ruby) or, even
346
+ # worse, silently kills the current thread (in JRuby).
347
+ #
348
+ # E.g.,
349
+ # BAD:
350
+ # query :foo do |arg|
351
+ # return false unless arg.present?
352
+ # # ...
353
+ # end
354
+ #
355
+ # GOOD:
356
+ # query :foo do |arg|
357
+ # break false unless arg.present?
358
+ # # ...
359
+ # end
343
360
  def self.query(type, opts={}, &impl)
344
361
  arity = opts.fetch(:arity, 1)
345
362
  super type, opts do |input, args, builder|
@@ -1,9 +1,13 @@
1
- require 'json' # stdlib
1
+ # stdlib
2
+ require 'json'
3
+ require 'pathname'
2
4
 
3
5
  module GoodGuide
4
6
  module Gibbon
5
7
  def self.version
6
- JSON.load(File.read('vendor/gibbon/package.json'))['version']
8
+ install_path = Pathname.new(__FILE__).dirname.parent.parent.parent
9
+ package_json = install_path.join('vendor/gibbon/package.json')
10
+ JSON.load(package_json.read)['version']
7
11
  end
8
12
  end
9
13
  end
@@ -5831,6 +5831,22 @@ stdlib = Gibbon.stdlib = (function() {
5831
5831
  return Core.fail('missing');
5832
5832
  }
5833
5833
  },
5834
+ assert: {
5835
+ type: parse.type('assert { %a -> bool } = %a -> %a'),
5836
+ compile: function(input, _arg) {
5837
+ var cond;
5838
+ cond = _arg[0];
5839
+ return cond.app(input).branch(input, Core.fail('assertion failed'));
5840
+ }
5841
+ },
5842
+ "assert-any": {
5843
+ type: parse.type('assert-any = [%a] -> [%a]'),
5844
+ compile: function(input, _arg) {
5845
+ var cond;
5846
+ cond = _arg[0];
5847
+ return input.len().op2('>', Core.constant(0)).branch(input, Core.fail('empty list'));
5848
+ }
5849
+ },
5834
5850
  blank: {
5835
5851
  type: parse.type('blank = % -> %a'),
5836
5852
  compile: function() {
@@ -6106,6 +6122,20 @@ stdlib = Gibbon.stdlib = (function() {
6106
6122
  compile: function() {
6107
6123
  return FALSE;
6108
6124
  }
6125
+ },
6126
+ assert: {
6127
+ type: parse.type('assert { %a -> bool } = %a -> %a'),
6128
+ compile: function(input, _arg) {
6129
+ var block;
6130
+ block = _arg[0];
6131
+ return block.app(input).branch(input, Core.fail('assert'));
6132
+ }
6133
+ },
6134
+ "assert-any": {
6135
+ type: parse.type('assert-any = [%a] -> [%a]'),
6136
+ compile: function(input) {
6137
+ return input.len().op2('>', Core.constant(0)).branch(input, Core.fail('assert-any'));
6138
+ }
6109
6139
  }
6110
6140
  };
6111
6141
  })();
@@ -5767,6 +5767,22 @@ stdlib = Gibbon.stdlib = (function() {
5767
5767
  return Core.fail('missing');
5768
5768
  }
5769
5769
  },
5770
+ assert: {
5771
+ type: parse.type('assert { %a -> bool } = %a -> %a'),
5772
+ compile: function(input, _arg) {
5773
+ var cond;
5774
+ cond = _arg[0];
5775
+ return cond.app(input).branch(input, Core.fail('assertion failed'));
5776
+ }
5777
+ },
5778
+ "assert-any": {
5779
+ type: parse.type('assert-any = [%a] -> [%a]'),
5780
+ compile: function(input, _arg) {
5781
+ var cond;
5782
+ cond = _arg[0];
5783
+ return input.len().op2('>', Core.constant(0)).branch(input, Core.fail('empty list'));
5784
+ }
5785
+ },
5770
5786
  blank: {
5771
5787
  type: parse.type('blank = % -> %a'),
5772
5788
  compile: function() {
@@ -6042,6 +6058,20 @@ stdlib = Gibbon.stdlib = (function() {
6042
6058
  compile: function() {
6043
6059
  return FALSE;
6044
6060
  }
6061
+ },
6062
+ assert: {
6063
+ type: parse.type('assert { %a -> bool } = %a -> %a'),
6064
+ compile: function(input, _arg) {
6065
+ var block;
6066
+ block = _arg[0];
6067
+ return block.app(input).branch(input, Core.fail('assert'));
6068
+ }
6069
+ },
6070
+ "assert-any": {
6071
+ type: parse.type('assert-any = [%a] -> [%a]'),
6072
+ compile: function(input) {
6073
+ return input.len().op2('>', Core.constant(0)).branch(input, Core.fail('assert-any'));
6074
+ }
6045
6075
  }
6046
6076
  };
6047
6077
  })();
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "gibbon",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "description": "A data language",
5
5
  "keywords": ["language"],
6
- "author": "Jeanine Adkisson <jjmadkisson at gmail dot com>",
6
+ "author": "Jeanine Adkisson <jeanine.adkisson@gmail.com>",
7
7
  "repository": "git://github.com/GoodGuide/gibbon",
8
8
 
9
9
  "files": ["index.js", "src", "test", "Makefile", "package.json"],
@@ -12,8 +12,7 @@
12
12
  "mocha": "1.8.x",
13
13
  "chai": "1.5.x",
14
14
  "coffee-script": "1.6.x",
15
- "supervisor": "0.5.x",
16
- "node-inspector": "0.2.x"
15
+ "supervisor": "0.5.x"
17
16
  },
18
17
  "dependencies": {
19
18
  "parsimmon": "0.6.x",
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.14.0
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2015-10-22 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:
@@ -45,9 +45,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
45
  version: '0'
46
46
  requirements: []
47
47
  rubyforge_project: goodguide-gibbon
48
- rubygems_version: 2.2.2
48
+ rubygems_version: 2.4.5.1
49
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: