Skip to content
This repository was archived by the owner on Feb 10, 2019. It is now read-only.

Commit

Permalink
Added InputObjectType support
Browse files Browse the repository at this point in the history
  • Loading branch information
dmongeau committed Mar 27, 2016
1 parent 9ffef05 commit 8da9b40
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
27 changes: 8 additions & 19 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
#!/bin/zsh

#Fetch remote tags
git fetch origin 'refs/tags/*:refs/tags/*'

#Variables
LAST_VERSION=$(git tag -l | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -n 1)
NEXT_VERSION=$(echo $LAST_VERSION | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}')
VERSION=${1-${NEXT_VERSION}}
DEFAULT_MESSAGE="Release"
MESSAGE=${2-${DEFAULT_MESSAGE}}
RELEASE_BRANCH="release/$VERSION"

# Commit uncommited changes
git add .
git commit -am $MESSAGE
git push

# Create release branch
git checkout -b $RELEASE_BRANCH develop
gulp build
git add .
git commit -am "Build $NEXT_VERSION"
git push origin $RELEASE_BRANCH
git push origin develop

# Merge release branch in master
# Merge develop branch in master
git checkout master
git merge $RELEASE_BRANCH

# Merge release branch in develop
git checkout develop
git merge $RELEASE_BRANCH
git push origin develop
git merge develop

# Tag and push master
git checkout master
git tag $VERSION
git push origin master --tags

# Remove release branch
git branch -d $RELEASE_BRANCH

# Return to develop
git checkout develop
11 changes: 9 additions & 2 deletions src/Folklore/GraphQL/Support/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
use Illuminate\Support\Fluent;

use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\InterfaceType;

class Type extends Fluent {

protected static $instances = [];
protected static $inputObject = false;

public function attributes()
{
Expand All @@ -28,13 +30,14 @@ public function interfaces()

protected function getFieldResolver($name, $field)
{
$resolveMethod = 'resolve'.studly_case($name).'Field';
if(isset($field['resolve']))
{
return $field['resolve'];
}
else if(method_exists($this, 'resolve'.studly_case($name).'Field'))
else if(method_exists($this, $resolveMethod))
{
$resolver = array($this, 'resolve'.studly_case($name).'Field');
$resolver = array($this, $resolveMethod);
return function() use ($resolver)
{
$args = func_get_args();
Expand Down Expand Up @@ -106,6 +109,10 @@ public function toArray()

public function toType()
{
if($this->inputObject)
{
return new InputObjectType($this->toArray());
}
return new ObjectType($this->toArray());
}

Expand Down

0 comments on commit 8da9b40

Please sign in to comment.