graphql-docs 1.3.4 → 1.3.5

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: 42cef7fe385194286416914af8452a76ccf6a5f1
4
- data.tar.gz: ee5a5c551ed610f354946967535ac72f421e8d67
3
+ metadata.gz: bd333b3b4214ce691d4f8f64645c706280a068ff
4
+ data.tar.gz: 1dc7d2814ce8ecd1d5751a8acda770ecfc8cddf7
5
5
  SHA512:
6
- metadata.gz: 664c2cbb744f49cc720181d751ae61c2169dae6fc803a2d48c2a27a74e9f61f3db768e87dc723dadb76edb153191e4c04d65381833563bc048db5dc27ac8711b
7
- data.tar.gz: 872c42d23f62fe7c4ed07e1eb421c360a96c6e37643d500a20f4e33e7cb4cc79aa6cfcf20923dc078ee3af521cac1b9af539959837f2df35d58a34f6d1ffead1
6
+ metadata.gz: 6704934871fee571da7c31c4f00e18f8ff06d27ba3ef8e079825e3939eff1176df70c63f0d1287de89ebfd2b28401305b3efe8c6e4eb45ffaacc74b00571b030
7
+ data.tar.gz: b710e45e461dc202921b7ee78ccbdaf2022f282bb92d26fc144edf666a6c41c11d15518051671addaadf2de98cb40c3f89d2018c23617ae71bba25a972afebe2
data/.travis.yml CHANGED
@@ -1,7 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.4
4
- - 2.4.0
3
+ - 2.3.6
4
+ - 2.4.3
5
+ - 2.5.0
5
6
 
6
7
  git:
7
8
  depth: 10
@@ -23,4 +24,4 @@ addons:
23
24
  matrix:
24
25
  include:
25
26
  - script: bundle exec rake rubocop
26
- rvm: 2.4.0
27
+ rvm: 2.5.0
@@ -13,14 +13,14 @@ 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][:operations]), nil, '>')
17
- @graphql_object_template = ERB.new(File.read(@options[:templates][:objects]), nil, '>')
18
- @graphql_mutations_template = ERB.new(File.read(@options[:templates][:mutations]), nil, '>')
19
- @graphql_interfaces_template = ERB.new(File.read(@options[:templates][:interfaces]), nil, '>')
20
- @graphql_enums_template = ERB.new(File.read(@options[:templates][:enums]), nil, '>')
21
- @graphql_unions_template = ERB.new(File.read(@options[:templates][:unions]), nil, '>')
22
- @graphql_input_objects_template = ERB.new(File.read(@options[:templates][:input_objects]), nil, '>')
23
- @graphql_scalars_template = ERB.new(File.read(@options[:templates][:scalars]), nil, '>')
16
+ @graphql_operation_template = ERB.new(File.read(@options[:templates][:operations]))
17
+ @graphql_object_template = ERB.new(File.read(@options[:templates][:objects]))
18
+ @graphql_mutations_template = ERB.new(File.read(@options[:templates][:mutations]))
19
+ @graphql_interfaces_template = ERB.new(File.read(@options[:templates][:interfaces]))
20
+ @graphql_enums_template = ERB.new(File.read(@options[:templates][:enums]))
21
+ @graphql_unions_template = ERB.new(File.read(@options[:templates][:unions]))
22
+ @graphql_input_objects_template = ERB.new(File.read(@options[:templates][:input_objects]))
23
+ @graphql_scalars_template = ERB.new(File.read(@options[:templates][:scalars]))
24
24
  end
25
25
 
26
26
  def generate
@@ -36,35 +36,35 @@ module GraphQLDocs
36
36
  create_graphql_scalar_pages
37
37
 
38
38
  unless @options[:landing_pages][:index].nil?
39
- write_file('static', 'index', File.read(@options[:landing_pages][:index]))
39
+ write_file('static', 'index', File.read(@options[:landing_pages][:index]), trim: false)
40
40
  end
41
41
 
42
42
  unless @options[:landing_pages][:object].nil?
43
- write_file('static', 'object', File.read(@options[:landing_pages][:object]))
43
+ write_file('static', 'object', File.read(@options[:landing_pages][:object]), trim: false)
44
44
  end
45
45
 
46
46
  unless @options[:landing_pages][:mutation].nil?
47
- write_file('operation', 'mutation', File.read(@options[:landing_pages][:mutation]))
47
+ write_file('operation', 'mutation', File.read(@options[:landing_pages][:mutation]), trim: false)
48
48
  end
49
49
 
50
50
  unless @options[:landing_pages][:interface].nil?
51
- write_file('static', 'interface', File.read(@options[:landing_pages][:interface]))
51
+ write_file('static', 'interface', File.read(@options[:landing_pages][:interface]), trim: false)
52
52
  end
53
53
 
54
54
  unless @options[:landing_pages][:enum].nil?
55
- write_file('static', 'enum', File.read(@options[:landing_pages][:enum]))
55
+ write_file('static', 'enum', File.read(@options[:landing_pages][:enum]), trim: false)
56
56
  end
57
57
 
58
58
  unless @options[:landing_pages][:union].nil?
59
- write_file('static', 'union', File.read(@options[:landing_pages][:union]))
59
+ write_file('static', 'union', File.read(@options[:landing_pages][:union]), trim: false)
60
60
  end
61
61
 
62
62
  unless @options[:landing_pages][:input_object].nil?
63
- write_file('static', 'input_object', File.read(@options[:landing_pages][:input_object]))
63
+ write_file('static', 'input_object', File.read(@options[:landing_pages][:input_object]), trim: false)
64
64
  end
65
65
 
66
66
  unless @options[:landing_pages][:scalar].nil?
67
- write_file('static', 'scalar', File.read(@options[:landing_pages][:scalar]))
67
+ write_file('static', 'scalar', File.read(@options[:landing_pages][:scalar]), trim: false)
68
68
  end
69
69
 
70
70
  if @options[:use_default_styles]
@@ -172,7 +172,7 @@ module GraphQLDocs
172
172
  @options.merge(opts).merge(helper_methods)
173
173
  end
174
174
 
175
- def write_file(type, name, contents)
175
+ def write_file(type, name, contents, trim: true)
176
176
  if type == 'static'
177
177
  if name == 'index'
178
178
  path = @options[:output_dir]
@@ -191,6 +191,12 @@ module GraphQLDocs
191
191
  @options = @options.merge(meta)
192
192
  end
193
193
 
194
+ if trim
195
+ # normalize spacing so that CommonMarker doesn't treat it as `pre`
196
+ contents.gsub!(/^\s+$/, '')
197
+ contents.gsub!(/^\s{4}/m, ' ')
198
+ end
199
+
194
200
  contents = @renderer.render(contents, type: type, name: name)
195
201
  File.write(File.join(path, 'index.html'), contents) unless contents.nil?
196
202
  end
@@ -87,7 +87,7 @@ module GraphQLDocs
87
87
 
88
88
  contents = File.read(File.join(@options[:templates][:includes], filename))
89
89
 
90
- @templates[filename] = ERB.new(contents, nil, '>')
90
+ @templates[filename] = ERB.new(contents)
91
91
  end
92
92
 
93
93
  def helper_methods
@@ -1,3 +1,3 @@
1
1
  module GraphQLDocs
2
- VERSION = '1.3.4'
2
+ VERSION = '1.3.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-21 00:00:00.000000000 Z
11
+ date: 2018-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql