jekyll-github-metadata 2.15.0 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8029d104bab61f3fc0eb41d52c6e053b6cc67dbe00666ca304095d4207494f5
4
- data.tar.gz: a84feb95d94df55a426c4f1f0c9dd7b4d9bda046faea401aa2bf661435e3f555
3
+ metadata.gz: 5621fa7f8d170317298114bbbe8b1f811f5af88e0eaa5a0a0bd2575bb9b5421a
4
+ data.tar.gz: a59e9cd62f6417d8d475de1d3b50e539fb8bbf4d5843c02ea54de060bac74c2c
5
5
  SHA512:
6
- metadata.gz: a58ac4957b6c1bde8f898dfb32661fe3f5238d9d4d8316e3175fd2f87ac1fff8698e664adc374a6c8284617f6ac069e583b64331cc43428123bde447485dc7a2
7
- data.tar.gz: df7ea4df4b7bc1fd84615287d94803e1d8e7f39c7d488710370eda06d96a451e767a6ba91f437b2a89379f4f5de52e4b99972b2c20ce021bcdbfec74bbec0ba8
6
+ metadata.gz: 289180a1ea9d3abd94ddee2dc6967b223e393e15c0894efe895ac278294de1f2bf19bc185ada379e6721cbcdaac9af762c9a9a66d5fb83c5ee8bfec15755b8ba
7
+ data.tar.gz: f07cbf68c0ad1a4330a837fd700e3b160090ac0f3c65caac940c96c77cfdde693fcab8ce8e1631f0901bed9e112f93f985568261bbd758b2fcdac140e8648daa
@@ -68,14 +68,20 @@ module Jekyll
68
68
  end
69
69
  end
70
70
 
71
- # NOTE: Faraday's error classes has been promoted to under Faraday module from v1.0.0.
72
- # This patch aims to prevent on locking specific version of Faraday.
71
+ # NOTE: Faraday's error classes have been simplified from v1.0.0.
72
+ #
73
+ # In older versions, both `Faraday::Error::ConnectionFailed` and `Faraday::ConnectionFailed`
74
+ # were valid and equivalent to each other.
75
+ # From v1.0.0 onwards, `Faraday::Error::ConnectionFailed` no longer exists.
76
+ #
77
+ # TODO: Remove in v2.0 of this plugin.
73
78
  FARADAY_FAILED_CONNECTION =
74
79
  begin
75
80
  Faraday::Error::ConnectionFailed
76
81
  rescue NameError
77
82
  Faraday::ConnectionFailed
78
83
  end
84
+ deprecate_constant :FARADAY_FAILED_CONNECTION
79
85
 
80
86
  def save_from_errors(default = false)
81
87
  unless internet_connected?
@@ -86,7 +92,7 @@ module Jekyll
86
92
  yield @client
87
93
  rescue Octokit::Unauthorized
88
94
  raise BadCredentialsError, "The GitHub API credentials you provided aren't valid."
89
- rescue FARADAY_FAILED_CONNECTION, Octokit::TooManyRequests => e
95
+ rescue Faraday::ConnectionFailed, Octokit::TooManyRequests => e
90
96
  GitHubMetadata.log :warn, e.message
91
97
  default
92
98
  rescue Octokit::NotFound
@@ -130,11 +136,11 @@ module Jekyll
130
136
  def pluck_auth_method
131
137
  if ENV["JEKYLL_GITHUB_TOKEN"] || Octokit.access_token
132
138
  { :access_token => ENV["JEKYLL_GITHUB_TOKEN"] || Octokit.access_token }
133
- elsif !ENV["NO_NETRC"] && File.exist?(File.join(ENV["HOME"], ".netrc")) && safe_require("netrc")
139
+ elsif !ENV["NO_NETRC"] && File.exist?(File.join(Dir.home, ".netrc")) && safe_require("netrc")
134
140
  { :netrc => true }
135
141
  else
136
- GitHubMetadata.log :warn, "No GitHub API authentication could be found." \
137
- " Some fields may be missing or have incorrect data."
142
+ GitHubMetadata.log :warn, "No GitHub API authentication could be found. " \
143
+ "Some fields may be missing or have incorrect data."
138
144
  {}.freeze
139
145
  end
140
146
  end
@@ -118,7 +118,8 @@ module Jekyll
118
118
  :accept => "application/vnd.github.mercy-preview+json",
119
119
  }
