jekyll-github-metadata 1.10.0 → 1.11.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfca06588f4d2c2769492d9ffa8d441925de0d39
|
4
|
+
data.tar.gz: c8a940aa8c5346259cd9c587260f994a2786f0d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6db4dbfc1fcd303b4f4d843117756a9286cb8d920541f4e685dba9c2f4271324ab36f6e7c7276a7b6b878e84fbf91b51f46537af92454bb883dddf59f3018483
|
7
|
+
data.tar.gz: 2265206c894d2f4579ca527990dbede34a5f9ca299103583e29e5007f3d9dd6bc12821df2d783738e9857af7285c988f80e5e437dfb446999f3bfe37505f4550
|
@@ -31,22 +31,43 @@ module Jekyll
|
|
31
31
|
def git_remote_url
|
32
32
|
`git remote --verbose`.split("\n").grep(%r{\Aorigin\t}).map do |remote|
|
33
33
|
remote.sub(/\Aorigin\t(.*) \([a-z]+\)/, "\\1")
|
34
|
-
end.uniq.first
|
34
|
+
end.uniq.first || ""
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def nwo_from_git_origin_remote
|
38
38
|
return unless Jekyll.env == "development"
|
39
39
|
matches = git_remote_url.match %r{github.com(:|/)([\w-]+)/([\w-]+)}
|
40
40
|
matches[2..3].join("/") if matches
|
41
41
|
end
|
42
42
|
|
43
|
+
def nwo_from_env
|
44
|
+
ENV['PAGES_REPO_NWO']
|
45
|
+
end
|
46
|
+
|
47
|
+
def nwo_from_config(site)
|
48
|
+
repo = site.config['repository']
|
49
|
+
repo if repo && repo.is_a?(String) && repo.include?('/')
|
50
|
+
end
|
51
|
+
|
52
|
+
# Public: fetches the repository name with owner to fetch metadata for.
|
53
|
+
# In order of precedence, this method uses:
|
54
|
+
# 1. the environment variable $PAGES_REPO_NWO
|
55
|
+
# 2. 'repository' variable in the site config
|
56
|
+
# 3. the 'origin' git remote's URL
|
57
|
+
#
|
58
|
+
# site - the Jekyll::Site being processed
|
59
|
+
#
|
60
|
+
# Return the name with owner (e.g. 'parkr/my-repo') or raises an
|
61
|
+
# error if one cannot be found.
|
43
62
|
def nwo(site)
|
44
|
-
|
45
|
-
site
|
46
|
-
|
63
|
+
nwo_from_env || \
|
64
|
+
nwo_from_config(site) || \
|
65
|
+
nwo_from_git_origin_remote || \
|
47
66
|
proc {
|
48
|
-
raise GitHubMetadata::NoRepositoryError, "No repo name found. "
|
49
|
-
"Specify using PAGES_REPO_NWO
|
67
|
+
raise GitHubMetadata::NoRepositoryError, "No repo name found. " \
|
68
|
+
"Specify using PAGES_REPO_NWO environment variables, " \
|
69
|
+
"'repository' in your configuration, or set up an 'origin' " \
|
70
|
+
"git remote pointing to your github.com repository."
|
50
71
|
}.call
|
51
72
|
end
|
52
73
|
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: 1.
|
4
|
+
version: 1.11.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: 2016-
|
11
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|