Skip to content

Commit b10f40d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into execution-error-path
2 parents adf0c0f + de11666 commit b10f40d

25 files changed

+546
-75
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ gemfiles/*.lock
99
.bundle/
1010
vendor/
1111
.idea/
12+
13+
_site
14+
.sass-cache
15+
.jekyll-metadata
16+
gh-pages/
17+
guides/index.md

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@
88

99
### Bug fixes
1010

11+
## 0.18.14 (20 Sep 2016)
12+
13+
### Breaking changes
14+
15+
- Directives are no longer considered as "conflicts" in query validation. This is in conformity with the spec, but a change for graphql-ruby #263
16+
17+
### Features
18+
19+
- Query analyzers may emit errors by raising `GraphQL::AnalysisError`s during `#call` or returning a single error or an array of errors from `#final_value` #262
20+
21+
### Bug fixes
22+
23+
- Merge fields even when `@skip` / `@include` are not identical #263
24+
- Fix possible infinite loop in `FieldsWillMerge` validation #261
25+
1126
## 0.18.13 (19 Sep 2016)
1227

1328
### Bug fixes

Rakefile

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,103 @@ task :console do
2626
IRB.start
2727
end
2828

29+
30+
2931
desc "Use Racc & Ragel to regenerate parser.rb & lexer.rb from configuration files"
3032
task :build_parser do
3133
`rm lib/graphql/language/parser.rb lib/graphql/language/lexer.rb `
3234
`racc lib/graphql/language/parser.y -o lib/graphql/language/parser.rb`
3335
`ragel -R lib/graphql/language/lexer.rl`
3436
end
37+
38+
namespace :site do
39+
task :generate_readme_index do
40+
File.open("guides/index.md", "w") do |fo|
41+
fo.puts "---\npermalink: \"/\"\n---\n"
42+
File.foreach("readme.md") do |li|
43+
fo.puts li
44+
end
45+
end
46+
end
47+
48+
desc "View the documentation site locally"
49+
task :serve => :generate_readme_index do
50+
require "jekyll"
51+
52+
# Generate the site in server mode.
53+
puts "Running Jekyll..."
54+
options = {
55+
"source" => File.expand_path("guides"),
56+
"destination" => File.expand_path("guides/_site"),
57+
"watch" => true,
58+
"serving" => true
59+
}
60+
Jekyll::Commands::Build.process(options)
61+
Jekyll::Commands::Serve.process(options)
62+
end
63+
64+
desc "Commit the local site to the gh-pages branch and publish to GitHub Pages"
65+
task :publish => [:generate_readme_index, :html_proofer] do
66+
# Ensure the gh-pages dir exists so we can generate into it.
67+
puts "Checking for gh-pages dir..."
68+
unless File.exist?("./gh-pages")
69+
puts "Creating gh-pages dir..."
70+
sh "git clone [email protected]:rmosolgo/graphql-ruby gh-pages"
71+
end
72+
73+
# Ensure latest gh-pages branch history.
74+
Dir.chdir("gh-pages") do
75+
sh "git checkout gh-pages"
76+
sh "git pull origin gh-pages"
77+
end
78+
79+
# Proceed to purge all files in case we removed a file in this release.
80+
puts "Cleaning gh-pages directory..."
81+
purge_exclude = %w[
82+
gh-pages/.
83+
gh-pages/..
84+
gh-pages/.git
85+
gh-pages/.gitignore
86+
]
87+
FileList["gh-pages/{*,.*}"].exclude(*purge_exclude).each do |path|
88+
sh "rm -rf #{path}"
89+
end
90+
91+
# Copy site to gh-pages dir.
92+
puts "Building site into gh-pages branch..."
93+
ENV['JEKYLL_ENV'] = 'production'
94+
require "jekyll"
95+
Jekyll::Commands::Build.process({
96+
"source" => File.expand_path("guides"),
97+
"destination" => File.expand_path("gh-pages"),
98+
"sass" => { "style" => "compressed" }
99+
})
100+
101+
File.open('gh-pages/.nojekyll', 'wb') { |f| f.puts(":dog: food.") }
102+
103+
# Commit and push.
104+
puts "Committing and pushing to GitHub Pages..."
105+
sha = `git rev-parse HEAD`.strip
106+
Dir.chdir('gh-pages') do
107+
sh "git add ."
108+
sh "git commit --allow-empty -m 'Updating to #{sha}.'"
109+
sh "git push origin gh-pages"
110+
end
111+
puts 'Done.'
112+
end
113+
114+
desc "Test the generated HTML files"
115+
task :html_proofer => :generate_readme_index do
116+
require "html-proofer"
117+
118+
Dir.chdir("guides") do
119+
system "bundle exec jekyll build"
120+
end
121+
122+
config = {
123+
:assume_extension => true
124+
}
125+
126+
HTMLProofer.check_directory("./guides/_site", config).run
127+
end
128+
end

graphql.gemspec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ Gem::Specification.new do |s|
3434
s.add_development_dependency "appraisal"
3535
s.add_development_dependency "sequel"
3636
s.add_development_dependency "sqlite3"
37+
38+
# website stuff
39+
s.add_development_dependency "github-pages"
40+
s.add_development_dependency "html-proofer"
3741
end

guides/_config.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
title: GraphQL Ruby
2+
baseurl: "/graphql-ruby"
3+
url: "https://rmosolgo.github.io"
4+
5+
exclude:
6+
- .gitignore
7+
8+
# Build settings
9+
markdown: kramdown
10+
highlighter: rouge
11+
12+
kramdown:
13+
auto_ids: true
14+
hard_wrap: false
15+
input: GFM
16+
17+
defaults:
18+
-
19+
scope:
20+
path: ""
21+
values:
22+
layout: "default"

guides/_layouts/default.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<!DOCTYPE HTML>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>GraphQL Ruby</title>
6+
<link rel="stylesheet" href="{{ site.baseurl }}/css/main.css">
7+
<link rel="icon" href="{{ site.baseurl }}/graphql-ruby-icon.png">
8+
<meta name="generator">
9+
</head>
10+
<body class="hack">
11+
<div class="container">
12+
<div style="display: flex; justify-content: center;">
13+
<strong style="white-space: pre; line-height: 1.1em; display: inline-block; font-size: 8px;">
14+
▄██████▄ ▄████████ ▄████████ ▄███████▄ ▄█ █▄ ████████▄ ▄█
15+
███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███
16+
███ █▀ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███
17+
▄███ ▄███▄▄▄▄██▀ ███ ███ ███ ███ ▄███▄▄▄▄███▄▄ ███ ███ ███
18+
▀▀███ ████▄ ▀▀███▀▀▀▀▀ ▀███████████ ▀█████████▀ ▀▀███▀▀▀▀███▀ ███ ███ ███
19+
███ ███ ▀███████████ ███ ███ ███ ███ ███ ███ ███ ███
20+
███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ▀ ███ ███▌ ▄
21+
████████▀ ███ ███ ███ █▀ ▄████▀ ███ █▀ ▀██████▀▄█ █████▄▄██
22+
███ ███ ▀
23+
</strong>
24+
</div>
25+
<p style="text-align: center;">A GraphQL server implementation for Ruby</p>
26+
27+
<div class="grid -between">
28+
<div class="cell -3of12">
29+
<h3><a href="{% if jekyll.environment == 'development' %}/{% else %}{{ site.baseurl }}{% endif %}">Readme</a></h3>
30+
<h3>Guides</h3>
31+
<ul>
32+
<li><a href="{{ site.baseurl }}/introduction">Introduction</a></li>
33+
<li><a href="{{ site.baseurl }}/defining_your_schema">Defining a Schema</a></li>
34+
<li><a href="{{ site.baseurl }}/executing_queries">Executing Queries</a></li>
35+
<li><a href="{{ site.baseurl }}/code_reuse">Code Reuse</a></li>
36+
<li><a href="{{ site.baseurl }}/security">Security</a></li>
37+
<li><a href="{{ site.baseurl }}/testing">Testing</a></li>
38+
</ul>
39+
<h3><a href="http://www.rubydoc.info/github/rmosolgo/graphql-ruby">API Docs</a></h3>
40+
<h3><a href="https://github.com/rmosolgo/graphql-ruby">Source Code</a></h3>
41+
</div>
42+
<div class="cell -9of12">
43+
{{ content }}
44+
</div>
45+
</div>
46+
</div>
47+
</body>
48+
</html>

guides/code_reuse.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# Code Reuse with GraphQL
1+
---
2+
title: Code Reuse with GraphQL
3+
---
24

35
Here are a few techniques for code reuse with graphql-ruby:
46

57
- [Resolver classes](#resolver-classes)
68
- [Dynamically defining types](#dynamically-defining-types)
7-
- [Functional composition and `resolve`](#functional-composition-and-resolve)
9+
- [Functional composition and `resolve`](#functional-composition--resolve)
810

911
Besides reducing duplicate code, these approaches also allow you to test parts of your schema in isolation.
1012

0 commit comments

Comments
 (0)