graphtown 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: 7f47657af97266ba1dee3c38eab5a831ad463dbcefaa9a08b9e0452817ad2a89
4
- data.tar.gz: e7b04fc544431cb93fa8ec4b816e643556156287c299362906fc73fe45e3976a
3
+ metadata.gz: c54e2275afc874fe0761dba661b16b746a9c3716f15eb74ee50d986ac442b04b
4
+ data.tar.gz: c113a90a48131d55dcf0b4d47ce1f17d6b383c5cbfd1fb765c5171a1ddb01499
5
5
  SHA512:
6
- metadata.gz: 9eda28d3c45ae087b5be37a390e5a02a24e7c975c9c2f0d327fd0cadea2f6d60930cf908d5bb0581bee7c96798c2e15db6405a53636556b477253be61797d202
7
- data.tar.gz: b6bc01538472d9c463930e24d7ff797ee09d028f3b3df65ce7bf6d12d1dcb3df54e510f0127feb979255c731204843e5ab5e1f4db9020ce4b3f458eed0bd89cb
6
+ metadata.gz: 16912ef133cdd7ae2ae3bfbef980839b6eb8e17a320eb8df113d6aef9bd3d3cbdab1e69bb73ecf4e20add8053a826a623b29cf955a51bab38de8352aa4620e3b
7
+ data.tar.gz: a66847460dbd420e44a20f2f4ed98040d4ea72b8b22a86179eb94eff25169f86d0d46463281ee9a22d2730269b48fce64d0d18cf364765636eaff92bfc6c3695
@@ -1,7 +1,9 @@
1
- # master
1
+ # main
2
2
 
3
- * Use this file to keep track of plugin updates
3
+ # 1.0.1 / 2020-08-20
4
4
 
5
- # 0.1.0 / 2020-05-01
5
+ * Add better detection of matching/not-matching data roots
6
+
7
+ # 1.0.0 / 2020-08-14
6
8
 
7
9
  * First version
data/README.md CHANGED
@@ -10,6 +10,32 @@ Run this command to add this plugin to your site's Gemfile:
10
10
  $ bundle add graphtown -g bridgetown_plugins
11
11
  ```
12
12
 
13
+ And then add the Graphtown mixin to your site builder superclass:
14
+
15
+ ```ruby
16
+ # plugins/site_builder.rb
17
+
18
+ class SiteBuilder < Bridgetown::Builder
19
+ include Graphtown::QueryBuilder
20
+ end
21
+ ```
22
+
23
+ You'll need to add your desired GraphQL API endpoint to the site config YAML:
24
+
25
+ ```yaml
26
+ # bridgetown.config.yml
27
+
28
+ graphql_endpoint: http://localhost:1337/graphql
29
+ ```
30
+
31
+ Alternatively, you can override the `graphql_endpoint` method in your site builder or a specific builder plugin:
32
+
33
+ ```ruby
34
+ def graphql_endpoint
35
+ "https://some.other.domain/graphql"
36
+ end
37
+ ```
38
+
13
39
  ---
14
40
 
15
41
  # Documentation coming soon…
@@ -31,7 +31,12 @@ module Graphtown
31
31
 
32
32
  self.class.graphql_queries.send(
33
33
  "#{graph_name}=",
34
- client.execute(graph_dsl.to_s, query_variables).data.send(graph_name)
34
+ client.execute(graph_dsl.to_s, query_variables).data.yield_self do |data|
35
+ # avoid having to do query.foo.foo if possible
36
+ data.send(graph_name)
37
+ rescue NoMethodError
38
+ data
39
+ end
35
40
  )
36
41
  end
37
42
 
@@ -40,8 +45,6 @@ module Graphtown
40
45
  end
41
46
 
42
47
  def graphql_client
43
- raise "Please add graphql_endpoint to your config file" unless config[:graphql_endpoint]
44
-
45
48
  Graphlient::Client.new(graphql_endpoint) do |client|
46
49
  configure_graphql_client(client)
47
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Graphtown
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphtown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared White
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-14 00:00:00.000000000 Z
11
+ date: 2020-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown
@@ -146,7 +146,6 @@ files:
146
146
  - lib/graphtown.rb
147
147
  - lib/graphtown/query_builder.rb
148
148
  - lib/graphtown/version.rb
149
- - package.json
150
149
  homepage: https://github.com/whitefusionhq/graphtown
151
150
  licenses:
152
151
  - MIT
@@ -1,16 +0,0 @@
1
- {
2
- "name": "graphtown",
3
- "version": "0.1.0",
4
- "main": "frontend/javascript/index.js",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/username/graphtown.git"
8
- },
9
- "author": "Bridgetown Maintainers <maintainers@bridgetownrb.com>",
10
- "homepage": "https://www.bridgetownrb.com",
11
- "license": "MIT",
12
- "private": false,
13
- "files": [
14
- "frontend"
15
- ]
16
- }