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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9ace666d5ef2589da4991e236b929b2fd0ec58b
4
- data.tar.gz: 5273fb7bf7bab9f9c5e9fbd36e92006822e1e18d
3
+ metadata.gz: 264a575490a5ac4ef54c6aa8597d34483b17e402
4
+ data.tar.gz: fbc39afcf946b906866d749da9889ab3a3abdb72
5
5
  SHA512:
6
- metadata.gz: ad3dd49c668b82de48707dd84905b4951ecfcbb16795c690eaccb4b74276fad4fa2140530becdb38045c351802e863bd9ff27509ddd497ee7f549b5c8d420d80
7
- data.tar.gz: 98b5241afd6d9b9c0b8024a0bfcae9393b70cf51f88a50031ed3e812126bc8bd8e97d29c58c805eaa7672c664e664a8ac93b1b97ffbd25c6ef3a89c08b2f17b9
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
- operation: "#{File.dirname(__FILE__)}/layouts/graphql_operation.html",
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][:operation]))
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
@@ -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)
@@ -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] %>" class="js-connection-name"><code><%= connection[:type][:info] %></code></a>)</span>
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>
@@ -127,7 +127,8 @@ module GraphQLDocs
127
127
  private
128
128
 
129
129
  def fetch_fields(object_fields)
130
- fields = connections = []
130
+ fields = []
131
+ connections = []
131
132
 
132
133
  object_fields.values.each do |field|
133
134
  hash = {}
@@ -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
- return '' if string.nil?
48
- CommonMarker.render_html(string, :DEFAULT).strip
49
+ @pipeline.to_html(string)
49
50
  end
50
51
 
51
52
  private
@@ -1,3 +1,3 @@
1
1
  module GraphQLDocs
2
- VERSION = '1.0.0.pre2'
2
+ VERSION = '1.0.0.pre3'
3
3
  end
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.pre2
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/graphql_operation.html
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