graphql-libgraphqlparser 0.0.1 → 0.1.2

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: a36c8dfc90001ecf63d6032683987c72cea30a09
4
- data.tar.gz: 1dc323ff5bd90ff440849ad4146761818bf32f04
3
+ metadata.gz: 66cc33f8789ca13aa84da1d2931732841943a607
4
+ data.tar.gz: c23e932dca62dba848d109d704cc5fdc355e69cc
5
5
  SHA512:
6
- metadata.gz: 087f862222ee9b94bc373f47d4333cf6df42ad12205c6a13c7f743fdd21ea86743eb1271e4487dd3b9be72f44627f69d0de36dc5fcb9e74a7cacddb4a6de2204
7
- data.tar.gz: 4542c42448fb8e552b4a708592d083590120463c9de175b45ab55f8aa41cd28983c4543ceb4833463a7c39292dba11d47b20b077f32f54bb8832fe70454ed0b2
6
+ metadata.gz: e426fed71b59bd245b0044f2b69e6d32826a0c5ceca1058c5128d8dda90a87ff8957cbbf8401e0b61d52eecaf026003d84b554cc5636b84e04df49d68875f448
7
+ data.tar.gz: d2bbeff1006b1adc1146517e0779d96df4890cbb0ba6185382849de2f75b0201a58d74db2739958ffea0084eaaf09bcdff4f0b8ada22ccfa93931a98509c33bd
data/.travis.yml CHANGED
@@ -2,7 +2,6 @@ language: ruby
2
2
  cache: bundler
3
3
  sudo: required
4
4
  rvm:
5
- - 2.1
6
5
  - 2.2
7
6
  addons:
8
7
  apt:
@@ -16,10 +15,10 @@ before_install:
16
15
  - sudo unlink /usr/bin/g++ && sudo ln -s /usr/bin/g++-5 /usr/bin/g++
17
16
  - g++ --version
18
17
  - sudo apt-get install bison
19
- - wget https://github.com/graphql/libgraphqlparser/archive/v0.4.0.tar.gz
20
- - tar -xzvf v0.4.0.tar.gz
21
- - cd libgraphqlparser-0.4.0/ && sudo cmake . && sudo make && sudo make install
18
+ - wget https://github.com/graphql/libgraphqlparser/archive/v0.4.1.tar.gz
19
+ - tar -xzvf v0.4.1.tar.gz
20
+ - cd libgraphqlparser-0.4.1/ && sudo cmake . && sudo make && sudo make install
22
21
  - gem update --system
23
22
  - gem install bundler
24
23
  script:
25
- - bundle exec rake
24
+ - bundle exec rake --trace
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # graphql-libgraphqlparser [![Build Status](https://travis-ci.org/rmosolgo/graphql-libgraphqlparser-ruby.svg?branch=master)](https://travis-ci.org/rmosolgo/graphql-libgraphqlparser-ruby)
1
+ # graphql-libgraphqlparser [![Build Status](https://travis-ci.org/rmosolgo/graphql-libgraphqlparser-ruby.svg?branch=master)](https://travis-ci.org/rmosolgo/graphql-libgraphqlparser-ruby) [![Gem Version](https://badge.fury.io/rb/graphql-libgraphqlparser.svg)](https://badge.fury.io/rb/graphql-libgraphqlparser)
2
2
 
