jekyll-remote-theme 0.6.0 → 0.6.1
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/lib/jekyll-remote-theme/munger.rb +1 -1
- data/lib/jekyll-remote-theme/theme.rb +20 -2
- data/lib/jekyll-remote-theme/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e01afd90316ec162cddd29765466d934ae241d626f473bcd9acfd9976a1fd01
|
|
4
|
+
data.tar.gz: '00945458c1ed12cb8bdc2a21aa41d11d22e3cc8060a67eb65b494e9bc1ac0775'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12c833b553ab123f001a1ec6610a01551265b675349045cd322e73816e2f421e3033174cad40a542b18087272f30edb945c838fe24b4e1d21b095d0453d2c9e4
|
|
7
|
+
data.tar.gz: 267ffe076935719f7e91cfc4ce4673ff29d437a908068b89b296e456d17d9a61128af54ddda2008e1d1fff5e58e430542d623b7925ae39e6b722afdbee1a2d4c
|
|
@@ -40,7 +40,7 @@ module Jekyll
|
|
|
40
40
|
# On a rebuild, reuse the theme configured by the first run rather than
|
|
41
41
|
# building a new one, which would create another temp directory.
|
|
42
42
|
def theme
|
|
43
|
-
@theme ||= munged? ? site.theme : Theme.new(raw_theme)
|
|
43
|
+
@theme ||= munged? ? site.theme : Theme.new(raw_theme, site)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def raw_theme
|
|
@@ -21,7 +21,10 @@ module Jekyll
|
|
|
21
21
|
# 5. /absolute/path/to/theme - an absolute local file path
|
|
22
22
|
# 6. ../relative/path/to/theme - a relative local file path
|
|
23
23
|
# 7. ~/path/to/theme - a home directory relative path
|
|
24
|
-
|
|
24
|
+
#
|
|
25
|
+
# Local paths are only valid when a site is given and it isn't in safe mode.
|
|
26
|
+
def initialize(raw_theme, site = nil)
|
|
27
|
+
@site = site
|
|
25
28
|
original_theme = raw_theme.to_s.strip
|
|
26
29
|
local_path = looks_like_local_path?(original_theme)
|
|
27
30
|
@raw_theme = local_path ? original_theme : original_theme.downcase
|
|
@@ -70,7 +73,9 @@ module Jekyll
|
|
|
70
73
|
end
|
|
71
74
|
|
|
72
75
|
def root
|
|
73
|
-
|
|
76
|
+
return (expanded_local_path if local_path_valid?) if local_theme?
|
|
77
|
+
|
|
78
|
+
@root ||= File.realpath(Dir.mktmpdir(TEMP_PREFIX))
|
|
74
79
|
end
|
|
75
80
|
|
|
76
81
|
def inspect
|
|
@@ -84,6 +89,15 @@ module Jekyll
|
|
|
84
89
|
|
|
85
90
|
private
|
|
86
91
|
|
|
92
|
+
# A rejected local theme has no root. Jekyll 3's Theme#initialize resolves
|
|
93
|
+
# the theme's Sass path straight away, so return no paths rather than
|
|
94
|
+
# passing a nil root to Jekyll.sanitized_path.
|
|
95
|
+
def path_for(folder)
|
|
96
|
+
return if root.nil?
|
|
97
|
+
|
|
98
|
+
super
|
|
99
|
+
end
|
|
100
|
+
|
|
87
101
|
def looks_like_local_path?(path)
|
|
88
102
|
# Check if it looks like a local path
|
|
89
103
|
# Supports: /, ./, ../, ~/ (Unix-style) and drive letters (Windows-style)
|
|
@@ -94,7 +108,11 @@ module Jekyll
|
|
|
94
108
|
@expanded_local_path ||= File.expand_path(@raw_theme)
|
|
95
109
|
end
|
|
96
110
|
|
|
111
|
+
# Local paths can reference any directory on the host, so they're never
|
|
112
|
+
# allowed in safe mode (or without a site to check).
|
|
97
113
|
def local_path_valid?
|
|
114
|
+
return false if @site.nil? || @site.safe
|
|
115
|
+
|
|
98
116
|
Dir.exist?(expanded_local_path)
|
|
99
117
|
end
|
|
100
118
|
|