-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Merge] Add Ratpack integration module
- Loading branch information
Showing
109 changed files
with
979 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
plugins { | ||
id 'groovy' | ||
id 'maven-publish' | ||
} | ||
|
||
apply plugin: 'com.jfrog.bintray' | ||
apply from: "../gradle/groovydoc.gradle" | ||
|
||
dependencies { | ||
compile 'com.graphql-java:graphql-java:7.0' | ||
compile "org.codehaus.groovy:groovy-all:$groovy" | ||
|
||
testCompile "org.spockframework:spock-core:$spock" | ||
testCompile 'junit:junit:4.12' | ||
} | ||
|
||
compileGroovy { | ||
groovyOptions.configurationScript = new File(projectDir, folder_compiler) | ||
} | ||
|
||
sourceSets { | ||
groovydoc { | ||
resources { | ||
srcDir folder_groovydoc | ||
} | ||
} | ||
} | ||
|
||
groovydoc { | ||
link 'https://docs.oracle.com/javase/8/docs/api/', 'java' | ||
link 'http://docs.groovy-lang.org/latest/html/api/', 'groovy', 'org.codehaus.groovy' | ||
link 'http://graphql-java.github.io/graphql-java', 'graphql' | ||
docTitle project.name | ||
|
||
destinationDir = file("../gql-docs/build/site/api") | ||
classpath = sourceSets.groovydoc.output + classpath | ||
} | ||
|
||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
artifacts { | ||
archives sourcesJar | ||
} | ||
|
||
publishing { | ||
publications { | ||
'gql-core'(MavenPublication) { | ||
groupId "$releaseGroup" | ||
artifactId 'gql-core' | ||
version "$releaseVersion" | ||
|
||
from components.java | ||
artifact sourcesJar | ||
} | ||
} | ||
} | ||
|
||
bintray { | ||
user = "$bintrayUser" | ||
key = "$bintrayKey" | ||
|
||
publish = true | ||
publications = ['gql-core'] | ||
|
||
pkg { | ||
repo = 'maven' | ||
name = 'gql' | ||
userOrg = 'grooviter' | ||
desc = "$releaseDescription" | ||
websiteUrl = 'http://grooviter.github.io/gql/' | ||
issueTrackerUrl = 'https://github.com/grooviter/gql/issues' | ||
licenses = ['Apache-2.0'] | ||
vcsUrl = 'https://github.com/grooviter/gql.git' | ||
labels = ['groovy', 'graphql', 'dsl', 'asts'] | ||
|
||
version { | ||
name = "$releaseVersion" | ||
desc = 'GQL Release' | ||
released = new Date() | ||
vcsTag = "$releaseVersion" | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
plugins { | ||
id 'org.asciidoctor.convert' version '1.5.3' | ||
} | ||
|
||
apply plugin: "org.ajoberstar.git-publish" | ||
|
||
task generateDocumentation() { | ||
dependsOn ':gql-core:groovydoc',':gql-ratpack:javadoc', asciidoctor | ||
|
||
doLast { | ||
copy { | ||
from "src/docs/site" | ||
into "$buildDir/site" | ||
} | ||
} | ||
} | ||
|
||
task setAuthentication() { | ||
doLast { | ||
System.setProperty('org.ajoberstar.grgit.auth.username', githubToken) | ||
} | ||
} | ||
|
||
gitPublish { | ||
repoUri = 'https://github.com/grooviter/gql.git' | ||
branch = 'gh-pages' | ||
|
||
contents { | ||
from file('build/site') | ||
} | ||
|
||
commitMessage = "Released version ${releaseVersion}" | ||
} | ||
|
||
gitPublishPush { | ||
dependsOn 'setAuthentication' | ||
dependsOn 'generateDocumentation' | ||
} | ||
|
||
|
||
|
||
asciidoctor { | ||
requires 'asciidoctor-diagram' | ||
|
||
outputDir file("$buildDir/site/docs") | ||
attributes 'endpoint-url': 'http://github.com/grooviter/gql', | ||
'source-highlighter': 'coderay', | ||
'releaseVersion': releaseVersion, | ||
'imagesdir': './images', | ||
'toc': 'left', | ||
'icons': 'font', | ||
'toclevels': 3 | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
== Ratpack | ||
|
||
Ratpack http://ratpack.io is a set of Java libraries for building | ||
scalable HTTP applications. | ||
|
||
You can use Ratpack to make a given GraphQL schema available through | ||
HTTP. | ||
|
||
=== Example | ||
|
||
Here is a minimum Groovy working example of a GraphQL schema exposed | ||
through HTTP thanks to Ratpack. | ||
|
||
[source, groovy] | ||
---- | ||
@Grapes([ | ||
@Grab('io.ratpack:ratpack-groovy:1.5.1'), | ||
@Grab('org.slf4j:slf4j-simple:1.7.25'), | ||
@Grab('com.github.grooviter:gql-ratpack:0.2.0') | ||
]) | ||
import static ratpack.groovy.Groovy.ratpack | ||
import gql.DSL | ||
import gql.ratpack.GraphQLModule | ||
import gql.ratpack.GraphQLHandler | ||
import gql.ratpack.GraphiQLHandler | ||
def schema = DSL.schema { // <1> | ||
queries('Queries') { | ||
field('hello') { | ||
type GraphQLString | ||
staticValue 'GraphQL and Groovy!' | ||
} | ||
} | ||
} | ||
ratpack { | ||
bindings { | ||
module GraphQLModule // <2> | ||
bindInstance schema // <3> | ||
} | ||
handlers { | ||
post('graphql', GraphQLHandler) // <4> | ||
get('graphql/browser', GraphiQLHandler) // <5> | ||
} | ||
} | ||
---- | ||
<1> Create the schema using `gql.DSL` api | ||
<2> Add the `gql.ratpack.GraphQLModule` in order to provide sane defaults to handlers and GraphiQL configuration | ||
<3> Add the schema to Ratpack's registry | ||
<4> Register the `GraphQLHandler` to handle all GrahpQL request at `/graphql` | ||
<5> Register the `GraphiQLHandler` to be able to expose GraphiQL client at `/graphql/browser`. | ||
|
||
=== Configuration | ||
|
||
If you would like to disable the GraphiQL client, you can always configure the | ||
GraphQLModule setting the `activateGraphiQL` to `false`. | ||
|
||
[source, groovy] | ||
---- | ||
ratpack { | ||
bindings { | ||
module(GraphQLModule) { conf -> | ||
conf.activateGraphiQL = false // <1> | ||
} | ||
//... | ||
} | ||
handlers { | ||
//... | ||
} | ||
} | ||
---- | ||
|
||
<1> Setting the `activateGraphiQL` to false will disable GraphiQL client | ||
|
||
[sidebar] | ||
.GraphiQL Client limitation | ||
**** | ||
At the moment, the GraphQL module provides GraphiQL as an static html | ||
page. However the resources (scripts/css) required to make it work | ||
properly aren't loaded from Ratpack but retrieved online once it's | ||
loaded by the browser. | ||
That means the GraphiQL client will only work if the browser accessing | ||
it has online access. | ||
Of course, the idea for upcoming releases would be to serve everything | ||
from the module so that it could be used under any circumstances. | ||
**** |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.