graphql-docs 1.4.1 → 1.5.0

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: ff2d6fddab0c0c4dd83298aa1137a5ff50565ed4
4
- data.tar.gz: 5b5f461978561689bd4b4593f0e453c2e59cdff7
3
+ metadata.gz: 1be3cf99394c17dec2e6808c2190bcde9ab6853b
4
+ data.tar.gz: c90aea1970848013e577153479682d043a8491c4
5
5
  SHA512:
6
- metadata.gz: 7235b43da05965859f48c16be81e18225d80cd0f2b0d22a4748d22803431bd9dedb10eaae485105d27455d45ff1f47e135bc0e55600e879a0d4a9fa1c9f2aeba
7
- data.tar.gz: 0a00134d9c51cff577e7c499a7ec6d335eb2624842da704a23f7b55bbf7cad6df6765210e4dc80d961095bd4acbf0ace2b4da561039126cc95acac857ab8207e
6
+ metadata.gz: 1612ff5cd6464ab3b9397782e8b7c6cd169d2259f23d418ce0cf35fa10c379950d3acf1187576fea4a112cb89a4caf156de4c6e5f57324cd75c344326da4bb41
7
+ data.tar.gz: 7abb66d7a2eeb1d561b908bad5eb549771507c956b5a631761439254f42b2180f324bead506bccf46be5ed6b0931cb28767c654f8bf6ed7f313ee9f98abd0271
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  gem 'commonmarker', '~> 0.16', require: false
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'bundler/gem_tasks'
2
3
  require 'rake/testtask'
3
4
 
data/graphql-docs.gemspec CHANGED
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'graphql-docs/version'
data/lib/graphql-docs.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'graphql-docs/helpers'
2
3
  require 'graphql-docs/renderer'
3
4
  require 'graphql-docs/configuration'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GraphQLDocs
2
3
  module Configuration
3
4
  GRAPHQLDOCS_DEFAULTS = {
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'erb'
2
3
  require 'sass'
3
4
 
@@ -210,8 +211,9 @@ module GraphQLDocs
210
211
  contents.gsub!(/^\s{4}/m, ' ')
211
212
  end
212
213
 
213
- contents = @renderer.render(contents, type: type, name: name)
214
- File.write(File.join(path, 'index.html'), contents) unless contents.nil?
214
+ filename = File.join(path, 'index.html')
215
+ contents = @renderer.render(contents, type: type, name: name, filename: filename)
216
+ File.write(filename, contents) unless contents.nil?
215
217
  end
216
218
  end
217
219
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GraphQLDocs
2
3
  module Helpers
3
4
  SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'graphql'
2
3
 
3
4
  module GraphQLDocs
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'html/pipeline'
2
3
  require 'yaml'
3
4
  require 'extended-markdown-filter'
@@ -36,17 +37,17 @@ module GraphQLDocs
36
37
  @pipeline = HTML::Pipeline.new(filters, @pipeline_config[:context])
37
38
  end
38
39
 
39
- def render(contents, type: nil, name: nil)
40
- opts = { base_url: @options[:base_url] }.merge({ type: type, name: name}).merge(helper_methods)
40
+ def render(contents, type: nil, name: nil, filename: nil)
41
+ opts = { base_url: @options[:base_url], output_dir: @options[:output_dir] }.merge({ type: type, name: name, filename: filename}).merge(helper_methods)
41
42
 
42
- contents = to_html(contents)
43
+ contents = to_html(contents, context: { filename: filename })
43
44
  return contents if @graphql_default_layout.nil?
44
45
  opts[:content] = contents
45
46
  @graphql_default_layout.result(OpenStruct.new(opts).instance_eval { binding })
46
47
  end
47
48
 
48
- def to_html(string)
49
- @pipeline.to_html(string)
49
+ def to_html(string, context: {})
50
+ @pipeline.to_html(string, context)
50
51
  end
51
52
 
52
53
  private
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GraphQLDocs
2
- VERSION = '1.4.1'
3
+ VERSION = '1.5.0'.freeze
3
4
  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.4.1
4
+ version: 1.5.0
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-06-27 00:00:00.000000000 Z
11
+ date: 2018-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql