graphql-docs 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/graphql-docs/generator.rb +11 -7
- data/lib/graphql-docs/helpers.rb +1 -0
- data/lib/graphql-docs/renderer.rb +1 -2
- data/lib/graphql-docs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34778b48d1030614b38cb76926c0a9efb07e37ff
|
4
|
+
data.tar.gz: deb65920cdd0793ce20d6eb22b3da6404090e94c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 513bf928412916481c9e63622c527f19ea0e8b652dfef73b3f3ed35e326c9853e915280b785caba06fc15addca760a8660cf477bf6eb07c1d2f07a07fdebae2e
|
7
|
+
data.tar.gz: eb0fc393dc01f797cbae2fca181ab450956d4e50be8611170df3f31525f7acd12b2f40b664a08248257f4232688617294bf8bfbe2ff8c08fb520c02f99cd171b
|
data/Rakefile
CHANGED
@@ -46,7 +46,7 @@ end
|
|
46
46
|
|
47
47
|
desc 'Generate and publish docs to gh-pages'
|
48
48
|
task :publish do
|
49
|
-
Rake::Task[:generate_sample].invoke('https://www.gjtorikian.com/graphql-docs
|
49
|
+
Rake::Task[:generate_sample].invoke('https://www.gjtorikian.com/graphql-docs')
|
50
50
|
Dir.mktmpdir do |tmp|
|
51
51
|
system "mv output/* #{tmp}"
|
52
52
|
system 'git checkout gh-pages'
|
@@ -54,7 +54,7 @@ module GraphQLDocs
|
|
54
54
|
def create_graphql_object_pages
|
55
55
|
graphql_object_types.each do |object_type|
|
56
56
|
next if object_type['name'].start_with?('__')
|
57
|
-
opts =
|
57
|
+
opts = default_generator_options(type: object_type)
|
58
58
|
contents = @graphql_object_template.result(OpenStruct.new(opts).instance_eval { binding })
|
59
59
|
write_file('object', object_type['name'], contents)
|
60
60
|
end
|
@@ -67,7 +67,7 @@ module GraphQLDocs
|
|
67
67
|
input = graphql_input_object_types.find { |t| t['name'] == input_name }
|
68
68
|
payload = graphql_object_types.find { |t| t['name'] == return_name }
|
69
69
|
|
70
|
-
opts = { type: mutation, input_fields: input, return_fields: payload }
|
70
|
+
opts = default_generator_options({ type: mutation, input_fields: input, return_fields: payload })
|
71
71
|
|
72
72
|
contents = @graphql_mutations_template.result(OpenStruct.new(opts).instance_eval { binding })
|
73
73
|
write_file('mutation', mutation['name'], contents)
|
@@ -76,7 +76,7 @@ module GraphQLDocs
|
|
76
76
|
|
77
77
|
def create_graphql_interface_pages
|
78
78
|
graphql_interface_types.each do |interface_type|
|
79
|
-
opts = { type: interface_type }
|
79
|
+
opts = default_generator_options({ type: interface_type })
|
80
80
|
|
81
81
|
contents = @graphql_interfaces_template.result(OpenStruct.new(opts).instance_eval { binding })
|
82
82
|
write_file('interface', interface_type['name'], contents)
|
@@ -85,7 +85,7 @@ module GraphQLDocs
|
|
85
85
|
|
86
86
|
def create_graphql_enum_pages
|
87
87
|
graphql_enum_types.each do |enum_type|
|
88
|
-
opts = { type: enum_type }
|
88
|
+
opts = default_generator_options({ type: enum_type })
|
89
89
|
|
90
90
|
contents = @graphql_enums_template.result(OpenStruct.new(opts).instance_eval { binding })
|
91
91
|
write_file('enum', enum_type['name'], contents)
|
@@ -94,7 +94,7 @@ module GraphQLDocs
|
|
94
94
|
|
95
95
|
def create_graphql_union_pages
|
96
96
|
graphql_union_types.each do |union_type|
|
97
|
-
opts = { type: union_type }
|
97
|
+
opts = default_generator_options({ type: union_type })
|
98
98
|
|
99
99
|
contents = @graphql_unions_template.result(OpenStruct.new(opts).instance_eval { binding })
|
100
100
|
write_file('union', union_type['name'], contents)
|
@@ -103,7 +103,7 @@ module GraphQLDocs
|
|
103
103
|
|
104
104
|
def create_graphql_input_object_pages
|
105
105
|
graphql_input_object_types.each do |input_object_type|
|
106
|
-
opts = { type: input_object_type }
|
106
|
+
opts = default_generator_options({ type: input_object_type })
|
107
107
|
|
108
108
|
contents = @graphql_input_objects_template.result(OpenStruct.new(opts).instance_eval { binding })
|
109
109
|
write_file('input_object', input_object_type['name'], contents)
|
@@ -112,7 +112,7 @@ module GraphQLDocs
|
|
112
112
|
|
113
113
|
def create_graphql_scalar_pages
|
114
114
|
graphql_scalar_types.each do |scalar_type|
|
115
|
-
opts = { type: scalar_type }
|
115
|
+
opts = default_generator_options({ type: scalar_type })
|
116
116
|
|
117
117
|
contents = @graphql_scalars_template.result(OpenStruct.new(opts).instance_eval { binding })
|
118
118
|
write_file('scalar', scalar_type['name'], contents)
|
@@ -121,6 +121,10 @@ module GraphQLDocs
|
|
121
121
|
|
122
122
|
private
|
123
123
|
|
124
|
+
def default_generator_options(opts = {})
|
125
|
+
@options.merge(opts).merge(helper_methods)
|
126
|
+
end
|
127
|
+
|
124
128
|
def write_file(type, name, contents)
|
125
129
|
if type == 'static'
|
126
130
|
if name == 'index'
|
data/lib/graphql-docs/helpers.rb
CHANGED
@@ -36,8 +36,7 @@ module GraphQLDocs
|
|
36
36
|
def render(type, name, contents)
|
37
37
|
contents = @pipeline.to_html(contents)
|
38
38
|
return contents if @graphql_default_layout.nil?
|
39
|
-
opts = @options
|
40
|
-
opts = opts.merge({ contents: contents, type: type, name: name}).merge(helper_methods)
|
39
|
+
opts = { base_url: @options[:base_url] }.merge({ contents: contents, type: type, name: name}).merge(helper_methods)
|
41
40
|
@graphql_default_layout.result(OpenStruct.new(opts).instance_eval { binding })
|
42
41
|
end
|
43
42
|
|
data/lib/graphql-docs/version.rb
CHANGED