-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpacker_docs.rb
58 lines (53 loc) · 1.23 KB
/
webpacker_docs.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class WebpackerDocs < SiteBuilder
# does not work
# graphql :docs do
# query {
# repository(owner: "rails", name: "webpacker") {
# object(expression: "master:docs/") {
# ... on Tree {
# entries {
# name
# }
# }
# }
# }
# }
# end
# Works
graphql :docs do
query {
repository(owner: "rails", name: "webpacker") {
object(expression: "master:docs/") {
id
}
}
}
end
def build
p queries.docs.repsository
# queries.docs.repository.object.entries do |entry|
# p entry
# slug = Bridgetown::Utils.slugify(entry.name)
# entry_url = entry.repository.url + "/" + entry.path
# puts entry.object.text
# doc "#{slug}.md" do
# collections "docs"
# layout "doc"
# title entry.name
# github_url entry_url
# # content entry.object.text
# date Time.new
# end
# end
end
def graphql_endpoint
"https://api.github.com/graphql"
end
def configure_graphql_client(client)
require "dotenv"
Dotenv.load(".env")
client.options[:headers] = {
"Authorization" => "bearer #{ENV["GITHUB_API_TOKEN"]}"
}
end
end