graphql-docs 1.0.0.pre2 → 1.0.0.pre3
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 +4 -4
- data/lib/graphql-docs/configuration.rb +1 -1
- data/lib/graphql-docs/generator.rb +1 -26
- data/lib/graphql-docs/helpers.rb +25 -0
- data/lib/graphql-docs/layouts/{graphql_operation.html → graphql_operations.html} +0 -0
- data/lib/graphql-docs/layouts/includes/connections.html +1 -1
- data/lib/graphql-docs/parser.rb +2 -1
- data/lib/graphql-docs/renderer.rb +3 -2
- data/lib/graphql-docs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 264a575490a5ac4ef54c6aa8597d34483b17e402
|
4
|
+
data.tar.gz: fbc39afcf946b906866d749da9889ab3a3abdb72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ff094577aead37f01f447087c1fb01396ed7ad4f176c41ee2f389faf6ebde32236406db331c2c281e4140a6da941f273ab57ec3b70c3f7b2ae7391b938c74b7
|
7
|
+
data.tar.gz: 30c56545dfb676f0814211c80d9f9fda55378907d5c643b06ae1628ca11d7451fd3d56735c6ffb40a0ffa26c9252a53f2d6ae697bbe46d6b0e7e124350b18e74
|
@@ -27,7 +27,7 @@ module GraphQLDocs
|
|
27
27
|
|
28
28
|
includes: "#{File.dirname(__FILE__)}/layouts/includes",
|
29
29
|
|
30
|
-
|
30
|
+
operations: "#{File.dirname(__FILE__)}/layouts/graphql_operations.html",
|
31
31
|
objects: "#{File.dirname(__FILE__)}/layouts/graphql_objects.html",
|
32
32
|
mutations: "#{File.dirname(__FILE__)}/layouts/graphql_mutations.html",
|
33
33
|
interfaces: "#{File.dirname(__FILE__)}/layouts/graphql_interfaces.html",
|
@@ -13,7 +13,7 @@ module GraphQLDocs
|
|
13
13
|
|
14
14
|
@renderer = @options[:renderer].new(@parsed_schema, @options)
|
15
15
|
|
16
|
-
@graphql_operation_template = ERB.new(File.read(@options[:templates][:
|
16
|
+
@graphql_operation_template = ERB.new(File.read(@options[:templates][:operations]))
|
17
17
|
@graphql_object_template = ERB.new(File.read(@options[:templates][:objects]))
|
18
18
|
@graphql_mutations_template = ERB.new(File.read(@options[:templates][:mutations]))
|
19
19
|
@graphql_interfaces_template = ERB.new(File.read(@options[:templates][:interfaces]))
|
@@ -198,30 +198,5 @@ module GraphQLDocs
|
|
198
198
|
contents = @renderer.render(contents, type: type, name: name)
|
199
199
|
File.write(File.join(path, 'index.html'), contents) unless contents.nil?
|
200
200
|
end
|
201
|
-
|
202
|
-
def split_into_metadata_and_contents(contents)
|
203
|
-
opts = {}
|
204
|
-
pieces = yaml_split(contents)
|
205
|
-
if pieces.size < 4
|
206
|
-
raise RuntimeError.new(
|
207
|
-
"The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.",
|
208
|
-
)
|
209
|
-
end
|
210
|
-
# Parse
|
211
|
-
begin
|
212
|
-
meta = YAML.load(pieces[2]) || {}
|
213
|
-
rescue Exception => e # rubocop:disable Lint/RescueException
|
214
|
-
raise "Could not parse YAML for #{name}: #{e.message}"
|
215
|
-
end
|
216
|
-
[meta, pieces[4]]
|
217
|
-
end
|
218
|
-
|
219
|
-
def has_yaml?(contents)
|
220
|
-
contents =~ /\A-{3,5}\s*$/
|
221
|
-
end
|
222
|
-
|
223
|
-
def yaml_split(contents)
|
224
|
-
contents.split(/^(-{5}|-{3})[ \t]*\r?\n?/, 3)
|
225
|
-
end
|
226
201
|
end
|
227
202
|
end
|
data/lib/graphql-docs/helpers.rb
CHANGED
@@ -53,6 +53,31 @@ module GraphQLDocs
|
|
53
53
|
@parsed_schema[:scalar_types] || []
|
54
54
|
end
|
55
55
|
|
56
|
+
def split_into_metadata_and_contents(contents)
|
57
|
+
opts = {}
|
58
|
+
pieces = yaml_split(contents)
|
59
|
+
if pieces.size < 4
|
60
|
+
raise RuntimeError.new(
|
61
|
+
"The file '#{content_filename}' appears to start with a metadata section (three or five dashes at the top) but it does not seem to be in the correct format.",
|
62
|
+
)
|
63
|
+
end
|
64
|
+
# Parse
|
65
|
+
begin
|
66
|
+
meta = YAML.load(pieces[2]) || {}
|
67
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
68
|
+
raise "Could not parse YAML for #{name}: #{e.message}"
|
69
|
+
end
|
70
|
+
[meta, pieces[4]]
|
71
|
+
end
|
72
|
+
|
73
|
+
def has_yaml?(contents)
|
74
|
+
contents =~ /\A-{3,5}\s*$/
|
75
|
+
end
|
76
|
+
|
77
|
+
def yaml_split(contents)
|
78
|
+
contents.split(/^(-{5}|-{3})[ \t]*\r?\n?/, 3)
|
79
|
+
end
|
80
|
+
|
56
81
|
private
|
57
82
|
|
58
83
|
def fetch_include(filename)
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% connections.each do |connection| %>
|
2
2
|
|
3
3
|
<div class="field-entry <%= classes[:field_entry] %>">
|
4
|
-
<span class="field-name connection-name"><%= connection[:name] %> (<a href="<%= base_url %>/<%= connection[:type][:path] %>"
|
4
|
+
<span class="field-name connection-name"><%= connection[:name] %> (<a href="<%= base_url %>/<%= connection[:type][:path] %>"><code><%= connection[:type][:info] %></code></a>)</span>
|
5
5
|
|
6
6
|
<div class="description-wrapper">
|
7
7
|
<p><%= connection[:description] %></p>
|
data/lib/graphql-docs/parser.rb
CHANGED
@@ -6,6 +6,8 @@ module GraphQLDocs
|
|
6
6
|
class Renderer
|
7
7
|
include Helpers
|
8
8
|
|
9
|
+
attr_reader :options
|
10
|
+
|
9
11
|
def initialize(parsed_schema, options)
|
10
12
|
@parsed_schema = parsed_schema
|
11
13
|
@options = options
|
@@ -44,8 +46,7 @@ module GraphQLDocs
|
|
44
46
|
end
|
45
47
|
|
46
48
|
def to_html(string)
|
47
|
-
|
48
|
-
CommonMarker.render_html(string, :DEFAULT).strip
|
49
|
+
@pipeline.to_html(string)
|
49
50
|
end
|
50
51
|
|
51
52
|
private
|
data/lib/graphql-docs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
@@ -287,7 +287,7 @@ files:
|
|
287
287
|
- lib/graphql-docs/layouts/graphql_interfaces.html
|
288
288
|
- lib/graphql-docs/layouts/graphql_mutations.html
|
289
289
|
- lib/graphql-docs/layouts/graphql_objects.html
|
290
|
-
- lib/graphql-docs/layouts/
|
290
|
+
- lib/graphql-docs/layouts/graphql_operations.html
|
291
291
|
- lib/graphql-docs/layouts/graphql_scalars.html
|
292
292
|
- lib/graphql-docs/layouts/graphql_unions.html
|
293
293
|
- lib/graphql-docs/layouts/includes/arguments.html
|