3
3
  Make [`graphql`](https://github.com/rmosolgo/graphql-ruby) faster with [`libgraphqlparser`](https://github.com/graphql/libgraphqlparser). Ruby bindings to a C-level GraphQL parser.
4
4
 
@@ -23,8 +23,8 @@ C 0.010000 0.000000 0.010000 ( 0.008584)
23
23
 
24
24
  This gem depends on [libgraphqlparser](https://github.com/graphql/libgraphqlparser). You can install it a few ways:
25
25
 
26
- - __Homebrew__: `brew install libgraphqlparser`
27
- - __From Source__:
26
+ - Homebrew: `brew install libgraphqlparser`
27
+ - From Source:
28
28
 
29
29
  ```
30
30
  wget https://github.com/graphql/libgraphqlparser/archive/v0.4.0.tar.gz
@@ -43,9 +43,3 @@ When you `require` this gem, it overrides `GraphQL.parse`:
43
43
  ```ruby
44
44
  require "graphql/libgraphqlparser"
45
45
  ```
46
-
47
- ## Todo
48
-
49
- - Get directives from OperationDefinitions
50
- - AbstractNode overrides are full of tension. Resolve that tension with GraphQL main.
51
- - Node `#type` is sometimes a String, sometimes a Node. That should always be the same.
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ Rake::TestTask.new do |t|
11
11
  end
12
12
 
13
13
  Rake::ExtensionTask.new "libgraphqlparser" do |ext|
14
- ext.lib_dir = "lib/graphql/libgraphqlparser"
14
+
15
15
  end
16
16
 
17
17
  task default: [:clobber, :compile, :test]
@@ -11,12 +11,13 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "Use Libgraphqlparser to parse queries for the GraphQL gem"
12
12
  spec.license = "minitest"
13
13
 
14
+ spec.extensions = ['ext/libgraphqlparser/extconf.rb']
14
15
  spec.files = `git ls-files -z`.split("\x0")
15
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
18
  spec.require_paths = ['lib']
18
19
 
19
- spec.add_runtime_dependency 'graphql', '~> 0.10.0'
20
+ spec.add_runtime_dependency 'graphql', '~> 0.11.0'
20
21
 
21
22
  spec.add_development_dependency 'bundler', '~> 1.0'
22
23
  spec.add_development_dependency "guard", "~> 2.12"
@@ -1,40 +1,6 @@
1
1
  module GraphQL
2
2
  module Language
3
3
  module Nodes
4
- class AbstractNode
5
- alias :old_initialize :initialize
6
- # Allow initialize with no args
7
- def initialize(*args)
8
- if args.any?
9
- old_initialize(*args)
10
- end
11
- end
12
-
13
- def position
14
- [line, col]
15
- end
16
- end
17
-
18
- # Document = AbstractNode.create(:parts)
19
- class Document
20
- def definitions
21
- @parts ||= []
22
- end
23
- end
24
-
25
- # OperationDefinition = AbstractNode.create(:operation_type, :name, :variables, :directives, :selections)
26
- class OperationDefinition
27
- def variables
28
- @variables ||= []
29
- end
30
-
31
- def selections
32
- @selections ||= []
33
- end
34
- end
35
-
36
- # Variable = AbstractNode.create(:name, :type, :default_value)
37
- VariableDefinition = Variable
38
4
  class VariableDefinition
39
5
  # Make it behave like an Argument
40
6
  def value=(new_value)
@@ -42,57 +8,6 @@ module GraphQL
42
8
  end
43
9
  end
44
10
 
45
- # VariableIdentifier = AbstractNode.create(:name)
46
-
47
- # FragmentDefinition = AbstractNode.create(:name, :type, :directives, :selections)
48
- class FragmentDefinition
49
- def selections
50
- @selections ||= []
51
- end
52
- end
53
-
54
- # Field = AbstractNode.create(:name, :alias, :arguments, :directives, :selections)
55
- class Field
56
- def selections
57
- @selections ||= []
58
- end
59
-
60
- def directives
61
- @directives ||= []
62
- end
63
-
64
- def arguments
65
- @arguments ||= []
66
- end
67
- end
68
-
69
- # Directive = AbstractNode.create(:name, :arguments)
70
- class Directive
71
- def arguments
72
- @arguments ||= []
73
- end
74
- end
75
-
76
- # FragmentSpread = AbstractNode.create(:name, :directives)
77
- class FragmentSpread
78
- def directives
79
- @directives ||= []
80
- end
81
- end
82
-
83
- # InlineFragment = AbstractNode.create(:type, :directives, :selections)
84
- class InlineFragment
85
- def directives
86
- @directives ||= []
87
- end
88
- def selections
89
- @selections ||= []
90
- end
91
- end
92
-
93
- # ListType = AbstractNode.create(:of_type)
94
- # NonNullType = AbstractNode.create(:of_type)
95
- # TypeName = AbstractNode.create(:name)
96
11
  class ListType
97
12
  def type=(inner_type)
98
13
  self.of_type = inner_type
@@ -106,13 +21,7 @@ module GraphQL
106
21
  def type; self.of_type; end
107
22
  end
108
23
 
109
- # Argument = AbstractNode.create(:name, :value)
110
- # Enum = AbstractNode.create(:name)
111
- class InputObject
112
- def arguments
113
- @pairs ||= []
114
- end
115
- end
24
+
116
25
 
117
26
  class ArrayLiteral < AbstractNode
118
27
  attr_reader :values
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Libgraphqlparser
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
@@ -1,8 +1,8 @@
1
1
  require 'graphql'
2
2
  require 'graphql/libgraphqlparser/builder'
3
- require 'graphql/libgraphqlparser/libgraphqlparser'
4
3
  require 'graphql/libgraphqlparser/monkey_patches/abstract_node'
5
4
  require 'graphql/libgraphqlparser/version'
5
+ require_relative '../libgraphqlparser'
6
6
 
7
7
  module GraphQL
8
8
  module Libgraphqlparser
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  describe GraphQL::Libgraphqlparser do
4
4
  let(:document) { GraphQL::Libgraphqlparser.parse(query_string) }
5
5
  let(:query_string) {%|
6
- query getStuff($someVar: Int = 1, $anotherVar: [String!] ) {
6
+ query getStuff($someVar: Int = 1, $anotherVar: [String!] ) @skip(if: false) {
7
7
  myField: someField(someArg: $someVar, ok: 1.4) @skip(if: $anotherVar) @thing(or: "Whatever")
8
8
 
9
9
  anotherField(someArg: [1,2,3]) {
@@ -18,7 +18,7 @@ describe GraphQL::Libgraphqlparser do
18
18
 
19
19
  }
20
20
 
21
- fragment moreNestedFields on NestedType {
21
+ fragment moreNestedFields on NestedType @or(something: "ok") {
22
22
  anotherNestedField
23
23
  }
24
24
  |}
@@ -43,6 +43,7 @@ describe GraphQL::Libgraphqlparser do
43
43
  assert_equal "query", query.operation_type
44
44
  assert_equal 2, query.variables.length
45
45
  assert_equal 3, query.selections.length
46
+ assert_equal 1, query.directives.length
46
47
  assert_equal [2, 5], [query.line, query.col]
47
48
  end
48
49
 
@@ -51,6 +52,7 @@ describe GraphQL::Libgraphqlparser do
51
52
  assert_equal "moreNestedFields", fragment_def.name
52
53
  assert_equal 1, fragment_def.selections.length
53
54
  assert_equal "NestedType", fragment_def.type
55
+ assert_equal 1, fragment_def.directives.length
54
56
  assert_equal [17, 5], fragment_def.position
55
57
  end
56
58
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-libgraphqlparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-09 00:00:00.000000000 Z
11
+ date: 2016-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.0
19
+ version: 0.11.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.10.0
26
+ version: 0.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -154,7 +154,8 @@ description:
154
154
  email:
155
155
  - rdmosolgo@gmail.com
156
156
  executables: []
157
- extensions: []
157
+ extensions:
158
+ - ext/libgraphqlparser/extconf.rb
158
159
  extra_rdoc_files: []
159
160
  files:
160
161
  - ".gitignore"