jekyll-gists-meta 0.1.0 → 0.2.0
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 +4 -4
- data/Gemfile.lock +7 -5
- data/README.md +1 -1
- data/jekyll-gists-meta.gemspec +1 -1
- data/lib/jekyll/gists/meta/version.rb +1 -1
- data/lib/jekyll/gists/meta.rb +17 -32
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abd1ec12ae583b533f4b75da5ca03f4bb3fbae56
|
4
|
+
data.tar.gz: d66a6dd22eae75bf8462956bcdfaaef840533819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b64f97ddaabc5ff0e1d4f10a6a324c8bb72d1972d6b6640b773f0724ce427ea8fcf72f107efb0a32e5596c25031ed72c9e6fcef6c4f08477cd507ba15c17c98
|
7
|
+
data.tar.gz: b3e5c45fa5ade02348ce9dbc01a5206fd4ae5ba2d633f3492f6b9e68d868fb619c2de7b534981cc3fb496cbee789465345fe3c9b7f64044351b4ade6547b3f88
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-gists-meta (0.
|
4
|
+
jekyll-gists-meta (0.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -21,6 +21,7 @@ GEM
|
|
21
21
|
http_parser.rb (0.6.0)
|
22
22
|
i18n (0.9.5)
|
23
23
|
concurrent-ruby (~> 1.0)
|
24
|
+
jaro_winkler (1.5.1)
|
24
25
|
jekyll (3.8.3)
|
25
26
|
addressable (~> 2.4)
|
26
27
|
colorator (~> 1.0)
|
@@ -46,7 +47,7 @@ GEM
|
|
46
47
|
ruby_dep (~> 1.2)
|
47
48
|
mercenary (0.3.6)
|
48
49
|
parallel (1.12.1)
|
49
|
-
parser (2.5.1.
|
50
|
+
parser (2.5.1.2)
|
50
51
|
ast (~> 2.4.0)
|
51
52
|
pathutil (0.16.1)
|
52
53
|
forwardable-extended (~> 2.6)
|
@@ -71,7 +72,8 @@ GEM
|
|
71
72
|
diff-lcs (>= 1.2.0, < 2.0)
|
72
73
|
rspec-support (~> 3.7.0)
|
73
74
|
rspec-support (3.7.1)
|
74
|
-
rubocop (0.
|
75
|
+
rubocop (0.57.2)
|
76
|
+
jaro_winkler (~> 1.5.1)
|
75
77
|
parallel (~> 1.10)
|
76
78
|
parser (>= 2.5)
|
77
79
|
powerpack (~> 0.1)
|
@@ -97,7 +99,7 @@ DEPENDENCIES
|
|
97
99
|
jekyll-gists-meta!
|
98
100
|
rake (~> 10.0)
|
99
101
|
rspec (~> 3.0)
|
100
|
-
rubocop (~> 0.
|
102
|
+
rubocop (~> 0.57.2)
|
101
103
|
|
102
104
|
BUNDLED WITH
|
103
|
-
1.16.
|
105
|
+
1.16.4
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ Once the datafile is populated, you may access its contents within Jekyll using
|
|
48
48
|
<ul>
|
49
49
|
{% for myedge in site.data.gists-meta-data.data.user.gists.edges %}
|
50
50
|
<li>
|
51
|
-
<a href="https://gist.github.com/{{ myedge.node.name }}">{{myedge.node.description}}</a>
|
51
|
+
<a href="https://gist.github.com/{{ myedge.node.name }}">{{ myedge.node.description }}</a>
|
52
52
|
</li>
|
53
53
|
{% endfor %}
|
54
54
|
</ul>
|
data/jekyll-gists-meta.gemspec
CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "jekyll", "~> 3.0"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
27
|
+
spec.add_development_dependency "rubocop", "~> 0.57.2"
|
28
28
|
end
|
data/lib/jekyll/gists/meta.rb
CHANGED
@@ -26,39 +26,39 @@ module Jekyll
|
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
29
|
+
|
29
30
|
def validate_environment(site)
|
30
31
|
if ENV["JEKYLL_GITHUB_TOKEN"].to_s.empty?
|
31
32
|
raise NoTokenError, "No GitHub Token found. Cannot query the API. " \
|
32
|
-
|
33
|
+
"Specify JEKYLL_GITHUB_TOKEN in environment."
|
33
34
|
end
|
34
35
|
unless Dir.exist?(site.config["data_dir"])
|
35
36
|
raise NoDataDirError, "Data directory does not exist. Jekyll reports " \
|
36
|
-
|
37
|
+
"directory should be: #{site.config["data_dir"]}."
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
|
-
private
|
41
41
|
def fetch_data(query)
|
42
42
|
url = "https://api.github.com/graphql"
|
43
43
|
uri = URI(url)
|
44
44
|
Net::HTTP.start(uri.host, uri.port,
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
:use_ssl => uri.scheme == "https",
|
46
|
+
:read_timeout => 3, :open_timeout => 3) do |http|
|
47
|
+
request = Net::HTTP::Post.new uri.to_s
|
48
|
+
request.add_field "Authorization", \
|
49
|
+
"bearer #{ENV["JEKYLL_GITHUB_TOKEN"]}"
|
50
|
+
request.body = query
|
51
|
+
response = http.request(request)
|
52
|
+
response.body
|
53
|
+
end
|
53
54
|
rescue Timeout::Error, SocketError, Net::HTTPError
|
54
55
|
nil
|
55
56
|
end
|
56
57
|
|
57
|
-
private
|
58
58
|
# rubocop:disable Metrics/MethodLength
|
59
59
|
def build_gists_query(site)
|
60
60
|
user = find_user(site)
|
61
|
-
query = +<<-
|
61
|
+
query = +<<-ENDQUERY
|
62
62
|
{
|
63
63
|
"query": "query {
|
64
64
|
user (login: #{user} ) {
|
@@ -83,26 +83,11 @@ module Jekyll
|
|
83
83
|
}
|
84
84
|
}"
|
85
85
|
}
|
86
|
-
|
86
|
+
ENDQUERY
|
87
87
|
query.tr!("\n", " ").freeze
|
88
88
|
end
|
89
89
|
# rubocop:enable Metrics/MethodLength
|
90
90
|
|
91
|
-
private
|
92
|
-
def build_user_query
|
93
|
-
query = +<<-EOS
|
94
|
-
{
|
95
|
-
"query": "query {
|
96
|
-
viewer {
|
97
|
-
login
|
98
|
-
}
|
99
|
-
}"
|
100
|
-
}
|
101
|
-
EOS
|
102
|
-
query.tr!("\n", " ").freeze
|
103
|
-
end
|
104
|
-
|
105
|
-
private
|
106
91
|
# rubocop:disable Style/MultilineTernaryOperator
|
107
92
|
def find_user(site)
|
108
93
|
site.config["gists_user"] || \
|
@@ -110,8 +95,8 @@ module Jekyll
|
|
110
95
|
site.config["github"]["contributors"][0]["login"] : nil) || \
|
111
96
|
proc do
|
112
97
|
raise NoUserError, "No user name found. " \
|
113
|
-
|
114
|
-
|
98
|
+
"Specify using 'gists_user' in your configuration, " \
|
99
|
+
"or ensure the github-metadata gem is installed. "
|
115
100
|
end.call
|
116
101
|
end
|
117
102
|
# rubocop:enable Style/MultilineTernaryOperator
|
@@ -122,6 +107,6 @@ end
|
|
122
107
|
|
123
108
|
Jekyll::Hooks.register :site, :after_init, :priority => :low do |site|
|
124
109
|
Jekyll.logger.debug "Jekyll-Gists-Meta:", \
|
125
|
-
|
110
|
+
"Generating gists data file in #{site.config["data_dir"]}"
|
126
111
|
Jekyll::Gists::Meta.generate(site)
|
127
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-gists-meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Luberda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.57.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.57.2
|
83
83
|
description:
|
84
84
|
email:
|
85
85
|
- james.luberda@gmail.com
|