120
120
  memoize_value :@owner_public_repositories, Value.new("owner_public_repositories", proc do |c|
121
- c.list_repos(owner, options).map do |r|
121
+ repos = c.list_repos(owner, options) || []
122
+ repos.map do |r|
122
123
  r[:releases] = Value.new("owner_public_repositories_releases", proc { c.releases(r[:full_name]) })
123
124
  r[:contributors] = Value.new("owner_public_repositories_contributors", proc { c.contributors(r[:full_name]) })
124
125
  r
@@ -27,9 +27,9 @@ module Jekyll
27
27
  nwo_from_git_origin_remote || \
28
28
  proc do
29
29
  raise NoRepositoryError, "No repo name found. " \
30
- "Specify using PAGES_REPO_NWO environment variables, " \
31
- "'repository' in your configuration, or set up an 'origin' " \
32
- "git remote pointing to your github.com repository."
30
+ "Specify using PAGES_REPO_NWO environment variables, " \
31
+ "'repository' in your configuration, or set up an 'origin' " \
32
+ "git remote pointing to your github.com repository."
33
33
  end.call
34
34
  end
35
35
  end
@@ -15,6 +15,7 @@ module Jekyll
15
15
 
16
16
  def initialize(site)
17
17
  Jekyll::GitHubMetadata.site = site
18
+ @original_config = site.config["github"]
18
19
  end
19
20
 
20
21
  def munge!
@@ -28,16 +29,20 @@ module Jekyll
28
29
  payload.site["github"] = github_namespace
29
30
  end
30
31
 
32
+ def uninject_metadata!(payload)
33
+ payload.site["github"] = @original_config
34
+ end
35
+
31
36
  private
32
37
 
33
38
  def github_namespace
34
- case site.config["github"]
39
+ case @original_config
35
40
  when nil
36
41
  drop
37
42
  when Hash
38
- Jekyll::Utils.deep_merge_hashes(drop, site.config["github"])
43
+ drop.merge(@original_config)
39
44
  else
40
- site.config["github"]
45
+ @original_config
41
46
  end
42
47
  end
43
48
 
@@ -94,5 +99,9 @@ module Jekyll
94
99
  Jekyll::Hooks.register :site, :pre_render do |_site, payload|
95
100
  SiteGitHubMunger.global_munger.inject_metadata!(payload)
96
101
  end
102
+
103
+ Jekyll::Hooks.register :site, :post_render do |_site, payload|
104
+ SiteGitHubMunger.global_munger.uninject_metadata!(payload)
105
+ end
97
106
  end
98
107
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module GitHubMetadata
5
- VERSION = "2.15.0"
5
+ VERSION = "2.16.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-github-metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.0
4
+ version: 2.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-20 00:00:00.000000000 Z
11
+ date: 2023-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -34,22 +34,28 @@ dependencies:
34
34
  name: octokit
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '4.0'
39
+ version: '4'
40
40
  - - "!="
41
41
  - !ruby/object:Gem::Version
42
42
  version: 4.4.0
43
+ - - "<"
44
+ - !ruby/object:Gem::Version
45
+ version: '7'
43
46
  type: :runtime
44
47
  prerelease: false
45
48
  version_requirements: !ruby/object:Gem::Requirement
46
49
  requirements:
47
- - - "~>"
50
+ - - ">="
48
51
  - !ruby/object:Gem::Version
49
- version: '4.0'
52
+ version: '4'
50
53
  - - "!="
51
54
  - !ruby/object:Gem::Version
52
55
  version: 4.4.0
56
+ - - "<"
57
+ - !ruby/object:Gem::Version
58
+ version: '7'
53
59
  - !ruby/object:Gem::Dependency
54
60
  name: bundler
55
61
  requirement: !ruby/object:Gem::Requirement
@@ -112,28 +118,28 @@ dependencies:
112
118
  requirements:
113
119
  - - "~>"
114
120
  - !ruby/object:Gem::Version
115
- version: 3.11.0
121
+ version: 3.12.0
116
122
  type: :development
117
123
  prerelease: false
118
124
  version_requirements: !ruby/object:Gem::Requirement
119
125
  requirements:
120
126
  - - "~>"
121
127
  - !ruby/object:Gem::Version
122
- version: 3.11.0
128
+ version: 3.12.0
123
129
  - !ruby/object:Gem::Dependency
124
130
  name: rubocop-jekyll
125
131
  requirement: !ruby/object:Gem::Requirement
126
132
  requirements:
127
133
  - - "~>"
128
134
  - !ruby/object:Gem::Version
129
- version: 0.12.0
135
+ version: 0.13.0
130
136
  type: :development
131
137
  prerelease: false
132
138
  version_requirements: !ruby/object:Gem::Requirement
133
139
  requirements:
134
140
  - - "~>"
135
141
  - !ruby/object:Gem::Version
136
- version: 0.12.0
142
+ version: 0.13.0
137
143
  description:
138
144
  email:
139
145
  - parkrmoore@gmail.com