jekyll-github-metadata 2.1.0 → 2.1.1

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
  SHA1:
3
- metadata.gz: 0e2f07193bb80feccf89ea426bcd93d8188e3c0b
4
- data.tar.gz: 9fa02218e3108a017a03337b8923b1357f8f3a50
3
+ metadata.gz: b7d6a9d7c3a9fd754220e85041847e91bbb2e76c
4
+ data.tar.gz: c9a791c58406dd4a0d27ea000cef9fae610dd1d5
5
5
  SHA512:
6
- metadata.gz: 58e40f5163d6f3e359f02c1aff7b5e87ee7ec87dfc8e94d59f004700bffe1092dcf4462e39ad6011ca56db4d6a9c0090b86c8e3351641e3295af465b061c2b86
7
- data.tar.gz: cb6d03ce523c88e3ae3fac2bac8aa66b4b97e69e67ed89dca4715dc8c4c8431da3f42573ad4d86e79dd2fc8d1628447cf76c7c205c6bead14a27050dac99f22e
6
+ metadata.gz: 1f146d6c25bc4c245615e11021c8eef409d1f03d561a1c9aa8efc0dbf66f4d31e2c974f8cd69383e550d4a63fe0b7ec566b5b33135b7a93436def4f8cf1f34fd
7
+ data.tar.gz: 0069d3c00e5f1dbc64b0fcb07a060c29d3b0c3ff9516831bfd822036da8031574739ca548839914e58600bc3ad1e25f053ab93fa78147395241967332895821e
@@ -1,4 +1,5 @@
1
1
  require "jekyll"
2
+ require "uri"
2
3
 
3
4
  module Jekyll
4
5
  module GitHubMetadata
@@ -11,13 +12,7 @@ module Jekyll
11
12
  Jekyll::GitHubMetadata.log :debug, "Initializing..."
12
13
  @site = site
13
14
  site.config["github"] = github_namespace
14
-
15
- # Set `site.url` and `site.baseurl` if unset and in production mode.
16
- if Jekyll.env == "production"
17
- site.config["url"] ||= drop.url
18
- site.config["baseurl"] = drop.baseurl if site.config["baseurl"].to_s.empty?
19
- end
20
-
15
+ set_url_and_baseurl_fallbacks!
21
16
  @site = nil
22
17
  end
23
18
 
@@ -37,6 +32,17 @@ module Jekyll
37
32
  def drop
38
33
  @drop ||= MetadataDrop.new(site)
39
34
  end
35
+
36
+ # Set `site.url` and `site.baseurl` if unset and in production mode.
37
+ def set_url_and_baseurl_fallbacks!
38
+ return unless Jekyll.env == "production"
39
+
40
+ repo = drop.send(:repository)
41
+ site.config["url"] ||= repo.url_without_path
42
+ if site.config["baseurl"].to_s.empty? && !["", "/"].include?(repo.baseurl)
43
+ site.config["baseurl"] = repo.baseurl
44
+ end
45
+ end
40
46
  end
41
47
  end
42
48
  end
@@ -151,6 +151,10 @@ module Jekyll
151
151
  @uri ||= URI(html_url)
152
152
  end
153
153
 
154
+ def url_without_path
155
+ uri.dup.tap { |u| u.path = "" }.to_s
156
+ end
157
+
154
158
  def domain
155
159
  uri.host
156
160
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module GitHubMetadata
3
- VERSION = "2.1.0".freeze
3
+ VERSION = "2.1.1".freeze
4
4
  end
5
5
  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.1.0
4
+ version: 2.1.1
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-10-05 00:00:00.000000000 Z
11
+ date: 2016-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.6.7
148
+ rubygems_version: 2.5.1
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: The site.github namespace